zhangjinyang
2025-05-13 d26e5a3456c2da492d6dcfd973c9c8a11e774e0c
fix: 修复llmExtraConfig为空的问题
1个文件已修改
21 ■■■■ 已修改文件
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/AiLlm.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/entity/AiLlm.java
@@ -128,17 +128,16 @@
        openAiLlmConfig.setModel(getLlmModel());
        openAiLlmConfig.setDefaultEmbeddingModel(getLlmModel());
        String llmExtraConfig = getLlmExtraConfig();
        if (llmExtraConfig == null){
            return null;
        }
        Properties prop = PropertiesUtil.textToProperties(llmExtraConfig);
        String chatPath = prop.getProperty("chatPath");
        String embedPath = prop.getProperty("embedPath");
        if (chatPath != null && !chatPath.isEmpty()) {
            openAiLlmConfig.setChatPath(chatPath);
        }
        if (embedPath != null && !embedPath.isEmpty()) {
            openAiLlmConfig.setEmbedPath(embedPath);
        if (llmExtraConfig != null && !llmExtraConfig.isEmpty()){
            Properties prop = PropertiesUtil.textToProperties(llmExtraConfig);
            String chatPath = prop.getProperty("chatPath");
            String embedPath = prop.getProperty("embedPath");
            if (chatPath != null && !chatPath.isEmpty()) {
                openAiLlmConfig.setChatPath(chatPath);
            }
            if (embedPath != null && !embedPath.isEmpty()) {
                openAiLlmConfig.setEmbedPath(embedPath);
            }
        }
        return new OpenAILlm(openAiLlmConfig);
    }