diff --git a/apps/jmidjourney/api.py b/apps/jmidjourney/api.py index 30fb303..b6e653f 100644 --- a/apps/jmidjourney/api.py +++ b/apps/jmidjourney/api.py @@ -40,7 +40,11 @@ async def ve_generate_image(data: dict, request: Request): yield json.dumps(result, ensure_ascii=False) + "\n" return StreamingResponse( - generate(), + generate(), media_type="application/x-ndjson", - headers={"X-Content-Type-Options": "nosniff"} + headers={ + "Cache-Control": "no-cache", + "X-Accel-Buffering": "no", + "X-Content-Type-Options": "nosniff" + } ) diff --git a/apps/jmidjourney/service.py b/apps/jmidjourney/service.py index 0ec6dcf..37799df 100644 --- a/apps/jmidjourney/service.py +++ b/apps/jmidjourney/service.py @@ -447,4 +447,4 @@ class MidjourneyService: "status": "error", "message": f"任务超时,已轮询 {settings.vectorengine_max_polling_attempts} 次", "task_id": task_id - } + } \ No newline at end of file