From d2556be5b91468ca5d863364ad667615a3967b1b Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 28 Apr 2026 09:26:48 +0800 Subject: [PATCH] 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)". --- src-tauri/src/services/balance.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/services/balance.rs b/src-tauri/src/services/balance.rs index fa6b5d5a1..dce56fed8 100644 --- a/src-tauri/src/services/balance.rs +++ b/src-tauri/src/services/balance.rs @@ -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,