Compare commits

...

2 Commits

  1. 15
      src/views/doc/agent.vue
  2. 9
      src/views/doc/manage.vue

15
src/views/doc/agent.vue

@ -25,6 +25,7 @@ const controller = ref<AbortController | null>(null)
const inputState=ref(true) const inputState=ref(true)
const conversations=ref<chatRecord[]>([]) const conversations=ref<chatRecord[]>([])
const centHoverItem=ref("") const centHoverItem=ref("")
const currentAgent=ref<{name:string,uuid:string}>({})
const interact_msg=ref<{ask:boolean,think:string,content:string,docinfo?:any[]}[]>([]) const interact_msg=ref<{ask:boolean,think:string,content:string,docinfo?:any[]}[]>([])
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -78,7 +79,7 @@ async function onSendTextToAI(){
let docinfo:any=[] let docinfo:any=[]
controller.value = new AbortController(); controller.value = new AbortController();
try{ 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, inputs: params,
query:myquestion.value, query:myquestion.value,
response_mode:"streaming", response_mode:"streaming",
@ -139,6 +140,7 @@ async function onSendTextToAI(){
setAiChat({ setAiChat({
"userid":atob(props.userid), "userid":atob(props.userid),
"uuid":conversation.value, "uuid":conversation.value,
"agentuuid":currentAgent.value!.uuid,
"brief":interact_msg.value[0].content, "brief":interact_msg.value[0].content,
"content":JSON.stringify(interact_msg.value) "content":JSON.stringify(interact_msg.value)
}) })
@ -160,6 +162,9 @@ function showChat(uuid:string){
}).then(resp=>{ }).then(resp=>{
interact_msg.value = JSON.parse(resp.data.content) interact_msg.value = JSON.parse(resp.data.content)
conversation.value=resp.data.uuid conversation.value=resp.data.uuid
if(resp.data.agentuuid!=""){
currentAgent.value={name:"会话",uuid:resp.data.agentuuid}
}
}) })
} }
@ -183,7 +188,7 @@ function handleMouseLeave(){
function newContext(){ function newContext(){
const c =conversations.value.find(c=>c.uuid==conversation.value) const c =conversations.value.find(c=>c.uuid==conversation.value)
if(!c){ if(!c && interact_msg.value.length>0){
conversations.value.push({ conversations.value.push({
"agentuuid":props.agent.uuid, "agentuuid":props.agent.uuid,
"uuid":conversation.value, "uuid":conversation.value,
@ -195,6 +200,7 @@ function newContext(){
inputState.value=true inputState.value=true
interact_msg.value=[] interact_msg.value=[]
conversation.value="" conversation.value=""
currentAgent.value=props.agent //
loadKnownLibList() // loadKnownLibList() //
} }
@ -213,14 +219,15 @@ function formatRefContent(content:string){
// //
onMounted(() => { onMounted(() => {
currentAgent.value=props.agent
loadKnownLibList() loadKnownLibList()
}); });
</script> </script>
<template> <template>
<el-drawer <el-drawer
:model-value="agent.model" :model-value="props.agent.model"
:title="agent.name+' : 知识库'" :title="currentAgent.name+' : 知识库'"
direction="rtl" direction="rtl"
size="80%" size="80%"
@close="resetContext" @close="resetContext"

9
src/views/doc/manage.vue

@ -697,7 +697,7 @@ function onSpaceNodeClick(data:matterTree,node:TreeNode,self:any,env:any){
uuid: data.uuid ?? "", uuid: data.uuid ?? "",
userUuid: data.userUuid ?? "", userUuid: data.userUuid ?? "",
manager: data.manager ?? false, manager: data.manager ?? false,
permits:data.permits ?? { id: 0, MatterUuid: '', data: '' } permits:data.permits ?? { id: 0, MatterUuid: '', data: '{}' }
}; };
PRIVATESPACE.value=false; PRIVATESPACE.value=false;
}else{ }else{
@ -708,7 +708,8 @@ function onSpaceNodeClick(data:matterTree,node:TreeNode,self:any,env:any){
agent:data.agent, agent:data.agent,
dir:true, dir:true,
permits:data.permits, permits:data.permits,
path:data.path path:data.path,
permitVal:data.permitVal
} }
// //
spaceEleRef.value.handleDoubleClick(matter) spaceEleRef.value.handleDoubleClick(matter)
@ -808,6 +809,7 @@ onMounted(() => {
// {name:'',uuid:'root',dir:false}, // {name:'',uuid:'root',dir:false},
// currentNode.value.uuid // currentNode.value.uuid
// ) // )
currentNode.value={uuid:"root"}
// //
getMySpaces(uid,{roles:Departs.value}).then((resp)=>{ getMySpaces(uid,{roles:Departs.value}).then((resp)=>{
resp.data.forEach((item)=>{ resp.data.forEach((item)=>{
@ -880,7 +882,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<template #default="{ node, data }"> <template #default="{ node, data }">
<div class="tree-item"> <div class="tree-item">
<span>{{ node.label}}</span> <span>{{ node.label}}</span>
<el-dropdown v-if="SpaceID.manager"> <el-dropdown v-if="data.manager">
<el-button size="small" :icon="Setting" circle ></el-button> <el-button size="small" :icon="Setting" circle ></el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
@ -893,7 +895,6 @@ const handleSelectionChange = (val:matterInfo[]) => {
</template> </template>
</el-dropdown> </el-dropdown>
</div> </div>
</template> </template>
</el-tree> </el-tree>
<div class="area_header" @click="showRecycling"> <div class="area_header" @click="showRecycling">

Loading…
Cancel
Save