Skip to content

Commit

Permalink
fix: decl access update in doc indexing (#125)
Browse files Browse the repository at this point in the history
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
  • Loading branch information
kyteinsky authored Jan 7, 2025
1 parent c70d7d8 commit 4c867b1
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions context_chat_backend/vectordb/pgvector.py
Original file line number Diff line number Diff line change
@@ -127,20 +127,10 @@ def add_indocuments(self, indocuments: list[InDocument]) -> list[str]:
modified=datetime.fromtimestamp(indoc.modified),
chunks=chunk_ids,
)

access = [
AccessListStore(
uid=user_id,
source_id=indoc.source_id,
)
for user_id in indoc.userIds
]

session.add(doc)
session.commit()
session.add_all(access)
session.commit()

self.decl_update_access(indoc.userIds, indoc.source_id, session)
added_sources.append(indoc.source_id)
except Exception as e:
log_error('Error adding documents to vectordb:', e)
@@ -206,6 +196,7 @@ def decl_update_access(self, user_ids: list[str], source_id: str, session_: orm.
.filter(AccessListStore.source_id == source_id)
)
session.execute(stmt)
session.commit()

access = [
AccessListStore(

0 comments on commit 4c867b1

Please sign in to comment.