mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-05 18:39:50 +08:00
chore(openclaw): remove dead code functions from openclaw_config
Remove 6 unused functions marked with #[allow(dead_code)]: - get_openclaw_skills_dir: Skills not supported - get_env_vars/set_env_var: Environment vars unused - get_mcp_servers/set_mcp_server/remove_mcp_server: MCP not supported OpenClaw integration only requires provider management functionality.
This commit is contained in:
@@ -70,14 +70,6 @@ pub fn get_openclaw_config_path() -> PathBuf {
|
||||
get_openclaw_dir().join("openclaw.json")
|
||||
}
|
||||
|
||||
/// 获取 OpenClaw Skills 目录路径
|
||||
///
|
||||
/// 返回 `~/.openclaw/skills/`
|
||||
#[allow(dead_code)]
|
||||
pub fn get_openclaw_skills_dir() -> PathBuf {
|
||||
get_openclaw_dir().join("skills")
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Type Definitions
|
||||
// ============================================================================
|
||||
@@ -262,65 +254,3 @@ pub fn set_typed_provider(id: &str, config: &OpenClawProviderConfig) -> Result<(
|
||||
let value = serde_json::to_value(config).map_err(|e| AppError::JsonSerialize { source: e })?;
|
||||
set_provider(id, value)
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Environment Variables
|
||||
// ============================================================================
|
||||
|
||||
/// 获取环境变量配置
|
||||
#[allow(dead_code)]
|
||||
pub fn get_env_vars() -> Result<Map<String, Value>, AppError> {
|
||||
let config = read_openclaw_config()?;
|
||||
Ok(config
|
||||
.get("env")
|
||||
.and_then(|v| v.as_object())
|
||||
.cloned()
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// 设置环境变量
|
||||
#[allow(dead_code)]
|
||||
pub fn set_env_var(key: &str, value: &str) -> Result<(), AppError> {
|
||||
let mut config = read_openclaw_config()?;
|
||||
|
||||
if config.get("env").is_none() {
|
||||
config["env"] = json!({});
|
||||
}
|
||||
|
||||
if let Some(env) = config.get_mut("env").and_then(|v| v.as_object_mut()) {
|
||||
env.insert(key.to_string(), Value::String(value.to_string()));
|
||||
}
|
||||
|
||||
write_openclaw_config(&config)
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// MCP Functions (Reserved for future use)
|
||||
// ============================================================================
|
||||
|
||||
/// 获取所有 MCP 服务器配置
|
||||
///
|
||||
/// OpenClaw MCP 配置在 `agents.list[].mcp.servers`
|
||||
/// 由于 OpenClaw MCP 支持仍在开发中(Issue #4834),暂时返回空
|
||||
#[allow(dead_code)]
|
||||
pub fn get_mcp_servers() -> Result<Map<String, Value>, AppError> {
|
||||
// OpenClaw MCP support is under development
|
||||
// Return empty for now
|
||||
Ok(Map::new())
|
||||
}
|
||||
|
||||
/// 设置 MCP 服务器配置
|
||||
#[allow(dead_code)]
|
||||
pub fn set_mcp_server(_id: &str, _config: Value) -> Result<(), AppError> {
|
||||
// OpenClaw MCP support is under development
|
||||
log::warn!("OpenClaw MCP support is not yet implemented");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 删除 MCP 服务器配置
|
||||
#[allow(dead_code)]
|
||||
pub fn remove_mcp_server(_id: &str) -> Result<(), AppError> {
|
||||
// OpenClaw MCP support is under development
|
||||
log::warn!("OpenClaw MCP support is not yet implemented");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user