mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-14 08:09:46 +00:00
fix: Docs & Chats in other search spaces
This commit is contained in:
parent
73623aa37e
commit
2008b07304
6 changed files with 32 additions and 21 deletions
|
@ -88,16 +88,19 @@ async def create_chat(
|
|||
async def read_chats(
|
||||
skip: int = 0,
|
||||
limit: int = 100,
|
||||
search_space_id: int = None,
|
||||
session: AsyncSession = Depends(get_async_session),
|
||||
user: User = Depends(current_active_user)
|
||||
):
|
||||
try:
|
||||
query = select(Chat).join(SearchSpace).filter(SearchSpace.user_id == user.id)
|
||||
|
||||
# Filter by search_space_id if provided
|
||||
if search_space_id is not None:
|
||||
query = query.filter(Chat.search_space_id == search_space_id)
|
||||
|
||||
result = await session.execute(
|
||||
select(Chat)
|
||||
.join(SearchSpace)
|
||||
.filter(SearchSpace.user_id == user.id)
|
||||
.offset(skip)
|
||||
.limit(limit)
|
||||
query.offset(skip).limit(limit)
|
||||
)
|
||||
return result.scalars().all()
|
||||
except OperationalError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue