chore: format
This commit is contained in:
1 parent
f71e9570c0
commit
5c62cc0517
99 files changed
+12026
-5908
No files matched your search
@@ -1990,11 +1990,7 @@ async def chat_completion_files_handler(
|
||||
__event_emitter__ = extra_params['__event_emitter__']
|
||||
sources = []
|
||||
|
||||
files = [
|
||||
item
|
||||
for item in (body.get('metadata', {}).get('files', None) or [])
|
||||
if item.get('type') != 'filesystem'
|
||||
]
|
||||
files = [item for item in (body.get('metadata', {}).get('files', None) or []) if item.get('type') != 'filesystem']
|
||||
if files:
|
||||
# Check if all files are in full context mode
|
||||
all_full_context = all(item.get('context') == 'full' for item in files)
|
||||
|
||||
@@ -318,9 +318,7 @@ def get_reasoning_details(payload: dict):
|
||||
return None
|
||||
|
||||
provider_fields = payload.get('provider_specific_fields') or {}
|
||||
provider_details = (
|
||||
provider_fields.get('reasoning_details') if isinstance(provider_fields, dict) else None
|
||||
)
|
||||
provider_details = provider_fields.get('reasoning_details') if isinstance(provider_fields, dict) else None
|
||||
return payload.get('reasoning_details') or provider_details
|
||||
|
||||
|
||||
|
||||
@@ -2320,11 +2320,7 @@ class OAuthManager:
|
||||
raise jwt.InvalidTokenError(str(e))
|
||||
|
||||
signing_key = next(
|
||||
(
|
||||
key
|
||||
for key in jwk_set.keys
|
||||
if key.key_id == token_kid and key.public_key_use in ['sig', None]
|
||||
),
|
||||
(key for key in jwk_set.keys if key.key_id == token_kid and key.public_key_use in ['sig', None]),
|
||||
None,
|
||||
)
|
||||
if not signing_key:
|
||||
|
||||
@@ -339,10 +339,7 @@ async def delegate(
|
||||
for file in metadata.get('files') or []
|
||||
if str(file.get('id') or '') in requested_file_ids
|
||||
or str(file.get('url') or '') in requested_file_ids
|
||||
or (
|
||||
isinstance(file.get('file'), dict)
|
||||
and str(file.get('file', {}).get('id') or '') in requested_file_ids
|
||||
)
|
||||
or (isinstance(file.get('file'), dict) and str(file.get('file', {}).get('id') or '') in requested_file_ids)
|
||||
]
|
||||
found_file_ids = {
|
||||
str(value)
|
||||
|
||||
@@ -43,8 +43,7 @@ async def resolve_tool_call_output(
|
||||
(
|
||||
item
|
||||
for item in output
|
||||
if item.get('type') == 'function_call'
|
||||
and (item.get('call_id') or item.get('id')) == form_data.call_id
|
||||
if item.get('type') == 'function_call' and (item.get('call_id') or item.get('id')) == form_data.call_id
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
@@ -954,10 +954,10 @@ def add_terminal_display_file_inline_param(spec: dict) -> dict:
|
||||
return spec
|
||||
|
||||
spec['description'] = (
|
||||
f"{spec.get('description', '')} "
|
||||
"Set inline=true when the file should be shown inline in the chat message instead of opening the file viewer. "
|
||||
"Set page for PDF, DOCX, and PPTX files when you want the preview to open at a specific 1-based page or slide. "
|
||||
"After display_file succeeds, do not display the same file again or emit Markdown for it."
|
||||
f'{spec.get("description", "")} '
|
||||
'Set inline=true when the file should be shown inline in the chat message instead of opening the file viewer. '
|
||||
'Set page for PDF, DOCX, and PPTX files when you want the preview to open at a specific 1-based page or slide. '
|
||||
'After display_file succeeds, do not display the same file again or emit Markdown for it.'
|
||||
).strip()
|
||||
parameters = spec.setdefault('parameters', {'type': 'object', 'properties': {}, 'required': []})
|
||||
parameters.setdefault('type', 'object')
|
||||
@@ -1411,11 +1411,7 @@ async def get_terminal_tools(
|
||||
|
||||
context_id = terminal_context_id(connection, metadata, terminal_context)
|
||||
config = terminal_context_config(connection, terminal_context)
|
||||
if (
|
||||
isinstance(config, dict)
|
||||
and config.get('context_id') in {'chat_id', 'automation_id'}
|
||||
and not context_id
|
||||
):
|
||||
if isinstance(config, dict) and config.get('context_id') in {'chat_id', 'automation_id'} and not context_id:
|
||||
raise RuntimeError(f"Terminal server '{terminal_id}' requires a saved {terminal_context} context")
|
||||
if context_id:
|
||||
headers[TERMINAL_CONTEXT_HEADER] = context_id
|
||||
@@ -1586,8 +1582,7 @@ async def get_tool_servers_data(servers: list[dict[str, Any]]) -> list[dict[str,
|
||||
'openapi': response,
|
||||
'info': response.get('info', {}),
|
||||
'specs': [
|
||||
add_terminal_display_file_inline_param(spec)
|
||||
for spec in convert_openapi_to_tool_payload(response)
|
||||
add_terminal_display_file_inline_param(spec) for spec in convert_openapi_to_tool_payload(response)
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user