AI 对话web、wx优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { request } from '../base'
|
||||
import { request, uploadFile } from '../base'
|
||||
import type { ResultDomain } from '../../types'
|
||||
import type {
|
||||
TbChat,
|
||||
@@ -11,7 +11,8 @@ import type {
|
||||
ChatMessageListParam,
|
||||
SSECallbacks,
|
||||
SSETask,
|
||||
SSEMessageData
|
||||
SSEMessageData,
|
||||
DifyFileInfo
|
||||
} from '../../types/ai/aiChat'
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
@@ -190,5 +191,21 @@ export const aiChatAPI = {
|
||||
*/
|
||||
commentChatMessage(param: CommentMessageParam): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/comment`, method: 'POST', data: param })
|
||||
},
|
||||
|
||||
// ====================== 文件上传 ======================
|
||||
|
||||
/**
|
||||
* 上传文件用于对话(图文多模态)
|
||||
* @param filePath 文件临时路径
|
||||
* @param agentId 智能体ID
|
||||
*/
|
||||
uploadFileForChat(filePath: string, agentId: string): Promise<ResultDomain<DifyFileInfo>> {
|
||||
return uploadFile<DifyFileInfo>({
|
||||
url: `${this.baseUrl}/file/upload`,
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
formData: { agentId: agentId }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user