From 0f7384cc1d6cafd4271da89164b5ff9f650d7124 Mon Sep 17 00:00:00 2001 From: Shivering Ocelot Date: Sun, 13 Jul 2025 03:53:43 -0500 Subject: [PATCH] Agent creation and editing support via UI --- frontend-vue/index.html | 4 + frontend-vue/src/backend.js | 15 ++- frontend-vue/src/router/index.js | 6 + frontend-vue/src/views/Agent.vue | 150 +++++++++++++++++++++++++ frontend-vue/src/views/AgentCreate.vue | 88 +++++++++++++++ frontend-vue/src/views/Chat.vue | 11 +- frontend-vue/src/views/ChatCreate.vue | 8 +- 7 files changed, 267 insertions(+), 15 deletions(-) create mode 100644 frontend-vue/src/views/Agent.vue create mode 100644 frontend-vue/src/views/AgentCreate.vue diff --git a/frontend-vue/index.html b/frontend-vue/index.html index 7fe5fa9..987c39b 100644 --- a/frontend-vue/index.html +++ b/frontend-vue/index.html @@ -7,6 +7,10 @@ + + + + Horde Chat diff --git a/frontend-vue/src/backend.js b/frontend-vue/src/backend.js index 2af3c22..a5d8d24 100644 --- a/frontend-vue/src/backend.js +++ b/frontend-vue/src/backend.js @@ -243,7 +243,7 @@ export async function getChats() { if (response && response.chats) { cache.chats = response.chats.map(msg => new ChatInfo({ id: msg.id, - name: msg.name?.length > 0 ? msg.name : `[Chat ${msg.id}]`, + name: msg.name || ``, })); } else { throw new Error("Invalid response for get-chats: " + JSON.stringify(response)); @@ -254,7 +254,7 @@ export async function getChats() { export async function getChat(chatId) { const allChats = await getChats(); - return allChats.find(chat => chat.id === chatId) || null; + return allChats.find(it => it.id == chatId); } export async function getAgents() { @@ -263,7 +263,11 @@ export async function getAgents() { if (response && response.agents) { cache.agents = response.agents.map(msg => ({ id: msg.id, - name: msg.name?.length > 0 ? msg.name : ``, + name: msg.name || ``, + agentname: msg.agentname, + description: msg.description, + picture: msg.picture, + kind: msg.kind, })); } else { throw new Error("Invalid response for get-agents: " + JSON.stringify(response)); @@ -272,6 +276,11 @@ export async function getAgents() { return cache.agents; } +export async function getAgent(agentId) { + const allAgents = await getAgents(); + return allAgents.find(it => it.id == agentId); +} + export function invalidateCache({ chats=false, agents=false } = {}) { if (chats) cache.chats = null; if (agents) cache.agents = null; diff --git a/frontend-vue/src/router/index.js b/frontend-vue/src/router/index.js index 6c2f2f4..1ed716e 100644 --- a/frontend-vue/src/router/index.js +++ b/frontend-vue/src/router/index.js @@ -33,7 +33,13 @@ const router = createRouter({ path: `/chat/create`, component: () => import('../views/ChatCreate.vue') }, + { + name: 'agent-create', + path: `/agent/create`, + component: () => import('../views/AgentCreate.vue') + }, objectView('chat', () => import('../views/Chat.vue')), + objectView('agent', () => import('../views/Agent.vue')), ], }) diff --git a/frontend-vue/src/views/Agent.vue b/frontend-vue/src/views/Agent.vue new file mode 100644 index 0000000..4ba0d85 --- /dev/null +++ b/frontend-vue/src/views/Agent.vue @@ -0,0 +1,150 @@ + + +