Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: i18n error (#12052)

yihong7a24c957bdb3
diff --git a/api/core/tools/entities/tool_entities.py b/api/core/tools/entities/tool_entities.py
index 260e4e457f0..c87a90c03a6 100644
--- a/api/core/tools/entities/tool_entities.py
+++ b/api/core/tools/entities/tool_entities.py
@@ -243,9 +243,11 @@ class ToolParameter(BaseModel):
:param options: the options of the parameter
"""
# convert options to ToolParameterOption
+ # FIXME fix the type error
if options:
- options_tool_parametor = [
- ToolParameterOption(value=option, label=I18nObject(en_US=option, zh_Hans=option)) for option in options
+ options = [
+ ToolParameterOption(value=option, label=I18nObject(en_US=option, zh_Hans=option)) # type: ignore
+ for option in options # type: ignore
]
return cls(
name=name,
@@ -256,7 +258,7 @@ class ToolParameter(BaseModel):
form=cls.ToolParameterForm.LLM,
llm_description=llm_description,
required=required,
- options=options_tool_parametor,
+ options=options, # type: ignore
)
diff --git a/api/services/tools/tools_transform_service.py b/api/services/tools/tools_transform_service.py
index b501554bcd0..6e3a45be0da 100644
--- a/api/services/tools/tools_transform_service.py
+++ b/api/services/tools/tools_transform_service.py
@@ -275,10 +275,7 @@ class ToolTransformService:
author=tool.identity.author,
name=tool.identity.name,
label=tool.identity.label,
- description=I18nObject(
- en_US=tool.description.human if tool.description else "",
- zh_Hans=tool.description.human if tool.description else "",
- ),
+ description=tool.description.human if tool.description else "", # type: ignore
parameters=current_parameters,
labels=labels,
)