Skip to content

Commit 21f6d44

Browse files
committed
fix: use db instead of undefined session in chats model
1 parent d7e5d8e commit 21f6d44

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
@@ -696,7 +696,7 @@ async def delete_shared_chat_by_chat_id(self, chat_id: str, db: AsyncSession | N
696696
from open_webui.models.shared_chats import SharedChats
697697

698698
try:
699-
return await SharedChats.delete_by_chat_id(chat_id, db=session)
699+
return await SharedChats.delete_by_chat_id(chat_id, db=db)
700700
except Exception:
701701
return False
702702

@@ -820,7 +820,7 @@ async def get_shared_chat_list_by_user_id(
820820
"""Delegate to SharedChats for listing shared chats by user."""
821821
from open_webui.models.shared_chats import SharedChats
822822

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

825825
async def get_chat_list_by_user_id(
826826
self,
@@ -960,7 +960,7 @@ async def get_chat_by_share_id(self, id: str, db: AsyncSession | None = None) ->
960960
from open_webui.models.shared_chats import SharedChats
961961

962962
try:
963-
shared = await SharedChats.get_by_id(id, db=session)
963+
shared = await SharedChats.get_by_id(id, db=db)
964964
if shared:
965965
# Return a ChatModel-compatible view of the snapshot
966966
return ChatModel(
@@ -1422,7 +1422,7 @@ async def add_chat_tag_by_id_and_user_id_and_tag_name(
14221422
self, id: str, user_id: str, tag_name: str, db: AsyncSession | None = None
14231423
) -> ChatModel | None:
14241424
tag_id = tag_name.replace(' ', '_').lower()
1425-
await Tags.ensure_tags_exist([tag_name], user_id, db=session)
1425+
await Tags.ensure_tags_exist([tag_name], user_id, db=db)
14261426
try:
14271427
async with get_async_db_context(db) as session:
14281428
chat = await session.get(Chat, id)

0 commit comments

Comments
 (0)