fix: normalize episodic/compact roles to system in all LLM providers
All checks were successful
BotServer CI/CD / build (push) Successful in 4m1s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-14 13:47:18 -03:00
parent d6527a438b
commit 32f8a10825
2 changed files with 12 additions and 2 deletions

View file

@ -207,8 +207,13 @@ impl LLMProvider for GLMClient {
let role = m.get("role")?.as_str()?;
let content = m.get("content")?.as_str()?;
let sanitized = Self::sanitize_utf8(content);
let normalized_role = match role {
"user" | "assistant" | "system" | "tool" => role,
"episodic" | "compact" => "system",
_ => "user",
};
Some(GLMMessage {
role: role.to_string(),
role: normalized_role.to_string(),
content: Some(sanitized),
tool_calls: None,
})

View file

@ -211,8 +211,13 @@ impl LLMProvider for KimiClient {
let role = m.get("role")?.as_str()?;
let content = m.get("content")?.as_str()?;
let sanitized = Self::sanitize_utf8(content);
let normalized_role = match role {
"user" | "assistant" | "system" | "tool" => role,
"episodic" | "compact" => "system",
_ => "user",
};
Some(KimiMessage {
role: role.to_string(),
role: normalized_role.to_string(),
content: Some(sanitized),
tool_calls: None,
})