From f75727b4bdb71baf40685f1f09e4b50bc4ab8d49 Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Sun, 1 Dec 2024 20:50:30 +0800 Subject: [PATCH 1/7] Make the model modifiable --- .../controller/LLMConfigController.java | 6 +++++ .../server/service/LLMConfigService.java | 2 ++ .../service/impl/LLMConfigServiceImpl.java | 24 +++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LLMConfigController.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LLMConfigController.java index 51f24a00..2b27cbb6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LLMConfigController.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/controller/LLMConfigController.java @@ -56,6 +56,12 @@ public ResponseEntity> platforms() { return ResponseEntity.success(llmConfigService.platforms()); } + @Operation(summary = "get platform", description = "Get platform") + @GetMapping("/platforms/{id}") + public ResponseEntity getPlatform(@PathVariable Long id) { + return ResponseEntity.success(llmConfigService.getPlatform(id)); + } + @Operation(summary = "platform credentials", description = "Get platform auth credentials") @GetMapping("/platforms/{platformId}/auth-credentials") public ResponseEntity> platformsAuthCredential(@PathVariable Long platformId) { diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/LLMConfigService.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/LLMConfigService.java index c5400002..223b5723 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/LLMConfigService.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/LLMConfigService.java @@ -46,4 +46,6 @@ public interface LLMConfigService { boolean deactivateAuthorizedPlatform(Long authId); AuthPlatformVO getAuthorizedPlatform(Long authId); + + PlatformVO getPlatform(Long id); } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LLMConfigServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LLMConfigServiceImpl.java index f5cf12c9..e26dfc71 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LLMConfigServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/LLMConfigServiceImpl.java @@ -276,6 +276,21 @@ public AuthPlatformVO updateAuthorizedPlatform(AuthPlatformDTO authPlatformDTO) throw new ApiException(ApiExceptionEnum.PLATFORM_NOT_AUTHORIZED); } + String newModel = authPlatformDTO.getModel(); + if (newModel != null) { + if (AuthPlatformStatus.isActive(authPlatformPO.getStatus())) { + throw new ApiException(ApiExceptionEnum.PLATFORM_IS_ACTIVE); + } + + authPlatformPO.setModel(newModel); + + if (authPlatformDTO.getTestPassed()) { + authPlatformPO.setStatus(AuthPlatformStatus.AVAILABLE.getCode()); + } else { + authPlatformPO.setStatus(AuthPlatformStatus.UNAVAILABLE.getCode()); + } + } + authPlatformPO.setName(authPlatformDTO.getName()); authPlatformPO.setDesc(authPlatformDTO.getDesc()); @@ -328,4 +343,13 @@ public AuthPlatformVO getAuthorizedPlatform(Long authId) { return AuthPlatformConverter.INSTANCE.fromPO2VO( authPlatformPO, platformDao.findById(authPlatformPO.getPlatformId())); } + + @Override + public PlatformVO getPlatform(Long id) { + PlatformPO platformPO = platformDao.findById(id); + if (platformPO == null) { + throw new ApiException(ApiExceptionEnum.PLATFORM_NOT_FOUND); + } + return PlatformConverter.INSTANCE.fromPO2VO(platformPO); + } } From 9a19fd90e5c78aafc5469748e1ebb6debf76990f Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Sun, 1 Dec 2024 20:50:41 +0800 Subject: [PATCH 2/7] add platform desc --- .../org/apache/bigtop/manager/dao/po/PlatformPO.java | 3 +++ .../bigtop/manager/server/model/vo/PlatformVO.java | 2 ++ .../src/main/resources/ddl/MySQL-DDL-CREATE.sql | 9 +++++++++ .../src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql | 1 + 4 files changed, 15 insertions(+) diff --git a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/PlatformPO.java b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/PlatformPO.java index df68a303..99c1071f 100644 --- a/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/PlatformPO.java +++ b/bigtop-manager-dao/src/main/java/org/apache/bigtop/manager/dao/po/PlatformPO.java @@ -43,4 +43,7 @@ public class PlatformPO extends BasePO implements Serializable { @Column(name = "support_models", length = 255) private String supportModels; + + @Column(name = "desc") + private String desc; } diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java index 5e127229..574ed309 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java @@ -28,6 +28,8 @@ public class PlatformVO { private String supportModels; + private String desc; + public PlatformVO(Long id, String name, String models) { this.id = id; this.name = name; diff --git a/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql b/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql index 761abea4..ae22d0a1 100644 --- a/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql +++ b/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql @@ -270,6 +270,7 @@ CREATE TABLE `llm_platform` `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `credential` TEXT DEFAULT NULL, + `desc` TEXT DEFAULT NULL, `support_models` VARCHAR(255) DEFAULT NULL, `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP, `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, @@ -346,3 +347,11 @@ VALUES ('{"apiKey": "API Key"}', 'OpenAI', 'gpt-3.5-turbo,gpt-4,gpt-4o,gpt-3.5-turbo-16k,gpt-4-turbo-preview,gpt-4-32k,gpt-4o-mini'), ('{"apiKey": "API Key"}', 'DashScope', 'qwen-1.8b-chat,qwen-max,qwen-plus,qwen-turbo'), ('{"apiKey": "API Key", "secretKey": "Secret Key"}', 'QianFan','Yi-34B-Chat,ERNIE-4.0-8K,ERNIE-3.5-128K,ERNIE-Speed-8K,Llama-2-7B-Chat,Fuyu-8B'); + +UPDATE `llm_platform` +SET `desc` = 'Get your API Key in https://platform.openai.com/api-keys' +WHERE `name` = 'OpenAI'; + +UPDATE `llm_platform` +SET `desc` = 'Get your API Key in https://platform.openai.com/api-keys' +WHERE `name` = 'DashScope'; \ No newline at end of file diff --git a/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql b/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql index 060893b9..ef691cff 100644 --- a/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql +++ b/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql @@ -280,6 +280,7 @@ CREATE TABLE llm_platform id BIGINT CHECK (id > 0) NOT NULL GENERATED ALWAYS AS IDENTITY, name VARCHAR(255) NOT NULL, credential TEXT DEFAULT NULL, + "desc" TEXT DEFAULT NULL, support_models VARCHAR(255) DEFAULT NULL, create_time TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP /* ON UPDATE CURRENT_TIMESTAMP */, From 47c68b824f2f08582bd27ad95615c19e99bbf7df Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Sun, 1 Dec 2024 21:28:50 +0800 Subject: [PATCH 3/7] add desc --- .../bigtop/manager/server/model/vo/PlatformVO.java | 6 ------ .../src/main/resources/ddl/MySQL-DDL-CREATE.sql | 8 ++++++-- .../src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql | 12 ++++++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java index 574ed309..1e6c1c1e 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/PlatformVO.java @@ -29,10 +29,4 @@ public class PlatformVO { private String supportModels; private String desc; - - public PlatformVO(Long id, String name, String models) { - this.id = id; - this.name = name; - this.supportModels = models; - } } diff --git a/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql b/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql index ae22d0a1..79ea4e51 100644 --- a/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql +++ b/bigtop-manager-server/src/main/resources/ddl/MySQL-DDL-CREATE.sql @@ -353,5 +353,9 @@ SET `desc` = 'Get your API Key in https://platform.openai.com/api-keys' WHERE `name` = 'OpenAI'; UPDATE `llm_platform` -SET `desc` = 'Get your API Key in https://platform.openai.com/api-keys' -WHERE `name` = 'DashScope'; \ No newline at end of file +SET `desc` = 'Get your API Key in https://bailian.console.aliyun.com/?apiKey=1#/api-key' +WHERE `name` = 'DashScope'; + +UPDATE `llm_platform` +SET `desc` = 'Get API Key and Secret Key in https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application/v1' +WHERE `name` = 'QianFan'; \ No newline at end of file diff --git a/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql b/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql index ef691cff..e2b5ca39 100644 --- a/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql +++ b/bigtop-manager-server/src/main/resources/ddl/PostgreSQL-DDL-CREATE.sql @@ -358,3 +358,15 @@ VALUES ('{"apiKey": "API Key"}','OpenAI','gpt-3.5-turbo,gpt-4,gpt-4o,gpt-3.5-turbo-16k,gpt-4-turbo-preview,gpt-4-32k,gpt-4o-mini'), ('{"apiKey": "API Key"}','DashScope','qwen-1.8b-chat,qwen-max,qwen-plus,qwen-turbo'), ('{"apiKey": "API Key", "secretKey": "Secret Key"}','QianFan','Yi-34B-Chat,ERNIE-4.0-8K,ERNIE-3.5-128K,ERNIE-Speed-8K,Llama-2-7B-Chat,Fuyu-8B'); + +UPDATE llm_platform +SET "desc" = 'Get your API Key in https://platform.openai.com/api-keys' +WHERE "name" = 'OpenAI'; + +UPDATE llm_platform +SET "desc" = 'Get your API Key in https://bailian.console.aliyun.com/?apiKey=1#/api-key' +WHERE "name" = 'DashScope'; + +UPDATE llm_platform +SET "desc" = 'Get API Key and Secret Key in https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application/v1' +WHERE "name" = 'QianFan'; From af4e15d245fd8b67074f00905fc9e7eff93b10ee Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Tue, 3 Dec 2024 14:20:23 +0800 Subject: [PATCH 4/7] add talkvo --- .../manager/server/model/vo/TalkVO.java | 30 +++++++++++++++++ .../service/impl/ChatbotServiceImpl.java | 32 +++++++++++++++++-- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java new file mode 100644 index 00000000..f0a6f167 --- /dev/null +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.bigtop.manager.server.model.vo; + +import lombok.Data; + +@Data +public class TalkVO { + private String content; + + private String finishReason; + + public TalkVO() {} +} diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java index 6bc70776..644565d6 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java @@ -44,6 +44,7 @@ import org.apache.bigtop.manager.server.model.dto.ChatThreadDTO; import org.apache.bigtop.manager.server.model.vo.ChatMessageVO; import org.apache.bigtop.manager.server.model.vo.ChatThreadVO; +import org.apache.bigtop.manager.server.model.vo.TalkVO; import org.apache.bigtop.manager.server.service.ChatbotService; import org.springframework.context.i18n.LocaleContextHolder; @@ -207,13 +208,38 @@ public SseEmitter talk(Long threadId, String message) { stringFlux.subscribe( s -> { try { - emitter.send(s); + TalkVO talkVO = new TalkVO(); + talkVO.setContent(s); + talkVO.setFinishReason(null); + emitter.send(talkVO); } catch (Exception e) { emitter.completeWithError(e); } }, - Throwable::printStackTrace, - emitter::complete); + throwable -> { + // 流处理过程中发生错误,返回错误信息 + try { + TalkVO errorVO = new TalkVO(); + errorVO.setContent(null); + errorVO.setFinishReason("Error: " + throwable.getMessage()); + emitter.send(errorVO); + } catch (Exception sendException) { + sendException.printStackTrace(); + } + emitter.completeWithError(throwable); + }, + () -> { + // 流完成时发送最终完成标志 + try { + TalkVO finishVO = new TalkVO(); + finishVO.setContent(null); + finishVO.setFinishReason("completed"); + emitter.send(finishVO); + } catch (Exception e) { + e.printStackTrace(); + } + emitter.complete(); + }); emitter.onTimeout(emitter::complete); return emitter; From 8e1018df50fd0ab840129effec46b956f62d1110 Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Tue, 3 Dec 2024 14:24:19 +0800 Subject: [PATCH 5/7] remove cn --- .../bigtop/manager/server/service/impl/ChatbotServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java index 644565d6..777ab200 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java @@ -217,7 +217,6 @@ public SseEmitter talk(Long threadId, String message) { } }, throwable -> { - // 流处理过程中发生错误,返回错误信息 try { TalkVO errorVO = new TalkVO(); errorVO.setContent(null); @@ -229,7 +228,6 @@ public SseEmitter talk(Long threadId, String message) { emitter.completeWithError(throwable); }, () -> { - // 流完成时发送最终完成标志 try { TalkVO finishVO = new TalkVO(); finishVO.setContent(null); From d66fe9b00778099a125c554d65065aefc7d4f4b5 Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Tue, 3 Dec 2024 14:48:51 +0800 Subject: [PATCH 6/7] remove talkvo --- .../java/org/apache/bigtop/manager/server/model/vo/TalkVO.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java index f0a6f167..f52de979 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/TalkVO.java @@ -25,6 +25,4 @@ public class TalkVO { private String content; private String finishReason; - - public TalkVO() {} } From 7cf44f236e049a6914febac3b42c0feee8b2be97 Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Tue, 3 Dec 2024 15:21:25 +0800 Subject: [PATCH 7/7] add detail --- .../model/converter/ChatThreadConverter.java | 8 +++++++- .../manager/server/model/vo/ChatThreadVO.java | 4 ++++ .../server/service/impl/ChatbotServiceImpl.java | 15 +++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/converter/ChatThreadConverter.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/converter/ChatThreadConverter.java index 59aa3fae..b28b3700 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/converter/ChatThreadConverter.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/converter/ChatThreadConverter.java @@ -18,12 +18,15 @@ */ package org.apache.bigtop.manager.server.model.converter; +import org.apache.bigtop.manager.dao.po.AuthPlatformPO; import org.apache.bigtop.manager.dao.po.ChatThreadPO; +import org.apache.bigtop.manager.dao.po.PlatformPO; import org.apache.bigtop.manager.server.config.MapStructSharedConfig; import org.apache.bigtop.manager.server.model.dto.ChatThreadDTO; import org.apache.bigtop.manager.server.model.req.ChatbotThreadReq; import org.apache.bigtop.manager.server.model.vo.ChatThreadVO; +import org.mapstruct.Context; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; @@ -35,7 +38,10 @@ public interface ChatThreadConverter { ChatThreadConverter INSTANCE = Mappers.getMapper(ChatThreadConverter.class); @Mapping(source = "id", target = "threadId") - ChatThreadVO fromPO2VO(ChatThreadPO platformAuthorizedPO); + @Mapping(target = "model", expression = "java(authPlatformPO.getModel())") + @Mapping(target = "platformName", expression = "java(platformPO.getName())") + ChatThreadVO fromPO2VO( + ChatThreadPO platformAuthorizedPO, @Context AuthPlatformPO authPlatformPO, @Context PlatformPO platformPO); ChatThreadPO fromDTO2PO(ChatThreadDTO chatThreadDTO); diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ChatThreadVO.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ChatThreadVO.java index ce49396b..846bbc39 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ChatThreadVO.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/model/vo/ChatThreadVO.java @@ -30,6 +30,10 @@ public class ChatThreadVO { private String name; + private String platformName; + + private String model; + private String createTime; private String updateTime; diff --git a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java index 777ab200..2ab8acde 100644 --- a/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java +++ b/bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/service/impl/ChatbotServiceImpl.java @@ -140,7 +140,7 @@ public ChatThreadVO createChatThread(ChatThreadDTO chatThreadDTO) { ChatThreadPO chatThreadPO = ChatThreadConverter.INSTANCE.fromDTO2PO(chatThreadDTO); chatThreadPO.setUserId(userId); chatThreadDao.save(chatThreadPO); - return ChatThreadConverter.INSTANCE.fromPO2VO(chatThreadPO); + return ChatThreadConverter.INSTANCE.fromPO2VO(chatThreadPO, authPlatformPO, platformPO); } @Override @@ -165,6 +165,8 @@ public List getAllChatThreads() { if (authPlatformPO == null) { throw new ApiException(ApiExceptionEnum.NO_PLATFORM_IN_USE); } + PlatformPO platformPO = platformDao.findById(authPlatformPO.getPlatformId()); + Long authId = authPlatformPO.getId(); Long userId = SessionUserHolder.getUserId(); List chatThreadPOS = chatThreadDao.findAllByAuthIdAndUserId(authId, userId); @@ -173,7 +175,8 @@ public List getAllChatThreads() { if (chatThreadPO.getIsDeleted()) { continue; } - ChatThreadVO chatThreadVO = ChatThreadConverter.INSTANCE.fromPO2VO(chatThreadPO); + ChatThreadVO chatThreadVO = + ChatThreadConverter.INSTANCE.fromPO2VO(chatThreadPO, authPlatformPO, platformPO); chatThreads.add(chatThreadVO); } return chatThreads; @@ -282,7 +285,9 @@ public ChatThreadVO updateChatThread(ChatThreadDTO chatThreadDTO) { chatThreadPO.setName(chatThreadDTO.getName()); chatThreadDao.partialUpdateById(chatThreadPO); - return ChatThreadConverter.INSTANCE.fromPO2VO(chatThreadPO); + AuthPlatformPO authPlatformPO = authPlatformDao.findById(chatThreadPO.getAuthId()); + return ChatThreadConverter.INSTANCE.fromPO2VO( + chatThreadPO, authPlatformPO, platformDao.findById(authPlatformPO.getPlatformId())); } @Override @@ -295,6 +300,8 @@ public ChatThreadVO getChatThread(Long threadId) { if (!chatThreadPO.getUserId().equals(userId)) { throw new ApiException(ApiExceptionEnum.PERMISSION_DENIED); } - return ChatThreadConverter.INSTANCE.fromPO2VO(chatThreadPO); + AuthPlatformPO authPlatformPO = authPlatformDao.findById(chatThreadPO.getAuthId()); + return ChatThreadConverter.INSTANCE.fromPO2VO( + chatThreadPO, authPlatformPO, platformDao.findById(authPlatformPO.getPlatformId())); } }