fix: restore direct actions after quota recommendations
This commit is contained in:
@@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
## 2026-04-07
|
## 2026-04-07
|
||||||
|
|
||||||
|
### 修复额度页套餐建议引起的全局渲染报错
|
||||||
|
|
||||||
|
- `额度` 页面现在会先初始化 `packageRecommendation` 再渲染套餐建议,不再因为变量未定义把整个工作台渲染链打断。
|
||||||
|
- 这次修复直接解决了公网页面点击 `AI 视频` 等直执行动作后被额度页报错拦住的问题,控制台已经恢复为无报错状态。
|
||||||
|
- 对应前端回归也补了一条更硬的断言,锁住 `renderCreditsScreen()` 对套餐建议变量的初始化。
|
||||||
|
|
||||||
### 额度策略开始按真实用量给出套餐建议
|
### 额度策略开始按真实用量给出套餐建议
|
||||||
|
|
||||||
- `租户额度与审计` 和 `额度` 工作区现在会根据当前项目最近的预算消耗、视频动作量、文案动作量和存储使用,直接给出 `试用 / 增长 / 规模 / 自定义` 的套餐建议。
|
- `租户额度与审计` 和 `额度` 工作区现在会根据当前项目最近的预算消耗、视频动作量、文案动作量和存储使用,直接给出 `试用 / 增长 / 规模 / 自定义` 的套餐建议。
|
||||||
|
|||||||
@@ -8184,6 +8184,10 @@ function renderCreditsScreen() {
|
|||||||
const usage = appState.tenantUsage || quota?.usage || {};
|
const usage = appState.tenantUsage || quota?.usage || {};
|
||||||
const categories = usage?.categories || {};
|
const categories = usage?.categories || {};
|
||||||
const forecast = getTenantQuotaForecastValues(quota || {}, usage);
|
const forecast = getTenantQuotaForecastValues(quota || {}, usage);
|
||||||
|
const packageRecommendation = getTenantQuotaPackageRecommendation({
|
||||||
|
...(quota || {}),
|
||||||
|
package_label: quota?.config?.package_label || "custom"
|
||||||
|
}, usage);
|
||||||
const estimatedVideoUsage = (categories.ai_video?.quantity || 0) + (categories.real_cut?.quantity || 0);
|
const estimatedVideoUsage = (categories.ai_video?.quantity || 0) + (categories.real_cut?.quantity || 0);
|
||||||
const budgetAmount = (quota?.monthly_budget_cents || usage?.total_cost_cents || 0) / 100;
|
const budgetAmount = (quota?.monthly_budget_cents || usage?.total_cost_cents || 0) / 100;
|
||||||
const usedAmount = (usage?.total_cost_cents || 0) / 100;
|
const usedAmount = (usage?.total_cost_cents || 0) / 100;
|
||||||
|
|||||||
@@ -331,6 +331,7 @@ test("quota and review screens foreground live next-step guidance", () => {
|
|||||||
assert.match(tenantQuota, /renderTenantQuotaForecastTags\(quota \|\| \{\}, usage\)/);
|
assert.match(tenantQuota, /renderTenantQuotaForecastTags\(quota \|\| \{\}, usage\)/);
|
||||||
assert.match(tenantQuota, /packageRecommendation\.title/);
|
assert.match(tenantQuota, /packageRecommendation\.title/);
|
||||||
assert.match(credits, /renderTenantQuotaForecastTags\(quota \|\| \{\}, usage\)/);
|
assert.match(credits, /renderTenantQuotaForecastTags\(quota \|\| \{\}, usage\)/);
|
||||||
|
assert.match(credits, /const packageRecommendation = getTenantQuotaPackageRecommendation\(/);
|
||||||
assert.match(credits, /<h4>套餐建议<\/h4>/);
|
assert.match(credits, /<h4>套餐建议<\/h4>/);
|
||||||
assert.match(credits, /packageRecommendation\.summary/);
|
assert.match(credits, /packageRecommendation\.summary/);
|
||||||
assert.match(credits, /剩余 \${escapeHtml\(formatNumber\(forecast\.remainingBudgetCents \/ 100\)\)} 元/);
|
assert.match(credits, /剩余 \${escapeHtml\(formatNumber\(forecast\.remainingBudgetCents \/ 100\)\)} 元/);
|
||||||
|
|||||||
Reference in New Issue
Block a user