fix: normalize episodic/compact roles to system in all LLM providers
All checks were successful
BotServer CI/CD / build (push) Successful in 4m1s
All checks were successful
BotServer CI/CD / build (push) Successful in 4m1s
This commit is contained in:
parent
d6527a438b
commit
32f8a10825
2 changed files with 12 additions and 2 deletions
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue