Apply agent selection: switch agent type
(&mut self, selected: &AgentItem, chat_state: &mut ChatState)
| 2223 | |
| 2224 | /// Apply agent selection: switch agent type |
| 2225 | fn apply_agent_selection(&mut self, selected: &AgentItem, chat_state: &mut ChatState) { |
| 2226 | if selected.id == self.agent_type { |
| 2227 | return; |
| 2228 | } |
| 2229 | self.agent_type = selected.id.clone(); |
| 2230 | chat_state.agent_type = selected.id.clone(); |
| 2231 | tracing::info!("Switched to agent: {}", selected.id); |
| 2232 | |
| 2233 | if selected.id == "HarmonyOSDev" { |
| 2234 | let deveco_home = std::env::var("DEVECO_HOME").ok(); |
| 2235 | let missing = deveco_home |
| 2236 | .as_deref() |
| 2237 | .map(|s| s.trim().is_empty()) |
| 2238 | .unwrap_or(true); |
| 2239 | if missing { |
| 2240 | chat_state.add_system_message( |
| 2241 | "HarmonyOSDev tip: HmosCompilation requires DEVECO_HOME (DevEco Studio install path). If compilation fails, set DEVECO_HOME and restart the terminal." |
| 2242 | .to_string(), |
| 2243 | ); |
| 2244 | } |
| 2245 | } |
| 2246 | } |
| 2247 | |
| 2248 | // ============ MCP management ============ |
| 2249 |
no test coverage detected