会话总结工作流接入、前后端处理
This commit is contained in:
@@ -35,4 +35,7 @@ public class ChatPrepareData implements Serializable {
|
||||
|
||||
@Schema(description = "智能体输入参数,不同智能体可能需要不同的输入参数")
|
||||
private Map<String, Object> inputsMap;
|
||||
|
||||
@Schema(description = "应用类型(chat=对话应用,workflow=工作流应用),默认为chat")
|
||||
private String appType = "chat";
|
||||
}
|
||||
|
||||
@@ -74,6 +74,13 @@ public interface AgentChatService {
|
||||
*/
|
||||
SseEmitter streamChatMessageWithSse(String sessionId);
|
||||
|
||||
/**
|
||||
* 阻塞式对话 - 使用sessionId进行同步调用,等待完整结果返回
|
||||
* @param sessionId 会话标识
|
||||
* @return ResultDomain<String> 返回AI回复的完整内容
|
||||
*/
|
||||
ResultDomain<String> blockingChatMessageWithSession(String sessionId);
|
||||
|
||||
/**
|
||||
* 停止对话生成(通过Dify TaskID)
|
||||
* @param filter 会话过滤条件(包含agentId, userId, userType)
|
||||
@@ -91,5 +98,23 @@ public interface AgentChatService {
|
||||
*/
|
||||
ResultDomain<Boolean> commentChatMessage(TbChat filter, String messageId, String comment);
|
||||
|
||||
// ====================== 工作流执行 ======================
|
||||
|
||||
/**
|
||||
* 工作流执行(阻塞模式)- 使用sessionId进行同步调用,等待完整结果返回
|
||||
* @param sessionId 会话标识(从prepareChatMessageSession返回)
|
||||
* @return ResultDomain<String> 返回工作流输出结果的JSON字符串
|
||||
*/
|
||||
ResultDomain<String> runWorkflowWithSession(String sessionId);
|
||||
|
||||
/**
|
||||
* 执行工作流(阻塞模式)- 直接传入inputs执行工作流
|
||||
* @param agentId 智能体ID(用于获取API Key)
|
||||
* @param inputs 工作流输入参数
|
||||
* @param userId 用户标识
|
||||
* @return ResultDomain<String> 返回工作流输出结果的JSON字符串
|
||||
*/
|
||||
ResultDomain<String> runWorkflowBlocking(String agentId, java.util.Map<String, Object> inputs, String userId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.xyzh.api.workcase.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description 聊天室总结请求参数
|
||||
* @filename ChatRoomSummaryRequest.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2026-01-01
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "聊天室总结请求参数")
|
||||
public class ChatRoomSummaryRequest implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "聊天室ID", required = true)
|
||||
private String roomId;
|
||||
|
||||
@Schema(description = "是否包含系统消息", defaultValue = "false")
|
||||
private Boolean includeSystemMessages = false;
|
||||
|
||||
@Schema(description = "是否包含会议消息", defaultValue = "false")
|
||||
private Boolean includeMeetingMessages = false;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.xyzh.api.workcase.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description 聊天室总结响应结果
|
||||
* @filename ChatRoomSummaryResponse.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2026-01-01
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "聊天室总结响应结果")
|
||||
public class ChatRoomSummaryResponse implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户提出的核心问题")
|
||||
private String question;
|
||||
|
||||
@Schema(description = "用户的核心诉求列表")
|
||||
private List<String> needs;
|
||||
|
||||
@Schema(description = "解决方案或答案")
|
||||
private String answer;
|
||||
|
||||
@Schema(description = "词云关键词列表")
|
||||
private List<String> workcloud;
|
||||
|
||||
@Schema(description = "聊天室ID")
|
||||
private String roomId;
|
||||
|
||||
@Schema(description = "总结生成时间")
|
||||
private String summaryTime;
|
||||
|
||||
@Schema(description = "参与总结的消息数量")
|
||||
private Integer messageCount;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.xyzh.api.workcase.dto;
|
||||
|
||||
import org.xyzh.common.dto.BaseDTO;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 聊天室总结表对象
|
||||
* @filename TbChatRoomSummaryDTO.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2026-01-01
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "聊天室总结表对象")
|
||||
public class TbChatRoomSummaryDTO extends BaseDTO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "总结ID")
|
||||
private String summaryId;
|
||||
|
||||
@Schema(description = "聊天室ID")
|
||||
private String roomId;
|
||||
|
||||
@Schema(description = "核心问题")
|
||||
private String question;
|
||||
|
||||
@Schema(description = "核心诉求数组")
|
||||
private List<String> needs;
|
||||
|
||||
@Schema(description = "解决方案")
|
||||
private String answer;
|
||||
|
||||
@Schema(description = "词云关键词数组")
|
||||
private List<String> workcloud;
|
||||
|
||||
@Schema(description = "参与总结的消息数量")
|
||||
private Integer messageCount;
|
||||
|
||||
@Schema(description = "总结生成时间")
|
||||
private String summaryTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.xyzh.api.workcase.service;
|
||||
|
||||
import org.xyzh.api.workcase.dto.ChatRoomSummaryRequest;
|
||||
import org.xyzh.api.workcase.dto.ChatRoomSummaryResponse;
|
||||
import org.xyzh.common.core.domain.ResultDomain;
|
||||
|
||||
/**
|
||||
* @description 智能体服务接口,提供AI相关的业务功能
|
||||
* @filename AgentService.java
|
||||
* @author system
|
||||
* @copyright xyzh
|
||||
* @since 2026-01-01
|
||||
*/
|
||||
public interface AgentService {
|
||||
|
||||
/**
|
||||
* @description 总结聊天室对话内容
|
||||
* @param request 聊天室总结请求参数
|
||||
* @return 总结结果
|
||||
* @author system
|
||||
* @since 2026-01-01
|
||||
*/
|
||||
ResultDomain<ChatRoomSummaryResponse> summaryChatRoom(ChatRoomSummaryRequest request);
|
||||
|
||||
/**
|
||||
* @description 获取聊天室最新的总结
|
||||
* @param roomId 聊天室ID
|
||||
* @return 总结结果
|
||||
* @author system
|
||||
* @since 2026-01-01
|
||||
*/
|
||||
ResultDomain<ChatRoomSummaryResponse> getLatestSummary(String roomId);
|
||||
}
|
||||
Reference in New Issue
Block a user