universal gemma4 fix, add memory check

This commit is contained in:
Concedo
2026-04-06 19:20:44 +08:00
parent a309086735
commit f6e712d919
+5 -3
View File
@@ -3857,12 +3857,14 @@ generation_outputs gpttype_generate(const generation_inputs inputs)
const std::string channel_close = "<channel|>";
const std::string channel_prefix = channel_open + channel_close;
const bool has_open = kcpp_data->prompt.find(channel_open) != std::string::npos;
const bool has_close = kcpp_data->prompt.find(channel_close) != std::string::npos;
const std::string fullbody = addedmemory + kcpp_data->prompt;
const bool has_open = fullbody.find(channel_open) != std::string::npos;
const bool has_close = fullbody.find(channel_close) != std::string::npos;
// If neither opening nor closing tag is present anywhere, prepend both
if (!has_open && !has_close) {
kcpp_data->prompt = channel_prefix + kcpp_data->prompt;
addedmemory = channel_prefix + addedmemory;
}
}
}