fix(helpers): restore tiktoken fallback in estimate_prompt_tokens_chain

This commit is contained in:
yorkhellen
2026-05-02 00:07:45 +08:00
committed by Xubin Ren
parent fd1a5a6267
commit ee364c6ac1
+1
View File
@@ -431,6 +431,7 @@ def estimate_prompt_tokens_chain(
tokens, source = provider_counter(messages, tools, model)
if isinstance(tokens, (int, float)) and tokens > 0:
return int(tokens), str(source or "provider_counter")
estimated = estimate_prompt_tokens(messages, tools)
if estimated > 0:
return int(estimated), "tiktoken"
return 0, "none"