diff --git a/src/api/doc/space.ts b/src/api/doc/space.ts index 2013476..45a52ef 100644 --- a/src/api/doc/space.ts +++ b/src/api/doc/space.ts @@ -160,6 +160,34 @@ export function doAiWorkflow(_url:string,data: aiChatData){ } ) } + +/** + * 设置queryURLS + */ +export function setAgentQueryURL(_url:string,data: {urls:string}){ + return request({ + url: _url, + method: 'post', + headers: { + 'Content-Type': 'application/json' + }, + data: JSON.stringify(data) + } + ) +} + +/** + * 查询queryURLS + */ +export function getAgentQueryURL(uuid:string){ + return request( + { + url: `/aibot/agents/${uuid}/query/urls`, + method: 'get', + } + ) +} + /** * 通过userid获取记录列表 * @requires userid @@ -211,6 +239,7 @@ export function setAiChat(data: any){ }); } + /** * 获取智能体 */ diff --git a/src/views/doc/agent.vue b/src/views/doc/agent.vue index 7663a49..f18eee6 100644 --- a/src/views/doc/agent.vue +++ b/src/views/doc/agent.vue @@ -27,7 +27,6 @@ const inputState=ref(true) const conversations=ref([]) const centHoverItem=ref("") const currentAgent=ref<{name:string,uuid:string}>({}) -const queryUrl=ref("") const interact_msg=ref<{ask:boolean,think:string,content:string,docinfo?:any[]}[]>([]) const props = withDefaults(defineProps<{ @@ -67,21 +66,16 @@ function abortFetch() { async function onSendTextToAI(){ if(myquestion.value==="")return; inputState.value=false - + let apiURL =`${baseURL}/aibot/agents/${currentAgent.value!.uuid}/chat` const params={ "onlineSearch":"否", - "useDataset":"否", + "useDataset":"是", "queryUrl":"" } for (let item of checkedModel.value){ if(item==="onlineSearch"){ - params.onlineSearch="是" - if(queryUrl.value!="") { - params.queryUrl=queryUrl.value - //queryUrl.value="" //立即清理 - } - } - if(item==="useDataset") params.useDataset="是" + apiURL=`${baseURL}/aibot/agents/${currentAgent.value!.uuid}/2chat` + } } if (conversation.value==""){ @@ -93,7 +87,7 @@ async function onSendTextToAI(){ let docinfo:any=[] controller.value = new AbortController(); try{ - const res= await doAiChat(`${baseURL}/aibot/agents/${currentAgent.value!.uuid}/chat`,{ + const res= await doAiChat(apiURL,{ inputs: params, query:myquestion.value, response_mode:"streaming", @@ -334,9 +328,6 @@ onMounted(() => { {{ mod.name }} -
- -
diff --git a/src/views/doc/manage.vue b/src/views/doc/manage.vue index 066e603..11cbe7a 100644 --- a/src/views/doc/manage.vue +++ b/src/views/doc/manage.vue @@ -25,7 +25,7 @@ import uploadlog from './uploadlog.vue'; import space from './space.vue'; import spacePermission from './spacePermission.vue'; import SvgIcon from "@/components/SvgIcon/index.vue"; -import {doDelSpace,doAccessManage,doCreateAiagent} from "@/api/doc/space" +import {doDelSpace,doAccessManage,doCreateAiagent,setAgentQueryURL,getAgentQueryURL} from "@/api/doc/space" import Space from "./space.vue"; import Logpanel from "./logpanel.vue"; @@ -861,6 +861,38 @@ function onAiAgent(row:matterInfo){ }) } +//设置智能体联网查询地址 +async function onAgentQueryURL(row:matterInfo){ + await getAgentQueryURL(row.uuid).then(resp=>{ + const newurls=ref(resp.data) + ElMessageBox({ + title:"填入网址(多个网址必须逗号分隔)", + customStyle: { '--el-messagebox-width':'630px',padding:'13px'}, + confirmButtonText: "确定", + cancelButtonText: "取消", + message: () => h(ElInput, { + type:"textarea", + rows:3, + style: { width:'600px' }, + modelValue: newurls.value, + 'onUpdate:modelValue': (val) => { + newurls.value = val + }, + }), + }).then(() => { + setAgentQueryURL(row.uuid,{ + urls:newurls.value + }).then(()=>{ + ElMessage({ + message: '已成功更新URL', + type: 'success', + plain: true, + }) + }) + }) + }) +} + //------------------------------------------------------ //http://172.20.2.87:6010/api/alien/preview/5a10aaf6-396e-4d9a-7e87-3c5c8029d4db/123.png?ir=fill_100_100 //渲染完页面再执行 @@ -954,6 +986,7 @@ const handleSelectionChange = (val:matterInfo[]) => { 成员管理 权限管理 创建智能体 + 联网查询 删除 重命名