Skip to content

Commit

Permalink
added the texxt category
Browse files Browse the repository at this point in the history
  • Loading branch information
jkmin3 committed Sep 13, 2023
1 parent 557b77a commit 79ce52a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ai_ta_backend/vector_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,21 @@ def ingest(file_ext_mapping, s3_path, *args, **kwargs):
self.s3_client.download_fileobj(Bucket=os.environ['S3_BUCKET_NAME'], Key=s3_path, Fileobj=tmpfile)
mime_type = mimetypes.guess_type(tmpfile.name)[0]
category, _ = mime_type.split('/')
match_file_ext = "." + _

if category in ['video', 'audio']:
ret = self._ingest_single_video(s3_path, course_name)
if ret != "Success":
success_status['failure_ingest'].append(s3_path)
else:
success_status['success_ingest'].append(s3_path)
elif category == 'text' and match_file_ext not in file_ext_mapping.keys():
print(category, match_file_ext)
ret = self._ingest_single_txt(s3_path, course_name)
if ret != "Success":
success_status['failure_ingest'].append(s3_path)
else:
success_status['success_ingest'].append(s3_path)
else:
ingest(file_ext_mapping, s3_path, course_name, kwargs=kwargs)

Expand Down

0 comments on commit 79ce52a

Please sign in to comment.