This commit is contained in:
jack ning
2025-09-24 09:02:35 +08:00
parent 6d27916522
commit bedb165f4e
4 changed files with 48 additions and 51 deletions

View File

@@ -21,7 +21,7 @@ import org.springframework.stereotype.Service;
import com.bytedesk.core.thread.ThreadEntity;
import com.bytedesk.core.thread.ThreadRestService;
import com.bytedesk.core.message.content.RobotStreamContent;
import com.bytedesk.core.message.content.StreamContent;
import jakarta.annotation.Nonnull;
import lombok.AllArgsConstructor;
@@ -62,18 +62,18 @@ public class MessagePersistService {
String existingJson = message.getContent();
String incomingJson = messageProtobuf.getContent();
RobotStreamContent existing = null;
RobotStreamContent incoming = null;
StreamContent existing = null;
StreamContent incoming = null;
try {
if (existingJson != null && !existingJson.isEmpty()) {
existing = RobotStreamContent.fromJson(existingJson, RobotStreamContent.class);
existing = StreamContent.fromJson(existingJson, StreamContent.class);
}
} catch (Exception ignore) {
// 旧数据或非JSON忽略
}
try {
if (incomingJson != null && !incomingJson.isEmpty()) {
incoming = RobotStreamContent.fromJson(incomingJson, RobotStreamContent.class);
incoming = StreamContent.fromJson(incomingJson, StreamContent.class);
}
} catch (Exception ignore) {
}
@@ -87,7 +87,7 @@ public class MessagePersistService {
String mergedReason = concatSafe(existing.getReasonContent(), incoming.getReasonContent());
// 沿用已有的其它字段question、sources、kbUid、robotUid、regenerationContext
RobotStreamContent merged = RobotStreamContent.builder()
StreamContent merged = StreamContent.builder()
.question(existing.getQuestion() != null ? existing.getQuestion()
: incoming.getQuestion())
.answer(mergedAnswer)

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-06-05 21:50:54
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-09-12 12:28:28
* @LastEditTime: 2025-09-24 08:55:22
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -84,15 +84,12 @@ public enum MessageTypeEnum {
ROBOT, // 机器人消息
ROBOT_QUESTION, // 机器人问题
ROBOT_ANSWER, // 机器人答案
ROBOT_STREAM, // 机器人流式响应(包含源引用)
ROBOT_STREAM_START, // 机器人流式响应开始
ROBOT_STREAM_END, // 机器人流式响应结束
ROBOT_UP, // 点赞
ROBOT_DOWN, // 点踩
//
// STREAM, // 流式消息TEXT大模型回复改为 ROBOT_STREAM
// STREAM_START, // 流式消息开始
// STREAM_END, // 流式消息结束
ROBOT_STREAM, // 机器人流式响应(包含源引用)
ROBOT_STREAM_START, // 机器人流式响应开始
ROBOT_STREAM_END, // 机器人流式响应结束
//
ARTICLE, // 文章
//

View File

@@ -22,7 +22,7 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class RobotStreamContent extends BaseContent {
public class StreamContent extends BaseContent {
private String question;