This commit is contained in:
beabigegg
2025-08-17 17:58:54 +08:00
parent 957743d83a
commit 9a263b6afb
4 changed files with 10 additions and 2 deletions

Binary file not shown.

1
app.py
View File

@@ -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),

View File

@@ -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);

View File

@@ -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