fix: apply ruff

pull/22550/head
Harry 10 months ago
parent ff03ae1a57
commit b8f79a7cb1

@ -807,7 +807,7 @@ class ToolOAuthCustomClient(Resource):
tenant_id=current_user.current_tenant_id, provider=provider
)
)
@setup_required
@login_required
@account_initialization_required
@ -845,6 +845,7 @@ class ToolBuiltinProviderGetCredentialInfoApi(Resource):
)
)
class ToolProviderMCPApi(Resource):
@setup_required
@login_required

@ -175,7 +175,7 @@ class PluginInvokeToolApi(Resource):
provider=payload.provider,
tool_name=payload.tool,
tool_parameters=payload.tool_parameters,
credential_id=payload.credential_id
credential_id=payload.credential_id,
),
)

@ -60,7 +60,5 @@ class PluginAgentStrategy(BaseAgentStrategy):
conversation_id=conversation_id,
app_id=app_id,
message_id=message_id,
context=PluginInvokeContext(
credentials=credentials or InvokeCredentials()
),
context=PluginInvokeContext(credentials=credentials or InvokeCredentials()),
)

@ -56,7 +56,6 @@ class OAuthHandler(BasePluginClient):
Get credentials from the given request.
"""
try:
# encode request to raw http request
raw_request_bytes = self._convert_request_to_raw_data(request)

@ -125,7 +125,7 @@ class BuiltinToolProviderController(ToolProviderController):
if credential_type == CredentialType.API_KEY.value:
return self.entity.credentials_schema.copy() if self.entity.credentials_schema else []
raise ValueError(f"Invalid credential type: {credential_type}")
def get_oauth_client_schema(self) -> list[ProviderConfig]:
"""
returns the oauth client schema of the provider

@ -207,7 +207,7 @@ class ToolManager:
# if the provider has been deleted, raise an error
if builtin_provider is None:
raise ToolProviderNotFoundError(f"provider has been deleted: {credential_id}")
# fallback to the default provider
if builtin_provider is None:
# use the default provider

@ -127,6 +127,7 @@ class ProviderConfigEncrypter:
def create_provider_encrypter(tenant_id: str, config: list[BasicProviderConfig], cache: ProviderConfigCache):
return ProviderConfigEncrypter(tenant_id=tenant_id, config=config, provider_config_cache=cache), cache
def create_tool_provider_encrypter(tenant_id: str, controller: ToolProviderController):
cache = SingletonProviderCredentialsCache(
tenant_id=tenant_id,

@ -5,7 +5,6 @@ def is_valid_uuid(uuid_str: str | None) -> bool:
if uuid_str is None or len(uuid_str) == 0:
return False
try:
uuid.UUID(uuid_str)
return True
except Exception:

Loading…
Cancel
Save