Browse Source

fix: 大模型简称重命名

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

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java → hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeApi.java

@ -10,8 +10,8 @@ import org.springframework.stereotype.Component;
*/ */
@Data @Data
@Component @Component
@ConfigurationProperties(prefix = "gglm.url") @ConfigurationProperties(prefix = "gglm.api")
public class BigModelInvokeUrl { public class BigModelInvokeApi {
private String assistantAsk; private String assistantAsk;

32
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.alibaba.fastjson.TypeReference;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.business.feign.IAuthClient; import com.hnac.hzims.bigmodel.business.feign.IAuthClient;
import com.hnac.hzims.bigmodel.business.service.AuthenticationService; import com.hnac.hzims.bigmodel.configuration.BigModelInvokeApi;
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeUrl;
import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService; import com.hnac.hzims.bigmodel.interactive.service.IHznlmInvokeService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzims.bigmodel.manager.SessionRedisManager; import com.hnac.hzims.bigmodel.manager.SessionRedisManager;
@ -15,10 +14,7 @@ import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManage
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; 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.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.dto.DeptStationDTO;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,12 +32,12 @@ import java.util.Map;
@Slf4j @Slf4j
public class HznlmInvokeServiceImpl implements IHznlmInvokeService { public class HznlmInvokeServiceImpl implements IHznlmInvokeService {
private final BigModelInvokeUrl bigModelInvokeUrl; private final BigModelInvokeApi bigModelInvokeApi;
private final SessionRedisManager sessionRedisManager; private final SessionRedisManager sessionRedisManager;
private final IAuthClient authClient; private final IAuthClient authClient;
@Value("${gglm.host}") @Value("${gglm.url}")
private String gglmHost; private String gglmUrl;
@Override @Override
public void ask(String question, String sessionId, String userId) { public void ask(String question, String sessionId, String userId) {
@ -51,13 +47,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(gglmHost + bigModelInvokeUrl.getAssistantAsk(), params); RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantAsk(), params);
sessionRedisManager.addSessionId(sessionId); sessionRedisManager.addSessionId(sessionId);
} }
@Override @Override
public void ask(QuestionDTO question) { 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()); sessionRedisManager.addSessionId(question.getChatId());
} }
@ -69,14 +65,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("调用大模型接口:{},传参为:{}",gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(),JSON.toJSONString(params)); log.info("调用大模型接口:{},传参为:{}",gglmUrl + bigModelInvokeApi.getAssistantSpecialAsk(),JSON.toJSONString(params));
RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getAssistantSpecialAsk(), params); RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantSpecialAsk(), params);
sessionRedisManager.addSessionId(sessionId); sessionRedisManager.addSessionId(sessionId);
} }
@Override @Override
public void specialAsk(QuestionDTO question) { 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()); sessionRedisManager.addSessionId(question.getChatId());
} }
@ -89,13 +85,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(gglmHost + bigModelInvokeUrl.getAssistantKnowledgeAsk(), params); RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantKnowledgeAsk(), params);
sessionRedisManager.addSessionId(sessionId); sessionRedisManager.addSessionId(sessionId);
} }
@Override @Override
public void knowledgeAsk(QuestionDTO question) { 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()); sessionRedisManager.addSessionId(question.getChatId());
} }
@ -111,14 +107,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(gglmHost + bigModelInvokeUrl.getAskAbort(), params); RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAskAbort(), params);
sessionRedisManager.removeSessionId(sessionId); sessionRedisManager.removeSessionId(sessionId);
} }
@Override @Override
public List hotQuestions() { public List hotQuestions() {
try { try {
return RequestClientUtil.postCall(gglmHost + bigModelInvokeUrl.getHotQuestion(), null, new TypeReference<List<String>>(){}); return RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.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 +126,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(gglmHost + bigModelInvokeUrl.getAssistantStatus(), params, new TypeReference<List<AnswerVO>>(){}); return RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getAssistantStatus(), params, new TypeReference<List<AnswerVO>>(){});
} }
private Map<String,String[]> getAuthDataIds(String userId) { private Map<String,String[]> getAuthDataIds(String userId) {

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

@ -48,17 +48,17 @@ spring:
password: 123 password: 123
gglm: gglm:
host: http://${gglm.host}:${gglm.port} url: "http://${gglm.host}:${gglm.port}"
url: api:
assistantAsk: /qa/assistant_ask assistantAsk: "/qa/assistant_ask"
assistantStatus: /qa/assistant_status assistantStatus: "/qa/assistant_status"
askAbort: /qa/ask_abort askAbort: "/qa/ask_abort"
updateVideo: /kn/update_video updateVideo: "/kn/update_video"
updateCanvas: /kn/update_canvas updateCanvas: "/kn/update_canvas"
updateFault: /kn/update_fault updateFault: "/kn/update_fault"
assistantSpecialAsk: /qa/assistant_special_ask assistantSpecialAsk: "/qa/assistant_special_ask"
assistantKnowledgeAsk: /qa/assistant_knowledge_ask assistantKnowledgeAsk: "/qa/assistant_knowledge_ask"
hotQuestion: /qa/question_recommand hotQuestion: "/qa/question_recommand"
xxl: xxl:
job: job:

Loading…
Cancel
Save