Files
lingji-work-fe/src/api/all/chat.ts

63 lines
1.6 KiB
TypeScript
Raw Normal View History

import Http from '@/api';
import axios from 'axios';
import { glsWithCatch } from '@/utils/stroage';
import { useEnterpriseStore } from '@/stores/modules/enterprise';
export const BASE_PYTHON_URL = 'https://agent.lvfunai.com';
2025-08-28 14:58:58 +08:00
import { genRandomId } from '@/utils/tools';
// 历史记录-列表
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}`);
};
2025-08-27 18:07:36 +08:00
// 历史记录-列表
export const getConversationList = (params: {}) => {
return Http.get(`/v1/conversation/message/list`, params);
};
2025-08-23 11:53:27 +08:00
export const getHeaders = () => {
const store = useEnterpriseStore();
return {
2025-08-28 14:58:58 +08:00
Authorization: glsWithCatch('accessToken'),
'enterprise-id': store.enterpriseInfo?.id,
2025-08-28 14:58:58 +08:00
Accept: 'application/json',
'Content-Type': 'application/json',
2025-08-28 14:58:58 +08:00
requestid: genRandomId(),
};
};
/**
*
*/
2025-08-28 12:03:52 +08:00
export const getAgentData = async () => {
const { data } = await axios.get(`${BASE_PYTHON_URL}/api/agent/info`, {
headers: getHeaders(),
});
return data;
};
/**
* id
*/
export const createSession = async () => {
const { data } = await axios.get(`${BASE_PYTHON_URL}/api/agent/create_session`, {
headers: getHeaders(),
});
return data;
2025-08-28 14:58:58 +08:00
};