You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
248 lines
4.4 KiB
248 lines
4.4 KiB
import request from '@/utils/request';
|
|
import { AxiosPromise } from 'axios';
|
|
import { matterPage,createDir,matterTreeList,matterInfo} from './type';
|
|
|
|
/**
|
|
* 获取空间目录文件
|
|
*/
|
|
export function getSpaceMatterList( uid:string,data?: matterPage): AxiosPromise<matterTreeList> {
|
|
return request({
|
|
url: '/hxpan/api/space/page',
|
|
method: 'post',
|
|
headers: {
|
|
'Identifier':uid,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 新建目录
|
|
*/
|
|
export function doCreateSpaceDir(uid:string,data?: createDir){
|
|
return request({
|
|
url: '/hxpan/api/space/directory',
|
|
method: 'post',
|
|
headers: {
|
|
'Identifier':uid,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
export function doCreateAiagent(uid:string,data?: {space:string,matter:string}){
|
|
return request({
|
|
url: '/hxpan/api/space/aiagent',
|
|
method: 'post',
|
|
headers: {
|
|
'Identifier':uid,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 空间权限控制管理
|
|
*/
|
|
export function doAccessManage(uid:string,data?: any){
|
|
return request({
|
|
url: '/hxpan/api/space/access',
|
|
method: 'post',
|
|
headers: {
|
|
'Identifier':uid,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 删除空间
|
|
*/
|
|
export function doDelSpace(uid:string,data?: any){
|
|
return request({
|
|
url: '/hxpan/api/space/delete',
|
|
method: 'post',
|
|
headers: {
|
|
'Identifier':uid,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 重命名
|
|
*/
|
|
export function spaceMatterRename(uid:string,data?: any){
|
|
return request({
|
|
url: '/hxpan/api/space/rename',
|
|
method: 'post',
|
|
headers: {
|
|
'Identifier':uid,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* 删除文件或目录
|
|
*/
|
|
export function doDelSpaceMatter(uid:string,data?: any){
|
|
return request({
|
|
url: '/hxpan/api/space/materdelete',
|
|
method: 'post',
|
|
headers: {
|
|
'Identifier':uid,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
//-------------------AI backend APIs---------------
|
|
/**
|
|
* 文档训练
|
|
*/
|
|
export function doAiTraining(_url:string,data?: any){
|
|
return request({
|
|
url: '/aibot'+_url,
|
|
method: 'post',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: data
|
|
});
|
|
}
|
|
|
|
export interface aiChatData{
|
|
inputs:object;
|
|
query?:string;
|
|
response_mode:string;
|
|
conversation_id?:string;
|
|
user:string,
|
|
file?:[]
|
|
}
|
|
|
|
|
|
/**
|
|
* 问答api
|
|
*/
|
|
export function doAiChat(_url:string,data: aiChatData,sig?:AbortSignal){
|
|
return fetch(
|
|
_url,{
|
|
method: 'post',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
signal:sig,
|
|
body: JSON.stringify(data)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 工作流
|
|
*/
|
|
export function doAiWorkflow(_url:string,data: aiChatData){
|
|
return fetch(
|
|
_url,{
|
|
method: 'post',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify(data)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* 通过userid获取记录列表
|
|
* @requires userid
|
|
*/
|
|
export function getAiChatList(data:any){
|
|
return request({
|
|
url: '/aibot/chat/list',
|
|
method: 'post',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 获取单个会话
|
|
* @requires userid
|
|
* @requires uuid
|
|
*/
|
|
export function getAiChat(data: any){
|
|
return request({
|
|
url: '/aibot/chat',
|
|
method: 'post',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 删除单个会话
|
|
* @requires userid
|
|
* @requires uuid
|
|
*/
|
|
export function delAiChat(data: any){
|
|
return request({
|
|
url: '/aibot/chat/del',
|
|
method: 'post',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 更新会话
|
|
* @requires userid
|
|
* @requires uuid
|
|
*/
|
|
export function setAiChat(data: any){
|
|
return request({
|
|
url: '/aibot/chat/update',
|
|
method: 'post',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 获取智能体
|
|
*/
|
|
export function getAiagentList(data?: any){
|
|
return request({
|
|
url: '/aibot/agent/list',
|
|
method: 'post',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 更新会话
|
|
* @requires key
|
|
*
|
|
*/
|
|
export function getShareChat(key: string){
|
|
return request({
|
|
url: '/aibot/chat/shared/'+key,
|
|
method: 'get',
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 更新会话
|
|
* @requires key agentID+chatID+index
|
|
* @requires data
|
|
*/
|
|
export function newShareChat(data: any){
|
|
return request({
|
|
url: '/aibot/chat/share',
|
|
method: 'post',
|
|
data: data
|
|
});
|
|
}
|