Merge branch 'ingestion-flow' into fix-create-task-service
This commit is contained in:
commit
28f9bfc820
5 changed files with 10 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "openrag"
|
name = "openrag"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
description = "Add your description here"
|
description = "Add your description here"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ async def connector_sync(request: Request, connector_service, session_manager):
|
||||||
max_files,
|
max_files,
|
||||||
jwt_token=jwt_token,
|
jwt_token=jwt_token,
|
||||||
)
|
)
|
||||||
|
task_ids.append(task_id)
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
{
|
{
|
||||||
"task_ids": task_ids,
|
"task_ids": task_ids,
|
||||||
|
|
|
||||||
|
|
@ -400,8 +400,9 @@ class GoogleDriveConnector(BaseConnector):
|
||||||
export_mime = self._pick_export_mime(mime_type)
|
export_mime = self._pick_export_mime(mime_type)
|
||||||
if mime_type.startswith("application/vnd.google-apps."):
|
if mime_type.startswith("application/vnd.google-apps."):
|
||||||
# default fallback if not overridden
|
# default fallback if not overridden
|
||||||
if not export_mime:
|
#if not export_mime:
|
||||||
export_mime = "application/pdf"
|
# export_mime = "application/pdf"
|
||||||
|
export_mime = "application/pdf"
|
||||||
# NOTE: export_media does not accept supportsAllDrives/includeItemsFromAllDrives
|
# NOTE: export_media does not accept supportsAllDrives/includeItemsFromAllDrives
|
||||||
request = self.service.files().export_media(fileId=file_id, mimeType=export_mime)
|
request = self.service.files().export_media(fileId=file_id, mimeType=export_mime)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,11 @@ class LangflowConnectorService:
|
||||||
filename=document.filename,
|
filename=document.filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suffix = self._get_file_extension(document.mimetype)
|
||||||
|
|
||||||
# Create temporary file from document content
|
# Create temporary file from document content
|
||||||
with tempfile.NamedTemporaryFile(
|
with tempfile.NamedTemporaryFile(
|
||||||
delete=False, suffix=self._get_file_extension(document.mimetype)
|
delete=False, suffix=suffix
|
||||||
) as tmp_file:
|
) as tmp_file:
|
||||||
tmp_file.write(document.content)
|
tmp_file.write(document.content)
|
||||||
tmp_file.flush()
|
tmp_file.flush()
|
||||||
|
|
@ -65,7 +67,7 @@ class LangflowConnectorService:
|
||||||
logger.debug("Uploading file to Langflow", filename=document.filename)
|
logger.debug("Uploading file to Langflow", filename=document.filename)
|
||||||
content = document.content
|
content = document.content
|
||||||
file_tuple = (
|
file_tuple = (
|
||||||
document.filename,
|
document.filename.replace(" ", "_").replace("/", "_")+suffix,
|
||||||
content,
|
content,
|
||||||
document.mimetype or "application/octet-stream",
|
document.mimetype or "application/octet-stream",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class LangflowFileService:
|
||||||
"[LF] Upload failed",
|
"[LF] Upload failed",
|
||||||
status_code=resp.status_code,
|
status_code=resp.status_code,
|
||||||
reason=resp.reason_phrase,
|
reason=resp.reason_phrase,
|
||||||
body=resp.text[:500],
|
body=resp.text,
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
return resp.json()
|
return resp.json()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue