File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -129,17 +129,18 @@ void common_chat_msg_parser::consume_literal(const std::string & literal) {
129129
130130bool common_chat_msg_parser::try_parse_reasoning (const std::string & start_think, const std::string & end_think) {
131131 auto handle_reasoning = [&](const std::string & reasoning, bool closed) {
132- if (reasoning.empty ()) {
132+ auto stripped_reasoning = string_strip (reasoning);
133+ if (stripped_reasoning.empty ()) {
133134 return ;
134135 }
135136 if (syntax_.reasoning_in_content ) {
136137 add_content (syntax_.reasoning_format == COMMON_REASONING_FORMAT_DEEPSEEK ? " <think>" : start_think);
137- add_content (reasoning );
138+ add_content (stripped_reasoning );
138139 if (closed) {
139140 add_content (syntax_.reasoning_format == COMMON_REASONING_FORMAT_DEEPSEEK ? " </think>" : end_think);
140141 }
141142 } else {
142- add_reasoning_content (reasoning );
143+ add_reasoning_content (stripped_reasoning );
143144 }
144145 };
145146 if (syntax_.reasoning_format != COMMON_REASONING_FORMAT_NONE) {
You can’t perform that action at this time.
0 commit comments