File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -1328,12 +1328,8 @@ static common_chat_params common_chat_params_init_deepseek_v3_1(const common_cha
13281328 additional_context);
13291329 data.prompt = prompt;
13301330 data.format = COMMON_CHAT_FORMAT_DEEPSEEK_V3_1;
1331- if (string_ends_with (data.prompt , " <think>\n " )) {
1332- if (!inputs.enable_thinking ) {
1333- data.prompt += " </think>" ;
1334- } else {
1335- data.thinking_forced_open = true ;
1336- }
1331+ if (inputs.enable_thinking ) {
1332+ data.thinking_forced_open = true ;
13371333 }
13381334 return data;
13391335}
@@ -1377,8 +1373,13 @@ static void common_chat_parse_deepseek_v3_1(common_chat_msg_parser & builder) {
13771373 // The rest is regular content
13781374 builder.add_content (builder.consume_rest ());
13791375 } else {
1380- // If no "</think>" tag found, treat everything as regular content
1381- builder.add_reasoning_content (builder.consume_rest ());
1376+ if (builder.syntax ().thinking_forced_open ) {
1377+ // If no "</think>" tag found, treat everything as reasoning content
1378+ builder.add_reasoning_content (builder.consume_rest ());
1379+ } else {
1380+ // If no "</think>" tag found, treat everything as regular content
1381+ builder.add_content (builder.consume_rest ());
1382+ }
13821383 }
13831384}
13841385
You can’t perform that action at this time.
0 commit comments