54 lines
1.7 KiB
Rust
54 lines
1.7 KiB
Rust
pub mod adapter;
|
|
pub mod adapters;
|
|
pub mod context;
|
|
pub mod handler;
|
|
pub mod handlers;
|
|
pub mod response;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// 统一命令枚举 - 与渠道无关
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(tag = "type", rename_all = "snake_case")]
|
|
pub enum Command {
|
|
/// 创建新话题(在同一个 Session 内)
|
|
CreateSession { title: Option<String> },
|
|
/// 保存当前话题内容到 Markdown 文件
|
|
SaveTopic {
|
|
filepath: Option<String>,
|
|
include_subagents: bool,
|
|
},
|
|
/// 保存会话内容到 Markdown 文件
|
|
SaveSession {
|
|
filepath: Option<String>,
|
|
include_all: bool,
|
|
include_subagents: bool,
|
|
},
|
|
/// 列出当前 Session 的所有话题
|
|
ListSessions { include_archived: bool },
|
|
/// 加载指定话题
|
|
LoadSession { session_id: String },
|
|
/// 切换到指定话题(清理当前历史并加载新话题)
|
|
SwitchSession { session_id: String },
|
|
/// 获取当前话题信息
|
|
GetCurrentSession,
|
|
/// 显示所有支持的命令
|
|
Help,
|
|
}
|
|
|
|
impl Command {
|
|
/// 获取命令名称(用于日志和调试)
|
|
pub fn name(&self) -> &'static str {
|
|
match self {
|
|
Command::CreateSession { .. } => "create_session",
|
|
Command::SaveTopic { .. } => "save_topic",
|
|
Command::SaveSession { .. } => "save_session",
|
|
Command::ListSessions { .. } => "list_sessions",
|
|
Command::LoadSession { .. } => "load_session",
|
|
Command::SwitchSession { .. } => "switch_session",
|
|
Command::GetCurrentSession => "get_current_session",
|
|
Command::Help => "help",
|
|
}
|
|
}
|
|
}
|