mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-02 02:05:57 +08:00
fix(openclaw): remove MCP/Skills/Prompts support from OpenClaw
OpenClaw only needs provider management functionality, not MCP, Skills, or Prompts features. This commit removes the incorrectly added support: - Revert SCHEMA_VERSION from 6 to 5 (remove v5->v6 migration) - Remove enabled_openclaw field from mcp_servers and skills tables - Remove openclaw field from McpApps and SkillApps structs - Update DAO queries to exclude enabled_openclaw column - Fix frontend components and types to exclude openclaw from MCP/Prompts - Update all related test files
This commit is contained in:
@@ -15,8 +15,6 @@ pub struct McpApps {
|
|||||||
pub gemini: bool,
|
pub gemini: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub opencode: bool,
|
pub opencode: bool,
|
||||||
#[serde(default)]
|
|
||||||
pub openclaw: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl McpApps {
|
impl McpApps {
|
||||||
@@ -27,7 +25,7 @@ impl McpApps {
|
|||||||
AppType::Codex => self.codex,
|
AppType::Codex => self.codex,
|
||||||
AppType::Gemini => self.gemini,
|
AppType::Gemini => self.gemini,
|
||||||
AppType::OpenCode => self.opencode,
|
AppType::OpenCode => self.opencode,
|
||||||
AppType::OpenClaw => self.openclaw,
|
AppType::OpenClaw => false, // OpenClaw doesn't support MCP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +36,7 @@ impl McpApps {
|
|||||||
AppType::Codex => self.codex = enabled,
|
AppType::Codex => self.codex = enabled,
|
||||||
AppType::Gemini => self.gemini = enabled,
|
AppType::Gemini => self.gemini = enabled,
|
||||||
AppType::OpenCode => self.opencode = enabled,
|
AppType::OpenCode => self.opencode = enabled,
|
||||||
AppType::OpenClaw => self.openclaw = enabled,
|
AppType::OpenClaw => {} // OpenClaw doesn't support MCP, ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,15 +55,12 @@ impl McpApps {
|
|||||||
if self.opencode {
|
if self.opencode {
|
||||||
apps.push(AppType::OpenCode);
|
apps.push(AppType::OpenCode);
|
||||||
}
|
}
|
||||||
if self.openclaw {
|
|
||||||
apps.push(AppType::OpenClaw);
|
|
||||||
}
|
|
||||||
apps
|
apps
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 检查是否所有应用都未启用
|
/// 检查是否所有应用都未启用
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
!self.claude && !self.codex && !self.gemini && !self.opencode && !self.openclaw
|
!self.claude && !self.codex && !self.gemini && !self.opencode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,8 +75,6 @@ pub struct SkillApps {
|
|||||||
pub gemini: bool,
|
pub gemini: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub opencode: bool,
|
pub opencode: bool,
|
||||||
#[serde(default)]
|
|
||||||
pub openclaw: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SkillApps {
|
impl SkillApps {
|
||||||
@@ -92,7 +85,7 @@ impl SkillApps {
|
|||||||
AppType::Codex => self.codex,
|
AppType::Codex => self.codex,
|
||||||
AppType::Gemini => self.gemini,
|
AppType::Gemini => self.gemini,
|
||||||
AppType::OpenCode => self.opencode,
|
AppType::OpenCode => self.opencode,
|
||||||
AppType::OpenClaw => self.openclaw,
|
AppType::OpenClaw => false, // OpenClaw doesn't support Skills
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +96,7 @@ impl SkillApps {
|
|||||||
AppType::Codex => self.codex = enabled,
|
AppType::Codex => self.codex = enabled,
|
||||||
AppType::Gemini => self.gemini = enabled,
|
AppType::Gemini => self.gemini = enabled,
|
||||||
AppType::OpenCode => self.opencode = enabled,
|
AppType::OpenCode => self.opencode = enabled,
|
||||||
AppType::OpenClaw => self.openclaw = enabled,
|
AppType::OpenClaw => {} // OpenClaw doesn't support Skills, ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,15 +115,12 @@ impl SkillApps {
|
|||||||
if self.opencode {
|
if self.opencode {
|
||||||
apps.push(AppType::OpenCode);
|
apps.push(AppType::OpenCode);
|
||||||
}
|
}
|
||||||
if self.openclaw {
|
|
||||||
apps.push(AppType::OpenClaw);
|
|
||||||
}
|
|
||||||
apps
|
apps
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 检查是否所有应用都未启用
|
/// 检查是否所有应用都未启用
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
!self.claude && !self.codex && !self.gemini && !self.opencode && !self.openclaw
|
!self.claude && !self.codex && !self.gemini && !self.opencode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 仅启用指定应用(其他应用设为禁用)
|
/// 仅启用指定应用(其他应用设为禁用)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ impl Database {
|
|||||||
pub fn get_all_mcp_servers(&self) -> Result<IndexMap<String, McpServer>, AppError> {
|
pub fn get_all_mcp_servers(&self) -> Result<IndexMap<String, McpServer>, AppError> {
|
||||||
let conn = lock_conn!(self.conn);
|
let conn = lock_conn!(self.conn);
|
||||||
let mut stmt = conn.prepare(
|
let mut stmt = conn.prepare(
|
||||||
"SELECT id, name, server_config, description, homepage, docs, tags, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, enabled_openclaw
|
"SELECT id, name, server_config, description, homepage, docs, tags, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode
|
||||||
FROM mcp_servers
|
FROM mcp_servers
|
||||||
ORDER BY name ASC, id ASC"
|
ORDER BY name ASC, id ASC"
|
||||||
).map_err(|e| AppError::Database(e.to_string()))?;
|
).map_err(|e| AppError::Database(e.to_string()))?;
|
||||||
@@ -31,7 +31,6 @@ impl Database {
|
|||||||
let enabled_codex: bool = row.get(8)?;
|
let enabled_codex: bool = row.get(8)?;
|
||||||
let enabled_gemini: bool = row.get(9)?;
|
let enabled_gemini: bool = row.get(9)?;
|
||||||
let enabled_opencode: bool = row.get(10)?;
|
let enabled_opencode: bool = row.get(10)?;
|
||||||
let enabled_openclaw: bool = row.get(11)?;
|
|
||||||
|
|
||||||
let server = serde_json::from_str(&server_config_str).unwrap_or_default();
|
let server = serde_json::from_str(&server_config_str).unwrap_or_default();
|
||||||
let tags = serde_json::from_str(&tags_str).unwrap_or_default();
|
let tags = serde_json::from_str(&tags_str).unwrap_or_default();
|
||||||
@@ -47,7 +46,6 @@ impl Database {
|
|||||||
codex: enabled_codex,
|
codex: enabled_codex,
|
||||||
gemini: enabled_gemini,
|
gemini: enabled_gemini,
|
||||||
opencode: enabled_opencode,
|
opencode: enabled_opencode,
|
||||||
openclaw: enabled_openclaw,
|
|
||||||
},
|
},
|
||||||
description,
|
description,
|
||||||
homepage,
|
homepage,
|
||||||
@@ -72,8 +70,8 @@ impl Database {
|
|||||||
conn.execute(
|
conn.execute(
|
||||||
"INSERT OR REPLACE INTO mcp_servers (
|
"INSERT OR REPLACE INTO mcp_servers (
|
||||||
id, name, server_config, description, homepage, docs, tags,
|
id, name, server_config, description, homepage, docs, tags,
|
||||||
enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, enabled_openclaw
|
enabled_claude, enabled_codex, enabled_gemini, enabled_opencode
|
||||||
) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12)",
|
) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11)",
|
||||||
params![
|
params![
|
||||||
server.id,
|
server.id,
|
||||||
server.name,
|
server.name,
|
||||||
@@ -89,7 +87,6 @@ impl Database {
|
|||||||
server.apps.codex,
|
server.apps.codex,
|
||||||
server.apps.gemini,
|
server.apps.gemini,
|
||||||
server.apps.opencode,
|
server.apps.opencode,
|
||||||
server.apps.openclaw,
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::Database(e.to_string()))?;
|
.map_err(|e| AppError::Database(e.to_string()))?;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ impl Database {
|
|||||||
let mut stmt = conn
|
let mut stmt = conn
|
||||||
.prepare(
|
.prepare(
|
||||||
"SELECT id, name, description, directory, repo_owner, repo_name, repo_branch,
|
"SELECT id, name, description, directory, repo_owner, repo_name, repo_branch,
|
||||||
readme_url, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, enabled_openclaw, installed_at
|
readme_url, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, installed_at
|
||||||
FROM skills ORDER BY name ASC",
|
FROM skills ORDER BY name ASC",
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::Database(e.to_string()))?;
|
.map_err(|e| AppError::Database(e.to_string()))?;
|
||||||
@@ -43,9 +43,8 @@ impl Database {
|
|||||||
codex: row.get(9)?,
|
codex: row.get(9)?,
|
||||||
gemini: row.get(10)?,
|
gemini: row.get(10)?,
|
||||||
opencode: row.get(11)?,
|
opencode: row.get(11)?,
|
||||||
openclaw: row.get(12)?,
|
|
||||||
},
|
},
|
||||||
installed_at: row.get(13)?,
|
installed_at: row.get(12)?,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.map_err(|e| AppError::Database(e.to_string()))?;
|
.map_err(|e| AppError::Database(e.to_string()))?;
|
||||||
@@ -64,7 +63,7 @@ impl Database {
|
|||||||
let mut stmt = conn
|
let mut stmt = conn
|
||||||
.prepare(
|
.prepare(
|
||||||
"SELECT id, name, description, directory, repo_owner, repo_name, repo_branch,
|
"SELECT id, name, description, directory, repo_owner, repo_name, repo_branch,
|
||||||
readme_url, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, enabled_openclaw, installed_at
|
readme_url, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, installed_at
|
||||||
FROM skills WHERE id = ?1",
|
FROM skills WHERE id = ?1",
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::Database(e.to_string()))?;
|
.map_err(|e| AppError::Database(e.to_string()))?;
|
||||||
@@ -84,9 +83,8 @@ impl Database {
|
|||||||
codex: row.get(9)?,
|
codex: row.get(9)?,
|
||||||
gemini: row.get(10)?,
|
gemini: row.get(10)?,
|
||||||
opencode: row.get(11)?,
|
opencode: row.get(11)?,
|
||||||
openclaw: row.get(12)?,
|
|
||||||
},
|
},
|
||||||
installed_at: row.get(13)?,
|
installed_at: row.get(12)?,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -103,8 +101,8 @@ impl Database {
|
|||||||
conn.execute(
|
conn.execute(
|
||||||
"INSERT OR REPLACE INTO skills
|
"INSERT OR REPLACE INTO skills
|
||||||
(id, name, description, directory, repo_owner, repo_name, repo_branch,
|
(id, name, description, directory, repo_owner, repo_name, repo_branch,
|
||||||
readme_url, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, enabled_openclaw, installed_at)
|
readme_url, enabled_claude, enabled_codex, enabled_gemini, enabled_opencode, installed_at)
|
||||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14)",
|
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)",
|
||||||
params![
|
params![
|
||||||
skill.id,
|
skill.id,
|
||||||
skill.name,
|
skill.name,
|
||||||
@@ -118,7 +116,6 @@ impl Database {
|
|||||||
skill.apps.codex,
|
skill.apps.codex,
|
||||||
skill.apps.gemini,
|
skill.apps.gemini,
|
||||||
skill.apps.opencode,
|
skill.apps.opencode,
|
||||||
skill.apps.openclaw,
|
|
||||||
skill.installed_at,
|
skill.installed_at,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@@ -148,8 +145,8 @@ impl Database {
|
|||||||
let conn = lock_conn!(self.conn);
|
let conn = lock_conn!(self.conn);
|
||||||
let affected = conn
|
let affected = conn
|
||||||
.execute(
|
.execute(
|
||||||
"UPDATE skills SET enabled_claude = ?1, enabled_codex = ?2, enabled_gemini = ?3, enabled_opencode = ?4, enabled_openclaw = ?5 WHERE id = ?6",
|
"UPDATE skills SET enabled_claude = ?1, enabled_codex = ?2, enabled_gemini = ?3, enabled_opencode = ?4 WHERE id = ?5",
|
||||||
params![apps.claude, apps.codex, apps.gemini, apps.opencode, apps.openclaw, id],
|
params![apps.claude, apps.codex, apps.gemini, apps.opencode, id],
|
||||||
)
|
)
|
||||||
.map_err(|e| AppError::Database(e.to_string()))?;
|
.map_err(|e| AppError::Database(e.to_string()))?;
|
||||||
Ok(affected > 0)
|
Ok(affected > 0)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const DB_BACKUP_RETAIN: usize = 10;
|
|||||||
|
|
||||||
/// 当前 Schema 版本号
|
/// 当前 Schema 版本号
|
||||||
/// 每次修改表结构时递增,并在 schema.rs 中添加相应的迁移逻辑
|
/// 每次修改表结构时递增,并在 schema.rs 中添加相应的迁移逻辑
|
||||||
pub(crate) const SCHEMA_VERSION: i32 = 6;
|
pub(crate) const SCHEMA_VERSION: i32 = 5;
|
||||||
|
|
||||||
/// 安全地序列化 JSON,避免 unwrap panic
|
/// 安全地序列化 JSON,避免 unwrap panic
|
||||||
pub(crate) fn to_json_string<T: Serialize>(value: &T) -> Result<String, AppError> {
|
pub(crate) fn to_json_string<T: Serialize>(value: &T) -> Result<String, AppError> {
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ impl Database {
|
|||||||
id TEXT PRIMARY KEY, name TEXT NOT NULL, server_config TEXT NOT NULL,
|
id TEXT PRIMARY KEY, name TEXT NOT NULL, server_config TEXT NOT NULL,
|
||||||
description TEXT, homepage TEXT, docs TEXT, tags TEXT NOT NULL DEFAULT '[]',
|
description TEXT, homepage TEXT, docs TEXT, tags TEXT NOT NULL DEFAULT '[]',
|
||||||
enabled_claude BOOLEAN NOT NULL DEFAULT 0, enabled_codex BOOLEAN NOT NULL DEFAULT 0,
|
enabled_claude BOOLEAN NOT NULL DEFAULT 0, enabled_codex BOOLEAN NOT NULL DEFAULT 0,
|
||||||
enabled_gemini BOOLEAN NOT NULL DEFAULT 0, enabled_opencode BOOLEAN NOT NULL DEFAULT 0,
|
enabled_gemini BOOLEAN NOT NULL DEFAULT 0, enabled_opencode BOOLEAN NOT NULL DEFAULT 0
|
||||||
enabled_openclaw BOOLEAN NOT NULL DEFAULT 0
|
|
||||||
)",
|
)",
|
||||||
[],
|
[],
|
||||||
)
|
)
|
||||||
@@ -87,7 +86,6 @@ impl Database {
|
|||||||
enabled_codex BOOLEAN NOT NULL DEFAULT 0,
|
enabled_codex BOOLEAN NOT NULL DEFAULT 0,
|
||||||
enabled_gemini BOOLEAN NOT NULL DEFAULT 0,
|
enabled_gemini BOOLEAN NOT NULL DEFAULT 0,
|
||||||
enabled_opencode BOOLEAN NOT NULL DEFAULT 0,
|
enabled_opencode BOOLEAN NOT NULL DEFAULT 0,
|
||||||
enabled_openclaw BOOLEAN NOT NULL DEFAULT 0,
|
|
||||||
installed_at INTEGER NOT NULL DEFAULT 0
|
installed_at INTEGER NOT NULL DEFAULT 0
|
||||||
)",
|
)",
|
||||||
[],
|
[],
|
||||||
@@ -362,11 +360,6 @@ impl Database {
|
|||||||
Self::migrate_v4_to_v5(conn)?;
|
Self::migrate_v4_to_v5(conn)?;
|
||||||
Self::set_user_version(conn, 5)?;
|
Self::set_user_version(conn, 5)?;
|
||||||
}
|
}
|
||||||
5 => {
|
|
||||||
log::info!("迁移数据库从 v5 到 v6(OpenClaw 支持)");
|
|
||||||
Self::migrate_v5_to_v6(conn)?;
|
|
||||||
Self::set_user_version(conn, 6)?;
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
return Err(AppError::Database(format!(
|
return Err(AppError::Database(format!(
|
||||||
"未知的数据库版本 {version},无法迁移到 {SCHEMA_VERSION}"
|
"未知的数据库版本 {version},无法迁移到 {SCHEMA_VERSION}"
|
||||||
@@ -859,7 +852,6 @@ impl Database {
|
|||||||
enabled_claude BOOLEAN NOT NULL DEFAULT 0,
|
enabled_claude BOOLEAN NOT NULL DEFAULT 0,
|
||||||
enabled_codex BOOLEAN NOT NULL DEFAULT 0,
|
enabled_codex BOOLEAN NOT NULL DEFAULT 0,
|
||||||
enabled_gemini BOOLEAN NOT NULL DEFAULT 0,
|
enabled_gemini BOOLEAN NOT NULL DEFAULT 0,
|
||||||
enabled_openclaw BOOLEAN NOT NULL DEFAULT 0,
|
|
||||||
installed_at INTEGER NOT NULL DEFAULT 0
|
installed_at INTEGER NOT NULL DEFAULT 0
|
||||||
)",
|
)",
|
||||||
[],
|
[],
|
||||||
@@ -922,30 +914,6 @@ impl Database {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// v5 -> v6 迁移:添加 OpenClaw 支持
|
|
||||||
///
|
|
||||||
/// 为 mcp_servers 和 skills 表添加 enabled_openclaw 列。
|
|
||||||
fn migrate_v5_to_v6(conn: &Connection) -> Result<(), AppError> {
|
|
||||||
// 为 mcp_servers 表添加 enabled_openclaw 列
|
|
||||||
Self::add_column_if_missing(
|
|
||||||
conn,
|
|
||||||
"mcp_servers",
|
|
||||||
"enabled_openclaw",
|
|
||||||
"BOOLEAN NOT NULL DEFAULT 0",
|
|
||||||
)?;
|
|
||||||
|
|
||||||
// 为 skills 表添加 enabled_openclaw 列
|
|
||||||
Self::add_column_if_missing(
|
|
||||||
conn,
|
|
||||||
"skills",
|
|
||||||
"enabled_openclaw",
|
|
||||||
"BOOLEAN NOT NULL DEFAULT 0",
|
|
||||||
)?;
|
|
||||||
|
|
||||||
log::info!("v5 -> v6 迁移完成:已添加 OpenClaw 支持");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 插入默认模型定价数据
|
/// 插入默认模型定价数据
|
||||||
/// 格式: (model_id, display_name, input, output, cache_read, cache_creation)
|
/// 格式: (model_id, display_name, input, output, cache_read, cache_creation)
|
||||||
/// 注意: model_id 使用短横线格式(如 claude-haiku-4-5),与 API 返回的模型名称标准化后一致
|
/// 注意: model_id 使用短横线格式(如 claude-haiku-4-5),与 API 返回的模型名称标准化后一致
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ pub(crate) fn parse_mcp_apps(apps_str: &str) -> Result<McpApps, AppError> {
|
|||||||
codex: false,
|
codex: false,
|
||||||
gemini: false,
|
gemini: false,
|
||||||
opencode: false,
|
opencode: false,
|
||||||
openclaw: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for app in apps_str.split(',') {
|
for app in apps_str.split(',') {
|
||||||
@@ -176,7 +175,10 @@ pub(crate) fn parse_mcp_apps(apps_str: &str) -> Result<McpApps, AppError> {
|
|||||||
"codex" => apps.codex = true,
|
"codex" => apps.codex = true,
|
||||||
"gemini" => apps.gemini = true,
|
"gemini" => apps.gemini = true,
|
||||||
"opencode" => apps.opencode = true,
|
"opencode" => apps.opencode = true,
|
||||||
"openclaw" => apps.openclaw = true,
|
"openclaw" => {
|
||||||
|
// OpenClaw doesn't support MCP, ignore silently
|
||||||
|
log::debug!("OpenClaw doesn't support MCP, ignoring in apps parameter");
|
||||||
|
}
|
||||||
other => {
|
other => {
|
||||||
return Err(AppError::InvalidInput(format!(
|
return Err(AppError::InvalidInput(format!(
|
||||||
"Invalid app in 'apps': {other}"
|
"Invalid app in 'apps': {other}"
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ pub fn import_from_claude(config: &mut MultiAppConfig) -> Result<usize, AppError
|
|||||||
codex: false,
|
codex: false,
|
||||||
gemini: false,
|
gemini: false,
|
||||||
opencode: false,
|
opencode: false,
|
||||||
openclaw: false,
|
|
||||||
},
|
},
|
||||||
description: None,
|
description: None,
|
||||||
homepage: None,
|
homepage: None,
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ pub fn import_from_codex(config: &mut MultiAppConfig) -> Result<usize, AppError>
|
|||||||
codex: true,
|
codex: true,
|
||||||
gemini: false,
|
gemini: false,
|
||||||
opencode: false,
|
opencode: false,
|
||||||
openclaw: false,
|
|
||||||
},
|
},
|
||||||
description: None,
|
description: None,
|
||||||
homepage: None,
|
homepage: None,
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ pub fn import_from_gemini(config: &mut MultiAppConfig) -> Result<usize, AppError
|
|||||||
codex: false,
|
codex: false,
|
||||||
gemini: true,
|
gemini: true,
|
||||||
opencode: false,
|
opencode: false,
|
||||||
openclaw: false,
|
|
||||||
},
|
},
|
||||||
description: None,
|
description: None,
|
||||||
homepage: None,
|
homepage: None,
|
||||||
|
|||||||
@@ -259,7 +259,6 @@ pub fn import_from_opencode(config: &mut MultiAppConfig) -> Result<usize, AppErr
|
|||||||
codex: false,
|
codex: false,
|
||||||
gemini: false,
|
gemini: false,
|
||||||
opencode: true,
|
opencode: true,
|
||||||
openclaw: false,
|
|
||||||
},
|
},
|
||||||
description: None,
|
description: None,
|
||||||
homepage: None,
|
homepage: None,
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ const McpFormModal: React.FC<McpFormModalProps> = ({
|
|||||||
codex: boolean;
|
codex: boolean;
|
||||||
gemini: boolean;
|
gemini: boolean;
|
||||||
opencode: boolean;
|
opencode: boolean;
|
||||||
openclaw: boolean;
|
|
||||||
}>(() => {
|
}>(() => {
|
||||||
if (initialData?.apps) {
|
if (initialData?.apps) {
|
||||||
return { ...initialData.apps };
|
return { ...initialData.apps };
|
||||||
@@ -76,7 +75,6 @@ const McpFormModal: React.FC<McpFormModalProps> = ({
|
|||||||
codex: defaultEnabledApps.includes("codex"),
|
codex: defaultEnabledApps.includes("codex"),
|
||||||
gemini: defaultEnabledApps.includes("gemini"),
|
gemini: defaultEnabledApps.includes("gemini"),
|
||||||
opencode: defaultEnabledApps.includes("opencode"),
|
opencode: defaultEnabledApps.includes("opencode"),
|
||||||
openclaw: defaultEnabledApps.includes("openclaw"),
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,13 @@ const PromptFormModal: React.FC<PromptFormModalProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const appName = t(`apps.${appId}`);
|
const appName = t(`apps.${appId}`);
|
||||||
const filenameMap: Record<AppId, string> = {
|
const filenameMap: Record<Exclude<AppId, "openclaw">, string> = {
|
||||||
claude: "CLAUDE.md",
|
claude: "CLAUDE.md",
|
||||||
codex: "AGENTS.md",
|
codex: "AGENTS.md",
|
||||||
gemini: "GEMINI.md",
|
gemini: "GEMINI.md",
|
||||||
opencode: "AGENTS.md",
|
opencode: "AGENTS.md",
|
||||||
openclaw: "AGENTS.md",
|
|
||||||
};
|
};
|
||||||
const filename = filenameMap[appId];
|
const filename = filenameMap[appId as Exclude<AppId, "openclaw">];
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [description, setDescription] = useState("");
|
const [description, setDescription] = useState("");
|
||||||
const [content, setContent] = useState("");
|
const [content, setContent] = useState("");
|
||||||
|
|||||||
@@ -24,14 +24,13 @@ const PromptFormPanel: React.FC<PromptFormPanelProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const appName = t(`apps.${appId}`);
|
const appName = t(`apps.${appId}`);
|
||||||
const filenameMap: Record<AppId, string> = {
|
const filenameMap: Record<Exclude<AppId, "openclaw">, string> = {
|
||||||
claude: "CLAUDE.md",
|
claude: "CLAUDE.md",
|
||||||
codex: "AGENTS.md",
|
codex: "AGENTS.md",
|
||||||
gemini: "GEMINI.md",
|
gemini: "GEMINI.md",
|
||||||
opencode: "AGENTS.md",
|
opencode: "AGENTS.md",
|
||||||
openclaw: "AGENTS.md",
|
|
||||||
};
|
};
|
||||||
const filename = filenameMap[appId];
|
const filename = filenameMap[appId as Exclude<AppId, "openclaw">];
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [description, setDescription] = useState("");
|
const [description, setDescription] = useState("");
|
||||||
const [content, setContent] = useState("");
|
const [content, setContent] = useState("");
|
||||||
|
|||||||
@@ -288,7 +288,6 @@ export interface McpApps {
|
|||||||
codex: boolean;
|
codex: boolean;
|
||||||
gemini: boolean;
|
gemini: boolean;
|
||||||
opencode: boolean;
|
opencode: boolean;
|
||||||
openclaw: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MCP 服务器条目(v3.7.0 统一结构)
|
// MCP 服务器条目(v3.7.0 统一结构)
|
||||||
|
|||||||
+4
-4
@@ -86,7 +86,7 @@ let mcpConfigs: McpConfigState = {
|
|||||||
id: "sample",
|
id: "sample",
|
||||||
name: "Sample Claude Server",
|
name: "Sample Claude Server",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
apps: { claude: true, codex: false, gemini: false, opencode: false, openclaw: false },
|
apps: { claude: true, codex: false, gemini: false, opencode: false },
|
||||||
server: {
|
server: {
|
||||||
type: "stdio",
|
type: "stdio",
|
||||||
command: "claude-server",
|
command: "claude-server",
|
||||||
@@ -98,7 +98,7 @@ let mcpConfigs: McpConfigState = {
|
|||||||
id: "httpServer",
|
id: "httpServer",
|
||||||
name: "HTTP Codex Server",
|
name: "HTTP Codex Server",
|
||||||
enabled: false,
|
enabled: false,
|
||||||
apps: { claude: false, codex: true, gemini: false, opencode: false, openclaw: false },
|
apps: { claude: false, codex: true, gemini: false, opencode: false },
|
||||||
server: {
|
server: {
|
||||||
type: "http",
|
type: "http",
|
||||||
url: "http://localhost:3000",
|
url: "http://localhost:3000",
|
||||||
@@ -131,7 +131,7 @@ export const resetProviderState = () => {
|
|||||||
id: "sample",
|
id: "sample",
|
||||||
name: "Sample Claude Server",
|
name: "Sample Claude Server",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
apps: { claude: true, codex: false, gemini: false, opencode: false, openclaw: false },
|
apps: { claude: true, codex: false, gemini: false, opencode: false },
|
||||||
server: {
|
server: {
|
||||||
type: "stdio",
|
type: "stdio",
|
||||||
command: "claude-server",
|
command: "claude-server",
|
||||||
@@ -143,7 +143,7 @@ export const resetProviderState = () => {
|
|||||||
id: "httpServer",
|
id: "httpServer",
|
||||||
name: "HTTP Codex Server",
|
name: "HTTP Codex Server",
|
||||||
enabled: false,
|
enabled: false,
|
||||||
apps: { claude: false, codex: true, gemini: false, opencode: false, openclaw: false },
|
apps: { claude: false, codex: true, gemini: false, opencode: false },
|
||||||
server: {
|
server: {
|
||||||
type: "http",
|
type: "http",
|
||||||
url: "http://localhost:3000",
|
url: "http://localhost:3000",
|
||||||
|
|||||||
Reference in New Issue
Block a user