From 7aab191f7aa7bfe49fb1cfffc4133e72f8354612 Mon Sep 17 00:00:00 2001
From: Haiping Chen <101423@smsassist.com>
Date: Fri, 26 Jan 2024 16:21:22 -0600
Subject: [PATCH] Add chat test in routing-flow.
---
src/lib/drawflow/drawflow.css | 10 +++++++-
.../page/agent/router/routing-flow.svelte | 24 +++++++++++--------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/src/lib/drawflow/drawflow.css b/src/lib/drawflow/drawflow.css
index 780b6012..7e80e31f 100644
--- a/src/lib/drawflow/drawflow.css
+++ b/src/lib/drawflow/drawflow.css
@@ -1,13 +1,21 @@
.drawflow .drawflow-node {
background: var(--bs-primary);
color: white;
+ width: 200px;
+ border: 2px solid var(--bs-primary);
}
.drawflow .drawflow-node.selected {
- background: var(--bs-success);
+ background: var(--bs-primary);
+ border: 2px solid black;
}
.drawflow .new-node {
background: var(--bs-info);
color: white;
+}
+
+.drawflow-delete {
+ background-color: var(--bs-danger);
+ line-height: 25px;
}
\ No newline at end of file
diff --git a/src/routes/page/agent/router/routing-flow.svelte b/src/routes/page/agent/router/routing-flow.svelte
index f13053cb..2ee9628f 100644
--- a/src/routes/page/agent/router/routing-flow.svelte
+++ b/src/routes/page/agent/router/routing-flow.svelte
@@ -49,8 +49,9 @@
/** @param {Drawflow} editor*/
function renderRoutingFlow(editor){
let posX = 0;
- let nodeSpace = 250;
- let posY = 100 * agents.length / 2 + 50;
+ const nodeSpaceX = 300, nodeSpaceY = 120;
+
+ let posY = nodeSpaceY * (agents.length + 1) / 2;
// add end-user node
let userNodeId = editor.addNode('user', 0, 1, posX, posY, 'user',
@@ -61,15 +62,16 @@
}, `User Request`, false);
// add router node
- posX += nodeSpace;
+ posX += nodeSpaceX;
let hostNodeId = 0;
- let routerPosY = posY;
+ let routerPosY = nodeSpaceY * (routers.length + 1) / 2;
routers.forEach(router => {
let profiles = [];
- let html = `${router.name}`;
+ const chatTestLinkHtml = ``;
+ let html = `${router.name} ${chatTestLinkHtml}Routing Agent`;
if (router.profiles.length > 0) {
profiles = router.profiles;
- html += `
${profiles.join(', ')}`;
+ html += `
${profiles.join(', ')}`;
}
const data = {
@@ -88,14 +90,15 @@
}
// connect user and router
editor.addConnection(userNodeId, nodeId, `output_1`, `input_1`);
- routerPosY += 100;
+ routerPosY += nodeSpaceY * (agents.length - 1) / 2;
});
posY = 100;
- posX += nodeSpace;
+ posX += nodeSpaceX;
agents.forEach(agent => {
let profiles = [];
- let html = `${agent.name}`;
+ const chatTestLinkHtml = ``;
+ let html = `${agent.name}${chatTestLinkHtml}`;
if (agent.profiles.length > 0) {
profiles = agent.profiles;
html += `
` + profiles.join(', ');
@@ -118,6 +121,7 @@
editor.addConnection(r.nid, nid, `output_1`, `input_1`);
} else {
// editor.removeNodeInput(nid, "input_2");
+ editor.addConnection(userNodeId, nid, `output_1`, `input_1`);
}
});
});
@@ -130,7 +134,7 @@
});
}
- posY += 100;
+ posY += nodeSpaceY;
});
}