Skip to content

Commit

Permalink
agent icon in builder.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oceania2018 committed Jan 22, 2024
1 parent 393423f commit b8fb8ab
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "botsharp-ui",
"version": "0.2.0",
"version": "0.3.0",
"private": true,
"engines": {
"node": ">=18.0.0"
Expand Down
5 changes: 5 additions & 0 deletions src/lib/drawflow/drawflow.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@

.drawflow .drawflow-node.selected {
background: var(--bs-success);
}

.drawflow .new-node {
background: var(--bs-info);
color: white;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<Node useDefaults id="output" position={{ x: 560, y: 30 }} let:selected locked>
<div class="node" class:selected>
<span class="avatar-title rounded-circle bg-light text-danger font-size-16">
<img src="/images/users/bot.png" alt="" width="120px"/>
<img src={agent?.icon_url} alt="" width="120px"/>
</span>
<p>{agent?.description}</p>
<div class="input-anchors">
Expand Down
17 changes: 14 additions & 3 deletions src/routes/page/agent/router/routing-flow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
allowRouting: true
});
// add a "New Agent" button
agents.push({
name: "New Agent",
allowRouting: true
});
const container = document.getElementById("drawflow");
const editor = new Drawflow(container);
editor.reroute = true;
Expand Down Expand Up @@ -57,8 +63,13 @@
posY = 100;
posX += nodeSpace;
nodeId++;
agents.forEach(agent => {
editor.addNode('agent', 1, 0, posX, posY, 'enabled-node', data, `Agent (${agent.name})`, false);
agents.forEach(agent => {
if (!agent.id) {
// add a "New Agent" button
editor.addNode('new-agent', 1, 0, posX, posY, 'new-node', data, `New Agent`, false);
} else {
editor.addNode('agent', 1, 0, posX, posY, 'enabled-node', data, `Agent (${agent.name})`, false);
}
editor.addConnection(2, nodeId, `output_1`, `input_1`);
posY += 100;
nodeId++;
Expand All @@ -80,4 +91,4 @@
</script>

<div id="drawflow" style="height: 75vh; width: 100%">
</div>
</div>
6 changes: 3 additions & 3 deletions src/routes/page/conversation/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
{#each conversations.items as conv}
<tr>
<td scope="row">
<a href={`/communication/${conv.id}`}>{conv.title}</a></td>
<a href="/page/conversation/{conv.id}">{conv.title}</a></td>
<td>{conv.user.full_name}</td>
<td>{conv.user.role}</td>
<td><span class="badge badge-soft-success">{conv.channel}</span></td>
Expand All @@ -256,9 +256,9 @@
<i class="mdi mdi-eye-outline" />
</Link>
</li>
<li data-bs-toggle="tooltip" data-bs-placement="top" title="Edit">
<li data-bs-toggle="tooltip" data-bs-placement="top" title="Chat">
<Link href="/chat/{conv.agent_id}/{conv.id}" target="_blank" class="btn btn-sm btn-soft-info">
<i class="mdi mdi-pencil-outline" />
<i class="mdi mdi-chat" />
</Link>
</li>
<li data-bs-toggle="tooltip" data-bs-placement="top" title="Delete">
Expand Down

0 comments on commit b8fb8ab

Please sign in to comment.