|
63 | 63 |
|
64 | 64 | // add router node |
65 | 65 | posX += nodeSpaceX; |
66 | | - let hostNodeId = 0; |
67 | 66 | let routerPosY = nodeSpaceY * (routers.length + 1) / 2; |
68 | 67 | routers.forEach(router => { |
69 | 68 | let profiles = []; |
|
82 | 81 | type: router.type, |
83 | 82 | }; |
84 | 83 |
|
85 | | - let nodeId = 0; |
86 | 84 | if (router.is_host) { |
87 | | - nodeId = editor.addNode('host', 1, 1, posX, routerPosY, 'router', data, `<img src="/images/users/bot.png" height="30">${html}`, false); |
88 | | - hostNodeId = nodeId; |
89 | | - } else { |
90 | | - nodeId = editor.addNode('router', 1, 1, posX, routerPosY, 'router', data, `${html}`, false); |
| 85 | + html =`<img src="/images/users/bot.png" height="30">${html}`; |
91 | 86 | } |
| 87 | + let nodeId = editor.addNode('router', 1, 1, posX, routerPosY, 'router', data, `${html}`, false);; |
92 | 88 | // connect user and router |
93 | 89 | editor.addConnection(userNodeId, nodeId, `output_1`, `input_1`); |
94 | 90 | routerPosY += nodeSpaceY * (agents.length - 1) / 2; |
|
99 | 95 | agents.forEach(agent => { |
100 | 96 | let profiles = []; |
101 | 97 | const chatTestLinkHtml = `<a href= "/chat/${agent.id}" class="btn btn-primary float-end" target="_blank"><i class="bx bx-chat"></i></a>`; |
102 | | - let html = `<span class="h6">${agent.name}</span>${chatTestLinkHtml}`; |
| 98 | + const taskLinkHtml = `<a href= "/page/agent/${agent.id}/task" class="btn btn-primary float-end" target="_blank"><i class="bx bx-task"></i></a>`; |
| 99 | + let html = `<span class="h6">${agent.name}</span>${chatTestLinkHtml}${taskLinkHtml}`; |
103 | 100 | if (agent.profiles.length > 0) { |
104 | 101 | profiles = agent.profiles; |
105 | 102 | html += `<br/><i class="mdi mdi-folder font-size-16 text-info me-2"></i>` + profiles.join(', '); |
106 | 103 | } |
| 104 | +
|
| 105 | + if (agent.is_host) { |
| 106 | + html =`<img src="/images/users/bot.png" height="30">${html}`; |
| 107 | + } |
107 | 108 | |
108 | 109 | const data = { |
109 | 110 | id: agent.id, |
|
122 | 123 | editor.addConnection(r.nid, nid, `output_1`, `input_1`); |
123 | 124 | } else { |
124 | 125 | // editor.removeNodeInput(nid, "input_2"); |
125 | | - editor.addConnection(userNodeId, nid, `output_1`, `input_1`); |
| 126 | + // editor.addConnection(userNodeId, nid, `output_1`, `input_1`); |
126 | 127 | } |
127 | 128 | }); |
128 | 129 | }); |
129 | 130 | |
130 | 131 | } else { |
131 | 132 | // profile is empty |
132 | | - agentNodes.filter(ag => ag.type == "routing" && ag.profiles.length == 0) |
| 133 | + /*agentNodes.filter(ag => ag.type == "routing" && ag.profiles.length == 0) |
133 | 134 | .forEach(r => { |
134 | 135 | editor.addConnection(r.nid, nid, `output_1`, `input_1`); |
135 | | - }); |
| 136 | + });*/ |
| 137 | + |
| 138 | + editor.addConnection(userNodeId, nid, `output_1`, `input_1`); |
136 | 139 | } |
137 | 140 |
|
138 | 141 | posY += nodeSpaceY; |
|
143 | 146 | if (fallback) { |
144 | 147 | let router = agentNodes.find(ag => ag.id == fallback.redirectTo); |
145 | 148 | editor.addNodeOutput(nid); |
146 | | - /*editor.addNodeInput(router.nid); |
| 149 | + editor.addNodeInput(router.nid); |
147 | 150 | var inputs = editor.getNodeFromId(router.nid).inputs; |
148 | 151 | let inputId = 0; |
149 | 152 | for (let prop in inputs) { |
150 | 153 | inputId++; |
151 | 154 | } |
152 | | - editor.addConnection(nid, router.nid, `output_1`, `input_${inputId}`); */ |
| 155 | + editor.addConnection(nid, router.nid, `output_1`, `input_${inputId}`); |
153 | 156 | } |
154 | 157 | }); |
155 | 158 | } |
|
0 commit comments