FEAT: NEW WORKFLOW ENGINE (#3160)
Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Yeuoly <admin@srmxy.cn> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: jyong <718720800@qq.com>
This commit is contained in:
@@ -16,6 +16,8 @@ from models.tools import ApiToolProvider
|
||||
|
||||
|
||||
class ApiBasedToolProviderController(ToolProviderController):
|
||||
provider_id: str
|
||||
|
||||
@staticmethod
|
||||
def from_db(db_provider: ApiToolProvider, auth_type: ApiProviderAuthType) -> 'ApiBasedToolProviderController':
|
||||
credentials_schema = {
|
||||
@@ -89,9 +91,10 @@ class ApiBasedToolProviderController(ToolProviderController):
|
||||
'en_US': db_provider.description,
|
||||
'zh_Hans': db_provider.description
|
||||
},
|
||||
'icon': db_provider.icon
|
||||
'icon': db_provider.icon,
|
||||
},
|
||||
'credentials_schema': credentials_schema
|
||||
'credentials_schema': credentials_schema,
|
||||
'provider_id': db_provider.id or '',
|
||||
})
|
||||
|
||||
@property
|
||||
@@ -120,7 +123,8 @@ class ApiBasedToolProviderController(ToolProviderController):
|
||||
'en_US': tool_bundle.operation_id,
|
||||
'zh_Hans': tool_bundle.operation_id
|
||||
},
|
||||
'icon': tool_bundle.icon if tool_bundle.icon else ''
|
||||
'icon': self.identity.icon,
|
||||
'provider': self.provider_id,
|
||||
},
|
||||
'description': {
|
||||
'human': {
|
||||
|
@@ -189,7 +189,7 @@ class StableDiffusionTool(BuiltinTool):
|
||||
if not base_url:
|
||||
return []
|
||||
api_url = str(URL(base_url) / 'sdapi' / 'v1' / 'sd-models')
|
||||
response = get(url=api_url, timeout=10)
|
||||
response = get(url=api_url, timeout=(2, 10))
|
||||
if response.status_code != 200:
|
||||
return []
|
||||
else:
|
||||
|
@@ -49,6 +49,7 @@ parameters:
|
||||
zh_Hans: Lora
|
||||
pt_BR: Lora
|
||||
form: form
|
||||
default: ""
|
||||
- name: steps
|
||||
type: number
|
||||
required: false
|
||||
|
@@ -68,6 +68,7 @@ class BuiltinToolProviderController(ToolProviderController):
|
||||
script_path=path.join(path.dirname(path.realpath(__file__)),
|
||||
'builtin', provider, 'tools', f'{tool_name}.py'),
|
||||
parent_type=BuiltinTool)
|
||||
tool["identity"]["provider"] = provider
|
||||
tools.append(assistant_tool_class(**tool))
|
||||
|
||||
self.tools = tools
|
||||
@@ -126,7 +127,8 @@ class BuiltinToolProviderController(ToolProviderController):
|
||||
|
||||
:return: whether the provider needs credentials
|
||||
"""
|
||||
return self.credentials_schema is not None and len(self.credentials_schema) != 0
|
||||
return self.credentials_schema is not None and \
|
||||
len(self.credentials_schema) != 0
|
||||
|
||||
@property
|
||||
def app_type(self) -> ToolProviderType:
|
||||
|
Reference in New Issue
Block a user