mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-02 07:06:37 +08:00
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import type { ChatMessageVo, GetChatListParams, SendDTO } from './types';
|
||
import { get, post } from '@/utils/request';
|
||
|
||
// 发送消息(旧接口)
|
||
export function send(data: SendDTO) {
|
||
const url = data.sessionId !== 'not_login'
|
||
? `/ai-chat/send/?sessionId=${data.sessionId}`
|
||
: '/ai-chat/send';
|
||
return post(url, data);
|
||
}
|
||
|
||
// 统一发送消息接口,支持4种API类型
|
||
export function unifiedSend(data: any, apiType: string, modelId: string, sessionId: string) {
|
||
const url = `/ai-chat/unified/send?apiType=${apiType}&modelId=${modelId}&sessionId=${sessionId}`;
|
||
return post(url, data);
|
||
}
|
||
|
||
// 新增对应会话聊天记录
|
||
export function addChat(data: ChatMessageVo) {
|
||
return post('/system/message', data).json();
|
||
}
|
||
|
||
// 获取当前会话的聊天记录
|
||
export function getChatList(params: GetChatListParams) {
|
||
// return get<ChatMessageVo[]>('/system/message/list', params);
|
||
return get<ChatMessageVo[]>('/message', params).json();
|
||
}
|
||
|
||
// 新增对应会话聊天记录
|
||
export function aiChatTool() {
|
||
return post('/ai-chat/tool').json();
|
||
}
|