Improve MindSpace visual editor UX and default RMB billing.
Add color-coded edit highlights with an in-preview legend, strip CSP meta for srcdoc editing, and simplify fullscreen preview to immersive visual edit only. Default billing to CNY token rates unless H5_USE_BACKEND_COST=1. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-1
@@ -1,5 +1,6 @@
|
||||
export function loadBillingConfig() {
|
||||
const useBackendCost = process.env.H5_USE_BACKEND_COST !== '0';
|
||||
// 默认按人民币分(CNY cents)计费;仅当 H5_USE_BACKEND_COST=1 时才用上游 USD 成本换算。
|
||||
const useBackendCost = process.env.H5_USE_BACKEND_COST === '1';
|
||||
return {
|
||||
useBackendCost,
|
||||
usdCnyRate: Number(process.env.H5_USD_CNY_RATE ?? 7.2),
|
||||
@@ -53,6 +54,8 @@ export function computeDeltaCostCents(previous, current, config = loadBillingCon
|
||||
return Math.max(config.minBillCents, Math.ceil(currCost * config.usdCnyRate * 100));
|
||||
}
|
||||
|
||||
// 默认路径:按 Token 增量 × 人民币单价(分/1k tokens)扣费。
|
||||
|
||||
const prevIn = Number(previous?.lastInputTokens ?? 0);
|
||||
const prevOut = Number(previous?.lastOutputTokens ?? 0);
|
||||
const deltaIn = Math.max(0, current.accumulatedInputTokens - prevIn);
|
||||
|
||||
Reference in New Issue
Block a user