fix5
This commit is contained in:
Binary file not shown.
1
app.py
1
app.py
@@ -18,6 +18,7 @@ def create_app():
|
|||||||
# --- Configuration ---
|
# --- Configuration ---
|
||||||
app.config.from_mapping(
|
app.config.from_mapping(
|
||||||
SQLALCHEMY_DATABASE_URI=os.environ.get('DATABASE_URL'),
|
SQLALCHEMY_DATABASE_URI=os.environ.get('DATABASE_URL'),
|
||||||
|
SQLALCHEMY_ENGINE_OPTIONS={'pool_recycle': 3600},
|
||||||
JWT_SECRET_KEY=os.environ.get('JWT_SECRET_KEY'),
|
JWT_SECRET_KEY=os.environ.get('JWT_SECRET_KEY'),
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS=False,
|
SQLALCHEMY_TRACK_MODIFICATIONS=False,
|
||||||
JWT_ACCESS_TOKEN_EXPIRES=timedelta(days=3),
|
JWT_ACCESS_TOKEN_EXPIRES=timedelta(days=3),
|
||||||
|
@@ -93,7 +93,14 @@ const ProcessingPage = () => {
|
|||||||
const intervalId = setInterval(async () => {
|
const intervalId = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
const updatedTask = await pollTaskStatus(task.status_url);
|
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 });
|
handleTaskUpdate(key, { ...task, ...updatedTask });
|
||||||
if (['SUCCESS', 'FAILURE', 'REVOKED'].includes(updatedTask.state)) {
|
if (['SUCCESS', 'FAILURE', 'REVOKED'].includes(updatedTask.state)) {
|
||||||
clearInterval(intervalId);
|
clearInterval(intervalId);
|
||||||
|
2
tasks.py
2
tasks.py
@@ -88,7 +88,7 @@ def run_dify_stt_chat_app(file_id: str) -> str:
|
|||||||
f"{DIFY_API_BASE_URL}/chat-messages",
|
f"{DIFY_API_BASE_URL}/chat-messages",
|
||||||
headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
|
headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
|
||||||
json=payload,
|
json=payload,
|
||||||
timeout=600
|
timeout=1800
|
||||||
)
|
)
|
||||||
|
|
||||||
print("Dify STT API Response:", r.status_code, r.text) # DEBUG PRINT
|
print("Dify STT API Response:", r.status_code, r.text) # DEBUG PRINT
|
||||||
|
Reference in New Issue
Block a user