对话、重新生成、评价完成
This commit is contained in:
@@ -48,14 +48,14 @@ public interface AiAgentConfigService {
|
||||
* 查询所有启用的智能体列表
|
||||
* @return 智能体列表
|
||||
*/
|
||||
ResultDomain<List<TbAiAgentConfig>> listEnabledAgents();
|
||||
ResultDomain<TbAiAgentConfig> listEnabledAgents();
|
||||
|
||||
/**
|
||||
* 查询智能体列表(支持过滤)
|
||||
* @param filter 过滤条件
|
||||
* @return 智能体列表
|
||||
*/
|
||||
ResultDomain<List<TbAiAgentConfig>> listAgents(TbAiAgentConfig filter);
|
||||
ResultDomain<TbAiAgentConfig> listAgents(TbAiAgentConfig filter);
|
||||
|
||||
/**
|
||||
* 分页查询智能体列表
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.xyzh.api.ai.chat;
|
||||
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
import org.xyzh.common.core.domain.ResultDomain;
|
||||
import org.xyzh.common.dto.ai.TbAiConversation;
|
||||
import org.xyzh.common.dto.ai.TbAiMessage;
|
||||
@@ -16,20 +17,18 @@ import java.util.List;
|
||||
public interface AiChatService {
|
||||
|
||||
/**
|
||||
* 流式对话(SSE)
|
||||
* 流式对话(SSE)- 使用SseEmitter实现真正的流式推送
|
||||
* @param agentId 智能体ID
|
||||
* @param conversationId 会话ID(可选,为空则创建新会话)
|
||||
* @param query 用户问题
|
||||
* @param knowledgeIds 使用的知识库ID列表(可选,用于知识库隔离)
|
||||
* @param callback 流式响应回调(StreamCallback类型,需在实现层处理)
|
||||
* @return 对话结果(包含会话ID和消息ID)
|
||||
* @return SseEmitter 流式推送对象
|
||||
*/
|
||||
ResultDomain<TbAiMessage> streamChat(
|
||||
SseEmitter streamChatWithSse(
|
||||
String agentId,
|
||||
String conversationId,
|
||||
String query,
|
||||
List<String> knowledgeIds,
|
||||
Object callback // 使用Object避免跨模块依赖
|
||||
List<String> knowledgeIds
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -47,12 +46,15 @@ public interface AiChatService {
|
||||
List<String> knowledgeIds
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 停止对话生成
|
||||
* @param messageId 消息ID
|
||||
* 停止对话生成(通过Dify TaskID)
|
||||
* @param taskId Dify任务ID
|
||||
* @param agentId 智能体ID
|
||||
* @return 停止结果
|
||||
*/
|
||||
ResultDomain<Boolean> stopChat(String messageId);
|
||||
ResultDomain<Boolean> stopChatByTaskId(String taskId, String agentId);
|
||||
|
||||
/**
|
||||
* 创建新会话
|
||||
@@ -88,14 +90,14 @@ public interface AiChatService {
|
||||
* @param agentId 智能体ID(可选)
|
||||
* @return 会话列表
|
||||
*/
|
||||
ResultDomain<List<TbAiConversation>> listUserConversations(String agentId);
|
||||
ResultDomain<TbAiConversation> listUserConversations(String agentId);
|
||||
|
||||
/**
|
||||
* 查询会话的消息列表
|
||||
* @param conversationId 会话ID
|
||||
* @return 消息列表
|
||||
*/
|
||||
ResultDomain<List<TbAiMessage>> listMessages(String conversationId);
|
||||
ResultDomain<TbAiMessage> listMessages(String conversationId);
|
||||
|
||||
/**
|
||||
* 获取单条消息
|
||||
@@ -105,12 +107,11 @@ public interface AiChatService {
|
||||
ResultDomain<TbAiMessage> getMessage(String messageId);
|
||||
|
||||
/**
|
||||
* 重新生成回答
|
||||
* 重新生成回答(SSE流式)
|
||||
* @param messageId 原消息ID
|
||||
* @param callback 流式回调(可选,StreamCallback类型)
|
||||
* @return 新消息
|
||||
* @return SseEmitter 流式推送对象
|
||||
*/
|
||||
ResultDomain<TbAiMessage> regenerateAnswer(String messageId, Object callback);
|
||||
SseEmitter regenerateAnswerWithSse(String messageId);
|
||||
|
||||
/**
|
||||
* 异步生成会话摘要
|
||||
|
||||
@@ -37,7 +37,7 @@ public interface AiUploadFileService {
|
||||
* @param indexingTechnique 索引方式(可选)
|
||||
* @return 上传结果列表
|
||||
*/
|
||||
ResultDomain<List<TbAiUploadFile>> batchUploadToKnowledge(
|
||||
ResultDomain<TbAiUploadFile> batchUploadToKnowledge(
|
||||
String knowledgeId,
|
||||
List<MultipartFile> files,
|
||||
String indexingTechnique
|
||||
@@ -69,7 +69,7 @@ public interface AiUploadFileService {
|
||||
* @param knowledgeId 知识库ID
|
||||
* @return 文件列表
|
||||
*/
|
||||
ResultDomain<List<TbAiUploadFile>> listFilesByKnowledge(String knowledgeId);
|
||||
ResultDomain<TbAiUploadFile> listFilesByKnowledge(String knowledgeId);
|
||||
|
||||
/**
|
||||
* 分页查询文件列表
|
||||
@@ -91,5 +91,5 @@ public interface AiUploadFileService {
|
||||
* @param knowledgeId 知识库ID
|
||||
* @return 同步结果
|
||||
*/
|
||||
ResultDomain<List<TbAiUploadFile>> syncKnowledgeFiles(String knowledgeId);
|
||||
ResultDomain<TbAiUploadFile> syncKnowledgeFiles(String knowledgeId);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public interface AiKnowledgeService {
|
||||
* @param filter 过滤条件
|
||||
* @return 知识库列表
|
||||
*/
|
||||
ResultDomain<List<TbAiKnowledge>> listKnowledges(TbAiKnowledge filter);
|
||||
ResultDomain<TbAiKnowledge> listKnowledges(TbAiKnowledge filter);
|
||||
|
||||
/**
|
||||
* 分页查询知识库
|
||||
|
||||
Reference in New Issue
Block a user