mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Enhance the robustness of the code (#1879)
### What problem does this PR solve? Enhance the robustness of the code ### Type of change - [x] Refactoring --------- Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
This commit is contained in:
@ -72,7 +72,7 @@ class Base(ABC):
|
||||
+ num_tokens_from_string(resp.choices[0].delta.content)
|
||||
)
|
||||
if not hasattr(resp, "usage") or not resp.usage
|
||||
else resp.usage["total_tokens"]
|
||||
else resp.usage.get("total_tokens",total_tokens)
|
||||
)
|
||||
if resp.choices[0].finish_reason == "length":
|
||||
ans += "...\nFor the content length reason, it stopped, continue?" if is_english(
|
||||
|
||||
Reference in New Issue
Block a user