Feat: Enable image edit in edit_chunk (#11971)

### What problem does this PR solve?

Feat: Enable image edit in edit_chunk

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Magicbook1108
2025-12-16 17:57:00 +08:00
committed by GitHub
parent bccad7b4a8
commit 344a106eba

View File

@ -17,7 +17,7 @@ import asyncio
import datetime
import json
import re
import base64
import xxhash
from quart import request
@ -174,6 +174,12 @@ async def set():
v = 0.1 * v[0] + 0.9 * v[1] if doc.parser_id != ParserType.QA else v[1]
_d["q_%d_vec" % len(v)] = v.tolist()
settings.docStoreConn.update({"id": req["chunk_id"]}, _d, search.index_name(tenant_id), doc.kb_id)
# update image
image_base64 = req.get("image_base64", None)
if image_base64:
image_binary = base64.b64decode(image_base64)
settings.STORAGE_IMPL.put(req["doc_id"], req["chunk_id"], image_binary)
return get_json_result(data=True)
return await asyncio.to_thread(_set_sync)