diff --git a/backend/Dockerfile b/backend/Dockerfile index b2b0e42..46d0c97 100755 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -28,6 +28,9 @@ COPY reference_docs/ ./reference_docs/ # Set reference docs path for container ENV REFERENCE_DOCS_PATH=/app/reference_docs +# Set file storage path for container +ENV FILE_STORAGE_PATH=/app/storage + EXPOSE 8000 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/backend/app/websocket/handlers.py b/backend/app/websocket/handlers.py index df7c4d5..b007d33 100755 --- a/backend/app/websocket/handlers.py +++ b/backend/app/websocket/handlers.py @@ -148,9 +148,9 @@ async def handle_analyze_message( file_type=file_type, ) - # Generate thumbnail for small files + # Generate thumbnail for images up to 10MB (data URLs are ~33% larger than binary) thumbnail_url = None - if len(file_data) < 500000: # < 500KB + if len(file_data) < 10000000 and file_type.startswith('image/'): thumbnail_url = await storage_service.generate_thumbnail_data_url(file_data, file_type) # Save proof and version diff --git a/docker-compose.yml b/docker-compose.yml index 5963351..7b44d12 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,9 @@ services: - HOST=0.0.0.0 - PORT=8000 - DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-modcomms}:${POSTGRES_PASSWORD:-modcomms_dev}@postgres:5432/${POSTGRES_DB:-modcomms} + - FILE_STORAGE_PATH=/app/storage + volumes: + - file_storage:/app/storage depends_on: postgres: condition: service_healthy @@ -42,3 +45,4 @@ services: volumes: postgres_data: + file_storage: diff --git a/frontend/services/apiService.ts b/frontend/services/apiService.ts index a87dd5b..1220945 100755 --- a/frontend/services/apiService.ts +++ b/frontend/services/apiService.ts @@ -184,7 +184,7 @@ class ApiService { async getFile(storageKey: string): Promise { const headers = await this.getHeaders(); - const response = await fetch(`${API_URL}/api/files/${encodeURIComponent(storageKey)}`, { headers }); + const response = await fetch(`${API_URL}/api/files/${storageKey}`, { headers }); if (!response.ok) { throw new Error(`Failed to fetch file: HTTP ${response.status}`); }