Commit a0d72c86 authored by shiyu's avatar shiyu

ai对话接口修改

parent b35cd810
...@@ -25,6 +25,7 @@ public class ChatApi { ...@@ -25,6 +25,7 @@ public class ChatApi {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("query", question); map.put("query", question);
map.put("history", null); map.put("history", null);
map.put("model_name", "chatglm2-6b");
okHttpUtil.addParams(map); okHttpUtil.addParams(map);
okHttpUtil.post(true); okHttpUtil.post(true);
String responseStr = okHttpUtil.async(); String responseStr = okHttpUtil.async();
......
...@@ -124,8 +124,8 @@ public class ImServiceImpl implements IMService { ...@@ -124,8 +124,8 @@ public class ImServiceImpl implements IMService {
logger.info("=========== userid:{}, 提问ai的消息发送成功 ==========", dto.getFromAccount()); logger.info("=========== userid:{}, 提问ai的消息发送成功 ==========", dto.getFromAccount());
if (dto.getMsgType() == IMEnum.MsgTypeEnum.TIMTextElem.getCode()) { if (dto.getMsgType() == IMEnum.MsgTypeEnum.TIMTextElem.getCode()) {
String question = (String) dto.getMsgContent(); String question = (String) dto.getMsgContent();
question = question + ",请回答钱币相关的内容";
String answer = chatApi.chatWithModel(question); String answer = chatApi.chatWithModel(question);
// String answer = JsonUtils.getValueByPath(response, "response");
//将回答也发送给IM //将回答也发送给IM
SendChatMsgRequestDto answerDto = new SendChatMsgRequestDto(); SendChatMsgRequestDto answerDto = new SendChatMsgRequestDto();
......
...@@ -53,7 +53,7 @@ public class ChatApiTest { ...@@ -53,7 +53,7 @@ public class ChatApiTest {
@Test @Test
public void chatWithModel() { public void chatWithModel() {
String question = "什么是站洋"; String question = "什么是站洋,请回答钱币相关的内容";
chatApi.chatWithModel(question); chatApi.chatWithModel(question);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment