feat(billing): make metering formula admin-configurable
Memind CI / Test, build, and release guards (pull_request) Failing after 1m29s

Allow margin/FX/cost-mode knobs to be overridden via h5_billing_admin_config so memind_adm can adjust DeepSeek billing without editing env.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-06 15:29:16 +08:00
parent c44017eccd
commit 391ba0b705
11 changed files with 491 additions and 12 deletions
+4 -1
View File
@@ -142,6 +142,7 @@ export function createUserAuth(pool, options = {}) {
? options.provisionUserDataSpace
: null;
const getMindSearchConfig = typeof options.getMindSearchConfig === 'function' ? options.getMindSearchConfig : null;
const billingConfigService = options.billingConfigService ?? null;
const sessions = new Map();
const loginFailures = new Map();
@@ -1334,7 +1335,9 @@ export function createUserAuth(pool, options = {}) {
};
}
const tokenState = normalizeTokenState(tokenStateRaw);
const config = loadBillingConfig();
const config = billingConfigService?.getEffectiveBillingConfig
? await billingConfigService.getEffectiveBillingConfig()
: loadBillingConfig(env);
const normalizedRequestId = requestId ? String(requestId).trim() || null : null;
const now = Date.now();
const conn = await pool.getConnection();