Skip to content

Commit

Permalink
Google Drive connector - txt and markdown support (danswer-ai#1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
lombax85 authored and rajiv chodisetti committed Oct 2, 2024
1 parent 7307ad0 commit bec2c5f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/danswer/connectors/google_drive/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class GDriveMimeType(str, Enum):
POWERPOINT = (
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
)
PLAIN_TEXT = "text/plain"
MARKDOWN = "text/markdown"


GoogleDriveFileType = dict[str, Any]
Expand Down Expand Up @@ -315,12 +317,19 @@ def extract_text(file: dict[str, str], service: discovery.Resource) -> str:
GDriveMimeType.DOC.value,
GDriveMimeType.PPT.value,
GDriveMimeType.SPREADSHEET.value,
GDriveMimeType.PLAIN_TEXT.value,
GDriveMimeType.MARKDOWN.value,
]:
export_mime_type = "text/plain"
if mime_type == GDriveMimeType.SPREADSHEET.value:
export_mime_type = "text/csv"
elif mime_type == GDriveMimeType.PPT.value:
export_mime_type = "text/plain"
elif mime_type in [
GDriveMimeType.PLAIN_TEXT.value,
GDriveMimeType.MARKDOWN.value
]:
export_mime_type = mime_type

response = (
service.files()
Expand Down

0 comments on commit bec2c5f

Please sign in to comment.