Improve WeChat MP replies and ship MindSpace/H5 production updates.
Add WeChat service account routing with sync acks, connectivity tests, and context isolation; document deploy runbooks; and bundle related MindSpace, voice, Plaza, and server gateway changes for production rollout. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+25
-1
@@ -49,6 +49,30 @@ test('computeDeltaCostCents ignores backend USD cost unless explicitly enabled',
|
||||
});
|
||||
const rmbConfig = { ...config, useBackendCost: false };
|
||||
assert.equal(computeDeltaCostCents(previous, current, rmbConfig), 5);
|
||||
const usdConfig = { ...config, useBackendCost: true };
|
||||
// 成本模式默认 margin=1:deltaUsd 0.01 × 7.2 × 100 = 7.2 → ceil = 8
|
||||
const usdConfig = { ...config, useBackendCost: true, marginMultiplier: 1 };
|
||||
assert.equal(computeDeltaCostCents(previous, current, usdConfig), 8);
|
||||
});
|
||||
|
||||
test('computeDeltaCostCents applies margin multiplier in cost mode', () => {
|
||||
const previous = { lastInputTokens: 0, lastOutputTokens: 0, lastAccumulatedCost: 0 };
|
||||
const current = normalizeTokenState({
|
||||
accumulatedInputTokens: 1_000_000,
|
||||
accumulatedOutputTokens: 10_000,
|
||||
accumulatedCost: 0.25,
|
||||
});
|
||||
// deltaUsd 0.25 × 7.2 × 100 × 3 = 540 分(而非 flat token 的 2060 分)
|
||||
const costConfig = { ...config, useBackendCost: true, marginMultiplier: 3 };
|
||||
assert.equal(computeDeltaCostCents(previous, current, costConfig), 540);
|
||||
});
|
||||
|
||||
test('computeDeltaCostCents falls back to token path when accumulatedCost missing', () => {
|
||||
const previous = { lastInputTokens: 0, lastOutputTokens: 0 };
|
||||
const current = normalizeTokenState({
|
||||
accumulatedInputTokens: 1000,
|
||||
accumulatedOutputTokens: 500,
|
||||
// 上游未回传 accumulatedCost → 即便开启成本模式也回退 token 计费
|
||||
});
|
||||
const costConfig = { ...config, useBackendCost: true, marginMultiplier: 3 };
|
||||
assert.equal(computeDeltaCostCents(previous, current, costConfig), 5);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user