matrixcode_core/command/handlers/
config.rs1use std::future::Future;
4use std::pin::Pin;
5
6use crate::command::{Command, BackendContext};
7
8pub struct Config;
9
10impl Command for Config {
11 fn name(&self) -> &'static str {
12 "config"
13 }
14
15 fn help(&self) -> Option<&'static str> {
16 Some("显示当前配置")
17 }
18
19 fn execute<'a>(&'a self, ctx: &'a mut BackendContext<'_>)
20 -> Pin<Box<dyn Future<Output = bool> + Send + 'a>>
21 {
22 Box::pin(async move {
23 let mut info = "⚙️ 当前配置:\n\n".to_string();
24 info.push_str(&format!("Provider: {}\n", ctx.config.provider.as_deref().unwrap_or("auto")));
25 info.push_str(&format!("Model: {}\n", ctx.model));
26 info.push_str(&format!("Think: {}\n", ctx.config.think));
27 info.push_str(&format!("Max Tokens: {}\n", ctx.config.max_tokens));
28 let _ = ctx.event_tx.send(crate::AgentEvent::progress(info, None)).await;
29 false
30 })
31 }
32}