Przeglądaj źródła

fix(web): say the API key format is wrong rather than naming the characters

Yichen Jiang 2 miesięcy temu
rodzic
commit
6b75bb0425

+ 2 - 2
apps/web/tests/models-settings.e2e.ts

@@ -84,14 +84,14 @@ describe('web e2e: Models settings page configures a dormant provider', () => {
     // The paste that used to save cleanly and then fail the first turn with a
     // ByteString TypeError now names the field that holds it.
     await key.fill('sk-\u{1F600}minimax')
-    await dialog.getByText('该 API 密钥含有无法发送的字符。请只粘贴原始密钥。').waitFor({ timeout: 10_000 })
+    await dialog.getByText('该 API 密钥格式错误,请检查。').waitFor({ timeout: 10_000 })
     await expect.poll(async () => save.isEnabled(), { timeout: 10_000 }).toBe(false)
 
     // Clearing it restores submit: an empty field means "keep what is stored",
     // never a refusal, or editing any other setting would demand the key.
     await key.fill('')
     await expect.poll(async () => save.isEnabled(), { timeout: 10_000 }).toBe(true)
-    expect(await dialog.getByText('该 API 密钥含有无法发送的字符。请只粘贴原始密钥。').count()).toBe(0)
+    expect(await dialog.getByText('该 API 密钥格式错误,请检查。').count()).toBe(0)
   }, 60_000)
 
   it('stores the key under the derived reference and the route registers live', async () => {

+ 2 - 2
packages/client/ui-models/src/client/locales.ts

@@ -47,7 +47,7 @@ export const en = {
   removeModel: 'Delete model',
   modelsEmpty: 'No models will be shown in the selector. Unlisted IDs can still be sent directly.',
   keyBlank: 'Enter the API key, or leave the field empty to keep the stored one.',
-  keyIllegalCharacters: 'This API key contains characters that cannot be sent. Paste the raw key only.',
+  keyIllegalCharacters: 'This API key is not in a valid format. Please check it.',
   keyLooksWrapped: 'Paste only the key itself — not a NAME=value line, and without surrounding quotes.',
   modelIdRequired: 'Model ID is required.',
   modelIdDuplicate: 'Model ID must be unique.',
@@ -134,7 +134,7 @@ export const zh: typeof en = {
   removeModel: '删除模型',
   modelsEmpty: '模型选择器中将不显示任何模型;目录外 ID 仍可直接发送。',
   keyBlank: '请输入 API 密钥;留空则保持已存储的密钥。',
-  keyIllegalCharacters: '该 API 密钥含有无法发送的字符。请只粘贴原始密钥。',
+  keyIllegalCharacters: '该 API 密钥格式错误,请检查。',
   keyLooksWrapped: '请只粘贴密钥本身——不要带 NAME=value 整行,也不要带引号。',
   modelIdRequired: '模型 ID 不能为空。',
   modelIdDuplicate: '模型 ID 不能重复。',