Skip to content

Commit c50d887

Browse files
committed
Try using try_find_literal instead of regex
1 parent 3d00d62 commit c50d887

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

common/chat.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,16 +1352,15 @@ 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-
static const common_regex thinking_end_regex("</think>");
1356-
if (auto res = builder.try_find_regex(thinking_end_regex, std::string::npos, false)) {
1355+
if (auto res = builder.try_find_literal("</think>")) {
13571356
// The prelude contains everything before the "</think>" tag
13581357
auto stripped_reasoning = string_strip(res->prelude);
13591358

13601359
if (!stripped_reasoning.empty()) {
13611360
builder.add_reasoning_content(stripped_reasoning);
13621361
}
13631362

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

0 commit comments

Comments
 (0)