Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anupam Kumar <[email protected]>
  • Loading branch information
kyteinsky committed Jan 10, 2025
1 parent 46ba864 commit d97f4f6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
6 changes: 5 additions & 1 deletion context_chat_backend/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ def _(sources: list[UploadFile]):
# wait for 10 minutes before failing the request
semres = doc_parse_semaphore.acquire(block=True, timeout=10*60)
if not semres:
return JSONResponse('Document parser worker limit reached, try again in some time', 503)
return JSONResponse(
'Document parser worker limit reached, try again in some time',
503,
headers={'cc-retry': 'true'}
)
added_sources = exec_in_proc(target=embed_sources, args=(vectordb_loader, app.extra['CONFIG'], sources))
doc_parse_semaphore.release()

Expand Down
20 changes: 12 additions & 8 deletions context_chat_backend/vectordb/pgvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,18 @@ def decl_update_access(self, user_ids: list[str], source_id: str, session_: orm.
session.execute(stmt)
session.commit()

access = [
AccessListStore(
uid=user_id,
source_id=source_id,
)
for user_id in user_ids
]
session.add_all(access)
stmt = (
sa.dialects.postgresql.insert(AccessListStore)
.values([
{
'uid': user_id,
'source_id': source_id,
}
for user_id in user_ids
])
.on_conflict_do_nothing(index_elements=['uid', 'source_id'])
)
session.execute(stmt)
session.commit()

if session_ is None:
Expand Down

0 comments on commit d97f4f6

Please sign in to comment.