fix: 对话格式兼容改造

This commit is contained in:
Gsh
2026-01-11 00:15:31 +08:00
parent a9a9e45b7c
commit 53d70ef9d7
7 changed files with 651 additions and 64 deletions

View File

@@ -1,7 +1,7 @@
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}`
@@ -9,6 +9,12 @@ export function send(data: SendDTO) {
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();

View File

@@ -14,6 +14,7 @@ export interface GetSessionListVO {
modelId?: string;
isFree?: boolean; // 是否为免费模型
isPremiumPackage?: boolean; // 是否为尊享套餐模型
modelApiType?: string; // API 格式类型: Completions | Messages | Responses | GenerateContent
}
// 模型类型枚举