fix: resolve default values of tool init parameters not taking effect#6267
Open
DurantChan1 wants to merge 1 commit into
Open
fix: resolve default values of tool init parameters not taking effect#6267DurantChan1 wants to merge 1 commit into
DurantChan1 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.
What this PR does / why we need it?
修复工具(Tool)初始化参数中配置的默认值(default_value)在部分场景下不生效的问题。
根因: 当工具的 init_field_list 中某个字段定义了 default_value,但用户已保存的 init_params 中不包含该字段时,代码直接使用 init_params 而跳过了默认值合并,导致该字段为空。
Summary of your change
在所有构建 tool_init_params 的地方,统一将 init_field_list 中的 default_value 作为基线,再与已保存的 init_params 合并(默认值 → 已保存参数),确保未配置的参数能正确回退到默认值
修改列表
Please indicate you've done the following:
本地验证:确认修改后工具调用时未配置参数字段能正确取到 init_field_list 中定义的 default_value
向后兼容:已有 init_params 的存量工具不受影响(用户参数优先级最高)
覆盖 4 条主要路径:对话、Flow 节点、工具节点执行、调试模式