From 79c697c34d0d48f216279747e59babca1116946e Mon Sep 17 00:00:00 2001 From: Shemol Date: Fri, 17 Oct 2025 00:50:09 +0800 Subject: [PATCH] fix: preserve spaces in API keys; update i18n tips to use commas or newlines (#10751) fix(api): preserve spaces in API keys; i18n: clarify tips Tips now say "Use commas to separate multiple keys." Full-width commas are auto-normalized. --- src/renderer/src/i18n/locales/en-us.json | 2 +- src/renderer/src/i18n/locales/zh-cn.json | 2 +- src/renderer/src/i18n/locales/zh-tw.json | 2 +- src/renderer/src/utils/api.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index 288f0964b0..1f7ec61e2f 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -4079,7 +4079,7 @@ "api_host_tooltip": "Override only when your provider requires a custom OpenAI-compatible endpoint.", "api_key": { "label": "API Key", - "tip": "Multiple keys separated by commas or spaces" + "tip": "Use commas to separate multiple keys" }, "api_version": "API Version", "aws-bedrock": { diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 3e6bac4708..7926e7396d 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -4079,7 +4079,7 @@ "api_host_tooltip": "仅在服务商需要自定义的 OpenAI 兼容地址时覆盖。", "api_key": { "label": "API 密钥", - "tip": "多个密钥使用逗号或空格分隔" + "tip": "多个密钥使用逗号分隔" }, "api_version": "API 版本", "aws-bedrock": { diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index b87e5e3256..ab96bff08a 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -4079,7 +4079,7 @@ "api_host_tooltip": "僅在服務商需要自訂的 OpenAI 相容端點時才覆蓋。", "api_key": { "label": "API 金鑰", - "tip": "多個金鑰使用逗號或空格分隔" + "tip": "多個金鑰使用逗號分隔" }, "api_version": "API 版本", "aws-bedrock": { diff --git a/src/renderer/src/utils/api.ts b/src/renderer/src/utils/api.ts index 62d0db5623..550de8c7dd 100644 --- a/src/renderer/src/utils/api.ts +++ b/src/renderer/src/utils/api.ts @@ -5,7 +5,7 @@ * @returns {string} 格式化后的 API key 字符串。 */ export function formatApiKeys(value: string): string { - return value.replaceAll(',', ',').replaceAll(' ', ',').replaceAll('\n', ',') + return value.replaceAll(',', ',').replaceAll('\n', ',') } /**