From 700c7df5424fa99c072ee1ce5a2b47bb47583762 Mon Sep 17 00:00:00 2001 From: Viswamedha Nalabotu Date: Fri, 27 Feb 2026 14:56:20 +0000 Subject: [PATCH] Enabled edits for agent configurations --- site/src/views/AgentDetailView.vue | 121 +++++++++++++++++++++++++++-- site/src/views/AgentsView.vue | 64 ++++++++++++++- 2 files changed, 177 insertions(+), 8 deletions(-) diff --git a/site/src/views/AgentDetailView.vue b/site/src/views/AgentDetailView.vue index 696289b..73bd618 100644 --- a/site/src/views/AgentDetailView.vue +++ b/site/src/views/AgentDetailView.vue @@ -12,6 +12,7 @@ import { message, Tag, InputNumber, + Select, } from 'ant-design-vue' import { marked } from 'marked' import DOMPurify from 'dompurify' @@ -22,18 +23,32 @@ import type { AgentConfig, AgentRunResult } from '../types/agent' const route = useRoute() const agentStore = useAgentStore() -const agentId = route.params.id as string +const agentUuid = route.params.agentUuid as string const agent = ref({ - id: agentId, name: 'Loading...', description: '', status: 'idle', - uuid: agentId, + uuid: agentUuid, agent_type: 'knowledge', llm_config: {}, organization: '', }) +const saveLoading = ref(false) +const editingConfig = ref(false) +const agentForm = ref({ + name: '', + agent_type: 'knowledge', + model_id: '', + system_prompt: '', +}) + +const agentTypeOptions = [ + { label: 'Curriculum Agent', value: 'curriculum' }, + { label: 'Knowledge Agent', value: 'knowledge' }, + { label: 'Assessment Agent', value: 'assessment' }, + { label: 'Progress Monitor', value: 'monitor' }, +] const maxTokens = ref(256) const queryInput = ref('') @@ -63,8 +78,14 @@ const statusColor = (status: string) => { const fetchAgent = async () => { try { - const response = await apiClient.get(API.agents.configs.byId(agentId)) + const response = await apiClient.get(API.agents.configs.byId(agentUuid)) agent.value = response.data + agentForm.value = { + name: response.data.name || '', + agent_type: response.data.agent_type || 'knowledge', + model_id: String(response.data.llm_config?.model_id || ''), + system_prompt: String(response.data.system_prompt || ''), + } } catch (error) { console.error('Failed to fetch agent:', error) if (isAxiosError(error)) { @@ -78,6 +99,50 @@ const fetchAgent = async () => { } } +const resetForm = () => { + agentForm.value = { + name: agent.value.name || '', + agent_type: agent.value.agent_type || 'knowledge', + model_id: String(agent.value.llm_config?.model_id || ''), + system_prompt: String(agent.value.system_prompt || ''), + } + editingConfig.value = false +} + +const saveConfig = async () => { + const payload = { + name: agentForm.value.name.trim(), + system_prompt: agentForm.value.system_prompt.trim(), + } + + if (!payload.name) { + message.error('Agent name is required') + return + } + + if (!payload.system_prompt) { + message.error('System prompt is required') + return + } + + saveLoading.value = true + try { + const response = await apiClient.patch(API.agents.configs.byId(agentUuid), payload) + agent.value = response.data + editingConfig.value = false + message.success('Agent configuration updated') + } catch (error) { + console.error('Failed to update agent config:', error) + if (isAxiosError(error)) { + message.error(error.response?.data?.detail || 'Failed to update configuration') + } else { + message.error('Failed to update configuration') + } + } finally { + saveLoading.value = false + } +} + const renderedAgentResponse = computed(() => { const rawMarkdown = agentResponse.value if (!rawMarkdown) return '' @@ -110,7 +175,7 @@ const stopAgent = () => { onMounted(() => { fetchAgent() - agentStore.connect(agentId) + agentStore.connect(agentUuid) }) onUnmounted(() => { @@ -132,6 +197,52 @@ onUnmounted(() => { {{ agent.description || 'No description available' }} + Configuration +
+ +
+ Agent Name: + +
+ +
+ Agent Type: + +
+ +
+ System Prompt: + +
+ + + + + +
+
+
WebSocket Status: diff --git a/site/src/views/AgentsView.vue b/site/src/views/AgentsView.vue index 6bf0986..e077740 100644 --- a/site/src/views/AgentsView.vue +++ b/site/src/views/AgentsView.vue @@ -1,6 +1,6 @@