fix:增加流式模型构建异常处理,防止模型导致崩溃 - #38
Open
j2016-java wants to merge 1 commit into
Open
j2016-java wants to merge 1 commit into
j2016-java wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36
问题描述
当配置的阿里 Qwen 模型无效(如 API Key 错误、网络不通等)时,底层 LangChain4j 的
QwenHelper会在处理流式响应时抛出NoSuchElementException,导致对话中断并报错。修复方案
在
ModelStoreFactory.chatHandler中构建流式模型时,增加了try-catch异常捕获机制。当捕获到异常时,仅记录错误日志并跳过该模型的加载,防止单个模型配置错误导致整个流式对话服务崩溃。
修改文件
langchat-ai/langchat-ai-biz/src/main/java/cn/tycoding/langchat/ai/core/provider/factory/ModelStoreFactory.java