mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: casting non-string type value for tool parameter options (#5267)
This commit is contained in:
parent
3a423e8ce7
commit
d94279ae75
|
@ -116,10 +116,10 @@ class ToolParameterOption(BaseModel):
|
||||||
value: str = Field(..., description="The value of the option")
|
value: str = Field(..., description="The value of the option")
|
||||||
label: I18nObject = Field(..., description="The label of the option")
|
label: I18nObject = Field(..., description="The label of the option")
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@field_validator('value', mode='before')
|
@field_validator('value', mode='before')
|
||||||
|
@classmethod
|
||||||
def transform_id_to_str(cls, value) -> str:
|
def transform_id_to_str(cls, value) -> str:
|
||||||
if isinstance(value, bool):
|
if not isinstance(value, str):
|
||||||
return str(value)
|
return str(value)
|
||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
|
|
@ -227,7 +227,7 @@ parameters:
|
||||||
en_US: New Zealand
|
en_US: New Zealand
|
||||||
zh_Hans: 新西兰
|
zh_Hans: 新西兰
|
||||||
pt_BR: New Zealand
|
pt_BR: New Zealand
|
||||||
- value: NO
|
- value: "NO"
|
||||||
label:
|
label:
|
||||||
en_US: Norway
|
en_US: Norway
|
||||||
zh_Hans: 挪威
|
zh_Hans: 挪威
|
||||||
|
|
Loading…
Reference in New Issue
Block a user