diff --git a/src/api/all/chat.ts b/src/api/all/chat.ts new file mode 100644 index 0000000..5290a61 --- /dev/null +++ b/src/api/all/chat.ts @@ -0,0 +1,68 @@ +import Http from '@/api'; +import axios from 'axios'; +import { glsWithCatch } from '@/utils/stroage'; +import { useEnterpriseStore } from '@/stores/modules/enterprise'; + +// 历史记录-列表 +export const getAgentHistory = (id: string) => { + return Http.get(`/v1/multi-agent/history/${id}`); +}; + +// 历史记录-更新标题 +export const postUpdateSessionTitle = (data: any) => { + return Http.post('/v1/multi-agent/edit-session-title', data); +}; + +// 历史记录-置顶/取消置顶 +export const postUpdateSessionSort = (data: any) => { + return Http.post('/v1/multi-agent/edit-session-sort', data); +}; + +// 历史记录-删除 +export const deleteHistoryItem = (id: string) => { + return Http.delete(`/v1/multi-agent/del-session/${id}`); +}; + + + +export const baseUrl = 'http://192.168.40.41:8001'; +const getHeaders = () => { + const store = useEnterpriseStore(); + return { + Authorization: glsWithCatch('accessToken'), + 'enterprise-id': store.enterpriseInfo?.id, + Accept: 'application/json', + 'Content-Type': 'application/json', + }; +}; + +/** + * 获取智能体信息 + */ +export const getAgentInfo = async () => { + const { data } = await axios.get(`${baseUrl}/api/agent/info`, { + headers: getHeaders(), + }); + return data; +}; + +/** + * 指令输入 + */ +export const getInputAgent = async (params: {}) => { + const { data } = await axios.get(`${baseUrl}/api/agent/input`, { + params, + headers: { ...getHeaders(), Accept: 'text/event-stream' }, + }); + return data; +}; + +/** + * 生成会话id + */ +export const createSession = async () => { + const { data } = await axios.get(`${baseUrl}/api/agent/create_session`, { + headers: getHeaders(), + }); + return data; +}; \ No newline at end of file diff --git a/src/api/index.ts b/src/api/index.ts index 2684e95..752c186 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -72,7 +72,6 @@ export class Request { const { response } = err; const status = response?.status; let errMessage = response?.data?.message ?? err.message; - switch (status) { case HttpStatusCode.InternalServerError: errMessage = '系统繁忙,请稍后再试或联系管理员。'; diff --git a/src/components/xt-chat/xt-conversations/index.vue b/src/components/xt-chat/xt-conversations/index.vue index 40502e4..ae5f97f 100644 --- a/src/components/xt-chat/xt-conversations/index.vue +++ b/src/components/xt-chat/xt-conversations/index.vue @@ -71,7 +71,7 @@ export default defineComponent({ }; const onMenuItemClick = ({ menuInfo, item }) => { const { key } = menuInfo; - emit('menuClick', menuInfo); + emit('menuClick', { menuInfo, item }); switch (key) { case 'rename': diff --git a/src/layouts/components/navbar/components/middle-side/index.vue b/src/layouts/components/navbar/components/middle-side/index.vue index 9eae6af..3c346e2 100644 --- a/src/layouts/components/navbar/components/middle-side/index.vue +++ b/src/layouts/components/navbar/components/middle-side/index.vue @@ -1,16 +1,16 @@