Procházet zdrojové kódy

Fix broken data stream when writing image file (#9354)

### What problem does this PR solve?

fix "broken data stream when writing image file", just log warning and
ignore

Close #8379 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.20.2
Jay Xu před 2 měsíci
rodič
revize
ce3dd019c3
Žádný účet není propojen s e-mailovou adresou tvůrce revize
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  1. 5
    1
      rag/svr/task_executor.py

+ 5
- 1
rag/svr/task_executor.py Zobrazit soubor

@@ -304,7 +304,11 @@ async def build_chunks(task, progress_callback):
converted_image = d["image"].convert("RGB")
d["image"].close() # Close original image
d["image"] = converted_image
d["image"].save(output_buffer, format='JPEG')
try:
d["image"].save(output_buffer, format='JPEG')
except OSError as e:
logging.warning(
"Saving image of chunk {}/{}/{} got exception, ignore: {}".format(task["location"], task["name"], d["id"], str(e)))

async with minio_limiter:
await trio.to_thread.run_sync(lambda: STORAGE_IMPL.put(task["kb_id"], d["id"], output_buffer.getvalue()))

Načítá se…
Zrušit
Uložit