mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: miss calculate of token number. (#6401)
### What problem does this PR solve? #6308 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -59,7 +59,7 @@ class Extractor:
|
|||||||
response = get_llm_cache(self._llm.llm_name, system, hist, conf)
|
response = get_llm_cache(self._llm.llm_name, system, hist, conf)
|
||||||
if response:
|
if response:
|
||||||
return response
|
return response
|
||||||
_, system_msg = message_fit_in([{"role": "system", "content": system}], int(self._llm.max_length * 0.97))
|
_, system_msg = message_fit_in([{"role": "system", "content": system}], int(self._llm.max_length * 0.92))
|
||||||
response = self._llm.chat(system_msg[0]["content"], hist, conf)
|
response = self._llm.chat(system_msg[0]["content"], hist, conf)
|
||||||
response = re.sub(r"<think>.*</think>", "", response, flags=re.DOTALL)
|
response = re.sub(r"<think>.*</think>", "", response, flags=re.DOTALL)
|
||||||
if response.find("**ERROR**") >= 0:
|
if response.find("**ERROR**") >= 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user