mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-18 05:05:09 +02:00
chore: format
This commit is contained in:
@@ -471,9 +471,7 @@ class ChatTable:
|
||||
if msg.get('parentId') and msg['parentId'] not in messages_map
|
||||
}
|
||||
|
||||
async def backfill_messages_by_chat_id(
|
||||
self, chat_id: str, user_id: str, messages: dict[str, dict]
|
||||
) -> None:
|
||||
async def backfill_messages_by_chat_id(self, chat_id: str, user_id: str, messages: dict[str, dict]) -> None:
|
||||
"""Write messages to the ``chat_message`` table so future lookups
|
||||
use the fast path. Errors are logged but never raised.
|
||||
"""
|
||||
@@ -509,9 +507,9 @@ class ChatTable:
|
||||
|
||||
# Graph has gaps — enrich from the legacy embedded history.
|
||||
log.info(
|
||||
'Chat %s: %d unresolved parent reference(s) in chat_message — '
|
||||
'enriching from legacy history',
|
||||
id, len(unresolved_ids),
|
||||
'Chat %s: %d unresolved parent reference(s) in chat_message — enriching from legacy history',
|
||||
id,
|
||||
len(unresolved_ids),
|
||||
)
|
||||
chat = await self.get_chat_by_id(id)
|
||||
if chat:
|
||||
|
||||
@@ -425,15 +425,12 @@ async def get_model_by_id(id: str, user=Depends(get_verified_user), db: AsyncSes
|
||||
)
|
||||
)
|
||||
|
||||
if (
|
||||
write_access
|
||||
or await AccessGrants.has_access(
|
||||
user_id=user.id,
|
||||
resource_type='model',
|
||||
resource_id=model.id,
|
||||
permission='read',
|
||||
db=db,
|
||||
)
|
||||
if write_access or await AccessGrants.has_access(
|
||||
user_id=user.id,
|
||||
resource_type='model',
|
||||
resource_id=model.id,
|
||||
permission='read',
|
||||
db=db,
|
||||
):
|
||||
model_dict = model.model_dump()
|
||||
# Strip params (system prompt and other admin-curated config)
|
||||
|
||||
@@ -484,9 +484,7 @@ async def update_tools_by_id(
|
||||
if form_data.content != tools.content:
|
||||
if user.role != 'admin' and not (
|
||||
await has_permission(user.id, 'workspace.tools', request.app.state.config.USER_PERMISSIONS, db=db)
|
||||
or await has_permission(
|
||||
user.id, 'workspace.tools_import', request.app.state.config.USER_PERMISSIONS, db=db
|
||||
)
|
||||
or await has_permission(user.id, 'workspace.tools_import', request.app.state.config.USER_PERMISSIONS, db=db)
|
||||
):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
|
||||
Reference in New Issue
Block a user