From af75e80563e76572c8b9d99c42e5652096cc0e7d Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Thu, 8 Aug 2024 09:58:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=A4=A7=E6=A8=A1=E5=9E=8B=E7=AE=80?= =?UTF-8?q?=E7=A7=B0=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/configuration/BigModelInvokeUrl.java | 2 +- .../service/impl/HznlmInvokeServiceImpl.java | 24 +++++++++++----------- .../src/main/resources/template/template.yml | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java index 996a155..37703a2 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; */ @Data @Component -@ConfigurationProperties(prefix = "fdp.url") +@ConfigurationProperties(prefix = "gglm.url") public class BigModelInvokeUrl { private String assistantAsk; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java index 2770cec..ccf70fa 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java @@ -40,8 +40,8 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { private final SessionRedisManager sessionRedisManager; private final IAuthClient authClient; - @Value("${fdp.host}") - private String fdpHost; + @Value("${gglm.host}") + private String gglmHost; @Override public void ask(String question, String sessionId, String userId) { @@ -51,13 +51,13 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { params.put("query",question); Map authDataIds = this.getAuthDataIds(userId); params.putAll(authDataIds); - RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantAsk(), params); + RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantAsk(), params); sessionRedisManager.addSessionId(sessionId); } @Override public void ask(QuestionDTO question) { - RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantAsk(), JSON.toJSONString(question)); + RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantAsk(), JSON.toJSONString(question)); sessionRedisManager.addSessionId(question.getChatId()); } @@ -69,14 +69,14 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { params.put("extra",extra); Map authDataIds = this.getAuthDataIds(userId); params.putAll(authDataIds); - log.info("调用大模型接口:{},传参为:{}",fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk(),JSON.toJSONString(params)); - RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk(), params); + log.info("调用大模型接口:{},传参为:{}",gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(),JSON.toJSONString(params)); + RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(), params); sessionRedisManager.addSessionId(sessionId); } @Override public void specialAsk(QuestionDTO question) { - RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk(), JSON.toJSONString(question)); + RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(), JSON.toJSONString(question)); sessionRedisManager.addSessionId(question.getChatId()); } @@ -89,13 +89,13 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { params.put("knowledge", knowledge); Map authDataIds = this.getAuthDataIds(userId); params.putAll(authDataIds); - RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), params); + RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), params); sessionRedisManager.addSessionId(sessionId); } @Override public void knowledgeAsk(QuestionDTO question) { - RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), JSON.toJSONString(question)); + RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), JSON.toJSONString(question)); sessionRedisManager.addSessionId(question.getChatId()); } @@ -111,14 +111,14 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { public void askAbort(String sessionId) { Map params = new HashMap<>(); params.put("chat_id",sessionId); - RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAskAbort(), params); + RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAskAbort(), params); sessionRedisManager.removeSessionId(sessionId); } @Override public List hotQuestions() { try { - return RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getHotQuestion(), null, new TypeReference>(){}); + return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getHotQuestion(), null, new TypeReference>(){}); } catch (Exception e) { log.error("An error occurred",e); @@ -130,7 +130,7 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { public List getAnswerBySessionIds(String sessionIds) { Map params = new HashMap<>(); params.put("chat_ids",Func.toStrList(",",sessionIds).toArray()); - return RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantStatus(), params, new TypeReference>(){}); + return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantStatus(), params, new TypeReference>(){}); } private Map getAuthDataIds(String userId) { diff --git a/hzims-service/hzims-big-model/src/main/resources/template/template.yml b/hzims-service/hzims-big-model/src/main/resources/template/template.yml index 5f1a299..4019e1d 100644 --- a/hzims-service/hzims-big-model/src/main/resources/template/template.yml +++ b/hzims-service/hzims-big-model/src/main/resources/template/template.yml @@ -47,8 +47,8 @@ spring: username: root password: 123 -fdp: - host: http://192.168.60.16:9997 +gglm: + host: http://${gglm.host}:${gglm.port} url: assistantAsk: /qa/assistant_ask assistantStatus: /qa/assistant_status From e229c4de91dc3fb597640b980d9f4c9af32a0847 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Thu, 8 Aug 2024 10:10:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=A4=A7=E6=A8=A1=E5=9E=8B=E7=AE=80?= =?UTF-8?q?=E7=A7=B0=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/configuration/BigModelInvokeApi.java | 33 ++++++++++++++++++++++ .../bigmodel/configuration/BigModelInvokeUrl.java | 33 ---------------------- .../service/impl/HznlmInvokeServiceImpl.java | 32 +++++++++------------ .../src/main/resources/template/template.yml | 22 +++++++-------- 4 files changed, 58 insertions(+), 62 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java delete mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java new file mode 100644 index 0000000..b22db97 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.bigmodel.configuration; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @Author: huangxing + * @Date: 2024/04/28 18:20 + */ +@Data +@Component +@ConfigurationProperties(prefix = "gglm.api") +public class BigModelInvokeApi { + + private String assistantAsk; + + private String assistantSpecialAsk; + + private String assistantStatus; + + private String askAbort; + + private String updateVideo; + + private String updateFault; + + private String updateCanvas; + + private String assistantKnowledgeAsk; + + private String hotQuestion; +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java deleted file mode 100644 index 37703a2..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hnac.hzims.bigmodel.configuration; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * @Author: huangxing - * @Date: 2024/04/28 18:20 - */ -@Data -@Component -@ConfigurationProperties(prefix = "gglm.url") -public class BigModelInvokeUrl { - - private String assistantAsk; - - private String assistantSpecialAsk; - - private String assistantStatus; - - private String askAbort; - - private String updateVideo; - - private String updateFault; - - private String updateCanvas; - - private String assistantKnowledgeAsk; - - private String hotQuestion; -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java index ccf70fa..49dd834 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java @@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.google.common.collect.Lists; import com.hnac.hzims.bigmodel.business.feign.IAuthClient; -import com.hnac.hzims.bigmodel.business.service.AuthenticationService; -import com.hnac.hzims.bigmodel.configuration.BigModelInvokeUrl; +import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi; import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; import com.hnac.hzims.bigmodel.manager.SessionRedisManager; @@ -15,10 +14,7 @@ import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManage import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.system.dto.DeptStationDTO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -36,12 +32,12 @@ import java.util.Map; @Slf4j public class HznlmInvokeServiceImpl implements IHznlmInvokeService { - private final BigModelInvokeUrl bigModelInvokeUrl; + private final BigModelInvokeApi bigModelInvokeApi; private final SessionRedisManager sessionRedisManager; private final IAuthClient authClient; - @Value("${gglm.host}") - private String gglmHost; + @Value("${gglm.url}") + private String gglmUrl; @Override public void ask(String question, String sessionId, String userId) { @@ -51,13 +47,13 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { params.put("query",question); Map authDataIds = this.getAuthDataIds(userId); params.putAll(authDataIds); - RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantAsk(), params); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantAsk(), params); sessionRedisManager.addSessionId(sessionId); } @Override public void ask(QuestionDTO question) { - RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantAsk(), JSON.toJSONString(question)); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantAsk(), JSON.toJSONString(question)); sessionRedisManager.addSessionId(question.getChatId()); } @@ -69,14 +65,14 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { params.put("extra",extra); Map authDataIds = this.getAuthDataIds(userId); params.putAll(authDataIds); - log.info("调用大模型接口:{},传参为:{}",gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(),JSON.toJSONString(params)); - RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(), params); + log.info("调用大模型接口:{},传参为:{}",gglmUrl + bigModelInvokeApi.getAssistantSpecialAsk(),JSON.toJSONString(params)); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantSpecialAsk(), params); sessionRedisManager.addSessionId(sessionId); } @Override public void specialAsk(QuestionDTO question) { - RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(), JSON.toJSONString(question)); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantSpecialAsk(), JSON.toJSONString(question)); sessionRedisManager.addSessionId(question.getChatId()); } @@ -89,13 +85,13 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { params.put("knowledge", knowledge); Map authDataIds = this.getAuthDataIds(userId); params.putAll(authDataIds); - RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), params); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantKnowledgeAsk(), params); sessionRedisManager.addSessionId(sessionId); } @Override public void knowledgeAsk(QuestionDTO question) { - RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), JSON.toJSONString(question)); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantKnowledgeAsk(), JSON.toJSONString(question)); sessionRedisManager.addSessionId(question.getChatId()); } @@ -111,14 +107,14 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { public void askAbort(String sessionId) { Map params = new HashMap<>(); params.put("chat_id",sessionId); - RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAskAbort(), params); + RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAskAbort(), params); sessionRedisManager.removeSessionId(sessionId); } @Override public List hotQuestions() { try { - return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getHotQuestion(), null, new TypeReference>(){}); + return RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getHotQuestion(), null, new TypeReference>(){}); } catch (Exception e) { log.error("An error occurred",e); @@ -130,7 +126,7 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService { public List getAnswerBySessionIds(String sessionIds) { Map params = new HashMap<>(); params.put("chat_ids",Func.toStrList(",",sessionIds).toArray()); - return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantStatus(), params, new TypeReference>(){}); + return RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantStatus(), params, new TypeReference>(){}); } private Map getAuthDataIds(String userId) { diff --git a/hzims-service/hzims-big-model/src/main/resources/template/template.yml b/hzims-service/hzims-big-model/src/main/resources/template/template.yml index 4019e1d..f411a42 100644 --- a/hzims-service/hzims-big-model/src/main/resources/template/template.yml +++ b/hzims-service/hzims-big-model/src/main/resources/template/template.yml @@ -48,17 +48,17 @@ spring: password: 123 gglm: - host: http://${gglm.host}:${gglm.port} - url: - assistantAsk: /qa/assistant_ask - assistantStatus: /qa/assistant_status - askAbort: /qa/ask_abort - updateVideo: /kn/update_video - updateCanvas: /kn/update_canvas - updateFault: /kn/update_fault - assistantSpecialAsk: /qa/assistant_special_ask - assistantKnowledgeAsk: /qa/assistant_knowledge_ask - hotQuestion: /qa/question_recommand + url: "http://${gglm.host}:${gglm.port}" + api: + assistantAsk: "/qa/assistant_ask" + assistantStatus: "/qa/assistant_status" + askAbort: "/qa/ask_abort" + updateVideo: "/kn/update_video" + updateCanvas: "/kn/update_canvas" + updateFault: "/kn/update_fault" + assistantSpecialAsk: "/qa/assistant_special_ask" + assistantKnowledgeAsk: "/qa/assistant_knowledge_ask" + hotQuestion: "/qa/question_recommand" xxl: job: