fix(balance): show USD on SiliconFlow international site (was CNY)

The query_siliconflow function received an is_cn flag that only switched
the request domain (.cn vs .com) but the response builder hardcoded
unit="CNY" for both sites. International users at api.siliconflow.com
saw their USD balance labelled as CNY. Now unit and plan_name follow
is_cn, so the EN site shows USD and "SiliconFlow (EN)".
This commit is contained in:
Jason
2026-04-28 09:26:48 +08:00
parent 5b6339d78c
commit d2556be5b9
+9 -2
View File
@@ -233,14 +233,21 @@ async fn query_siliconflow(api_key: &str, is_cn: bool) -> UsageResult {
let total_balance = parse_f64_field(data, "totalBalance").unwrap_or(0.0);
let unit = if is_cn { "CNY" } else { "USD" };
let plan_name = if is_cn {
"SiliconFlow"
} else {
"SiliconFlow (EN)"
};
UsageResult {
success: true,
data: Some(vec![UsageData {
plan_name: Some("SiliconFlow".to_string()),
plan_name: Some(plan_name.to_string()),
remaining: Some(total_balance),
total: None,
used: None,
unit: Some("CNY".to_string()),
unit: Some(unit.to_string()),
is_valid: Some(true),
invalid_message: None,
extra: None,