Browse Source

Merge branch 'space2'

lwx_v27
han2015 2 months ago
parent
commit
3a12ecc811
  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 conversations=ref<chatRecord[]>([])
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()
});
</script>
<template>
<el-drawer
:model-value="agent.model"
:title="agent.name+' : 知识库'"
:model-value="props.agent.model"
:title="currentAgent.name+' : 知识库'"
direction="rtl"
size="80%"
@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 ?? "",
userUuid: data.userUuid ?? "",
manager: data.manager ?? false,
permits:data.permits ?? { id: 0, MatterUuid: '', data: '' }
permits:data.permits ?? { id: 0, MatterUuid: '', data: '{}' }
};
PRIVATESPACE.value=false;
}else{
@ -708,7 +708,8 @@ function onSpaceNodeClick(data:matterTree,node:TreeNode,self:any,env:any){
agent:data.agent,
dir:true,
permits:data.permits,
path:data.path
path:data.path,
permitVal:data.permitVal
}
//
spaceEleRef.value.handleDoubleClick(matter)
@ -808,6 +809,7 @@ onMounted(() => {
// {name:'',uuid:'root',dir:false},
// currentNode.value.uuid
// )
currentNode.value={uuid:"root"}
//
getMySpaces(uid,{roles:Departs.value}).then((resp)=>{
resp.data.forEach((item)=>{
@ -880,7 +882,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<template #default="{ node, data }">
<div class="tree-item">
<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>
<template #dropdown>
<el-dropdown-menu>
@ -893,7 +895,6 @@ const handleSelectionChange = (val:matterInfo[]) => {
</template>
</el-dropdown>
</div>
</template>
</el-tree>
<div class="area_header" @click="showRecycling">

Loading…
Cancel
Save