Skip to content

Commit dd54a0d

Browse files
authored
Add files via upload
1 parent bd6ab8b commit dd54a0d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

common/chat.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ static void common_chat_parse_glm_4_5(common_chat_msg_parser & builder) {
20322032
throw common_chat_msg_partial_exception("Expected </arg_key> after <arg_key>");
20332033
}
20342034
if (key_res->groups[0].end - key_res->groups[0].begin != 10) {
2035-
gen_partial_args([&](auto &&rest, auto &&needle){arguments[key_res->prelude + needle] = "";});
2035+
gen_partial_args([&](auto &&, auto &&needle){arguments[key_res->prelude + needle] = "";});
20362036
throw common_chat_msg_partial_exception("Expected </arg_key> after <arg_key>");
20372037
}
20382038
auto &key = key_res->prelude;
@@ -2075,7 +2075,7 @@ static void common_chat_parse_glm_4_5(common_chat_msg_parser & builder) {
20752075
if (val_start == builder.pos()) {
20762076
if (auto value_plain = builder.try_find_literal("</arg_value>")) {
20772077
if (value_plain->groups[0].end - value_plain->groups[0].begin != 12) {
2078-
gen_partial_args([&](auto &&rest, auto &&needle){arguments[key] = value_plain->prelude + needle;});
2078+
gen_partial_args([&](auto &&, auto &&needle){arguments[key] = value_plain->prelude + needle;});
20792079
throw common_chat_msg_partial_exception("Expected </arg_value> after <arg_value>");
20802080
}
20812081
arguments[key] = value_plain->prelude;
@@ -2104,8 +2104,9 @@ static void common_chat_parse_glm_4_5(common_chat_msg_parser & builder) {
21042104
throw common_chat_msg_partial_exception("Failed to add GLM tool call");
21052105
}
21062106
}
2107+
2108+
builder.consume_spaces();
21072109
while (builder.pos() != builder.input().size()) {
2108-
builder.consume_spaces();
21092110
builder.try_parse_reasoning("<think>", "</think>");
21102111
builder.consume_spaces();
21112112
std::string content;
@@ -2127,6 +2128,10 @@ static void common_chat_parse_glm_4_5(common_chat_msg_parser & builder) {
21272128
}
21282129
builder.add_content(content);
21292130
}
2131+
if (!builder.try_consume_literal("<think>")) {
2132+
break;
2133+
}
2134+
builder.move_to(builder.pos() - 7);
21302135
}
21312136
}
21322137

0 commit comments

Comments
 (0)