Skip to content

Commit

Permalink
added functionality for adding or removing a single doc_group for imo…
Browse files Browse the repository at this point in the history
…proved readability
  • Loading branch information
Maxwell-Lindsey committed Feb 26, 2024
1 parent fe0f2a5 commit 800528f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ai_ta_backend/vector_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,22 @@ def add_documents_to_doc_group(self, course_name: str, docs: MaterialDocument |
if ret == '':
return "Success"
return ret

def append_doc_group(self, course_name: str, doc: MaterialDocument, doc_group: str):
"""
Append a document group to a document's doc_groups array.
"""
if doc_group not in doc.doc_groups:
doc.doc_groups.append(doc_group)
self.add_documents_to_doc_group(course_name, doc)

def remove_doc_group(self, course_name: str, doc: MaterialDocument, doc_group: str):
"""
Remove a document group from a document's doc_groups array.
"""
if doc_group in doc.doc_groups:
doc.doc_groups.remove(doc_group)
self.add_documents_to_doc_group(course_name, doc)

if __name__ == '__main__':
pass

0 comments on commit 800528f

Please sign in to comment.