chore: format
This commit is contained in:
@@ -591,7 +591,11 @@ OAUTH_ALLOWED_ROLES = PersistentConfig(
|
||||
OAUTH_ADMIN_ROLES = PersistentConfig(
|
||||
"OAUTH_ADMIN_ROLES",
|
||||
"oauth.admin_roles",
|
||||
[role.strip() for role in os.environ.get("OAUTH_ADMIN_ROLES", "admin").split(SEP) if role],
|
||||
[
|
||||
role.strip()
|
||||
for role in os.environ.get("OAUTH_ADMIN_ROLES", "admin").split(SEP)
|
||||
if role
|
||||
],
|
||||
)
|
||||
|
||||
OAUTH_ALLOWED_DOMAINS = PersistentConfig(
|
||||
|
||||
@@ -1556,13 +1556,15 @@ async def chat_completion(
|
||||
log.info("Chat processing was cancelled")
|
||||
try:
|
||||
event_emitter = get_event_emitter(metadata)
|
||||
await asyncio.shield(event_emitter(
|
||||
{"type": "chat:tasks:cancel"},
|
||||
))
|
||||
await asyncio.shield(
|
||||
event_emitter(
|
||||
{"type": "chat:tasks:cancel"},
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
pass
|
||||
finally:
|
||||
raise # re-raise to ensure proper task cancellation handling
|
||||
raise # re-raise to ensure proper task cancellation handling
|
||||
except Exception as e:
|
||||
log.debug(f"Error processing chat payload: {e}")
|
||||
if metadata.get("chat_id") and metadata.get("message_id"):
|
||||
|
||||
@@ -83,7 +83,7 @@ class YoutubeLoader:
|
||||
TranscriptsDisabled,
|
||||
YouTubeTranscriptApi,
|
||||
)
|
||||
from youtube_transcript_api.proxies import (GenericProxyConfig)
|
||||
from youtube_transcript_api.proxies import GenericProxyConfig
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
'Could not import "youtube_transcript_api" Python package. '
|
||||
@@ -91,7 +91,9 @@ class YoutubeLoader:
|
||||
)
|
||||
|
||||
if self.proxy_url:
|
||||
youtube_proxies = GenericProxyConfig(http_url=self.proxy_url, https_url=self.proxy_url)
|
||||
youtube_proxies = GenericProxyConfig(
|
||||
http_url=self.proxy_url, https_url=self.proxy_url
|
||||
)
|
||||
log.debug(f"Using proxy URL: {self.proxy_url[:14]}...")
|
||||
else:
|
||||
youtube_proxies = None
|
||||
|
||||
@@ -9,6 +9,7 @@ from mcp.client.auth import OAuthClientProvider, TokenStorage
|
||||
from mcp.client.streamable_http import streamablehttp_client
|
||||
from mcp.shared.auth import OAuthClientInformationFull, OAuthClientMetadata, OAuthToken
|
||||
|
||||
|
||||
class MCPClient:
|
||||
def __init__(self):
|
||||
self.session: Optional[ClientSession] = None
|
||||
@@ -35,7 +36,6 @@ class MCPClient:
|
||||
except Exception as e:
|
||||
await asyncio.shield(self.disconnect())
|
||||
raise e
|
||||
|
||||
|
||||
async def list_tool_specs(self) -> Optional[dict]:
|
||||
if not self.session:
|
||||
|
||||
Reference in New Issue
Block a user