mirror of
https://github.com/langgenius/dify.git
synced 2024-11-15 19:22:36 +08:00
Fixes you have not added provider None
(#10501)
This commit is contained in:
parent
570f10d91c
commit
f19c18dc14
|
@ -555,6 +555,7 @@ class ToolManager:
|
|||
"""
|
||||
get tool provider
|
||||
"""
|
||||
provider_name = provider
|
||||
provider: ApiToolProvider = (
|
||||
db.session.query(ApiToolProvider)
|
||||
.filter(
|
||||
|
@ -565,7 +566,7 @@ class ToolManager:
|
|||
)
|
||||
|
||||
if provider is None:
|
||||
raise ValueError(f"you have not added provider {provider}")
|
||||
raise ValueError(f"you have not added provider {provider_name}")
|
||||
|
||||
try:
|
||||
credentials = json.loads(provider.credentials_str) or {}
|
||||
|
|
|
@ -113,6 +113,8 @@ class ApiToolManageService:
|
|||
if schema_type not in [member.value for member in ApiProviderSchemaType]:
|
||||
raise ValueError(f"invalid schema type {schema}")
|
||||
|
||||
provider_name = provider_name.strip()
|
||||
|
||||
# check if the provider exists
|
||||
provider: ApiToolProvider = (
|
||||
db.session.query(ApiToolProvider)
|
||||
|
@ -203,6 +205,7 @@ class ApiToolManageService:
|
|||
"""
|
||||
list api tool provider tools
|
||||
"""
|
||||
provider_name = provider
|
||||
provider: ApiToolProvider = (
|
||||
db.session.query(ApiToolProvider)
|
||||
.filter(
|
||||
|
@ -213,7 +216,7 @@ class ApiToolManageService:
|
|||
)
|
||||
|
||||
if provider is None:
|
||||
raise ValueError(f"you have not added provider {provider}")
|
||||
raise ValueError(f"you have not added provider {provider_name}")
|
||||
|
||||
controller = ToolTransformService.api_provider_to_controller(db_provider=provider)
|
||||
labels = ToolLabelManager.get_tool_labels(controller)
|
||||
|
@ -246,6 +249,8 @@ class ApiToolManageService:
|
|||
if schema_type not in [member.value for member in ApiProviderSchemaType]:
|
||||
raise ValueError(f"invalid schema type {schema}")
|
||||
|
||||
provider_name = provider_name.strip()
|
||||
|
||||
# check if the provider exists
|
||||
provider: ApiToolProvider = (
|
||||
db.session.query(ApiToolProvider)
|
||||
|
|
Loading…
Reference in New Issue
Block a user