mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-19 12:03:54 +02:00
Google Drive connector - txt and markdown support (#1469)
This commit is contained in:
@@ -62,6 +62,8 @@ class GDriveMimeType(str, Enum):
|
|||||||
POWERPOINT = (
|
POWERPOINT = (
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||||
)
|
)
|
||||||
|
PLAIN_TEXT = "text/plain"
|
||||||
|
MARKDOWN = "text/markdown"
|
||||||
|
|
||||||
|
|
||||||
GoogleDriveFileType = dict[str, Any]
|
GoogleDriveFileType = dict[str, Any]
|
||||||
@@ -315,12 +317,19 @@ def extract_text(file: dict[str, str], service: discovery.Resource) -> str:
|
|||||||
GDriveMimeType.DOC.value,
|
GDriveMimeType.DOC.value,
|
||||||
GDriveMimeType.PPT.value,
|
GDriveMimeType.PPT.value,
|
||||||
GDriveMimeType.SPREADSHEET.value,
|
GDriveMimeType.SPREADSHEET.value,
|
||||||
|
GDriveMimeType.PLAIN_TEXT.value,
|
||||||
|
GDriveMimeType.MARKDOWN.value,
|
||||||
]:
|
]:
|
||||||
export_mime_type = "text/plain"
|
export_mime_type = "text/plain"
|
||||||
if mime_type == GDriveMimeType.SPREADSHEET.value:
|
if mime_type == GDriveMimeType.SPREADSHEET.value:
|
||||||
export_mime_type = "text/csv"
|
export_mime_type = "text/csv"
|
||||||
elif mime_type == GDriveMimeType.PPT.value:
|
elif mime_type == GDriveMimeType.PPT.value:
|
||||||
export_mime_type = "text/plain"
|
export_mime_type = "text/plain"
|
||||||
|
elif mime_type in [
|
||||||
|
GDriveMimeType.PLAIN_TEXT.value,
|
||||||
|
GDriveMimeType.MARKDOWN.value
|
||||||
|
]:
|
||||||
|
export_mime_type = mime_type
|
||||||
|
|
||||||
response = (
|
response = (
|
||||||
service.files()
|
service.files()
|
||||||
|
Reference in New Issue
Block a user