File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,10 @@ std::optional<common_chat_msg_parser::find_regex_result> common_chat_msg_parser:
160160 return std::nullopt ;
161161 }
162162 if (m.type == COMMON_REGEX_MATCH_TYPE_PARTIAL) {
163- incomplete (regex.str ());
163+ if (is_partial ()) {
164+ incomplete (regex.str ());
165+ }
166+ return std::nullopt ;
164167 }
165168 auto prelude = input_.substr (pos_, m.groups [0 ].begin - pos_);
166169 pos_ = m.groups [0 ].end ;
Original file line number Diff line number Diff line change @@ -1494,6 +1494,11 @@ static void common_chat_parse_hermes_2_pro(common_chat_msg_parser & builder) {
14941494 );
14951495
14961496 if (auto res = builder.try_find_regex (open_regex)) {
1497+ if (res->groups [0 ].begin != 0 && res->groups [4 ].empty () && res->groups [5 ].empty ()) {
1498+ // The only syntax we allow after the very start is <function=...> or <function name=...>
1499+ builder.add_content (builder.consume_rest ());
1500+ return ;
1501+ }
14971502 GGML_ASSERT (res->prelude .empty ()); // matching at_start
14981503
14991504 const auto & block_start = res->groups [1 ];
You can’t perform that action at this time.
0 commit comments