mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-04-23 20:26:11 +08:00
Feat: add_chunk supports add image (#13629)
### What problem does this PR solve? Add_chunk supports add image. ### Type of change - [x] New Feature (non-breaking change which adds functionality) Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
This commit is contained in:
@ -87,8 +87,11 @@ class Document(Base):
|
||||
return chunks
|
||||
raise Exception(res.get("message"))
|
||||
|
||||
def add_chunk(self, content: str, important_keywords: list[str] = [], questions: list[str] = []):
|
||||
res = self.post(f"/datasets/{self.dataset_id}/documents/{self.id}/chunks", {"content": content, "important_keywords": important_keywords, "questions": questions})
|
||||
def add_chunk(self, content: str, important_keywords: list[str] = [], questions: list[str] = [], image_base64: str | None = None):
|
||||
body = {"content": content, "important_keywords": important_keywords, "questions": questions}
|
||||
if image_base64 is not None:
|
||||
body["image_base64"] = image_base64
|
||||
res = self.post(f"/datasets/{self.dataset_id}/documents/{self.id}/chunks", body)
|
||||
res = res.json()
|
||||
if res.get("code") == 0:
|
||||
return Chunk(self.rag, res["data"].get("chunk"))
|
||||
|
||||
Reference in New Issue
Block a user