fix(provider): split CN/global endpoints for Chinese provider variants (#542)

* fix(providers): add CN/global endpoint variants for Chinese vendors

* fix(onboard): deduplicate provider key-url match arms

* chore(i18n): normalize non-English literals to English
This commit is contained in:
Chummy 2026-02-17 22:51:51 +08:00 committed by GitHub
parent 93d9d0de06
commit 85de9b5625
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 373 additions and 45 deletions

View file

@ -1620,7 +1620,7 @@ impl Default for AuditConfig {
}
}
/// DingTalk (钉钉) configuration for Stream Mode messaging
/// DingTalk configuration for Stream Mode messaging
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DingTalkConfig {
/// Client ID (AppKey) from DingTalk developer console
@ -1827,10 +1827,19 @@ impl Config {
self.api_key = Some(key);
}
}
// API Key: GLM_API_KEY overrides when provider is glm (provider-specific)
if self.default_provider.as_deref() == Some("glm")
|| self.default_provider.as_deref() == Some("zhipu")
{
// API Key: GLM_API_KEY overrides when provider is a GLM/Zhipu variant.
if matches!(
self.default_provider.as_deref(),
Some(
"glm"
| "zhipu"
| "glm-global"
| "zhipu-global"
| "glm-cn"
| "zhipu-cn"
| "bigmodel"
)
) {
if let Ok(key) = std::env::var("GLM_API_KEY") {
if !key.is_empty() {
self.api_key = Some(key);
@ -3086,6 +3095,21 @@ default_temperature = 0.7
std::env::remove_var("PROVIDER");
}
#[test]
fn env_override_glm_api_key_for_regional_aliases() {
let _env_guard = env_override_test_guard();
let mut config = Config {
default_provider: Some("glm-cn".to_string()),
..Config::default()
};
std::env::set_var("GLM_API_KEY", "glm-regional-key");
config.apply_env_overrides();
assert_eq!(config.api_key.as_deref(), Some("glm-regional-key"));
std::env::remove_var("GLM_API_KEY");
}
#[test]
fn env_override_model() {
let _env_guard = env_override_test_guard();