2025-07-18 16:38:18 +08:00
|
|
|
import request from '@/utils/request'
|
|
|
|
import requestStream from '@/utils/requestStream'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 聊天消息相关接口定义
|
|
|
|
export interface ChatMessageSendRequest {
|
|
|
|
content: string;
|
|
|
|
userId: string;
|
|
|
|
conversationId?: string;
|
|
|
|
chatType?: string;
|
|
|
|
// apiKey: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ChatMessageResponse {
|
|
|
|
event: string;
|
|
|
|
conversationId?: string;
|
|
|
|
messageId?: string;
|
|
|
|
created_at?: number;
|
|
|
|
taskId?: string;
|
|
|
|
id?: string;
|
|
|
|
answer?: string;
|
|
|
|
from_variable_selector?: any;
|
|
|
|
metadata?: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 发送聊天消息(流式请求)
|
|
|
|
export const sendChatMessage = (data: ChatMessageSendRequest) => {
|
|
|
|
return requestStream.post('/brichat-service/chat/diagnose/completions', data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const getMaintStatData = (conversationId: string,messageId: string) => {
|
|
|
|
return request({
|
|
|
|
url: '/brichat-service/maintRecord/maintStatData',
|
|
|
|
method: 'get',
|
|
|
|
params: {
|
|
|
|
conversationId,
|
|
|
|
messageId
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 文件来源相关接口定义
|
|
|
|
export interface TraceFile {
|
|
|
|
fileName: string;
|
|
|
|
filePath: string;
|
|
|
|
}
|
|
|
|
|
2025-08-07 17:01:06 +08:00
|
|
|
// 文件内容接口定义 (Excel、Markdown、Word等包含内容的文件)
|
|
|
|
export interface TraceContext {
|
|
|
|
fileName: string;
|
|
|
|
context: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 更新TraceData接口以支持四种文件类型
|
2025-07-18 16:38:18 +08:00
|
|
|
export interface TraceData {
|
2025-08-07 17:01:06 +08:00
|
|
|
resultPdf: TraceFile[];
|
|
|
|
resultExcel: TraceContext[];
|
|
|
|
resultMarkdown: TraceContext[];
|
|
|
|
resultWord: TraceContext[];
|
2025-07-18 16:38:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 获取文件来源列表
|
|
|
|
export const getFilePathList = (conversationId: string, messageId: string) => {
|
|
|
|
return request({
|
2025-08-08 09:47:59 +08:00
|
|
|
url: '/brichat-service/trace/getTraceFileList',
|
2025-07-18 16:38:18 +08:00
|
|
|
method: 'get',
|
|
|
|
params: {
|
|
|
|
conversationId,
|
|
|
|
messageId
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export const stopMessagesStream = (chatType: Number,taskId: string, userId: string) => {
|
|
|
|
return request({
|
|
|
|
url: '/brichat-service/chat/stop',
|
|
|
|
method: 'get',
|
|
|
|
params: {
|
|
|
|
chatType,
|
|
|
|
taskId,
|
|
|
|
userId
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|