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: Fix typo in credentials field name (#2155)

Yeuoly57024614bd4e
diff --git a/api/core/tools/docs/en_US/tool_scale_out.md b/api/core/tools/docs/en_US/tool_scale_out.md
index 90aa38bfdd0..f7919423976 100644
--- a/api/core/tools/docs/en_US/tool_scale_out.md
+++ b/api/core/tools/docs/en_US/tool_scale_out.md
@@ -45,7 +45,7 @@ identity:
en_US: Google
zh_Hans: Google
icon: icon.svg
-credentails_for_provider: # Credential field
+credentials_for_provider: # Credential field
serpapi_api_key: # Credential field name
type: secret-input # Credential field type
required: true # Required or not
diff --git a/api/core/tools/docs/zh_Hans/tool_scale_out.md b/api/core/tools/docs/zh_Hans/tool_scale_out.md
index 08746c70fc7..034e24e784f 100644
--- a/api/core/tools/docs/zh_Hans/tool_scale_out.md
+++ b/api/core/tools/docs/zh_Hans/tool_scale_out.md
@@ -45,7 +45,7 @@ identity:
en_US: Google
zh_Hans: Google
icon: icon.svg
-credentails_for_provider: # 凭据字段
+credentials_for_provider: # 凭据字段
serpapi_api_key: # 凭据字段名称
type: secret-input # 凭据字段类型
required: true # 是否必填
diff --git a/api/core/tools/entities/user_entities.py b/api/core/tools/entities/user_entities.py
index ce4723f0714..305b6668b53 100644
--- a/api/core/tools/entities/user_entities.py
+++ b/api/core/tools/entities/user_entities.py
@@ -38,7 +38,7 @@ class UserToolProvider(BaseModel):
}
class UserToolProviderCredentials(BaseModel):
- credentails: Dict[str, ToolProviderCredentials]
+ credentials: Dict[str, ToolProviderCredentials]
class UserTool(BaseModel):
author: str
diff --git a/api/core/tools/provider/builtin/chart/chart.yaml b/api/core/tools/provider/builtin/chart/chart.yaml
index 70aa2f388fe..7aac32b3bb1 100644
--- a/api/core/tools/provider/builtin/chart/chart.yaml
+++ b/api/core/tools/provider/builtin/chart/chart.yaml
@@ -10,4 +10,4 @@ identity:
zh_Hans: 图表生成是一个用于生成可视化图表的工具,你可以通过它来生成柱状图、折线图、饼图等各类图表
pt_BR: O Gerador de gráficos é uma ferramenta para gerar gráficos estatísticos como gráfico de barras, gráfico de linhas, gráfico de pizza, etc.
icon: icon.png
-credentails_for_provider:
+credentials_for_provider:
diff --git a/api/core/tools/provider/builtin/dalle/dalle.yaml b/api/core/tools/provider/builtin/dalle/dalle.yaml
index b347915e802..a99401d82d6 100644
--- a/api/core/tools/provider/builtin/dalle/dalle.yaml
+++ b/api/core/tools/provider/builtin/dalle/dalle.yaml
@@ -10,7 +10,7 @@ identity:
zh_Hans: DALL-E 绘画
pt_BR: DALL-E art
icon: icon.png
-credentails_for_provider:
+credentials_for_provider:
openai_api_key:
type: secret-input
required: true
diff --git a/api/core/tools/provider/builtin/google/google.yaml b/api/core/tools/provider/builtin/google/google.yaml
index 793aed39363..43b75b51cdf 100644
--- a/api/core/tools/provider/builtin/google/google.yaml
+++ b/api/core/tools/provider/builtin/google/google.yaml
@@ -10,7 +10,7 @@ identity:
zh_Hans: GoogleSearch
pt_BR: Google
icon: icon.svg
-credentails_for_provider:
+credentials_for_provider:
serpapi_api_key:
type: secret-input
required: true
diff --git a/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml b/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml
index 9ceaf1ba766..7b918cb8541 100644
--- a/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml
+++ b/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml
@@ -10,7 +10,7 @@ identity:
zh_Hans: Stable Diffusion 是一个可以在本地部署的图片生成的工具。
pt_BR: Stable Diffusion is a tool for generating images which can be deployed locally.
icon: icon.png
-credentails_for_provider:
+credentials_for_provider:
base_url:
type: secret-input
required: true
diff --git a/api/core/tools/provider/builtin/time/time.yaml b/api/core/tools/provider/builtin/time/time.yaml
index 23320114258..8ea67cded58 100644
--- a/api/core/tools/provider/builtin/time/time.yaml
+++ b/api/core/tools/provider/builtin/time/time.yaml
@@ -10,4 +10,4 @@ identity:
zh_Hans: 一个用于获取当前时间的工具。
pt_BR: A tool for getting the current time.
icon: icon.svg
-credentails_for_provider:
+credentials_for_provider:
diff --git a/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml b/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml
index 4798544aeea..07a20380e96 100644
--- a/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml
+++ b/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml
@@ -10,7 +10,7 @@ identity:
zh_Hans: 一个将 PNG 和 JPG 图像快速轻松地转换为 SVG 矢量图的工具。
pt_BR: Convert your PNG and JPG images to SVG vectors quickly and easily. Fully automatically. Using AI.
icon: icon.png
-credentails_for_provider:
+credentials_for_provider:
api_key_name:
type: secret-input
required: true
diff --git a/api/core/tools/provider/builtin/webscraper/webscraper.yaml b/api/core/tools/provider/builtin/webscraper/webscraper.yaml
index 40683ff3919..056108f0360 100644
--- a/api/core/tools/provider/builtin/webscraper/webscraper.yaml
+++ b/api/core/tools/provider/builtin/webscraper/webscraper.yaml
@@ -10,4 +10,4 @@ identity:
zh_Hans: 一个用于抓取网页的工具。
pt_BR: Web Scrapper tool kit is used to scrape web
icon: icon.svg
-credentails_for_provider:
+credentials_for_provider:
diff --git a/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml b/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml
index c9dbc412987..f4b5da8947c 100644
--- a/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml
+++ b/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml
@@ -10,4 +10,4 @@ identity:
zh_Hans: 维基百科是一个由全世界的志愿者创建和编辑的免费在线百科全书。
pt_BR: Wikipedia is a free online encyclopedia, created and edited by volunteers around the world.
icon: icon.svg
-credentails_for_provider:
+credentials_for_provider:
diff --git a/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml b/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml
index 8b1c9a755be..e4cc4657128 100644
--- a/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml
+++ b/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml
@@ -10,7 +10,7 @@ identity:
zh_Hans: WolframAlpha 是一个强大的计算知识引擎。
pt_BR: WolframAlpha is a powerful computational knowledge engine.
icon: icon.svg
-credentails_for_provider:
+credentials_for_provider:
appid:
type: secret-input
required: true
diff --git a/api/core/tools/provider/builtin/yahoo/yahoo.yaml b/api/core/tools/provider/builtin/yahoo/yahoo.yaml
index 6632aedc2fe..b16517eaf9f 100644
--- a/api/core/tools/provider/builtin/yahoo/yahoo.yaml
+++ b/api/core/tools/provider/builtin/yahoo/yahoo.yaml
@@ -10,4 +10,4 @@ identity:
zh_Hans: 雅虎财经,获取并整理出最新的新闻、股票报价等一切你想要的财经信息。
pt_BR: Finance, and Yahoo! get the latest news, stock quotes, and interactive chart with Yahoo!
icon: icon.png
-credentails_for_provider:
+credentials_for_provider:
diff --git a/api/core/tools/provider/builtin/youtube/youtube.yaml b/api/core/tools/provider/builtin/youtube/youtube.yaml
index 2bc35e9d775..0fa267b2a94 100644
--- a/api/core/tools/provider/builtin/youtube/youtube.yaml
+++ b/api/core/tools/provider/builtin/youtube/youtube.yaml
@@ -10,7 +10,7 @@ identity:
zh_Hans: Youtube(油管)是全球最大的视频分享网站,用户可以在上面上传、观看和分享视频。
pt_BR: Youtube é o maior site de compartilhamento de vídeos do mundo, onde os usuários podem fazer upload, assistir e compartilhar vídeos.
icon: icon.png
-credentails_for_provider:
+credentials_for_provider:
google_api_key:
type: secret-input
required: true
diff --git a/api/core/tools/provider/builtin_tool_provider.py b/api/core/tools/provider/builtin_tool_provider.py
index e071dcbea0d..721a8ebea52 100644
--- a/api/core/tools/provider/builtin_tool_provider.py
+++ b/api/core/tools/provider/builtin_tool_provider.py
@@ -30,14 +30,14 @@ class BuiltinToolProviderController(ToolProviderController):
except:
raise ToolProviderNotFoundError(f'can not load provider yaml for {provider}')
- if 'credentails_for_provider' in provider_yaml and provider_yaml['credentails_for_provider'] is not None:
+ if 'credentials_for_provider' in provider_yaml and provider_yaml['credentials_for_provider'] is not None:
# set credentials name
- for credential_name in provider_yaml['credentails_for_provider']:
- provider_yaml['credentails_for_provider'][credential_name]['name'] = credential_name
+ for credential_name in provider_yaml['credentials_for_provider']:
+ provider_yaml['credentials_for_provider'][credential_name]['name'] = credential_name
super().__init__(**{
'identity': provider_yaml['identity'],
- 'credentials_schema': provider_yaml['credentails_for_provider'] if 'credentails_for_provider' in provider_yaml else None,
+ 'credentials_schema': provider_yaml['credentials_for_provider'] if 'credentials_for_provider' in provider_yaml else None,
})
def _get_bulitin_tools(self) -> List[Tool]:
@@ -75,7 +75,7 @@ class BuiltinToolProviderController(ToolProviderController):
self.tools = tools
return tools
- def get_credentails_schema(self) -> Dict[str, ToolProviderCredentials]:
+ def get_credentials_schema(self) -> Dict[str, ToolProviderCredentials]:
"""
returns the credentials schema of the provider
@@ -86,14 +86,14 @@ class BuiltinToolProviderController(ToolProviderController):
return self.credentials_schema.copy()
- def user_get_credentails_schema(self) -> UserToolProviderCredentials:
+ def user_get_credentials_schema(self) -> UserToolProviderCredentials:
"""
returns the credentials schema of the provider, this method is used for user
:return: the credentials schema
"""
credentials = self.credentials_schema.copy()
- return UserToolProviderCredentials(credentails=credentials)
+ return UserToolProviderCredentials(credentials=credentials)
def get_tools(self) -> List[Tool]:
"""
diff --git a/api/core/tools/provider/tool_provider.py b/api/core/tools/provider/tool_provider.py
index 722b1662a8e..aa3f6661249 100644
--- a/api/core/tools/provider/tool_provider.py
+++ b/api/core/tools/provider/tool_provider.py
@@ -15,7 +15,7 @@ class ToolProviderController(BaseModel, ABC):
tools: Optional[List[Tool]] = None
credentials_schema: Optional[Dict[str, ToolProviderCredentials]] = None
- def get_credentails_schema(self) -> Dict[str, ToolProviderCredentials]:
+ def get_credentials_schema(self) -> Dict[str, ToolProviderCredentials]:
"""
returns the credentials schema of the provider
@@ -23,14 +23,14 @@ class ToolProviderController(BaseModel, ABC):
"""
return self.credentials_schema.copy()
- def user_get_credentails_schema(self) -> UserToolProviderCredentials:
+ def user_get_credentials_schema(self) -> UserToolProviderCredentials:
"""
returns the credentials schema of the provider, this method is used for user
:return: the credentials schema
"""
credentials = self.credentials_schema.copy()
- return UserToolProviderCredentials(credentails=credentials)
+ return UserToolProviderCredentials(credentials=credentials)
@abstractmethod
def get_tools(self) -> List[Tool]:
diff --git a/api/core/tools/tool/api_tool.py b/api/core/tools/tool/api_tool.py
index 896adc5b818..4328c7d1e94 100644
--- a/api/core/tools/tool/api_tool.py
+++ b/api/core/tools/tool/api_tool.py
@@ -30,7 +30,7 @@ class ApiTool(Tool):
runtime=Tool.Runtime(**meta)
)
- def validate_credentials(self, credentails: Dict[str, Any], parameters: Dict[str, Any], format_only: bool = False) -> None:
+ def validate_credentials(self, credentials: Dict[str, Any], parameters: Dict[str, Any], format_only: bool = False) -> None:
"""
validate the credentials for Api tool
"""
diff --git a/api/core/tools/tool/dataset_retriever_tool.py b/api/core/tools/tool/dataset_retriever_tool.py
index 800952226ab..bcf0aa2935d 100644
--- a/api/core/tools/tool/dataset_retriever_tool.py
+++ b/api/core/tools/tool/dataset_retriever_tool.py
@@ -88,7 +88,7 @@ class DatasetRetrieverTool(Tool):
return self.create_text_message(text=result)
- def validate_credentials(self, credentails: Dict[str, Any], parameters: Dict[str, Any]) -> None:
+ def validate_credentials(self, credentials: Dict[str, Any], parameters: Dict[str, Any]) -> None:
"""
validate the credentials for dataset retriever tool
"""
diff --git a/api/core/tools/tool/tool.py b/api/core/tools/tool/tool.py
index 4e29b427a9d..cce6ffcc728 100644
--- a/api/core/tools/tool/tool.py
+++ b/api/core/tools/tool/tool.py
@@ -228,11 +228,11 @@ class Tool(BaseModel, ABC):
def _invoke(self, user_id: str, tool_paramters: Dict[str, Any]) -> Union[ToolInvokeMessage, List[ToolInvokeMessage]]:
pass
- def validate_credentials(self, credentails: Dict[str, Any], parameters: Dict[str, Any]) -> None:
+ def validate_credentials(self, credentials: Dict[str, Any], parameters: Dict[str, Any]) -> None:
"""
validate the credentials
- :param credentails: the credentials
+ :param credentials: the credentials
:param parameters: the parameters
"""
pass
diff --git a/api/core/tools/tool_manager.py b/api/core/tools/tool_manager.py
index 4b88d9b9e8b..0dbb1c1116d 100644
--- a/api/core/tools/tool_manager.py
+++ b/api/core/tools/tool_manager.py
@@ -175,11 +175,11 @@ class ToolManager:
controller = ToolManager.get_builtin_provider(provider_name)
tool_configuration = ToolConfiguration(tenant_id=tanent_id, provider_controller=controller)
- decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials)
+ decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials)
return builtin_tool.fork_tool_runtime(meta={
'tenant_id': tanent_id,
- 'credentials': decrypted_credentails,
+ 'credentials': decrypted_credentials,
'runtime_parameters': {}
}, agent_callback=agent_callback)
@@ -191,11 +191,11 @@ class ToolManager:
# decrypt the credentials
tool_configuration = ToolConfiguration(tenant_id=tanent_id, provider_controller=api_provider)
- decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials)
+ decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials)
return api_provider.get_tool(tool_name).fork_tool_runtime(meta={
'tenant_id': tanent_id,
- 'credentials': decrypted_credentails,
+ 'credentials': decrypted_credentials,
})
elif provider_type == 'app':
raise NotImplementedError('app provider not implemented')
@@ -295,7 +295,7 @@ class ToolManager:
)
# get credentials schema
- schema = provider.get_credentails_schema()
+ schema = provider.get_credentials_schema()
for name, value in schema.items():
result_providers[provider.identity.name].team_credentials[name] = \
ToolProviderCredentials.CredentialsType.defaut(value.type)
@@ -311,7 +311,7 @@ class ToolManager:
for db_builtin_provider in db_builtin_providers:
# add provider into providers
- credentails = db_builtin_provider.credentials
+ credentials = db_builtin_provider.credentials
provider_name = db_builtin_provider.provider
result_providers[provider_name].is_team_authorization = True
@@ -321,8 +321,8 @@ class ToolManager:
# init tool configuration
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
# decrypt the credentials and mask the credentials
- decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials=credentails)
- masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentails)
+ decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials=credentials)
+ masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentials)
result_providers[provider_name].team_credentials = masked_credentials
@@ -337,7 +337,7 @@ class ToolManager:
except Exception as e:
logger.error(f'failed to get user name for api provider {db_api_provider.id}: {str(e)}')
# add provider into providers
- credentails = db_api_provider.credentials
+ credentials = db_api_provider.credentials
provider_name = db_api_provider.name
result_providers[provider_name] = UserToolProvider(
id=db_api_provider.id,
@@ -367,8 +367,8 @@ class ToolManager:
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
# decrypt the credentials and mask the credentials
- decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials=credentails)
- masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentails)
+ decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials=credentials)
+ masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentials)
result_providers[provider_name].team_credentials = masked_credentials
@@ -426,8 +426,8 @@ class ToolManager:
# init tool configuration
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
- decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials)
- masked_credentials = tool_configuration.mask_tool_credentials(decrypted_credentails)
+ decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials)
+ masked_credentials = tool_configuration.mask_tool_credentials(decrypted_credentials)
try:
icon = json.loads(provider.icon)
diff --git a/api/core/tools/utils/configration.py b/api/core/tools/utils/configration.py
index a0ff8d754ff..29c2a53ff4a 100644
--- a/api/core/tools/utils/configration.py
+++ b/api/core/tools/utils/configration.py
@@ -9,22 +9,22 @@ class ToolConfiguration(BaseModel):
tenant_id: str
provider_controller: ToolProviderController
- def _deep_copy(self, credentails: Dict[str, str]) -> Dict[str, str]:
+ def _deep_copy(self, credentials: Dict[str, str]) -> Dict[str, str]:
"""
deep copy credentials
"""
- return {key: value for key, value in credentails.items()}
+ return {key: value for key, value in credentials.items()}
- def encrypt_tool_credentials(self, credentails: Dict[str, str]) -> Dict[str, str]:
+ def encrypt_tool_credentials(self, credentials: Dict[str, str]) -> Dict[str, str]:
"""
encrypt tool credentials with tanent id
return a deep copy of credentials with encrypted values
"""
- credentials = self._deep_copy(credentails)
+ credentials = self._deep_copy(credentials)
# get fields need to be decrypted
- fields = self.provider_controller.get_credentails_schema()
+ fields = self.provider_controller.get_credentials_schema()
for field_name, field in fields.items():
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
if field_name in credentials:
@@ -42,7 +42,7 @@ class ToolConfiguration(BaseModel):
credentials = self._deep_copy(credentials)
# get fields need to be decrypted
- fields = self.provider_controller.get_credentails_schema()
+ fields = self.provider_controller.get_credentials_schema()
for field_name, field in fields.items():
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
if field_name in credentials:
@@ -65,7 +65,7 @@ class ToolConfiguration(BaseModel):
credentials = self._deep_copy(credentials)
# get fields need to be decrypted
- fields = self.provider_controller.get_credentails_schema()
+ fields = self.provider_controller.get_credentials_schema()
for field_name, field in fields.items():
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
if field_name in credentials:
diff --git a/api/migrations/versions/8ec536f3c800_rename_api_provider_credentails.py b/api/migrations/versions/8ec536f3c800_rename_api_provider_credentails.py
index 1380512f305..6cab1f20926 100644
--- a/api/migrations/versions/8ec536f3c800_rename_api_provider_credentails.py
+++ b/api/migrations/versions/8ec536f3c800_rename_api_provider_credentails.py
@@ -1,4 +1,4 @@
-"""rename api provider credentails
+"""rename api provider credentials
Revision ID: 8ec536f3c800
Revises: ad472b61a054
diff --git a/api/services/tools_manage_service.py b/api/services/tools_manage_service.py
index ee530b1c1ad..a866cbb4f96 100644
--- a/api/services/tools_manage_service.py
+++ b/api/services/tools_manage_service.py
@@ -112,7 +112,7 @@ class ToolManageService:
except Exception as e:
raise ValueError(f'invalid schema: {str(e)}')
- credentails_schema = [
+ credentials_schema = [
ToolProviderCredentials(
name='auth_type',
type=ToolProviderCredentials.CredentialsType.SELECT,
@@ -163,7 +163,7 @@ class ToolManageService:
{
'schema_type': schema_type,
'parameters_schema': tool_bundles,
- 'credentials_schema': credentails_schema,
+ 'credentials_schema': credentials_schema,
'warning': warnings
}
))