fix(stage-ui): localize Volcengine model descriptions (#2323)

This commit is contained in:
葱姜蒜
2026-08-19 19:17:32 +10:00
committed by GitHub
parent d67056435a
commit abc8b62f9e
6 changed files with 24 additions and 13 deletions
@@ -1422,6 +1422,11 @@ pages:
title: Volcano Engine
volcengine-coding-plan:
description: Volcengine Coding Plan
models:
ark-code-latest:
description: Uses the model selected in the Coding Plan console, including Auto; changes apply in 35 minutes.
legacy:
description: Legacy Coding Plan model scheduled for retirement. Switch to a currently supported model.
title: Volcengine Coding Plan
byteplus:
description: byteplus.com
@@ -38,7 +38,13 @@ describe('ark chat provider definitions', () => {
const chatConfig = providerInstance.chat('volcengine-coding-plan/doubao-seed-2.1-turbo')
expect(chatConfig.model).toBe('doubao-seed-2.1-turbo')
const listedModels = await provider!.extraMethods!.listModels!(parsedConfig, providerInstance)
const descriptions: Record<string, string> = {
'settings.pages.providers.provider.volcengine-coding-plan.models.ark-code-latest.description': 'Localized current model description.',
'settings.pages.providers.provider.volcengine-coding-plan.models.legacy.description': 'Localized legacy model description.',
}
const listedModels = await provider!.extraMethods!.listModels!(parsedConfig, providerInstance, {
t: input => descriptions[input] ?? input,
})
expect(listedModels.map(model => model.id)).toEqual([
'volcengine-coding-plan/ark-code-latest',
'volcengine-coding-plan/doubao-seed-2.1-turbo',
@@ -53,7 +59,7 @@ describe('ark chat provider definitions', () => {
])
expect(listedModels[0]).toEqual({
description: 'Uses the model selected in the Coding Plan console, including Auto; changes apply in 35 minutes.',
description: 'Localized current model description.',
id: 'volcengine-coding-plan/ark-code-latest',
name: 'ark-code-latest',
provider: 'volcengine-coding-plan',
@@ -62,7 +68,7 @@ describe('ark chat provider definitions', () => {
{
contextLength: 256000,
deprecated: true,
description: 'Legacy Coding Plan model scheduled for retirement. Switch to a currently supported model.',
description: 'Localized legacy model description.',
id: 'volcengine-coding-plan/doubao-seed-2.0-code',
name: 'doubao-seed-2.0-code',
provider: 'volcengine-coding-plan',
@@ -70,7 +76,7 @@ describe('ark chat provider definitions', () => {
{
contextLength: 256000,
deprecated: true,
description: 'Legacy Coding Plan model scheduled for retirement. Switch to a currently supported model.',
description: 'Localized legacy model description.',
id: 'volcengine-coding-plan/doubao-seed-2.0-pro',
name: 'doubao-seed-2.0-pro',
provider: 'volcengine-coding-plan',
@@ -18,7 +18,7 @@ interface ArkModelSpec {
id: string
contextLength?: number
deprecated?: boolean
description?: string
descriptionKey?: string
}
interface ArkProviderDefinitionOptions {
@@ -93,7 +93,7 @@ export function createArkChatProviderDefinition(options: ArkProviderDefinitionOp
},
extraMethods: {
listModels: async () => models.map((model) => {
listModels: async (_config, _provider, contextOptions) => models.map((model) => {
const modelInfo: ModelInfo = {
id: `${modelPrefix}${model.id}`,
name: model.id,
@@ -105,8 +105,8 @@ export function createArkChatProviderDefinition(options: ArkProviderDefinitionOp
if (model.deprecated !== undefined) {
modelInfo.deprecated = model.deprecated
}
if (model.description !== undefined) {
modelInfo.description = model.description
if (model.descriptionKey !== undefined && contextOptions) {
modelInfo.description = contextOptions.t(model.descriptionKey)
}
return modelInfo
}),
@@ -14,7 +14,7 @@ export const providerVolcengineCodingPlan = createArkChatProviderDefinition({
models: [
{
id: 'ark-code-latest',
description: 'Uses the model selected in the Coding Plan console, including Auto; changes apply in 35 minutes.',
descriptionKey: 'settings.pages.providers.provider.volcengine-coding-plan.models.ark-code-latest.description',
},
{ id: 'doubao-seed-2.1-turbo', contextLength: 256000 },
{ id: 'doubao-seed-2.0-lite', contextLength: 256000 },
@@ -27,13 +27,13 @@ export const providerVolcengineCodingPlan = createArkChatProviderDefinition({
id: 'doubao-seed-2.0-code',
contextLength: 256000,
deprecated: true,
description: 'Legacy Coding Plan model scheduled for retirement. Switch to a currently supported model.',
descriptionKey: 'settings.pages.providers.provider.volcengine-coding-plan.models.legacy.description',
},
{
id: 'doubao-seed-2.0-pro',
contextLength: 256000,
deprecated: true,
description: 'Legacy Coding Plan model scheduled for retirement. Switch to a currently supported model.',
descriptionKey: 'settings.pages.providers.provider.volcengine-coding-plan.models.legacy.description',
},
],
})
@@ -61,7 +61,7 @@ export interface ProviderOnboardingField {
}
export interface ProviderExtraMethods<TConfig> {
listModels?: (config: TConfig, provider: ProviderInstance) => Promise<ModelInfo[]>
listModels?: (config: TConfig, provider: ProviderInstance, contextOptions?: { t: (input: string) => string }) => Promise<ModelInfo[]>
/**
* Returns the voice catalogue. `model` lets providers whose voices vary by
* model variant (Volcengine streaming TTS 1.0 vs 2.0 differ in catalogue)
@@ -495,7 +495,7 @@ export const useProviderStore = defineStore('provider', () => {
const provider = await definition.createProvider(config)
try {
if (definition.extraMethods?.listModels) {
const models = await definition.extraMethods.listModels(config, provider)
const models = await definition.extraMethods.listModels(config, provider, { t })
return normalizeProviderModels(providerId, models)
}