fix "GrammarMatcher has terminated after accepting the stop token, but is trying to find the next token mask" when both reasoning and spec are enabled (#14464)

This commit is contained in:
gongwei-130
2025-12-06 06:15:22 -08:00
committed by GitHub
parent 80122e4f4c
commit 3e40c63674

View File

@@ -51,6 +51,9 @@ class ReasonerGrammarObject(BaseGrammarObject):
self.grammar.accept_token(token)
self.transfer_state(token)
def is_terminated(self):
return self.grammar.is_terminated()
def rollback(self, k):
steps_after_think = min(k, self.tokens_after_think_end)
if steps_after_think > 0: