refactor ProgressHelper

This commit is contained in:
jxxghp
2025-08-24 09:02:55 +08:00
parent ba146e13ef
commit 71a9fe10f4
6 changed files with 99 additions and 97 deletions

View File

@@ -254,14 +254,14 @@ async def get_progress(request: Request, process_type: str, _: schemas.TokenPayl
"""
实时获取处理进度返回格式为SSE
"""
progress = ProgressHelper()
progress = ProgressHelper(process_type)
async def event_generator():
try:
while not global_vars.is_system_stopped:
if await request.is_disconnected():
break
detail = progress.get(process_type)
detail = progress.get()
yield f"data: {json.dumps(detail)}\n\n"
await asyncio.sleep(0.5)
except asyncio.CancelledError: