79 lines
1.6 KiB
TypeScript
79 lines
1.6 KiB
TypeScript
|
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;
|
||
|
}
|
||
|
|
||
|
// 新增TraceData接口
|
||
|
export interface TraceData {
|
||
|
tracePdf: TraceFile[];
|
||
|
traceExcel: string;
|
||
|
}
|
||
|
|
||
|
// 获取文件来源列表
|
||
|
export const getFilePathList = (conversationId: string, messageId: string) => {
|
||
|
return request({
|
||
|
url: '/brichat-service/fileManage/getTraceFileList',
|
||
|
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
|
||
|
}
|
||
|
})
|
||
|
}
|