增加不同类型中转站

This commit is contained in:
2025-09-05 23:51:05 +08:00
parent 71adf8416a
commit e8fe999d16
6 changed files with 798 additions and 111 deletions

View File

@@ -838,6 +838,11 @@ impl StationAdapter for CustomAdapter {
pub fn create_adapter(adapter_type: &RelayStationAdapter) -> Box<dyn StationAdapter> {
match adapter_type {
RelayStationAdapter::Packycode => Box::new(PackycodeAdapter),
// DeepSeek、GLM、Qwen、Kimi 都使用类似 NewAPI 的适配器
RelayStationAdapter::Deepseek => Box::new(NewApiAdapter),
RelayStationAdapter::Glm => Box::new(NewApiAdapter),
RelayStationAdapter::Qwen => Box::new(NewApiAdapter),
RelayStationAdapter::Kimi => Box::new(NewApiAdapter),
RelayStationAdapter::Newapi => Box::new(NewApiAdapter),
RelayStationAdapter::Oneapi => Box::new(NewApiAdapter), // OneAPI 兼容 NewAPI
RelayStationAdapter::Yourapi => Box::new(YourApiAdapter::new()),

View File

@@ -15,6 +15,10 @@ use crate::claude_config;
#[serde(rename_all = "snake_case")]
pub enum RelayStationAdapter {
Packycode, // PackyCode 平台(放在第一位)
Deepseek, // DeepSeek v3.1
Glm, // 智谱GLM
Qwen, // 千问Qwen
Kimi, // Kimi k2
Newapi, // NewAPI 兼容平台
Oneapi, // OneAPI 兼容平台
Yourapi, // YourAPI 特定平台
@@ -25,6 +29,10 @@ impl RelayStationAdapter {
pub fn as_str(&self) -> &str {
match self {
RelayStationAdapter::Packycode => "packycode",
RelayStationAdapter::Deepseek => "deepseek",
RelayStationAdapter::Glm => "glm",
RelayStationAdapter::Qwen => "qwen",
RelayStationAdapter::Kimi => "kimi",
RelayStationAdapter::Newapi => "newapi",
RelayStationAdapter::Oneapi => "oneapi",
RelayStationAdapter::Yourapi => "yourapi",

File diff suppressed because it is too large Load Diff

View File

@@ -453,6 +453,10 @@ export interface ImportServerResult {
/** 中转站适配器类型 */
export type RelayStationAdapter =
| 'packycode' // PackyCode 平台(默认)
| 'deepseek' // DeepSeek v3.1
| 'glm' // 智谱GLM
| 'qwen' // 千问Qwen
| 'kimi' // Kimi k2
| 'newapi' // NewAPI 兼容平台
| 'oneapi' // OneAPI 兼容平台
| 'yourapi' // YourAPI 特定平台

View File

@@ -863,6 +863,7 @@
"adapterType": "Adapter Type",
"authMethod": "Authentication Method",
"systemToken": "System Token",
"getApiKey": "Get API Key",
"tokenPlaceholder": "Enter your API token",
"tokenRequired": "System token is required",
"userId": "User ID",
@@ -883,6 +884,11 @@
"disabledSuccess": "Relay station disabled successfully",
"toggleEnableFailed": "Failed to toggle relay station status",
"syncConfig": "Sync Config",
"configPreview": "Config Preview",
"viewJson": "View JSON",
"configSaved": "Config saved",
"invalidJson": "Invalid JSON format",
"saveFailed": "Save failed",
"syncFailed": "Failed to sync configuration",
"currentConfig": "Current Configuration",
"notConfigured": "Not configured",

View File

@@ -790,6 +790,7 @@
"adapterType": "适配器类型",
"authMethod": "认证方式",
"systemToken": "系统令牌",
"getApiKey": "获取 API Key",
"tokenPlaceholder": "输入您的 API 令牌",
"tokenRequired": "系统令牌必填",
"userId": "用户 ID",
@@ -810,6 +811,11 @@
"disabledSuccess": "中转站禁用成功",
"toggleEnableFailed": "切换中转站状态失败",
"syncConfig": "同步配置",
"configPreview": "配置预览",
"viewJson": "查看 JSON",
"configSaved": "配置已保存",
"invalidJson": "JSON 格式无效",
"saveFailed": "保存失败",
"syncFailed": "同步配置失败",
"currentConfig": "当前配置",
"notConfigured": "未配置",