mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 07:39:00 +08:00
fix: Fix typo in credentials field name (#2155)
This commit is contained in:
parent
a31b502668
commit
57024614bd
@ -45,7 +45,7 @@ identity:
|
|||||||
en_US: Google
|
en_US: Google
|
||||||
zh_Hans: Google
|
zh_Hans: Google
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
credentails_for_provider: # Credential field
|
credentials_for_provider: # Credential field
|
||||||
serpapi_api_key: # Credential field name
|
serpapi_api_key: # Credential field name
|
||||||
type: secret-input # Credential field type
|
type: secret-input # Credential field type
|
||||||
required: true # Required or not
|
required: true # Required or not
|
||||||
|
@ -45,7 +45,7 @@ identity:
|
|||||||
en_US: Google
|
en_US: Google
|
||||||
zh_Hans: Google
|
zh_Hans: Google
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
credentails_for_provider: # 凭据字段
|
credentials_for_provider: # 凭据字段
|
||||||
serpapi_api_key: # 凭据字段名称
|
serpapi_api_key: # 凭据字段名称
|
||||||
type: secret-input # 凭据字段类型
|
type: secret-input # 凭据字段类型
|
||||||
required: true # 是否必填
|
required: true # 是否必填
|
||||||
|
@ -38,7 +38,7 @@ class UserToolProvider(BaseModel):
|
|||||||
}
|
}
|
||||||
|
|
||||||
class UserToolProviderCredentials(BaseModel):
|
class UserToolProviderCredentials(BaseModel):
|
||||||
credentails: Dict[str, ToolProviderCredentials]
|
credentials: Dict[str, ToolProviderCredentials]
|
||||||
|
|
||||||
class UserTool(BaseModel):
|
class UserTool(BaseModel):
|
||||||
author: str
|
author: str
|
||||||
|
@ -10,4 +10,4 @@ identity:
|
|||||||
zh_Hans: 图表生成是一个用于生成可视化图表的工具,你可以通过它来生成柱状图、折线图、饼图等各类图表
|
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.
|
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
|
icon: icon.png
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
|
@ -10,7 +10,7 @@ identity:
|
|||||||
zh_Hans: DALL-E 绘画
|
zh_Hans: DALL-E 绘画
|
||||||
pt_BR: DALL-E art
|
pt_BR: DALL-E art
|
||||||
icon: icon.png
|
icon: icon.png
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
openai_api_key:
|
openai_api_key:
|
||||||
type: secret-input
|
type: secret-input
|
||||||
required: true
|
required: true
|
||||||
|
@ -10,7 +10,7 @@ identity:
|
|||||||
zh_Hans: GoogleSearch
|
zh_Hans: GoogleSearch
|
||||||
pt_BR: Google
|
pt_BR: Google
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
serpapi_api_key:
|
serpapi_api_key:
|
||||||
type: secret-input
|
type: secret-input
|
||||||
required: true
|
required: true
|
||||||
|
@ -10,7 +10,7 @@ identity:
|
|||||||
zh_Hans: Stable Diffusion 是一个可以在本地部署的图片生成的工具。
|
zh_Hans: Stable Diffusion 是一个可以在本地部署的图片生成的工具。
|
||||||
pt_BR: Stable Diffusion is a tool for generating images which can be deployed locally.
|
pt_BR: Stable Diffusion is a tool for generating images which can be deployed locally.
|
||||||
icon: icon.png
|
icon: icon.png
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
base_url:
|
base_url:
|
||||||
type: secret-input
|
type: secret-input
|
||||||
required: true
|
required: true
|
||||||
|
@ -10,4 +10,4 @@ identity:
|
|||||||
zh_Hans: 一个用于获取当前时间的工具。
|
zh_Hans: 一个用于获取当前时间的工具。
|
||||||
pt_BR: A tool for getting the current time.
|
pt_BR: A tool for getting the current time.
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
|
@ -10,7 +10,7 @@ identity:
|
|||||||
zh_Hans: 一个将 PNG 和 JPG 图像快速轻松地转换为 SVG 矢量图的工具。
|
zh_Hans: 一个将 PNG 和 JPG 图像快速轻松地转换为 SVG 矢量图的工具。
|
||||||
pt_BR: Convert your PNG and JPG images to SVG vectors quickly and easily. Fully automatically. Using AI.
|
pt_BR: Convert your PNG and JPG images to SVG vectors quickly and easily. Fully automatically. Using AI.
|
||||||
icon: icon.png
|
icon: icon.png
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
api_key_name:
|
api_key_name:
|
||||||
type: secret-input
|
type: secret-input
|
||||||
required: true
|
required: true
|
||||||
|
@ -10,4 +10,4 @@ identity:
|
|||||||
zh_Hans: 一个用于抓取网页的工具。
|
zh_Hans: 一个用于抓取网页的工具。
|
||||||
pt_BR: Web Scrapper tool kit is used to scrape web
|
pt_BR: Web Scrapper tool kit is used to scrape web
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
|
@ -10,4 +10,4 @@ identity:
|
|||||||
zh_Hans: 维基百科是一个由全世界的志愿者创建和编辑的免费在线百科全书。
|
zh_Hans: 维基百科是一个由全世界的志愿者创建和编辑的免费在线百科全书。
|
||||||
pt_BR: Wikipedia is a free online encyclopedia, created and edited by volunteers around the world.
|
pt_BR: Wikipedia is a free online encyclopedia, created and edited by volunteers around the world.
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
|
@ -10,7 +10,7 @@ identity:
|
|||||||
zh_Hans: WolframAlpha 是一个强大的计算知识引擎。
|
zh_Hans: WolframAlpha 是一个强大的计算知识引擎。
|
||||||
pt_BR: WolframAlpha is a powerful computational knowledge engine.
|
pt_BR: WolframAlpha is a powerful computational knowledge engine.
|
||||||
icon: icon.svg
|
icon: icon.svg
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
appid:
|
appid:
|
||||||
type: secret-input
|
type: secret-input
|
||||||
required: true
|
required: true
|
||||||
|
@ -10,4 +10,4 @@ identity:
|
|||||||
zh_Hans: 雅虎财经,获取并整理出最新的新闻、股票报价等一切你想要的财经信息。
|
zh_Hans: 雅虎财经,获取并整理出最新的新闻、股票报价等一切你想要的财经信息。
|
||||||
pt_BR: Finance, and Yahoo! get the latest news, stock quotes, and interactive chart with Yahoo!
|
pt_BR: Finance, and Yahoo! get the latest news, stock quotes, and interactive chart with Yahoo!
|
||||||
icon: icon.png
|
icon: icon.png
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
|
@ -10,7 +10,7 @@ identity:
|
|||||||
zh_Hans: Youtube(油管)是全球最大的视频分享网站,用户可以在上面上传、观看和分享视频。
|
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.
|
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
|
icon: icon.png
|
||||||
credentails_for_provider:
|
credentials_for_provider:
|
||||||
google_api_key:
|
google_api_key:
|
||||||
type: secret-input
|
type: secret-input
|
||||||
required: true
|
required: true
|
||||||
|
@ -30,14 +30,14 @@ class BuiltinToolProviderController(ToolProviderController):
|
|||||||
except:
|
except:
|
||||||
raise ToolProviderNotFoundError(f'can not load provider yaml for {provider}')
|
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
|
# set credentials name
|
||||||
for credential_name in provider_yaml['credentails_for_provider']:
|
for credential_name in provider_yaml['credentials_for_provider']:
|
||||||
provider_yaml['credentails_for_provider'][credential_name]['name'] = credential_name
|
provider_yaml['credentials_for_provider'][credential_name]['name'] = credential_name
|
||||||
|
|
||||||
super().__init__(**{
|
super().__init__(**{
|
||||||
'identity': provider_yaml['identity'],
|
'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]:
|
def _get_bulitin_tools(self) -> List[Tool]:
|
||||||
@ -75,7 +75,7 @@ class BuiltinToolProviderController(ToolProviderController):
|
|||||||
self.tools = tools
|
self.tools = tools
|
||||||
return 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
|
returns the credentials schema of the provider
|
||||||
|
|
||||||
@ -86,14 +86,14 @@ class BuiltinToolProviderController(ToolProviderController):
|
|||||||
|
|
||||||
return self.credentials_schema.copy()
|
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
|
returns the credentials schema of the provider, this method is used for user
|
||||||
|
|
||||||
:return: the credentials schema
|
:return: the credentials schema
|
||||||
"""
|
"""
|
||||||
credentials = self.credentials_schema.copy()
|
credentials = self.credentials_schema.copy()
|
||||||
return UserToolProviderCredentials(credentails=credentials)
|
return UserToolProviderCredentials(credentials=credentials)
|
||||||
|
|
||||||
def get_tools(self) -> List[Tool]:
|
def get_tools(self) -> List[Tool]:
|
||||||
"""
|
"""
|
||||||
|
@ -15,7 +15,7 @@ class ToolProviderController(BaseModel, ABC):
|
|||||||
tools: Optional[List[Tool]] = None
|
tools: Optional[List[Tool]] = None
|
||||||
credentials_schema: Optional[Dict[str, ToolProviderCredentials]] = 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
|
returns the credentials schema of the provider
|
||||||
|
|
||||||
@ -23,14 +23,14 @@ class ToolProviderController(BaseModel, ABC):
|
|||||||
"""
|
"""
|
||||||
return self.credentials_schema.copy()
|
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
|
returns the credentials schema of the provider, this method is used for user
|
||||||
|
|
||||||
:return: the credentials schema
|
:return: the credentials schema
|
||||||
"""
|
"""
|
||||||
credentials = self.credentials_schema.copy()
|
credentials = self.credentials_schema.copy()
|
||||||
return UserToolProviderCredentials(credentails=credentials)
|
return UserToolProviderCredentials(credentials=credentials)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_tools(self) -> List[Tool]:
|
def get_tools(self) -> List[Tool]:
|
||||||
|
@ -30,7 +30,7 @@ class ApiTool(Tool):
|
|||||||
runtime=Tool.Runtime(**meta)
|
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
|
validate the credentials for Api tool
|
||||||
"""
|
"""
|
||||||
|
@ -88,7 +88,7 @@ class DatasetRetrieverTool(Tool):
|
|||||||
|
|
||||||
return self.create_text_message(text=result)
|
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
|
validate the credentials for dataset retriever tool
|
||||||
"""
|
"""
|
||||||
|
@ -228,11 +228,11 @@ class Tool(BaseModel, ABC):
|
|||||||
def _invoke(self, user_id: str, tool_paramters: Dict[str, Any]) -> Union[ToolInvokeMessage, List[ToolInvokeMessage]]:
|
def _invoke(self, user_id: str, tool_paramters: Dict[str, Any]) -> Union[ToolInvokeMessage, List[ToolInvokeMessage]]:
|
||||||
pass
|
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
|
validate the credentials
|
||||||
|
|
||||||
:param credentails: the credentials
|
:param credentials: the credentials
|
||||||
:param parameters: the parameters
|
:param parameters: the parameters
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
@ -175,11 +175,11 @@ class ToolManager:
|
|||||||
controller = ToolManager.get_builtin_provider(provider_name)
|
controller = ToolManager.get_builtin_provider(provider_name)
|
||||||
tool_configuration = ToolConfiguration(tenant_id=tanent_id, provider_controller=controller)
|
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={
|
return builtin_tool.fork_tool_runtime(meta={
|
||||||
'tenant_id': tanent_id,
|
'tenant_id': tanent_id,
|
||||||
'credentials': decrypted_credentails,
|
'credentials': decrypted_credentials,
|
||||||
'runtime_parameters': {}
|
'runtime_parameters': {}
|
||||||
}, agent_callback=agent_callback)
|
}, agent_callback=agent_callback)
|
||||||
|
|
||||||
@ -191,11 +191,11 @@ class ToolManager:
|
|||||||
|
|
||||||
# decrypt the credentials
|
# decrypt the credentials
|
||||||
tool_configuration = ToolConfiguration(tenant_id=tanent_id, provider_controller=api_provider)
|
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={
|
return api_provider.get_tool(tool_name).fork_tool_runtime(meta={
|
||||||
'tenant_id': tanent_id,
|
'tenant_id': tanent_id,
|
||||||
'credentials': decrypted_credentails,
|
'credentials': decrypted_credentials,
|
||||||
})
|
})
|
||||||
elif provider_type == 'app':
|
elif provider_type == 'app':
|
||||||
raise NotImplementedError('app provider not implemented')
|
raise NotImplementedError('app provider not implemented')
|
||||||
@ -295,7 +295,7 @@ class ToolManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# get credentials schema
|
# get credentials schema
|
||||||
schema = provider.get_credentails_schema()
|
schema = provider.get_credentials_schema()
|
||||||
for name, value in schema.items():
|
for name, value in schema.items():
|
||||||
result_providers[provider.identity.name].team_credentials[name] = \
|
result_providers[provider.identity.name].team_credentials[name] = \
|
||||||
ToolProviderCredentials.CredentialsType.defaut(value.type)
|
ToolProviderCredentials.CredentialsType.defaut(value.type)
|
||||||
@ -311,7 +311,7 @@ class ToolManager:
|
|||||||
|
|
||||||
for db_builtin_provider in db_builtin_providers:
|
for db_builtin_provider in db_builtin_providers:
|
||||||
# add provider into providers
|
# add provider into providers
|
||||||
credentails = db_builtin_provider.credentials
|
credentials = db_builtin_provider.credentials
|
||||||
provider_name = db_builtin_provider.provider
|
provider_name = db_builtin_provider.provider
|
||||||
result_providers[provider_name].is_team_authorization = True
|
result_providers[provider_name].is_team_authorization = True
|
||||||
|
|
||||||
@ -321,8 +321,8 @@ class ToolManager:
|
|||||||
# init tool configuration
|
# init tool configuration
|
||||||
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
|
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
|
||||||
# decrypt the credentials and mask the credentials
|
# decrypt the credentials and mask the credentials
|
||||||
decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials=credentails)
|
decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials=credentials)
|
||||||
masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentails)
|
masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentials)
|
||||||
|
|
||||||
result_providers[provider_name].team_credentials = masked_credentials
|
result_providers[provider_name].team_credentials = masked_credentials
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ class ToolManager:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f'failed to get user name for api provider {db_api_provider.id}: {str(e)}')
|
logger.error(f'failed to get user name for api provider {db_api_provider.id}: {str(e)}')
|
||||||
# add provider into providers
|
# add provider into providers
|
||||||
credentails = db_api_provider.credentials
|
credentials = db_api_provider.credentials
|
||||||
provider_name = db_api_provider.name
|
provider_name = db_api_provider.name
|
||||||
result_providers[provider_name] = UserToolProvider(
|
result_providers[provider_name] = UserToolProvider(
|
||||||
id=db_api_provider.id,
|
id=db_api_provider.id,
|
||||||
@ -367,8 +367,8 @@ class ToolManager:
|
|||||||
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
|
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
|
||||||
|
|
||||||
# decrypt the credentials and mask the credentials
|
# decrypt the credentials and mask the credentials
|
||||||
decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials=credentails)
|
decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials=credentials)
|
||||||
masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentails)
|
masked_credentials = tool_configuration.mask_tool_credentials(credentials=decrypted_credentials)
|
||||||
|
|
||||||
result_providers[provider_name].team_credentials = masked_credentials
|
result_providers[provider_name].team_credentials = masked_credentials
|
||||||
|
|
||||||
@ -426,8 +426,8 @@ class ToolManager:
|
|||||||
# init tool configuration
|
# init tool configuration
|
||||||
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
|
tool_configuration = ToolConfiguration(tenant_id=tenant_id, provider_controller=controller)
|
||||||
|
|
||||||
decrypted_credentails = tool_configuration.decrypt_tool_credentials(credentials)
|
decrypted_credentials = tool_configuration.decrypt_tool_credentials(credentials)
|
||||||
masked_credentials = tool_configuration.mask_tool_credentials(decrypted_credentails)
|
masked_credentials = tool_configuration.mask_tool_credentials(decrypted_credentials)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
icon = json.loads(provider.icon)
|
icon = json.loads(provider.icon)
|
||||||
|
@ -9,22 +9,22 @@ class ToolConfiguration(BaseModel):
|
|||||||
tenant_id: str
|
tenant_id: str
|
||||||
provider_controller: ToolProviderController
|
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
|
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
|
encrypt tool credentials with tanent id
|
||||||
|
|
||||||
return a deep copy of credentials with encrypted values
|
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
|
# 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():
|
for field_name, field in fields.items():
|
||||||
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
|
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
|
||||||
if field_name in credentials:
|
if field_name in credentials:
|
||||||
@ -42,7 +42,7 @@ class ToolConfiguration(BaseModel):
|
|||||||
credentials = self._deep_copy(credentials)
|
credentials = self._deep_copy(credentials)
|
||||||
|
|
||||||
# get fields need to be decrypted
|
# 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():
|
for field_name, field in fields.items():
|
||||||
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
|
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
|
||||||
if field_name in credentials:
|
if field_name in credentials:
|
||||||
@ -65,7 +65,7 @@ class ToolConfiguration(BaseModel):
|
|||||||
credentials = self._deep_copy(credentials)
|
credentials = self._deep_copy(credentials)
|
||||||
|
|
||||||
# get fields need to be decrypted
|
# 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():
|
for field_name, field in fields.items():
|
||||||
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
|
if field.type == ToolProviderCredentials.CredentialsType.SECRET_INPUT:
|
||||||
if field_name in credentials:
|
if field_name in credentials:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""rename api provider credentails
|
"""rename api provider credentials
|
||||||
|
|
||||||
Revision ID: 8ec536f3c800
|
Revision ID: 8ec536f3c800
|
||||||
Revises: ad472b61a054
|
Revises: ad472b61a054
|
||||||
|
@ -112,7 +112,7 @@ class ToolManageService:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ValueError(f'invalid schema: {str(e)}')
|
raise ValueError(f'invalid schema: {str(e)}')
|
||||||
|
|
||||||
credentails_schema = [
|
credentials_schema = [
|
||||||
ToolProviderCredentials(
|
ToolProviderCredentials(
|
||||||
name='auth_type',
|
name='auth_type',
|
||||||
type=ToolProviderCredentials.CredentialsType.SELECT,
|
type=ToolProviderCredentials.CredentialsType.SELECT,
|
||||||
@ -163,7 +163,7 @@ class ToolManageService:
|
|||||||
{
|
{
|
||||||
'schema_type': schema_type,
|
'schema_type': schema_type,
|
||||||
'parameters_schema': tool_bundles,
|
'parameters_schema': tool_bundles,
|
||||||
'credentials_schema': credentails_schema,
|
'credentials_schema': credentials_schema,
|
||||||
'warning': warnings
|
'warning': warnings
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user