Skip to content

Commit

Permalink
fixed supabase 'doc_groups' column name to match database; changed do…
Browse files Browse the repository at this point in the history
…cument_groups to doc_groups
  • Loading branch information
Maxwell-Lindsey committed Feb 26, 2024
1 parent b0617e2 commit fe0f2a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ai_ta_backend/types/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ class MaterialDocument(BaseModel):
s3_path: str
base_url: str = Field(default='')
url: str = Field(default='')
document_groups: List[str] = Field(default=[])
doc_groups: List[str] = Field(default=[])
10 changes: 5 additions & 5 deletions ai_ta_backend/vector_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,14 +1694,14 @@ def add_documents_to_doc_group(self, course_name: str, docs: MaterialDocument |
try:
if doc.s3_path:
self.supabase_client.table(doc_table).update({
'doc_group': doc.document_groups,
'doc_groups': doc.doc_groups,
}).eq('course_name', course_name).eq('s3_path', doc.s3_path).execute()
elif doc.url:
self.supabase_client.table(doc_table).update({
'doc_group': doc.document_groups,
'doc_groups': doc.doc_groups,
}).eq('course_name', course_name).eq('url', doc.url).execute()
except Exception as e:
error = f"Error in updating document_groups in Supabase: {e}"
error = f"Error in updating doc_groups in Supabase: {e}"
print(error)
ret += error
sentry_sdk.capture_exception(e)
Expand All @@ -1711,7 +1711,7 @@ def add_documents_to_doc_group(self, course_name: str, docs: MaterialDocument |
self.qdrant_client.set_payload(
collection_name=os.environ['QDRANT_COLLECTION_NAME'],
payload={
"doc_group": doc.document_groups,
"doc_group": doc.doc_groups,
},
points=models.Filter(must=[
models.FieldCondition(
Expand All @@ -1729,7 +1729,7 @@ def add_documents_to_doc_group(self, course_name: str, docs: MaterialDocument |
],),
)
except Exception as e:
error = f"Error in updating document_groups in Qdrant: {e}"
error = f"Error in updating doc_groups in Qdrant: {e}"
print(error)
ret += error
sentry_sdk.capture_exception(e)
Expand Down

0 comments on commit fe0f2a5

Please sign in to comment.