Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src-tauri/src/cloud_stt/doubao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub(crate) enum DoubaoEvent {
// ─── Credential extraction ──────────────────────────────────────────

/// Extract the three Doubao credentials:
/// - `access_key` from the `api_key` parameter (the main API Key field)
/// - `access_token` from the main credential field
/// - `app_key` and `resource_id` from the cloud options
pub(crate) fn extract_credentials<'a>(
api_key: &'a str,
Expand All @@ -69,7 +69,8 @@ pub(crate) fn extract_credentials<'a>(
.and_then(|v| v.as_str())
.filter(|s| !s.is_empty())
.unwrap_or(DEFAULT_RESOURCE_ID);
Ok((api_key, app_key, resource_id))
let access_token = api_key;
Ok((access_token, app_key, resource_id))
}

/// Map app language codes to Doubao API language codes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ interface ApiKeyFieldProps {
onChange?: (value: string) => void;
disabled: boolean;
placeholder?: string;
ariaLabel?: string;
className?: string;
}

export const ApiKeyField: React.FC<ApiKeyFieldProps> = React.memo(
({ value, onBlur, onChange, disabled, placeholder, className = "" }) => {
({
value,
onBlur,
onChange,
disabled,
placeholder,
ariaLabel,
className = "",
}) => {
const { t } = useTranslation();
const [localValue, setLocalValue] = useState(value);
const [showCopied, setShowCopied] = useState(false);
Expand Down Expand Up @@ -53,6 +62,7 @@ export const ApiKeyField: React.FC<ApiKeyFieldProps> = React.memo(
if (localValue !== value) onBlur(localValue);
}}
placeholder={placeholder}
aria-label={ariaLabel}
variant="compact"
disabled={disabled}
className={`w-full ${localValue ? "pr-7" : ""}`}
Expand Down
22 changes: 17 additions & 5 deletions src/components/settings/models/CloudProviderConfigCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@ export const CloudProviderConfigCard: React.FC<
const effectiveStatus =
!isVerified && status === "active" ? "available" : status;
const isClickable = isVerified;
const isDoubao = provider.id === "doubao";
const credentialLabel = isDoubao
? t("settings.models.cloudProviders.doubao.accessToken")
: t("settings.models.cloudProviders.apiKey.title");
const credentialPlaceholder = isDoubao
? t("settings.models.cloudProviders.doubao.accessTokenPlaceholder")
: t("settings.models.cloudProviders.apiKey.placeholder");
const verifyFirstLabel = isDoubao
? t("settings.models.cloudProviders.doubao.verifyFirst")
: t("settings.models.cloudProviders.verifyFirst");
const consoleButtonLabel = isDoubao
? t("settings.models.cloudProviders.doubao.openSpeechConsole")
: t("settings.models.cloudProviders.getApiKey");

const [showVerifyHint, setShowVerifyHint] = useState(false);
const hintTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
Expand Down Expand Up @@ -328,7 +341,7 @@ export const CloudProviderConfigCard: React.FC<
)}
{showVerifyHint && (
<span className="text-xs text-warning font-medium animate-pulse">
{t("settings.models.cloudProviders.verifyFirst")}
{verifyFirstLabel}
</span>
)}
<button
Expand Down Expand Up @@ -365,9 +378,8 @@ export const CloudProviderConfigCard: React.FC<
onBlur={onApiKeyChange}
onChange={setLocalApiKey}
disabled={false}
placeholder={t(
"settings.models.cloudProviders.apiKey.placeholder",
)}
placeholder={credentialPlaceholder}
ariaLabel={credentialLabel}
className="min-w-[180px] max-w-[240px]"
/>
<Input
Expand Down Expand Up @@ -433,7 +445,7 @@ export const CloudProviderConfigCard: React.FC<
}}
>
<ArrowSquareOut className="w-3 h-3" />
{t("settings.models.cloudProviders.getApiKey")}
{consoleButtonLabel}
</button>
)}
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/ar/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/cs/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/ko/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/pl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/tr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/uk/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/vi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "App Key (App ID)",
"appKeyDescription": "Your Volcengine App ID (from the Speech console)",
"resourceId": "Resource ID",
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)"
"resourceIdDescription": "Your Volcengine speech resource ID (from the Speech console)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "Verify your Access Token first",
"openSpeechConsole": "Open speech console"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@
"appKey": "應用金鑰 (App ID)",
"appKeyDescription": "火山引擎 App ID(從語音控制台取得)",
"resourceId": "資源 ID",
"resourceIdDescription": "火山引擎語音資源 ID(從語音控制台取得)"
"resourceIdDescription": "火山引擎語音資源 ID(從語音控制台取得)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "請先驗證您的 Access Token",
"openSpeechConsole": "開啟語音控制台"
}
},
"localModels": {
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@
"appKey": "应用密钥 (App ID)",
"appKeyDescription": "火山引擎 App ID(从语音控制台获取)",
"resourceId": "资源 ID",
"resourceIdDescription": "火山引擎语音资源 ID(从语音控制台获取)"
"resourceIdDescription": "火山引擎语音资源 ID(从语音控制台获取)",
"accessToken": "Access Token",
"accessTokenPlaceholder": "Access Token",
"verifyFirst": "请先验证您的 Access Token",
"openSpeechConsole": "打开语音控制台"
}
},
"localModels": {
Expand Down