|
|
@ -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) { |
|
|
|