Skip to content

Commit 0857b4e

Browse files
committed
fix: use db instead of undefined session in chats model
1 parent 745a4fc commit 0857b4e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

backend/open_webui/models/chats.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ async def delete_shared_chat_by_chat_id(self, chat_id: str, db: AsyncSession | N
718718
from open_webui.models.shared_chats import SharedChats
719719

720720
try:
721-
return await SharedChats.delete_by_chat_id(chat_id, db=session)
721+
return await SharedChats.delete_by_chat_id(chat_id, db=db)
722722
except Exception:
723723
return False
724724

@@ -842,7 +842,7 @@ async def get_shared_chat_list_by_user_id(
842842
"""Delegate to SharedChats for listing shared chats by user."""
843843
from open_webui.models.shared_chats import SharedChats
844844

845-
return await SharedChats.get_by_user_id(user_id, filter=filter, skip=skip, limit=limit, db=session)
845+
return await SharedChats.get_by_user_id(user_id, filter=filter, skip=skip, limit=limit, db=db)
846846

847847
async def get_chat_list_by_user_id(
848848
self,
@@ -982,7 +982,7 @@ async def get_chat_by_share_id(self, id: str, db: AsyncSession | None = None) ->
982982
from open_webui.models.shared_chats import SharedChats
983983

984984
try:
985-
shared = await SharedChats.get_by_id(id, db=session)
985+
shared = await SharedChats.get_by_id(id, db=db)
986986
if shared:
987987
# Return a ChatModel-compatible view of the snapshot
988988
return ChatModel(
@@ -1444,7 +1444,7 @@ async def add_chat_tag_by_id_and_user_id_and_tag_name(
14441444
self, id: str, user_id: str, tag_name: str, db: AsyncSession | None = None
14451445
) -> ChatModel | None:
14461446
tag_id = tag_name.replace(' ', '_').lower()
1447-
await Tags.ensure_tags_exist([tag_name], user_id, db=session)
1447+
await Tags.ensure_tags_exist([tag_name], user_id, db=db)
14481448
try:
14491449
async with get_async_db_context(db) as session:
14501450
chat = await session.get(Chat, id)

0 commit comments

Comments
 (0)