18586361686
2025-04-21 b54e4a3c76789d12c6165d3a568fdc5d251e8639
fix: bot can't normal chat
2个文件已修改
15 ■■■■■ 已修改文件
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiBotController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/base/AiBotApiKeyBase.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiBotController.java
@@ -231,20 +231,23 @@
                .select("apiKey")
                .from("tb_ai_bot_api_key")
                .where("apikey = ? ", apiKey);
        long count =  aiBotApiKeyMapper.selectCountByQuery(queryWrapper);
        if (count <= 0){
        AiBotApiKey aiBotApiKey =  aiBotApiKeyMapper.selectOneByQuery(queryWrapper);
        if (aiBotApiKey == null ){
            return createResponse(stream, JSON.toJSONString(errorRespnseMsg(1,"该apiKey不存在")));
        }
        if (aiBotApiKey.getStatus() == 0 ){
            return createResponse(stream, JSON.toJSONString(errorRespnseMsg(2,"该apiKey未启用")));
        }
        AiBot aiBot = service.getById(botId);
        if (aiBot == null) {
            return createResponse(stream, JSON.toJSONString(errorRespnseMsg(2,"机器人不存在")));
            return createResponse(stream, JSON.toJSONString(errorRespnseMsg(3,"机器人不存在")));
        }
        Map<String, Object> llmOptions = aiBot.getLlmOptions();
        AiLlm aiLlm = aiLlmService.getById(aiBot.getLlmId());
        if (aiLlm == null) {
            return createResponse(stream, JSON.toJSONString(errorRespnseMsg(3, "LLM不存在")));
            return createResponse(stream, JSON.toJSONString(errorRespnseMsg(4, "LLM不存在")));
        }
        Llm llm = aiLlm.toLlm();
@@ -386,7 +389,7 @@
                emitter.send(JSON.toJSONString(result, new SerializeConfig()));
            } else{
                emitter.send(messageContent.toString());
                emitter.send(JSON.toJSONString(messageContent));
            }
        }
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/base/AiBotApiKeyBase.java
@@ -21,7 +21,7 @@
    /**
     * apiKey
     */
    @Id(comment = "apiKey")@Column(value = "apiKey", comment = "apiKey")
    @Column(comment = "apiKey")
    private String apiKey;
    /**