Skip to content

Commit 3fbe84f

Browse files
author
ochafik
committed
don't return empty <think></think>
1 parent 5b9c5a4 commit 3fbe84f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

common/chat-parser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ void common_chat_msg_parser::consume_literal(const std::string & literal) {
141141

142142
bool common_chat_msg_parser::try_parse_reasoning(const std::string & start_think, const std::string & end_think) {
143143
auto handle_reasoning = [&](const std::string & reasoning, bool closed) {
144+
if (reasoning.empty()) {
145+
return;
146+
}
144147
if (syntax_.reasoning_in_content) {
145148
add_content(syntax_.reasoning_format == COMMON_REASONING_FORMAT_DEEPSEEK ? "<think>" : start_think);
146149
add_content(reasoning);

0 commit comments

Comments
 (0)