fix(core): volcengine 配置判定不再要求 resource id——运行时留空会回落默认资源
听写运行时对空 resource id 回落 volc.seedasr.sauc.duration(resolve_resource_id), 但 volcengine_configured 把它当硬门槛:合法的「密钥齐全、资源 id 留空」配置被误报 「语音识别未配置」并每次启动弹配置提示。认证是否就绪只取决于密钥本身。
This commit is contained in:
1 parent
e3f63e97fc
commit
105fb99dc0
1 file changed
+7
-3
@@ -334,7 +334,9 @@ pub struct CredentialConfiguration {
|
||||
pub fn volcengine_configured(configuration: &CredentialConfiguration) -> bool {
|
||||
use crate::asr::volcengine::VolcengineAuthMode;
|
||||
|
||||
let credentials_ready = match configuration
|
||||
// resource id 不是配置门槛:留空时运行时回落默认资源
|
||||
//(见 VolcengineCredentials::resolve_resource_id),认证只取决于密钥本身。
|
||||
match configuration
|
||||
.volcengine_auth_mode
|
||||
.as_deref()
|
||||
.map(VolcengineAuthMode::parse)
|
||||
@@ -344,8 +346,7 @@ pub fn volcengine_configured(configuration: &CredentialConfiguration) -> bool {
|
||||
configuration.volcengine_app_key && configuration.volcengine_access_key
|
||||
}
|
||||
VolcengineAuthMode::ApiKey => configuration.volcengine_api_key,
|
||||
};
|
||||
credentials_ready && configuration.volcengine_resource_id
|
||||
}
|
||||
}
|
||||
|
||||
pub fn asr_configured(
|
||||
@@ -962,6 +963,9 @@ mod tests {
|
||||
configuration.volcengine_api_key = true;
|
||||
configuration.volcengine_resource_id = true;
|
||||
assert!(volcengine_configured(&configuration));
|
||||
// resource id 留空(运行时回落默认资源)不构成「未配置」。
|
||||
configuration.volcengine_resource_id = false;
|
||||
assert!(volcengine_configured(&configuration));
|
||||
assert!(!asr_configured(
|
||||
"foundry-local-whisper",
|
||||
&configuration,
|
||||
|
||||
Reference in new issue
Block a user