feat(admin-web): show centered modal in Chinese when AI points are insufficient

- Add `ai_points_insufficient` / `ai_points_unavailable` Chinese mappings in
  errors.ts so the toast copy is localized.
- Add `showAiPointsInsufficientModal()` helper that renders a centered
  `Modal.confirm` with localized title/body and a "查看点数明细" action that
  routes to `/account/ai-points`. The helper is debounced so concurrent
  failed requests do not stack multiple modals.
- Trigger the modal globally from the admin-web response interceptor when
  the backend returns `ai_points_insufficient`, so every AI-generating
  endpoint surfaces the same prominent prompt without per-callsite changes.
- Drop the English `detail` for ai_points_insufficient in `formatError` so
  the secondary toast stays pure Chinese.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 01:31:02 +08:00
parent 635782041a
commit b6cc12cefe
2 changed files with 42 additions and 0 deletions
+6
View File
@@ -315,6 +315,12 @@ apiClient.raw.interceptors.response.use(
markStoredMembershipBlocked(error.message)
}
if (error instanceof ApiClientError && error.message === 'ai_points_insufficient') {
void import('./errors').then(({ showAiPointsInsufficientModal }) => {
showAiPointsInsufficientModal()
})
}
return Promise.reject(error)
},
)