@@ -141,8 +141,8 @@ class chat_formatter {
141141 }
142142
143143 common_chat_msg new_msg;
144- if (syntax ) {
145- new_msg = common_chat_parse (content, false , *syntax );
144+ if (syntax_ptr ) {
145+ new_msg = common_chat_parse (content, false , *syntax_ptr );
146146 } else {
147147 new_msg.content = content;
148148 }
@@ -163,17 +163,17 @@ class chat_formatter {
163163
164164 common_chat_params cparams = common_chat_templates_apply (chat_templates.get (), cinputs);
165165
166- if (!syntax ) {
167- syntax .reset (new common_chat_syntax);
168- syntax ->format = cparams.format ;
169- syntax ->reasoning_format = params.reasoning_format ;
170- syntax ->thinking_forced_open = cparams.thinking_forced_open ;
171- syntax ->parse_tool_calls = false ;
166+ if (!syntax_ptr ) {
167+ syntax_ptr .reset (new common_chat_syntax);
168+ syntax_ptr ->format = cparams.format ;
169+ syntax_ptr ->reasoning_format = params.reasoning_format ;
170+ syntax_ptr ->thinking_forced_open = cparams.thinking_forced_open ;
171+ syntax_ptr ->parse_tool_calls = false ;
172172 }
173173
174174 bool use_partial_formatter = params.reasoning_format != COMMON_REASONING_FORMAT_NONE;
175175 if (!partial_formatter_ptr && use_partial_formatter) {
176- partial_formatter_ptr = std::make_unique<partial_formatter>(*syntax );
176+ partial_formatter_ptr = std::make_unique<partial_formatter>(*syntax_ptr );
177177 }
178178
179179 std::string formatted;
@@ -199,7 +199,7 @@ class chat_formatter {
199199 std::vector<common_chat_msg> & chat_msgs;
200200 const common_chat_templates_ptr & chat_templates;
201201 const common_params & params;
202- std::unique_ptr<common_chat_syntax> syntax ;
202+ std::unique_ptr<common_chat_syntax> syntax_ptr ;
203203 std::unique_ptr<partial_formatter> partial_formatter_ptr;
204204 std::string formatted_cumulative;
205205};
0 commit comments