修改获取历史记录
This commit is contained in:
@@ -3,6 +3,7 @@ package com.peanut.common.utils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.peanut.modules.common.entity.AiChatContent;
|
||||
import com.peanut.modules.common.service.AiChatContentService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.Consts;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
@@ -63,7 +64,18 @@ public class RagFlowApiUtil {
|
||||
//聊天助手下对话列表
|
||||
public List<Map<String,Object>> getChats(Map<String,Object> params) throws Exception{
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
String chatId = params.get("chatId").toString();
|
||||
String id = params.get("chatId").toString();
|
||||
List<String> chatIds = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(id)){
|
||||
List<Map<String,Object>> assistants = getChatAssistants("");
|
||||
for (Map<String, Object> map:assistants) {
|
||||
chatIds.add(map.get("id").toString());
|
||||
}
|
||||
}else {
|
||||
chatIds.add(id);
|
||||
}
|
||||
List<Map<String,Object>> list = new ArrayList();
|
||||
for (String chatId : chatIds){
|
||||
String page = params.get("page").toString();
|
||||
String pageSize = params.get("pageSize").toString();
|
||||
String sessionId = params.get("sessionId").toString();
|
||||
@@ -79,7 +91,6 @@ public class RagFlowApiUtil {
|
||||
HttpEntity responseEntity = response.getEntity();
|
||||
String responseString = EntityUtils.toString(responseEntity, Consts.UTF_8);
|
||||
JSONObject jsonObject = JSONObject.parseObject(responseString);
|
||||
List<Map<String,Object>> list = new ArrayList();
|
||||
if ("0".equals(jsonObject.get("code").toString())){
|
||||
List l = jsonObject.getJSONArray("data");
|
||||
for (Object o : l) {
|
||||
@@ -91,6 +102,7 @@ public class RagFlowApiUtil {
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user