自我检查
- 这仅用于提交错误报告,如果您想提问,请访问 Discussions 。
- 我已在现有问题中进行了搜索,包括已关闭的问题。
- 我确认我使用英文提交此报告(我已阅读并同意 Language Policy )。
- 请务必使用英文提交问题,否则会被关闭。谢谢!:)
- 请不要修改此模板 :) 并填写所有必需的字段。
Dify版本
0.6.15
云或自托管
自托管(Docker)
重现步骤
创建应用程序 > 从空白开始创建 > 在工具中点击添加。.
出现内部服务器错误,然后在日志中我们看到了这个。
ERROR [Dummy-32] [module_import_helper.py:32] - 无法从 /app/api/core/tools/provider/builtin/duckduckgo/tools/duckduckgo_search.py 加载模块 core.tools.provider.builtin.duckduckgo.tools.duckduckgo_search:检测到一个未注解的属性:name = 'duckduckgo_search'
。所有模型字段都需要类型注解;如果 name
不是一个字段,您可能可以通过将其注解为 ClassVar
或更新 model_config['ignored_types']
来解决此错误。
✔️ 预期行为
没有错误,可以像预期的那样添加工具。
❌ 实际行为
出现内部服务器错误,然后添加工具选项卡继续加载。
4条答案
按热度按时间biswetbf1#
你好!我在这里帮助你解决仓库中的任何错误、问题或贡献。让我们一起解决你正在经历的问题。
要解决
duckduckgo_search
模块中的 "非注解属性" 错误,你需要在DuckDuckGoSearchTool
类的属性中添加类型注解。以下是带有必要类型注解的更新后的代码:添加的类型注解如下:
Dict[str, Any]
用于tool_parameters
str
用于query
、result_type
和prompt
int
用于max_results
bool
用于require_summary
List[Dict[str, Any]]
用于response
str
用于results
这些注解与
ddgo_search.yaml
文件中的参数定义相匹配。lh80um4z2#
.
我无法在云端版本和最新主分支上重现此问题。您是否有应用程序配置的任何屏幕截图?
bjp0bcyl3#
@crazywoola 我尝试用 @dosu 建议的替换 https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_search.py,但仍然出现错误。
这里还有我在点击 Create App > Create from Blank > Choose Agent > 在 Tools 点击 Add 时出现的错误截图。
ohfgkhjo4#
您遇到的错误是由于在
DuckDuckGoSearchTool
类中的name
属性没有被注解类型。您需要为类中的所有属性添加类型注解。以下是带有必要类型注解的ddgo_search.py
文件的更新版本:通过向类属性添加
ClassVar
类型注解并确保所有属性都正确地进行了类型标注,您应该能够解决“内部服务器错误”问题 1(https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_search.yaml)2(https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_search.py)。已经有维护者介入进一步协助。