Refactor Chunk API (#2855)

### What problem does this PR solve?

Refactor Chunk API
#2846
### Type of change


- [x] Refactoring

---------

Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn>
Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
liuhua
2024-10-16 18:41:24 +08:00
committed by GitHub
parent b9fa00f341
commit dab92ac1e8
11 changed files with 760 additions and 791 deletions

View File

@@ -15,8 +15,8 @@ class Session(Base):
for message in self.messages:
if "reference" in message:
message.pop("reference")
res = self.post(f"/chat/{self.chat_id}/session/{self.id}/completion",
{"question": question, "stream": True}, stream=stream)
res = self.post(f"/chat/{self.chat_id}/completion",
{"question": question, "stream": True,"session_id":self.id}, stream=stream)
for line in res.iter_lines():
line = line.decode("utf-8")
if line.startswith("{"):
@@ -82,3 +82,4 @@ class Chunk(Base):
self.term_similarity = None
self.positions = None
super().__init__(rag, res_dict)