mirror of
https://github.com/langgenius/dify.git
synced 2026-05-13 08:57:28 +08:00
[autofix.ci] apply automated fixes
This commit is contained in:
parent
fb8a356616
commit
faa2d00cc6
@ -38,7 +38,7 @@ class MCPProviderEntity(BaseModel):
|
|||||||
# Authentication related
|
# Authentication related
|
||||||
authed: bool
|
authed: bool
|
||||||
credentials: dict[str, Any] # encrypted credentials
|
credentials: dict[str, Any] # encrypted credentials
|
||||||
code_verifier: Optional[str] = None # for OAuth
|
code_verifier: str | None = None # for OAuth
|
||||||
|
|
||||||
# Tools and display info
|
# Tools and display info
|
||||||
tools: list[dict[str, Any]] # parsed tools list
|
tools: list[dict[str, Any]] # parsed tools list
|
||||||
@ -98,7 +98,7 @@ class MCPProviderEntity(BaseModel):
|
|||||||
# If not JSON, assume it's a file path
|
# If not JSON, assume it's a file path
|
||||||
return file_helpers.get_signed_file_url(self.icon)
|
return file_helpers.get_signed_file_url(self.icon)
|
||||||
|
|
||||||
def to_api_response(self, user_name: Optional[str] = None) -> dict[str, Any]:
|
def to_api_response(self, user_name: str | None = None) -> dict[str, Any]:
|
||||||
"""Convert to API response format"""
|
"""Convert to API response format"""
|
||||||
return {
|
return {
|
||||||
"id": self.id,
|
"id": self.id,
|
||||||
@ -117,14 +117,14 @@ class MCPProviderEntity(BaseModel):
|
|||||||
"description": I18nObject(en_US="", zh_Hans="").to_dict(),
|
"description": I18nObject(en_US="", zh_Hans="").to_dict(),
|
||||||
}
|
}
|
||||||
|
|
||||||
def retrieve_client_information(self) -> Optional[OAuthClientInformation]:
|
def retrieve_client_information(self) -> OAuthClientInformation | None:
|
||||||
"""OAuth client information if available"""
|
"""OAuth client information if available"""
|
||||||
client_info = self.decrypt_credentials().get("client_information", {})
|
client_info = self.decrypt_credentials().get("client_information", {})
|
||||||
if not client_info:
|
if not client_info:
|
||||||
return None
|
return None
|
||||||
return OAuthClientInformation.model_validate(client_info)
|
return OAuthClientInformation.model_validate(client_info)
|
||||||
|
|
||||||
def retrieve_tokens(self) -> Optional[OAuthTokens]:
|
def retrieve_tokens(self) -> OAuthTokens | None:
|
||||||
"""OAuth tokens if available"""
|
"""OAuth tokens if available"""
|
||||||
if not self.credentials:
|
if not self.credentials:
|
||||||
return None
|
return None
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class MCPClientWithAuthRetry(MCPClient):
|
|||||||
provider_entity: MCPProviderEntity | None = None,
|
provider_entity: MCPProviderEntity | None = None,
|
||||||
auth_callback: Callable[[MCPProviderEntity, "MCPToolManageService", Optional[str]], dict[str, str]]
|
auth_callback: Callable[[MCPProviderEntity, "MCPToolManageService", Optional[str]], dict[str, str]]
|
||||||
| None = None,
|
| None = None,
|
||||||
authorization_code: Optional[str] = None,
|
authorization_code: str | None = None,
|
||||||
by_server_id: bool = False,
|
by_server_id: bool = False,
|
||||||
mcp_service: Optional["MCPToolManageService"] = None,
|
mcp_service: Optional["MCPToolManageService"] = None,
|
||||||
):
|
):
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
|
|
||||||
@ -33,7 +33,7 @@ class MCPToolManageService:
|
|||||||
# ========== Provider CRUD Operations ==========
|
# ========== Provider CRUD Operations ==========
|
||||||
|
|
||||||
def get_provider(
|
def get_provider(
|
||||||
self, *, provider_id: Optional[str] = None, server_identifier: Optional[str] = None, tenant_id: str
|
self, *, provider_id: str | None = None, server_identifier: str | None = None, tenant_id: str
|
||||||
) -> MCPToolProvider:
|
) -> MCPToolProvider:
|
||||||
"""
|
"""
|
||||||
Get MCP provider by ID or server identifier.
|
Get MCP provider by ID or server identifier.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user