i18n: localize provider preset names and sorting logic

- Replace hardcoded Chinese preset names with English versions (Claude Official, Zhipu GLM, Qwen Coder, ModelScope, Codex Official, KAT-Coder)
- Update ProviderList sorting to use locale-aware comparison based on current language (zh-CN for Chinese, en-US for English)
- Reorder presets: move KAT-Coder before PackyCode for better grouping
This commit is contained in:
Jason
2025-10-08 11:02:09 +08:00
parent 01da9a1eac
commit 3f3905fda0
3 changed files with 31 additions and 29 deletions

View File

@@ -29,7 +29,7 @@ const ProviderList: React.FC<ProviderListProps> = ({
appType, appType,
onNotify, onNotify,
}) => { }) => {
const { t } = useTranslation(); const { t, i18n } = useTranslation();
// 提取API地址兼容不同供应商配置Claude env / Codex TOML // 提取API地址兼容不同供应商配置Claude env / Codex TOML
const getApiUrl = (provider: Provider): string => { const getApiUrl = (provider: Provider): string => {
try { try {
@@ -118,7 +118,8 @@ const ProviderList: React.FC<ProviderListProps> = ({
// 如果都没有时间戳,按名称排序 // 如果都没有时间戳,按名称排序
if (timeA === 0 && timeB === 0) { if (timeA === 0 && timeB === 0) {
return a.name.localeCompare(b.name, "zh-CN"); const locale = i18n.language === "zh" ? "zh-CN" : "en-US";
return a.name.localeCompare(b.name, locale);
} }
// 如果只有一个没有时间戳,没有时间戳的排在前面 // 如果只有一个没有时间戳,没有时间戳的排在前面

View File

@@ -54,7 +54,7 @@ wire_api = "responses"`;
export const codexProviderPresets: CodexProviderPreset[] = [ export const codexProviderPresets: CodexProviderPreset[] = [
{ {
name: "Codex官方", name: "Codex Official",
websiteUrl: "https://chatgpt.com/codex", websiteUrl: "https://chatgpt.com/codex",
isOfficial: true, isOfficial: true,
category: "official", category: "official",

View File

@@ -26,7 +26,7 @@ export interface ProviderPreset {
export const providerPresets: ProviderPreset[] = [ export const providerPresets: ProviderPreset[] = [
{ {
name: "Claude官方", name: "Claude Official",
websiteUrl: "https://www.anthropic.com/claude-code", websiteUrl: "https://www.anthropic.com/claude-code",
settingsConfig: { settingsConfig: {
env: {}, env: {},
@@ -48,7 +48,7 @@ export const providerPresets: ProviderPreset[] = [
category: "cn_official", category: "cn_official",
}, },
{ {
name: "智谱GLM", name: "Zhipu GLM",
websiteUrl: "https://open.bigmodel.cn", websiteUrl: "https://open.bigmodel.cn",
settingsConfig: { settingsConfig: {
env: { env: {
@@ -65,7 +65,7 @@ export const providerPresets: ProviderPreset[] = [
category: "cn_official", category: "cn_official",
}, },
{ {
name: "Qwen-Coder", name: "Qwen Coder",
websiteUrl: "https://bailian.console.aliyun.com", websiteUrl: "https://bailian.console.aliyun.com",
settingsConfig: { settingsConfig: {
env: { env: {
@@ -92,7 +92,7 @@ export const providerPresets: ProviderPreset[] = [
category: "cn_official", category: "cn_official",
}, },
{ {
name: "魔搭", name: "ModelScope",
websiteUrl: "https://modelscope.cn", websiteUrl: "https://modelscope.cn",
settingsConfig: { settingsConfig: {
env: { env: {
@@ -104,6 +104,28 @@ export const providerPresets: ProviderPreset[] = [
}, },
category: "aggregator", category: "aggregator",
}, },
{
name: "KAT-Coder",
websiteUrl: "https://console.streamlake.ai/wanqing/",
apiKeyUrl: "https://console.streamlake.ai/console/wanqing/api-key",
settingsConfig: {
env: {
ANTHROPIC_BASE_URL: "https://vanchin.streamlake.ai/api/gateway/v1/endpoints/${ENDPOINT_ID}/claude-code-proxy",
ANTHROPIC_AUTH_TOKEN: "",
ANTHROPIC_MODEL: "KAT-Coder",
ANTHROPIC_SMALL_FAST_MODEL: "KAT-Coder",
},
},
category: "cn_official",
templateValues: {
ENDPOINT_ID: {
label: "Vanchin Endpoint ID",
placeholder: "ep-xxx-xxx",
defaultValue: "",
editorValue: "",
},
},
},
{ {
name: "PackyCode", name: "PackyCode",
websiteUrl: "https://www.packycode.com", websiteUrl: "https://www.packycode.com",
@@ -124,26 +146,5 @@ export const providerPresets: ProviderPreset[] = [
], ],
category: "third_party", category: "third_party",
}, },
{
name: "KAT-Coder 官方",
websiteUrl: "https://console.streamlake.ai/wanqing/",
apiKeyUrl: "https://console.streamlake.ai/console/wanqing/api-key",
settingsConfig: {
env: {
ANTHROPIC_BASE_URL: "https://vanchin.streamlake.ai/api/gateway/v1/endpoints/${ENDPOINT_ID}/claude-code-proxy",
ANTHROPIC_AUTH_TOKEN: "",
ANTHROPIC_MODEL: "KAT-Coder",
ANTHROPIC_SMALL_FAST_MODEL: "KAT-Coder",
},
},
category: "cn_official",
templateValues: {
ENDPOINT_ID: {
label: "Vanchin Endpoint ID",
placeholder: "ep-xxx-xxx",
defaultValue: "",
editorValue: "",
},
},
},
]; ];