This commit is contained in:
Timothy Jaeryang Baek
2026-06-16 23:24:27 +02:00
parent 56ae99e96a
commit 40c09167cd
5 changed files with 112 additions and 37 deletions
+14 -1
View File
@@ -957,6 +957,20 @@ class ChatTable:
all_chats = result.scalars().all()
return [ChatModel.model_validate(chat) for chat in all_chats]
async def get_chat_metas_by_chat_ids(
self,
chat_ids: list[str],
include_archived: bool = False,
db: AsyncSession | None = None,
) -> list[dict]:
async with get_async_db_context(db) as session:
stmt = select(Chat.meta).filter(Chat.id.in_(chat_ids))
if not include_archived:
stmt = stmt.filter_by(archived=False)
result = await session.execute(stmt)
return [meta for meta in result.scalars().all() if isinstance(meta, dict)]
# retrieve conversation
async def get_chat_by_id(
self,
@@ -1389,7 +1403,6 @@ class ChatTable:
for chat in all_chats
]
async def get_chats_by_folder_ids_and_user_id(
self, folder_ids: list[str], user_id: str, db: AsyncSession | None = None
) -> list[ChatModel]: