refine components retrieval and rewrite (#2818)

### What problem does this PR solve?


### Type of change

- [x] Performance Improvement
This commit is contained in:
Kevin Hu
2024-10-12 18:47:25 +08:00
committed by GitHub
parent a20b82092f
commit 7d80fc474c
2 changed files with 14 additions and 7 deletions

View File

@ -91,7 +91,11 @@ class RewriteQuestion(Generate, ABC):
raise Exception("Sorry! Nothing relevant found.")
self._loop += 1
conv = self._canvas.get_history(4)
hist = self._canvas.get_history(4)
conv = []
for m in hist:
if m["role"] not in ["user", "assistant"]: continue
conv.append("{}: {}".format(m["role"].upper(), m["content"]))
conv = "\n".join(conv)
chat_mdl = LLMBundle(self._canvas.get_tenant_id(), LLMType.CHAT, self._param.llm_id)