瀏覽代碼

ignore when save image fail (#2178)

### What problem does this PR solve?


### Type of change
- [x] Performance Improvement
tags/v0.11.0
Kevin Hu 1 年之前
父節點
當前提交
fc6d8ee77f
No account linked to committer's email address
共有 1 個文件被更改,包括 13 次插入8 次删除
  1. 13
    8
      rag/svr/task_executor.py

+ 13
- 8
rag/svr/task_executor.py 查看文件

@@ -206,15 +206,20 @@ def build(row):
docs.append(d)
continue

output_buffer = BytesIO()
if isinstance(d["image"], bytes):
output_buffer = BytesIO(d["image"])
else:
d["image"].save(output_buffer, format='JPEG')
try:
output_buffer = BytesIO()
if isinstance(d["image"], bytes):
output_buffer = BytesIO(d["image"])
else:
d["image"].save(output_buffer, format='JPEG')

st = timer()
MINIO.put(row["kb_id"], d["_id"], output_buffer.getvalue())
el += timer() - st
except Exception as e:
cron_logger.error(str(e))
traceback.print_exc()

st = timer()
MINIO.put(row["kb_id"], d["_id"], output_buffer.getvalue())
el += timer() - st
d["img_id"] = "{}-{}".format(row["kb_id"], d["_id"])
del d["image"]
docs.append(d)

Loading…
取消
儲存