Browse Source

fix: 大模型简称重命名

zhongwei
haungxing 4 months ago
parent
commit
af75e80563
  1. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java
  2. 24
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/HznlmInvokeServiceImpl.java
  3. 4
      hzims-service/hzims-big-model/src/main/resources/template/template.yml

2
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 @Data
@Component @Component
@ConfigurationProperties(prefix = "fdp.url") @ConfigurationProperties(prefix = "gglm.url")
public class BigModelInvokeUrl { public class BigModelInvokeUrl {
private String assistantAsk; private String assistantAsk;

24
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 SessionRedisManager sessionRedisManager;
private final IAuthClient authClient; private final IAuthClient authClient;
@Value("${fdp.host}") @Value("${gglm.host}")
private String fdpHost; private String gglmHost;
@Override @Override
public void ask(String question, String sessionId, String userId) { public void ask(String question, String sessionId, String userId) {
@ -51,13 +51,13 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
params.put("query",question); params.put("query",question);
Map<String, String[]> authDataIds = this.getAuthDataIds(userId); Map<String, String[]> authDataIds = this.getAuthDataIds(userId);
params.putAll(authDataIds); params.putAll(authDataIds);
RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantAsk(), params); RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantAsk(), params);
sessionRedisManager.addSessionId(sessionId); sessionRedisManager.addSessionId(sessionId);
} }
@Override @Override
public void ask(QuestionDTO question) { 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()); sessionRedisManager.addSessionId(question.getChatId());
} }
@ -69,14 +69,14 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
params.put("extra",extra); params.put("extra",extra);
Map<String, String[]> authDataIds = this.getAuthDataIds(userId); Map<String, String[]> authDataIds = this.getAuthDataIds(userId);
params.putAll(authDataIds); params.putAll(authDataIds);
log.info("调用大模型接口:{},传参为:{}",fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk(),JSON.toJSONString(params)); log.info("调用大模型接口:{},传参为:{}",gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(),JSON.toJSONString(params));
RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk(), params); RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(), params);
sessionRedisManager.addSessionId(sessionId); sessionRedisManager.addSessionId(sessionId);
} }
@Override @Override
public void specialAsk(QuestionDTO question) { 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()); sessionRedisManager.addSessionId(question.getChatId());
} }
@ -89,13 +89,13 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
params.put("knowledge", knowledge); params.put("knowledge", knowledge);
Map<String, String[]> authDataIds = this.getAuthDataIds(userId); Map<String, String[]> authDataIds = this.getAuthDataIds(userId);
params.putAll(authDataIds); params.putAll(authDataIds);
RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), params); RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), params);
sessionRedisManager.addSessionId(sessionId); sessionRedisManager.addSessionId(sessionId);
} }
@Override @Override
public void knowledgeAsk(QuestionDTO question) { 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()); sessionRedisManager.addSessionId(question.getChatId());
} }
@ -111,14 +111,14 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
public void askAbort(String sessionId) { public void askAbort(String sessionId) {
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
params.put("chat_id",sessionId); params.put("chat_id",sessionId);
RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAskAbort(), params); RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAskAbort(), params);
sessionRedisManager.removeSessionId(sessionId); sessionRedisManager.removeSessionId(sessionId);
} }
@Override @Override
public List hotQuestions() { public List hotQuestions() {
try { try {
return RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getHotQuestion(), null, new TypeReference<List<String>>(){}); return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getHotQuestion(), null, new TypeReference<List<String>>(){});
} }
catch (Exception e) { catch (Exception e) {
log.error("An error occurred",e); log.error("An error occurred",e);
@ -130,7 +130,7 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
public List<AnswerVO> getAnswerBySessionIds(String sessionIds) { public List<AnswerVO> getAnswerBySessionIds(String sessionIds) {
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
params.put("chat_ids",Func.toStrList(",",sessionIds).toArray()); params.put("chat_ids",Func.toStrList(",",sessionIds).toArray());
return RequestClientUtil.postCall(fdpHost + bigModelInvokeUrl.getAssistantStatus(), params, new TypeReference<List<AnswerVO>>(){}); return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantStatus(), params, new TypeReference<List<AnswerVO>>(){});
} }
private Map<String,String[]> getAuthDataIds(String userId) { private Map<String,String[]> getAuthDataIds(String userId) {

4
hzims-service/hzims-big-model/src/main/resources/template/template.yml

@ -47,8 +47,8 @@ spring:
username: root username: root
password: 123 password: 123
fdp: gglm:
host: http://192.168.60.16:9997 host: http://${gglm.host}:${gglm.port}
url: url:
assistantAsk: /qa/assistant_ask assistantAsk: /qa/assistant_ask
assistantStatus: /qa/assistant_status assistantStatus: /qa/assistant_status

Loading…
Cancel
Save