mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
refac
This commit is contained in:
parent
3d6d050ad8
commit
c9282135c4
1 changed files with 18 additions and 15 deletions
|
|
@ -411,6 +411,7 @@ async def get_file_process_status(
|
||||||
MAX_FILE_PROCESSING_DURATION = 3600 * 2
|
MAX_FILE_PROCESSING_DURATION = 3600 * 2
|
||||||
|
|
||||||
async def event_stream(file_item):
|
async def event_stream(file_item):
|
||||||
|
if file_item:
|
||||||
for _ in range(MAX_FILE_PROCESSING_DURATION):
|
for _ in range(MAX_FILE_PROCESSING_DURATION):
|
||||||
file_item = Files.get_file_by_id(file_item.id)
|
file_item = Files.get_file_by_id(file_item.id)
|
||||||
if file_item:
|
if file_item:
|
||||||
|
|
@ -430,6 +431,8 @@ async def get_file_process_status(
|
||||||
break
|
break
|
||||||
|
|
||||||
await asyncio.sleep(0.5)
|
await asyncio.sleep(0.5)
|
||||||
|
else:
|
||||||
|
yield f"data: {json.dumps({'status': 'not_found'})}\n\n"
|
||||||
|
|
||||||
return StreamingResponse(
|
return StreamingResponse(
|
||||||
event_stream(file),
|
event_stream(file),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue