diff --git a/__pycache__/app.cpython-312.pyc b/__pycache__/app.cpython-312.pyc index a409ade..f92d23f 100644 Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ diff --git a/app.py b/app.py index ce65fdc..3d2d2f0 100644 --- a/app.py +++ b/app.py @@ -18,6 +18,7 @@ def create_app(): # --- Configuration --- app.config.from_mapping( SQLALCHEMY_DATABASE_URI=os.environ.get('DATABASE_URL'), + SQLALCHEMY_ENGINE_OPTIONS={'pool_recycle': 3600}, JWT_SECRET_KEY=os.environ.get('JWT_SECRET_KEY'), SQLALCHEMY_TRACK_MODIFICATIONS=False, JWT_ACCESS_TOKEN_EXPIRES=timedelta(days=3), diff --git a/frontend/src/pages/ProcessingPage.jsx b/frontend/src/pages/ProcessingPage.jsx index 1dfbde6..c34b19a 100644 --- a/frontend/src/pages/ProcessingPage.jsx +++ b/frontend/src/pages/ProcessingPage.jsx @@ -93,7 +93,14 @@ const ProcessingPage = () => { const intervalId = setInterval(async () => { try { const updatedTask = await pollTaskStatus(task.status_url); - // Pass the full task object to avoid stale closures + + // FIX: Check for inner 'Error' status even if Celery task state is 'SUCCESS' + if (updatedTask.state === 'SUCCESS' && updatedTask.info?.status === 'Error') { + handleTaskUpdate(key, { ...task, state: 'FAILURE', info: { ...task.info, error: updatedTask.info.error || 'Task failed with an unknown error.' } }); + clearInterval(intervalId); + return; + } + handleTaskUpdate(key, { ...task, ...updatedTask }); if (['SUCCESS', 'FAILURE', 'REVOKED'].includes(updatedTask.state)) { clearInterval(intervalId); diff --git a/tasks.py b/tasks.py index 5b7e311..c204708 100644 --- a/tasks.py +++ b/tasks.py @@ -88,7 +88,7 @@ def run_dify_stt_chat_app(file_id: str) -> str: f"{DIFY_API_BASE_URL}/chat-messages", headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, json=payload, - timeout=600 + timeout=1800 ) print("Dify STT API Response:", r.status_code, r.text) # DEBUG PRINT