From fe0f2a55c71d2794f4802e5ddb6e7c58a2b224e3 Mon Sep 17 00:00:00 2001 From: Maxwell-Lindsey Date: Sun, 25 Feb 2024 21:17:11 -0600 Subject: [PATCH] fixed supabase 'doc_groups' column name to match database; changed document_groups to doc_groups --- ai_ta_backend/types/document.py | 2 +- ai_ta_backend/vector_database.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ai_ta_backend/types/document.py b/ai_ta_backend/types/document.py index 594015d1..7c29d7c0 100644 --- a/ai_ta_backend/types/document.py +++ b/ai_ta_backend/types/document.py @@ -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=[]) \ No newline at end of file + doc_groups: List[str] = Field(default=[]) \ No newline at end of file diff --git a/ai_ta_backend/vector_database.py b/ai_ta_backend/vector_database.py index 7560038b..7c223add 100644 --- a/ai_ta_backend/vector_database.py +++ b/ai_ta_backend/vector_database.py @@ -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) @@ -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( @@ -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)