From 0e558302a2daf5ecd671c14e84a52be1b89490e7 Mon Sep 17 00:00:00 2001 From: CNE FICHEPOIL Pierre Date: Tue, 26 Aug 2025 14:48:26 +0200 Subject: [PATCH] fix thinking-content eating closing think tag | ref #8953 --- common/chat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/chat.cpp b/common/chat.cpp index 6e087625a5..154b2a352d 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -1829,7 +1829,7 @@ static common_chat_params common_chat_params_init_hermes_2_pro(const common_chat auto tool_call = builder.add_rule("tool_call", string_join(tool_call_alts, " | ")); builder.add_rule("thinking-start", "\"\""); - builder.add_rule("thinking-content", "[^\\x00]*"); + builder.add_rule("thinking-content", "( [^<] | \"<\" [^/] | \"] )*"); builder.add_rule("thinking-end", "\"\" space"); //thinking grammar logic depending on if thinking_forced_open was to true (so already opened (and maybe closed)) and if thinking is even allowed