mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-21 12:50:55 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user