From 21a9f96b14918a96fba921ed08a00fee18d27475 Mon Sep 17 00:00:00 2001 From: han2015 <1019850453@qq.com> Date: Thu, 9 Oct 2025 14:44:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E7=9B=98=EF=BC=9A=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=89=8D=E7=AB=AFjs=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/doc/agent.vue | 15 +++++++++++---- src/views/doc/manage.vue | 9 +++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/views/doc/agent.vue b/src/views/doc/agent.vue index ad59e20..b8d70e4 100644 --- a/src/views/doc/agent.vue +++ b/src/views/doc/agent.vue @@ -25,6 +25,7 @@ const controller = ref(null) const inputState=ref(true) const conversations=ref([]) const centHoverItem=ref("") +const currentAgent=ref<{name:string,uuid:string}>({}) const interact_msg=ref<{ask:boolean,think:string,content:string,docinfo?:any[]}[]>([]) const props = withDefaults(defineProps<{ @@ -78,7 +79,7 @@ async function onSendTextToAI(){ let docinfo:any=[] controller.value = new AbortController(); try{ - const res= await doAiChat(`${baseURL}/aibot/agents/${props.agent.uuid}/chat`,{ + const res= await doAiChat(`${baseURL}/aibot/agents/${currentAgent.value!.uuid}/chat`,{ inputs: params, query:myquestion.value, response_mode:"streaming", @@ -139,6 +140,7 @@ async function onSendTextToAI(){ setAiChat({ "userid":atob(props.userid), "uuid":conversation.value, + "agentuuid":currentAgent.value!.uuid, "brief":interact_msg.value[0].content, "content":JSON.stringify(interact_msg.value) }) @@ -160,6 +162,9 @@ function showChat(uuid:string){ }).then(resp=>{ interact_msg.value = JSON.parse(resp.data.content) conversation.value=resp.data.uuid + if(resp.data.agentuuid!=""){ + currentAgent.value={name:"会话",uuid:resp.data.agentuuid} + } }) } @@ -183,7 +188,7 @@ function handleMouseLeave(){ function newContext(){ const c =conversations.value.find(c=>c.uuid==conversation.value) - if(!c){ + if(!c && interact_msg.value.length>0){ conversations.value.push({ "agentuuid":props.agent.uuid, "uuid":conversation.value, @@ -195,6 +200,7 @@ function newContext(){ inputState.value=true interact_msg.value=[] conversation.value="" + currentAgent.value=props.agent //每次重置 loadKnownLibList() //刷新对话列表 } @@ -213,14 +219,15 @@ function formatRefContent(content:string){ //渲染完页面再执行 onMounted(() => { + currentAgent.value=props.agent loadKnownLibList() });