chore: format

This commit is contained in:
Timothy Jaeryang Baek
2026-03-24 06:07:20 -05:00
parent 9f946dec60
commit f7e07f3ca1
73 changed files with 1820 additions and 114 deletions
+1 -3
View File
@@ -582,9 +582,7 @@ async def signin(
if user.role != trusted_role:
Users.update_user_role_by_id(user.id, trusted_role, db=db)
elif trusted_role:
log.warning(
f'Ignoring invalid trusted role header value: {trusted_role}'
)
log.warning(f'Ignoring invalid trusted role header value: {trusted_role}')
elif WEBUI_AUTH == False:
admin_email = 'admin@localhost'
+1 -1
View File
@@ -1096,7 +1096,7 @@ async def export_knowledge_by_id(id: str, user=Depends(get_admin_user), db: Sess
# Use RFC 5987 filename* for non-ASCII names so the browser gets the real name
quoted_name = quote(f'{knowledge.name}.zip')
content_disposition = f"attachment; filename=\"{zip_filename}\"; filename*=UTF-8''{quoted_name}"
content_disposition = f'attachment; filename="{zip_filename}"; filename*=UTF-8\'\'{quoted_name}'
return StreamingResponse(
zip_buffer,
+27 -19
View File
@@ -839,32 +839,41 @@ def convert_to_responses_payload(payload: dict) -> dict:
if role == 'assistant' and msg.get('tool_calls'):
# Add text content as message if present
if content:
text = content if isinstance(content, str) else '\n'.join(
p.get('text', '') for p in content if p.get('type') == 'text'
text = (
content
if isinstance(content, str)
else '\n'.join(p.get('text', '') for p in content if p.get('type') == 'text')
)
if text.strip():
input_items.append({
'type': 'message', 'role': 'assistant',
'content': [{'type': 'output_text', 'text': text}],
})
input_items.append(
{
'type': 'message',
'role': 'assistant',
'content': [{'type': 'output_text', 'text': text}],
}
)
# Convert each tool_call to a function_call input item
for tool_call in msg['tool_calls']:
func = tool_call.get('function', {})
input_items.append({
'type': 'function_call',
'call_id': tool_call.get('id', ''),
'name': func.get('name', ''),
'arguments': func.get('arguments', '{}'),
})
input_items.append(
{
'type': 'function_call',
'call_id': tool_call.get('id', ''),
'name': func.get('name', ''),
'arguments': func.get('arguments', '{}'),
}
)
continue
# Handle tool result messages
if role == 'tool':
input_items.append({
'type': 'function_call_output',
'call_id': msg.get('tool_call_id', ''),
'output': msg.get('content', ''),
})
input_items.append(
{
'type': 'function_call_output',
'call_id': msg.get('tool_call_id', ''),
'output': msg.get('content', ''),
}
)
continue
# Convert content format
@@ -1132,8 +1141,7 @@ async def generate_chat_completion(
for message in payload['messages']:
if message.get('role') == 'tool' and isinstance(message.get('content'), list):
message['content'] = ''.join(
part.get('text', '') for part in message['content']
if part.get('type') in ('input_text', 'text')
part.get('text', '') for part in message['content'] if part.get('type') in ('input_text', 'text')
)
payload = json.dumps(payload)