提示
截至2026-03-18,该问题已在主线修复。
时间
所属版本时间2026年03月08日
原因
通过Jinja控制思考模式关闭,模型输出普通文本,但llama.cpp仍然认为思考模式是启用的,故其解析器期望得到</think>,当格式不匹配时,解析失败并抛出 std::runtime_error 异常。
临时修改摘要
文件: common/chat.cpp:1549-1557
修改: 当 common_chat_peg_parse 函数中 is_partial=false 且解析失败时,将输入作为普通文本返回,而非抛出异常。
if (!is_partial) {
LOG_WRN("Parser failed at pos %zu, treating input as plain content\n", result.end);
common_chat_msg msg;
msg.role = "assistant";
msg.content = input;
return msg;
}