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
@Component
@ConfigurationProperties(prefix = "fdp.url")
@ConfigurationProperties(prefix = "gglm.url")
public class BigModelInvokeUrl {
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 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<String, String[]> 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<String, String[]> 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<String, String[]> 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<String,Object> 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<List<String>>(){});
return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getHotQuestion(), null, new TypeReference<List<String>>(){});
}
catch (Exception e) {
log.error("An error occurred",e);
@ -130,7 +130,7 @@ public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
public List<AnswerVO> getAnswerBySessionIds(String sessionIds) {
Map<String,Object> params = new HashMap<>();
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) {

4
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

Loading…
Cancel
Save