update modules/core: mod 4 files

This commit is contained in:
jack ning
2025-04-22 13:46:18 +08:00
parent cd352b8349
commit 85352bbb1a
4 changed files with 21 additions and 27 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-03-22 16:44:41
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-22 12:59:49
* @LastEditTime: 2025-04-22 13:36:51
* @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.
@@ -53,6 +53,7 @@ import com.bytedesk.core.topic.TopicUtils;
import com.bytedesk.core.constant.AvatarConsts;
import com.bytedesk.core.constant.BytedeskConsts;
import com.bytedesk.core.uid.UidUtils;
import com.bytedesk.core.utils.ConvertUtils;
import com.bytedesk.core.utils.Utils;
import com.bytedesk.kbase.faq.FaqEntity;
import com.bytedesk.kbase.faq.FaqRestService;
@@ -172,8 +173,8 @@ public class RobotRestService extends BaseRestService<RobotEntity, RobotRequest,
if (owner == null) {
throw new RuntimeException("should login first");
}
RobotProtobuf agent = RobotProtobuf.fromJson(request.getAgent());
String robotUid = agent.getUid();
RobotProtobuf robotProtobuf = RobotProtobuf.fromJson(request.getAgent());
String robotUid = robotProtobuf.getUid();
if (!StringUtils.hasText(robotUid)) {
throw new RuntimeException("robotUid is required");
}
@@ -230,13 +231,14 @@ public class RobotRestService extends BaseRestService<RobotEntity, RobotRequest,
public ThreadResponse updateLlmThread(ThreadRequest request) {
//
String topic = request.getTopic();
RobotProtobuf robotProtobuf = RobotProtobuf.fromJson(request.getAgent());
//
Optional<ThreadEntity> threadOptional = threadService.findFirstByTopic(topic);
if (!threadOptional.isPresent()) {
throw new RuntimeException("thread not found");
}
ThreadEntity thread = threadOptional.get();
//
RobotProtobuf robotProtobuf = RobotProtobuf.fromJson(thread.getAgent());
//
Optional<LlmProviderEntity> llmProviderOptional = llmProviderRestService
.findByNameAndOrgUid(robotProtobuf.getLlm().getProvider(), thread.getOrgUid());
if (!llmProviderOptional.isPresent()) {
@@ -246,13 +248,15 @@ public class RobotRestService extends BaseRestService<RobotEntity, RobotRequest,
robotProtobuf.setNickname(llmProviderOptional.get().getNickname());
thread.setAgent(robotProtobuf.toJson());
thread.setRobot(robotProtobuf.toJson());
thread.setUser(robotProtobuf.toJson());
log.info("update thread robot: {}", robotProtobuf.toJson());
//
ThreadEntity savedThread = threadService.save(thread);
if (savedThread == null) {
throw new RuntimeException("thread save failed");
}
//
return threadService.convertToResponse(savedThread);
return ConvertUtils.convertToThreadResponse(savedThread);
}

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-06-29 13:00:33
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-15 10:42:20
* @LastEditTime: 2025-04-22 13:26:04
* @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.
@@ -116,16 +116,6 @@ public abstract class AbstractThreadEntity extends BaseEntity {
@Column(name = "thread_note")
private String note;
// 是否离线
// @Builder.Default
// @Column(name = "is_offline")
// private boolean offline = false;
// 是否robot
// @Builder.Default
// @Column(name = "is_robot")
// private boolean isRobot = false;
// 标签
@Builder.Default
@Convert(converter = StringListConverter.class)

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-03-01 17:20:46
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-14 10:54:53
* @LastEditTime: 2025-04-22 13:27:53
* @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.
@@ -110,38 +110,38 @@ public class ConvertUtils {
// }
// agent
if (thread.getAgent() != null) {
UserProtobuf agent = JSON.parseObject(thread.getAgent(), UserProtobuf.class);
UserProtobuf agent = UserProtobuf.fromJson(thread.getAgent()); //JSON.parseObject(thread.getAgent(), UserProtobuf.class);
threadResponse.setAgentProtobuf(agent);
}
if (thread.getUser() != null) {
UserProtobuf user = JSON.parseObject(thread.getUser(), UserProtobuf.class);
UserProtobuf user = UserProtobuf.fromJson(thread.getUser()); //JSON.parseObject(thread.getUser(), UserProtobuf.class);
threadResponse.setUser(user);
}
// robot
if (thread.getRobot() != null) {
UserProtobuf robot = JSON.parseObject(thread.getRobot(), UserProtobuf.class);
UserProtobuf robot = UserProtobuf.fromJson(thread.getRobot()); //JSON.parseObject(thread.getRobot(), UserProtobuf.class);
threadResponse.setRobot(robot);
}
if (thread.getWorkgroup() != null) {
UserProtobuf workgroup = JSON.parseObject(thread.getWorkgroup(), UserProtobuf.class);
UserProtobuf workgroup = UserProtobuf.fromJson(thread.getWorkgroup()); //JSON.parseObject(thread.getWorkgroup(), UserProtobuf.class);
threadResponse.setWorkgroup(workgroup);
}
if (thread.getInvites() != null) {
// 将string[]为UserProtobuf[]并存入threadResponse.setInvites()中
for (String invite : thread.getInvites()) {
UserProtobuf inviteUser = JSON.parseObject(invite, UserProtobuf.class);
UserProtobuf inviteUser = UserProtobuf.fromJson(invite); //JSON.parseObject(invite, UserProtobuf.class);
threadResponse.getInvites().add(inviteUser);
}
}
if (thread.getMonitors() != null) {
for (String monitor : thread.getMonitors()) {
UserProtobuf monitorUser = JSON.parseObject(monitor, UserProtobuf.class);
UserProtobuf monitorUser = UserProtobuf.fromJson(monitor); //JSON.parseObject(monitor, UserProtobuf.class);
threadResponse.getMonitors().add(monitorUser);
}
}
if (thread.getAssistants() != null) {
for (String assistant : thread.getAssistants()) {
UserProtobuf assistantUser = JSON.parseObject(assistant, UserProtobuf.class);
UserProtobuf assistantUser = UserProtobuf.fromJson(assistant); //JSON.parseObject(assistant, UserProtobuf.class);
threadResponse.getAssistants().add(assistantUser);
}
}

View File

@@ -466,11 +466,11 @@
<div class="module-title" lang="en">Modules</div>
<div class="module-title" lang="zh">模块</div>
<div class="submodule" lang="en">core - Core functionality</div>
<div class="submodule" lang="zh">core - 核心功能</div>
<div class="submodule" lang="zh">core - 基本功能</div>
<div class="submodule" lang="en">kbase - Knowledge Base</div>
<div class="submodule" lang="zh">kbase - 知识库</div>
<div class="submodule" lang="en">ai - AI capabilities</div>
<div class="submodule" lang="zh">ai - AI助手</div>
<div class="submodule" lang="zh">ai - AI Agent</div>
<div class="submodule" lang="en">team - Team management</div>
<div class="submodule" lang="zh">team - 企业IM</div>
<div class="submodule" lang="en">service - Service modules</div>