mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +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
|
get tool provider
|
||||||
"""
|
"""
|
||||||
|
provider_name = provider
|
||||||
provider: ApiToolProvider = (
|
provider: ApiToolProvider = (
|
||||||
db.session.query(ApiToolProvider)
|
db.session.query(ApiToolProvider)
|
||||||
.filter(
|
.filter(
|
||||||
|
@ -565,7 +566,7 @@ class ToolManager:
|
||||||
)
|
)
|
||||||
|
|
||||||
if provider is None:
|
if provider is None:
|
||||||
raise ValueError(f"you have not added provider {provider}")
|
raise ValueError(f"you have not added provider {provider_name}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
credentials = json.loads(provider.credentials_str) or {}
|
credentials = json.loads(provider.credentials_str) or {}
|
||||||
|
|
|
@ -113,6 +113,8 @@ class ApiToolManageService:
|
||||||
if schema_type not in [member.value for member in ApiProviderSchemaType]:
|
if schema_type not in [member.value for member in ApiProviderSchemaType]:
|
||||||
raise ValueError(f"invalid schema type {schema}")
|
raise ValueError(f"invalid schema type {schema}")
|
||||||
|
|
||||||
|
provider_name = provider_name.strip()
|
||||||
|
|
||||||
# check if the provider exists
|
# check if the provider exists
|
||||||
provider: ApiToolProvider = (
|
provider: ApiToolProvider = (
|
||||||
db.session.query(ApiToolProvider)
|
db.session.query(ApiToolProvider)
|
||||||
|
@ -203,6 +205,7 @@ class ApiToolManageService:
|
||||||
"""
|
"""
|
||||||
list api tool provider tools
|
list api tool provider tools
|
||||||
"""
|
"""
|
||||||
|
provider_name = provider
|
||||||
provider: ApiToolProvider = (
|
provider: ApiToolProvider = (
|
||||||
db.session.query(ApiToolProvider)
|
db.session.query(ApiToolProvider)
|
||||||
.filter(
|
.filter(
|
||||||
|
@ -213,7 +216,7 @@ class ApiToolManageService:
|
||||||
)
|
)
|
||||||
|
|
||||||
if provider is None:
|
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)
|
controller = ToolTransformService.api_provider_to_controller(db_provider=provider)
|
||||||
labels = ToolLabelManager.get_tool_labels(controller)
|
labels = ToolLabelManager.get_tool_labels(controller)
|
||||||
|
@ -246,6 +249,8 @@ class ApiToolManageService:
|
||||||
if schema_type not in [member.value for member in ApiProviderSchemaType]:
|
if schema_type not in [member.value for member in ApiProviderSchemaType]:
|
||||||
raise ValueError(f"invalid schema type {schema}")
|
raise ValueError(f"invalid schema type {schema}")
|
||||||
|
|
||||||
|
provider_name = provider_name.strip()
|
||||||
|
|
||||||
# check if the provider exists
|
# check if the provider exists
|
||||||
provider: ApiToolProvider = (
|
provider: ApiToolProvider = (
|
||||||
db.session.query(ApiToolProvider)
|
db.session.query(ApiToolProvider)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user