Skip to content

Commit 79f7ca3

Browse files
committed
Revert "Try using try_find_literal instead of regex"
This reverts commit c50d887.
1 parent 3f319aa commit 79f7ca3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

common/chat.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,15 +1352,16 @@ static void common_chat_parse_deepseek_v3_1(common_chat_msg_parser & builder) {
13521352
// There's no opening "<think>" tag, so we need to handle this differently
13531353

13541354
// First, try to find the "</think>" tag that separates thinking from regular content
1355-
if (auto res = builder.try_find_literal("</think>")) {
1355+
static const common_regex thinking_end_regex("</think>");
1356+
if (auto res = builder.try_find_regex(thinking_end_regex, std::string::npos, false)) {
13561357
// The prelude contains everything before the "</think>" tag
13571358
auto stripped_reasoning = string_strip(res->prelude);
13581359

13591360
if (!stripped_reasoning.empty()) {
13601361
builder.add_reasoning_content(stripped_reasoning);
13611362
}
13621363

1363-
// The parser position is already advanced past the "</think>" tag by try_find_literal
1364+
// The parser position is already advanced past the "</think>" tag by try_find_regex
13641365
// The rest is regular content
13651366
builder.add_content(builder.consume_rest());
13661367
} else {

0 commit comments

Comments
 (0)