Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.
TypeScript agent-skillscodex-clideskop-appdubbingimage-generationlocalizationskillsttsvideo-editingvideo-generationvideo-transcriptionvideo-translation
fix(web): align Volcengine credential mode labels
wulien584252d86cdb
diff --git a/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsx b/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsxindex 506c3ae9..8b573a88 100644--- a/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsx+++ b/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsx@@ -388,12 +388,13 @@ describe('CreatorServicesSettingsView', () => {expect(screen.getByText(/旧版填 App ID 和 Access Token/)).toBeInTheDocument();expect(screen.queryByText('OSS 存储')).not.toBeInTheDocument();- // The explicit toggle selects the legacy form; before an App ID is typed- // the credential is still sent as a newer-console API Key, so the field- // keeps the API Key label and a note explains the pending switch.+ // The explicit toggle selects the legacy labels immediately, even before+ // an App ID is typed and the legacy request headers become active.const legacyToggle = screen.getByRole('switch', { name: /使用旧版凭据/ });expect(legacyToggle).not.toBeChecked();await user.click(legacyToggle);+ expect(screen.getByLabelText('Access Token')).toBeInTheDocument();+ expect(screen.queryByLabelText('API Key')).not.toBeInTheDocument();// Scope by id: the TTS panel renders its own App ID field on the same page.const asrAppId = document.getElementById('transcription-volcengine-app-id');expect(asrAppId).not.toBeNull();@@ -417,6 +418,12 @@ describe('CreatorServicesSettingsView', () => {expect(screen.queryByLabelText('App ID')).not.toBeInTheDocument();expect(screen.getByLabelText('克隆 / 自定义 Speaker ID')).toBeInTheDocument();expect(screen.getByText(/豆包语音 2.0 使用 API Key/)).toBeInTheDocument();+ const ttsLegacyToggle = screen.getByRole('switch', { name: /使用旧版凭据/ });+ await user.click(ttsLegacyToggle);+ expect(screen.getByLabelText('Access Token')).toBeInTheDocument();+ expect(screen.queryByLabelText('API Key')).not.toBeInTheDocument();+ await user.click(ttsLegacyToggle);+ expect(screen.getByLabelText('API Key')).toBeInTheDocument();await user.click(screen.getByRole('combobox', { name: '服务商' }));await user.click(screen.getByRole('option', { name: 'Edge TTS' }));@@ -442,6 +449,28 @@ describe('CreatorServicesSettingsView', () => {expect(screen.queryByLabelText('API Key')).not.toBeInTheDocument();});+ it('clears a stored TTS App ID when switching to the API Key credential mode', async () => {+ const user = userEvent.setup();+ const service = createService(['tts.volcengine.appId', 'tts.volcengine.accessToken']);+ render(<CreatorServicesSettingsView connected service={service} modelService={createModelService()} initialSection="tts" />);++ await user.click(await screen.findByRole('combobox', { name: '服务商' }));+ await user.click(screen.getByRole('option', { name: '火山引擎' }));+ const legacyToggle = screen.getByRole('switch', { name: /使用旧版凭据/ });+ expect(legacyToggle).toBeChecked();+ expect(screen.getByLabelText('App ID')).toBeInTheDocument();+ expect(screen.getByLabelText('Access Token')).toBeInTheDocument();++ await user.click(legacyToggle);+ expect(screen.queryByLabelText('App ID')).not.toBeInTheDocument();+ await user.type(screen.getByLabelText('API Key'), 'new-api-key');+ await user.click(screen.getByRole('button', { name: '保存配置' }));++ await waitFor(() => expect(service.saveConfig).toHaveBeenCalledOnce());+ expect(vi.mocked(service.saveConfig).mock.calls[0]?.[0].tts.volcengine.appId).toBe('');+ expect(vi.mocked(service.saveConfig).mock.calls[0]?.[1]).toEqual(['tts.volcengine.appId']);+ });+it('confirms before saving a newly selected local Whisper provider', async () => {const user = userEvent.setup();const service = createService();diff --git a/apps/web/src/features/settings/CreatorServicesSettingsView.tsx b/apps/web/src/features/settings/CreatorServicesSettingsView.tsxindex ddb90e38..40d8546b 100644--- a/apps/web/src/features/settings/CreatorServicesSettingsView.tsx+++ b/apps/web/src/features/settings/CreatorServicesSettingsView.tsx@@ -481,6 +481,7 @@ export function CreatorServicesSettingsView(props: {update={updateConfig}configuredCredentials={configuredCredentials}service={props.service}+ onCredentialClearChange={setCredentialCleared}/>) : null}{activeSection === 'image' ? (@@ -948,7 +949,9 @@ function TranscriptionModeField(props: {);}-function TtsSettings(props: SettingsGroupProps) {+function TtsSettings(props: SettingsGroupProps & {+ onCredentialClearChange(field: CreatorServicesCredentialField, cleared: boolean): void;+}) {const l = useLocalizedCopy();const provider = props.config.tts.provider;return (@@ -1026,6 +1029,10 @@ function TtsSettings(props: SettingsGroupProps) {<VolcengineTtsFieldsconfiguredCredentials={props.configuredCredentials}value={props.config.tts.volcengine}+ onAppIdClearChange={cleared => props.onCredentialClearChange(+ 'tts.volcengine.appId',+ cleared+ )}onChange={value => props.update(config => {const previousModel = config.tts.volcengine.model;config.tts.volcengine = { ...config.tts.volcengine, ...value };@@ -1280,7 +1287,7 @@ function VolcengineAsrFields(props: {) : null}<PasswordFieldid="transcription-volcengine-access-token"- label={legacyActive ? 'Access Token' : 'API Key'}+ label={useLegacy ? 'Access Token' : 'API Key'}value={props.value.accessToken}configured={props.configuredCredentials.has('transcription.volcengine.accessToken')}onChange={accessToken => props.onChange({ ...props.value, accessToken })}@@ -1315,10 +1322,15 @@ function VolcengineAsrFields(props: {function VolcengineTtsFields(props: {configuredCredentials: ReadonlySet<CreatorServicesCredentialField>;value: VolcengineTtsConfig;+ onAppIdClearChange(cleared: boolean): void;onChange(value: VolcengineTtsConfig): void;}) {const l = useLocalizedCopy();- const usesApiKey = volcengineTtsUsesApiKey(props.value.model);+ const supportsApiKey = volcengineTtsUsesApiKey(props.value.model);+ const hasAppId = props.value.appId.trim().length > 0+ || props.configuredCredentials.has('tts.volcengine.appId');+ const [useLegacy, setUseLegacy] = useState(hasAppId);+ const apiKeyActive = supportsApiKey && !useLegacy;return (<><TextField@@ -1329,7 +1341,22 @@ function VolcengineTtsFields(props: {onChange={baseUrl => props.onChange({ ...props.value, baseUrl })}wide/>- {!usesApiKey ? (+ {supportsApiKey ? (+ <ToggleField+ label={l('使用旧版凭据', 'Use legacy credentials')}+ description={l(+ '关闭时使用新版控制台的单个 API Key(X-Api-Key);开启后填写旧版控制台的 App ID 与 Access Token。',+ 'Off uses the newer-console single API Key (X-Api-Key). On switches to the legacy console App ID and Access Token pair.'+ )}+ checked={useLegacy}+ onChange={next => {+ setUseLegacy(next);+ props.onAppIdClearChange(!next);+ if (!next) props.onChange({ ...props.value, appId: '' });+ }}+ />+ ) : null}+ {!supportsApiKey || useLegacy ? (<PasswordFieldid="tts-volcengine-app-id"label="App ID"@@ -1340,11 +1367,19 @@ function VolcengineTtsFields(props: {) : null}<PasswordFieldid="tts-volcengine-access-token"- label={usesApiKey ? 'API Key' : 'Access Token'}+ label={apiKeyActive ? 'API Key' : 'Access Token'}value={props.value.accessToken}configured={props.configuredCredentials.has('tts.volcengine.accessToken')}onChange={accessToken => props.onChange({ ...props.value, accessToken })}/>+ {supportsApiKey && useLegacy && !hasAppId ? (+ <p className="creator-services-inline-note">+ {l(+ '旧版模式需要 App ID 才会按旧版协议发送;App ID 留空时该凭据仍会作为新版 API Key 以 X-Api-Key 发送。',+ 'Legacy mode only takes effect once an App ID is set; while it is empty the credential is still sent as a newer-console API Key via X-Api-Key.'+ )}+ </p>+ ) : null}<SelectFieldid="tts-volcengine-cluster"label={l('接口 / 集群', 'API / cluster')}