ai对话优化知识库选择

This commit is contained in:
2025-12-29 18:40:26 +08:00
parent a33720b9f6
commit 4b6cb726d2
14 changed files with 249 additions and 81 deletions

View File

@@ -88,6 +88,7 @@ export interface ChatPrepareData {
userId?: string
/** 用户类型false=来客true=员工) */
userType?: boolean
service?: string
}
// ==================== 请求参数类型(必传校验) ====================
@@ -106,24 +107,6 @@ export interface CreateChatParam {
title?: string
}
/**
* 准备流式对话参数
*/
export interface PrepareChatParam {
/** 对话ID必传 */
chatId: string
/** 用户问题(必传) */
query: string
/** 智能体ID必传 */
agentId: string
/** 用户类型(必传) */
userType: boolean
/** 用户ID */
userId?: string
/** 文件列表 */
files?: DifyFileInfo[]
}
/**
* 停止对话参数
*/

View File

@@ -131,7 +131,6 @@ declare module 'shared/types' {
DifyFileInfo,
ChatPrepareData,
CreateChatParam,
PrepareChatParam,
StopChatParam,
CommentMessageParam,
ChatListParam,

View File

@@ -275,7 +275,7 @@ import type {
TbChat,
TbChatMessage,
TbAgent,
PrepareChatParam,
ChatPrepareData,
SSEMessageData,
DifyFileInfo,
TbSysFileDTO
@@ -479,13 +479,14 @@ const sendMessage = async () => {
}
// 准备流式对话参数
const prepareParam: PrepareChatParam = {
const prepareParam: ChatPrepareData = {
chatId: currentChatId.value!,
query: query,
agentId: agentId,
userType: userType.value,
userId: userId.value,
files: uploadedFiles.value.length > 0 ? uploadedFiles.value : undefined
files: uploadedFiles.value.length > 0 ? uploadedFiles.value : undefined,
service: "workcase"
}
// 清空已上传的文件

View File

@@ -4,7 +4,7 @@ import type {
TbChat,
TbChatMessage,
CreateChatParam,
PrepareChatParam,
ChatPrepareData,
StopChatParam,
CommentMessageParam,
ChatListParam,
@@ -72,7 +72,7 @@ export const aiChatAPI = {
* 准备流式对话会话
* @param param agentId、chatId、query、userId 必传
*/
prepareChatMessageSession(param: PrepareChatParam): Promise<ResultDomain<string>> {
prepareChatMessageSession(param: ChatPrepareData): Promise<ResultDomain<string>> {
return request<string>({ url: `${this.baseUrl}/stream/prepare`, method: 'POST', data: param })
},

View File

@@ -16,7 +16,7 @@ import type {
TbChat,
TbChatMessage,
CreateChatParam,
PrepareChatParam,
ChatPrepareData,
StopChatParam,
CommentMessageParam,
ChatListParam,

View File

@@ -354,13 +354,14 @@
}
// 准备流式对话(包含文件)
const prepareData = {
const prepareData: ChatPrepareData = {
chatId: chatId.value,
query: query,
agentId: agentId,
userType: userType.value,
userId: userInfo.value.userId,
files: files.length > 0 ? files : undefined
files: files.length > 0 ? files : undefined,
service: "workcase"
}
console.log('准备流式对话参数:', JSON.stringify(prepareData))

View File

@@ -87,6 +87,7 @@ export interface ChatPrepareData {
userId?: string
/** 用户类型false=来客true=员工) */
userType?: boolean
service?: string
}
/**
@@ -125,23 +126,6 @@ export interface CreateChatParam {
title?: string
}
/**
* 准备流式对话参数
*/
export interface PrepareChatParam {
/** 对话ID必传 */
chatId: string
/** 用户问题(必传) */
query: string
/** 智能体ID */
agentId: string
userType: boolean
/** 用户ID */
userId?: string
/** 用户类型 */
/** 文件列表 */
files?: DifyFileInfo[]
}
/**
* 停止对话参数