Files
Yi.Framework/Yi.Ai.Vue3/src/api/chat/index.ts
2025-08-03 21:56:51 +08:00

22 lines
673 B
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);
}
// 新增对应会话聊天记录
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();
}