fix(chat-channel): use session agent in responding indicator and localize command messages

- Replace hardcoded "Claude Code" in agent_responding with each session's actual AgentType label; store agent_type on ActiveSession and populate it in both task-start and resume paths
- Remove silent ClaudeCode fallback in resolve_agent_type; /task now prompts the user to pick an agent when none is selected and the folder has no default
- Move session command strings out of session_commands.rs into i18n.rs with full 10-language coverage (en/zh-CN/zh-TW/ja/ko/es/de/fr/pt/ar)
- Fix French accent and wrap Latin agent name with Arabic bidi isolates (FSI/PDI) for consistent rendering across Telegram/Lark/WeiXin clients
- Release the bridge lock before the get_lang DB lookup in the content_delta flush path to avoid cross-session contention
- Log unknown agent_type fallback in conversation_service::parse_agent_type for observability
This commit is contained in:
xintaofei
2026-04-18 20:05:56 +08:00
parent dcaa4b4f5a
commit ff9fbad50a
5 changed files with 873 additions and 256 deletions

View File

@@ -99,8 +99,18 @@ pub async fn soft_delete(conn: &DatabaseConnection, conversation_id: i32) -> Res
}
fn parse_agent_type(s: &str) -> AgentType {
serde_json::from_value(serde_json::Value::String(s.to_string()))
.unwrap_or(AgentType::ClaudeCode)
match serde_json::from_value(serde_json::Value::String(s.to_string())) {
Ok(at) => at,
Err(_) => {
// DB has a value the enum does not recognise (manual edit or removed variant).
// Fall back to ClaudeCode so the row stays readable, but log so resume-as-wrong-agent
// regressions are traceable.
eprintln!(
"[conversation_service] unknown agent_type {s:?} in DB, falling back to ClaudeCode"
);
AgentType::ClaudeCode
}
}
}
fn conv_to_summary(r: conversation::Model) -> DbConversationSummary {