This commit is contained in:
2025-11-28 15:16:47 +08:00
parent a6e7c82fe5
commit 96e9419496
2 changed files with 22 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ import org.xyzh.ai.client.DifyApiClient;
import org.xyzh.ai.client.callback.StreamCallback;
import org.xyzh.ai.client.dto.ChatRequest;
import org.xyzh.ai.client.dto.ChatResponse;
import org.xyzh.ai.config.DifyConfig;
import org.xyzh.ai.exception.DifyException;
import org.xyzh.ai.mapper.AiAgentConfigMapper;
import org.xyzh.ai.mapper.AiConversationMapper;
@@ -62,6 +63,9 @@ public class AiChatServiceImpl implements AiChatService {
@Autowired
private DifyApiClient difyApiClient;
@Autowired
private DifyConfig difyConfig;
@Autowired
private AiKnowledgeRedisService knowledgeRedisService;
@@ -278,6 +282,7 @@ public class AiChatServiceImpl implements AiChatService {
Map<String, Object> inputs = new HashMap<>();
inputs.put("connectInternet", agent.getConnectInternet());
inputs.put("datasets", JSON.toJSONString(knowledgeIds));
inputs.put("dataset_apikey", difyConfig.getKnowledgeApiKey());
chatRequest.setInputs(inputs);
chatRequest.setFiles(filesData);
// 6. 调用Dify流式对话