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
@Component
@ConfigurationProperties(prefix = "gglm.url")
public class BigModelInvokeUrl {
@ConfigurationProperties(prefix = "gglm.api")
public class BigModelInvokeApi {
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.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<String, String[]> 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<String, String[]> 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<String, String[]> 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<String,Object> 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<List<String>>(){});
return RequestClientUtil.postCall(gglmUrl + bigModelInvokeApi.getHotQuestion(), null, new TypeReference<List<String>>(){});
}
catch (Exception e) {
log.error("An error occurred",e);
@ -130,7 +126,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(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) {

22
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:

Loading…
Cancel
Save