自检
- 仅用于提交 bug 报告,如果您想提问,请访问 Discussions 。
- 我已在 search for existing issues 中搜索现有问题,包括已关闭的问题。
- 我确认我使用英文提交此报告(我已阅读并同意 Language Policy )。
- 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- 请不要修改此模板 :) 并填写所有必需的字段。
Dify 版本
0.6.14
云或自托管
自托管(源代码)
重现步骤
工具中的参数类型为 secret-input
:
在 Agnet 中添加此工具并手动填写参数:
启动测试对话:
✔️ 预期行为
有时,API 请求期间参数会正常发送,结果也是正确的:
❌ 实际行为
有时,参数会被替换为 **** ,服务器收到的请求也是遮罩参数,请求结果不正确:
这种情况并非不可避免,也无法找到偶尔的规律。它只是发生了!而且,当它发生时,即使我立即重新填写这些参数并保存它们,再次请求时,参数仍然被替换为 **** 。
顺便说一下,我的 Dify 已拉取了代码的最新版本(0.6.14-2024/07/19, f2004ad )
2条答案
按热度按时间xdyibdwo1#
为了解决Dify版本0.6.14中API请求中
secret-input
类型参数偶尔被替换为"***"的问题,确保在API请求中使用这些参数之前对其进行正确解密。应在使用参数之前调用decrypt_tool_parameters
方法对参数进行解密。以下是处理解密的代码相关部分:确保在准备API请求的参数时在代码的适当位置调用此方法。这将确保
secret-input
类型参数得到解密,而不是被替换为"***" 1(https://github.com/langgenius/dify/blob/main/api/core/tools/utils/configuration.py)。此外,当API请求中的
secret-input
参数被替换为"***"时,会生成特定的日志或错误消息。API响应将包括action
字段设置为"overrided",并且inputs
或text
字段将显示被替换的内容 2(https://github.com/langgenius/dify-docs/blob/main/en/guides/extension/api-based-extension/moderation-extension.md)3(https://github.com/langgenius/dify-docs/blob/main/en/guides/extension/api-based-extension/moderation.md)。uqcuzwp82#
@takatost@Yeuoly