Merge branch 'feat-googledrive-enhancements' of github.com:langflow-ai/openrag into feat-googledrive-enhancements
This commit is contained in:
commit
39e52273d7
4 changed files with 34 additions and 33 deletions
|
|
@ -5,11 +5,9 @@ services:
|
||||||
#context: .
|
#context: .
|
||||||
#dockerfile: Dockerfile
|
#dockerfile: Dockerfile
|
||||||
container_name: os
|
container_name: os
|
||||||
depends_on:
|
|
||||||
- openrag-backend
|
|
||||||
environment:
|
environment:
|
||||||
- discovery.type=single-node
|
- 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
|
# Run security setup in background after OpenSearch starts
|
||||||
command: >
|
command: >
|
||||||
bash -c "
|
bash -c "
|
||||||
|
|
@ -34,7 +32,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
|
OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
|
||||||
OPENSEARCH_USERNAME: "admin"
|
OPENSEARCH_USERNAME: "admin"
|
||||||
OPENSEARCH_PASSWORD: ${OPENSEARCH_PASSWORD}
|
OPENSEARCH_PASSWORD: ${OPENSEARCH_PASSWORD:-admin123}
|
||||||
ports:
|
ports:
|
||||||
- "5601:5601"
|
- "5601:5601"
|
||||||
|
|
||||||
|
|
@ -45,17 +43,18 @@ services:
|
||||||
#dockerfile: Dockerfile.backend
|
#dockerfile: Dockerfile.backend
|
||||||
container_name: openrag-backend
|
container_name: openrag-backend
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- opensearch
|
||||||
- langflow
|
- langflow
|
||||||
environment:
|
environment:
|
||||||
- OPENSEARCH_HOST=opensearch
|
- OPENSEARCH_HOST=opensearch
|
||||||
- LANGFLOW_URL=http://langflow:7860
|
- LANGFLOW_URL=http://langflow:7860
|
||||||
- LANGFLOW_PUBLIC_URL=${LANGFLOW_PUBLIC_URL}
|
- LANGFLOW_PUBLIC_URL=${LANGFLOW_PUBLIC_URL}
|
||||||
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER}
|
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER:-admin}
|
||||||
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD}
|
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD:-admin123}
|
||||||
- FLOW_ID=${FLOW_ID}
|
- FLOW_ID=${FLOW_ID}
|
||||||
- OPENSEARCH_PORT=9200
|
- OPENSEARCH_PORT=9200
|
||||||
- OPENSEARCH_USERNAME=admin
|
- OPENSEARCH_USERNAME=admin
|
||||||
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD}
|
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD:-admin123}
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||||||
- NVIDIA_VISIBLE_DEVICES=all
|
- NVIDIA_VISIBLE_DEVICES=all
|
||||||
|
|
@ -69,6 +68,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./documents:/app/documents:Z
|
- ./documents:/app/documents:Z
|
||||||
- ./keys:/app/keys:Z
|
- ./keys:/app/keys:Z
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
gpus: all
|
gpus: all
|
||||||
|
|
||||||
openrag-frontend:
|
openrag-frontend:
|
||||||
|
|
@ -87,7 +88,7 @@ services:
|
||||||
langflow:
|
langflow:
|
||||||
volumes:
|
volumes:
|
||||||
- ./flows:/app/flows:Z
|
- ./flows:/app/flows:Z
|
||||||
image: phact/langflow:responses
|
image: langflowai/langflow:latest
|
||||||
container_name: langflow
|
container_name: langflow
|
||||||
ports:
|
ports:
|
||||||
- "7860:7860"
|
- "7860:7860"
|
||||||
|
|
@ -99,8 +100,8 @@ services:
|
||||||
- OPENRAG-QUERY-FILTER="{}"
|
- OPENRAG-QUERY-FILTER="{}"
|
||||||
- LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=JWT,OPENRAG-QUERY-FILTER
|
- LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=JWT,OPENRAG-QUERY-FILTER
|
||||||
- LANGFLOW_LOG_LEVEL=DEBUG
|
- LANGFLOW_LOG_LEVEL=DEBUG
|
||||||
- LANGFLOW_AUTO_LOGIN=${LANGFLOW_AUTO_LOGIN}
|
- LANGFLOW_AUTO_LOGIN=${LANGFLOW_AUTO_LOGIN:-true}
|
||||||
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER}
|
- LANGFLOW_SUPERUSER=${LANGFLOW_SUPERUSER:-admin}
|
||||||
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD}
|
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_SUPERUSER_PASSWORD:-admin123}
|
||||||
- LANGFLOW_NEW_USER_IS_ACTIVE=${LANGFLOW_NEW_USER_IS_ACTIVE}
|
- LANGFLOW_NEW_USER_IS_ACTIVE=${LANGFLOW_NEW_USER_IS_ACTIVE:-true}
|
||||||
- LANGFLOW_ENABLE_SUPERUSER_CLI=${LANGFLOW_ENABLE_SUPERUSER_CLI}
|
- LANGFLOW_ENABLE_SUPERUSER_CLI=${LANGFLOW_ENABLE_SUPERUSER_CLI:-true}
|
||||||
|
|
|
||||||
12
frontend/package-lock.json
generated
12
frontend/package-lock.json
generated
|
|
@ -5402,18 +5402,6 @@
|
||||||
"@pkgjs/parseargs": "^0.11.0"
|
"@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": {
|
"node_modules/js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ async def connector_sync(request: Request, connector_service, session_manager):
|
||||||
data = await request.json()
|
data = await request.json()
|
||||||
max_files = data.get("max_files")
|
max_files = data.get("max_files")
|
||||||
|
|
||||||
|
if not data.get("selected_files"):
|
||||||
|
return JSONResponse({"error": "selected_files is required"}, status_code=400)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user = request.state.user
|
user = request.state.user
|
||||||
jwt_token = request.state.jwt_token
|
jwt_token = request.state.jwt_token
|
||||||
|
|
|
||||||
|
|
@ -168,11 +168,18 @@ class GoogleDriveConnector(BaseConnector):
|
||||||
# Helpers
|
# Helpers
|
||||||
# -------------------------
|
# -------------------------
|
||||||
@property
|
@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]:
|
def _pick_corpora_args(self) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
|
|
@ -241,7 +248,7 @@ class GoogleDriveConnector(BaseConnector):
|
||||||
"id, name, mimeType, modifiedTime, createdTime, size, "
|
"id, name, mimeType, modifiedTime, createdTime, size, "
|
||||||
"webViewLink, parents, shortcutDetails, driveId)"
|
"webViewLink, parents, shortcutDetails, driveId)"
|
||||||
),
|
),
|
||||||
**self._drives_flags,
|
**self._drives_list_flags,
|
||||||
**self._pick_corpora_args(),
|
**self._pick_corpora_args(),
|
||||||
)
|
)
|
||||||
.execute()
|
.execute()
|
||||||
|
|
@ -292,7 +299,7 @@ class GoogleDriveConnector(BaseConnector):
|
||||||
"id, name, mimeType, modifiedTime, createdTime, size, "
|
"id, name, mimeType, modifiedTime, createdTime, size, "
|
||||||
"webViewLink, parents, shortcutDetails, driveId"
|
"webViewLink, parents, shortcutDetails, driveId"
|
||||||
),
|
),
|
||||||
**self._drives_flags,
|
**self._drives_get_flags,
|
||||||
)
|
)
|
||||||
.execute()
|
.execute()
|
||||||
)
|
)
|
||||||
|
|
@ -396,9 +403,10 @@ class GoogleDriveConnector(BaseConnector):
|
||||||
# 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"
|
||||||
|
# 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:
|
||||||
# Binary download
|
# Binary download (get_media also doesn't accept the Drive flags)
|
||||||
request = self.service.files().get_media(fileId=file_id)
|
request = self.service.files().get_media(fileId=file_id)
|
||||||
|
|
||||||
fh = io.BytesIO()
|
fh = io.BytesIO()
|
||||||
|
|
@ -846,7 +854,8 @@ class GoogleDriveConnector(BaseConnector):
|
||||||
# Changes API (polling or webhook-backed)
|
# Changes API (polling or webhook-backed)
|
||||||
# -------------------------
|
# -------------------------
|
||||||
def get_start_page_token(self) -> str:
|
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"]
|
return resp["startPageToken"]
|
||||||
|
|
||||||
def poll_changes_and_sync(self) -> Optional[str]:
|
def poll_changes_and_sync(self) -> Optional[str]:
|
||||||
|
|
@ -867,7 +876,7 @@ class GoogleDriveConnector(BaseConnector):
|
||||||
"changes(fileId, file(id, name, mimeType, trashed, parents, "
|
"changes(fileId, file(id, name, mimeType, trashed, parents, "
|
||||||
"shortcutDetails, driveId, modifiedTime, webViewLink))"
|
"shortcutDetails, driveId, modifiedTime, webViewLink))"
|
||||||
),
|
),
|
||||||
**self._drives_flags,
|
**self._drives_list_flags,
|
||||||
)
|
)
|
||||||
.execute()
|
.execute()
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue