Merge branch 'feat-googledrive-enhancements' of github.com:langflow-ai/openrag into feat-googledrive-enhancements

This commit is contained in:
Mike Fortman 2025-09-04 21:37:58 -05:00
commit 39e52273d7
4 changed files with 34 additions and 33 deletions

View file

@ -5,11 +5,9 @@ services:
#context: .
#dockerfile: Dockerfile
container_name: os
depends_on:
- openrag-backend
environment:
- discovery.type=single-node
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD}
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-admin123}
# Run security setup in background after OpenSearch starts
command: >
bash -c "
@ -34,7 +32,7 @@ services:
environment:
OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
OPENSEARCH_USERNAME: "admin"
OPENSEARCH_PASSWORD: ${OPENSEARCH_PASSWORD}
OPENSEARCH_PASSWORD: ${OPENSEARCH_PASSWORD:-admin123}
ports:
- "5601:5601"
@ -45,17 +43,18 @@ services:
#dockerfile: Dockerfile.backend
container_name: openrag-backend
depends_on:
- opensearch
- langflow
environment:
- OPENSEARCH_HOST=opensearch
- LANGFLOW_URL=http://langflow:7860
- LANGFLOW_PUBLIC_URL=${LANGFLOW_PUBLIC_URL}
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER}
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD}
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER:-admin}
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD:-admin123}
- FLOW_ID=${FLOW_ID}
- OPENSEARCH_PORT=9200
- OPENSEARCH_USERNAME=admin
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD}
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD:-admin123}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
- NVIDIA_VISIBLE_DEVICES=all
@ -69,6 +68,8 @@ services:
volumes:
- ./documents:/app/documents:Z
- ./keys:/app/keys:Z
ports:
- "8000:8000"
gpus: all
openrag-frontend:
@ -87,7 +88,7 @@ services:
langflow:
volumes:
- ./flows:/app/flows:Z
image: phact/langflow:responses
image: langflowai/langflow:latest
container_name: langflow
ports:
- "7860:7860"
@ -99,8 +100,8 @@ services:
- OPENRAG-QUERY-FILTER="{}"
- LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=JWT,OPENRAG-QUERY-FILTER
- LANGFLOW_LOG_LEVEL=DEBUG
- LANGFLOW_AUTO_LOGIN=${LANGFLOW_AUTO_LOGIN}
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER}
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD}
- LANGFLOW_NEW_USER_IS_ACTIVE=${LANGFLOW_NEW_USER_IS_ACTIVE}
- LANGFLOW_ENABLE_SUPERUSER_CLI=${LANGFLOW_ENABLE_SUPERUSER_CLI}
- LANGFLOW_AUTO_LOGIN=${LANGFLOW_AUTO_LOGIN:-true}
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER:-admin}
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD:-admin123}
- LANGFLOW_NEW_USER_IS_ACTIVE=${LANGFLOW_NEW_USER_IS_ACTIVE:-true}
- LANGFLOW_ENABLE_SUPERUSER_CLI=${LANGFLOW_ENABLE_SUPERUSER_CLI:-true}

View file

@ -5402,18 +5402,6 @@
"@pkgjs/parseargs": "^0.11.0"
}
},
"node_modules/jiti": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz",
"integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"bin": {
"jiti": "lib/jiti-cli.mjs"
}
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",

View file

@ -23,6 +23,9 @@ async def connector_sync(request: Request, connector_service, session_manager):
data = await request.json()
max_files = data.get("max_files")
if not data.get("selected_files"):
return JSONResponse({"error": "selected_files is required"}, status_code=400)
try:
user = request.state.user
jwt_token = request.state.jwt_token

View file

@ -168,11 +168,18 @@ class GoogleDriveConnector(BaseConnector):
# Helpers
# -------------------------
@property
def _drives_flags(self) -> Dict[str, Any]:
def _drives_get_flags(self) -> Dict[str, Any]:
"""
Common flags for ALL Drive calls to ensure Shared Drives are included.
Flags valid for GET-like calls (files.get, changes.getStartPageToken).
"""
return dict(supportsAllDrives=True, includeItemsFromAllDrives=True)
return {"supportsAllDrives": True}
@property
def _drives_list_flags(self) -> Dict[str, Any]:
"""
Flags valid for LIST-like calls (files.list, changes.list).
"""
return {"supportsAllDrives": True, "includeItemsFromAllDrives": True}
def _pick_corpora_args(self) -> Dict[str, Any]:
"""
@ -241,7 +248,7 @@ class GoogleDriveConnector(BaseConnector):
"id, name, mimeType, modifiedTime, createdTime, size, "
"webViewLink, parents, shortcutDetails, driveId)"
),
**self._drives_flags,
**self._drives_list_flags,
**self._pick_corpora_args(),
)
.execute()
@ -292,7 +299,7 @@ class GoogleDriveConnector(BaseConnector):
"id, name, mimeType, modifiedTime, createdTime, size, "
"webViewLink, parents, shortcutDetails, driveId"
),
**self._drives_flags,
**self._drives_get_flags,
)
.execute()
)
@ -396,9 +403,10 @@ class GoogleDriveConnector(BaseConnector):
# default fallback if not overridden
if not export_mime:
export_mime = "application/pdf"
# NOTE: export_media does not accept supportsAllDrives/includeItemsFromAllDrives
request = self.service.files().export_media(fileId=file_id, mimeType=export_mime)
else:
# Binary download
# Binary download (get_media also doesn't accept the Drive flags)
request = self.service.files().get_media(fileId=file_id)
fh = io.BytesIO()
@ -846,7 +854,8 @@ class GoogleDriveConnector(BaseConnector):
# Changes API (polling or webhook-backed)
# -------------------------
def get_start_page_token(self) -> str:
resp = self.service.changes().getStartPageToken(**self._drives_flags).execute()
# getStartPageToken accepts supportsAllDrives (not includeItemsFromAllDrives)
resp = self.service.changes().getStartPageToken(**self._drives_get_flags).execute()
return resp["startPageToken"]
def poll_changes_and_sync(self) -> Optional[str]:
@ -867,7 +876,7 @@ class GoogleDriveConnector(BaseConnector):
"changes(fileId, file(id, name, mimeType, trashed, parents, "
"shortcutDetails, driveId, modifiedTime, webViewLink))"
),
**self._drives_flags,
**self._drives_list_flags,
)
.execute()
)