Feat: Add question parameter to edit chunk modal (#3875)

### What problem does this PR solve?

Close #3873

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Kevin Hu
2024-12-05 14:51:19 +08:00
committed by GitHub
parent b502dc7399
commit 56f473b680
8 changed files with 55 additions and 24 deletions

View File

@ -6,6 +6,7 @@ class Chunk(Base):
self.id = ""
self.content = ""
self.important_keywords = []
self.questions = []
self.create_time = ""
self.create_timestamp = 0.0
self.dataset_id = None

View File

@ -61,9 +61,9 @@ class Document(Base):
return chunks
raise Exception(res.get("message"))
def add_chunk(self, content: str,important_keywords: list[str] = []):
res = self.post(f'/datasets/{self.dataset_id}/documents/{self.id}/chunks', {"content":content,"important_keywords":important_keywords})
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})
res = res.json()
if res.get("code") == 0:
return Chunk(self.rag,res["data"].get("chunk"))