mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-07-21 10:15:35 +00:00
If a slot is reused for a standard completion (`/v1/completions`) after being used for a chat completion (`/v1/chat/completions`), the previous chat's PEG parser would remain active in the slot's parameters. This caused standard text completions to throw on the raw text.
This commit is contained in:
@@ -1624,6 +1624,9 @@ bool server_context::launch_slot_with_task(server_slot& slot, server_task& task)
|
||||
slot.params.chat_parser_params.parse_tool_calls = json_value(data, "parse_tool_calls", false);
|
||||
if (data.contains("chat_parser")) {
|
||||
slot.params.chat_parser_params.parser.load(data.at("chat_parser").get<std::string>());
|
||||
} else {
|
||||
// Reset to default; otherwise a reused slot would apply the previous chat's PEG parser to non-chat outputs (e.g., /v1/completions).
|
||||
slot.params.chat_parser_params.parser = defaults.chat_parser_params.parser;
|
||||
}
|
||||
}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user