From d917d2f4d14ca8b4cac741eb46d3704274b55d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Mon, 5 Oct 2026 20:22:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(AGC=E6=A8=A1=E5=9E=8B):=20?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=88=B0=E8=B4=A6=E5=90=8E=E4=B8=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E6=A8=A1=E5=9E=8B=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - confirmNativeRechargePayment 确认订单为 paid 且 kind=membership 时调用 notifyLlmConfigChanged - 保留 applyCatalog 的 revision 门控不变,由配置变更事件重置已应用 revision 并重新读取 - 补「revision 不变但账号档位变化时,显式通知必须重新应用」的回归测试 --- .../features/app-shell/useAccountWallet.ts | 6 +++++ .../tests/conversationModelSelect.test.tsx | 24 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/apps/ai-game-creator-shell/src/features/app-shell/useAccountWallet.ts b/apps/ai-game-creator-shell/src/features/app-shell/useAccountWallet.ts index d95dabd72..63d8d9d82 100644 --- a/apps/ai-game-creator-shell/src/features/app-shell/useAccountWallet.ts +++ b/apps/ai-game-creator-shell/src/features/app-shell/useAccountWallet.ts @@ -19,6 +19,7 @@ import { getClientProfileWalletLedger, redeemClientProfileRewardCode, } from '../../services/accountHost'; +import { notifyLlmConfigChanged } from '../../services/llmModelCatalog'; import { useWalletStore } from '../../stores/useWalletStore'; export function useAccountWallet(currentUserId: string) { @@ -363,6 +364,11 @@ export function useAccountWallet(currentUserId: string) { applyRechargeContent(walletSnapshot, response.center); if (response.order.status === 'paid') { setNativeRechargePayment(null); + // 会员到账会改变账号可用的模型档位,但目录 revision 不变;显式通知 + // ConversationModelSelect 重置已应用 revision 并重新读取,否则锁定列表保持陈旧。 + if (response.order.kind === 'membership') { + notifyLlmConfigChanged(); + } void onWalletBalanceMayHaveChanged(); return; } diff --git a/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx b/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx index 6a4f2a067..2fcecb599 100644 --- a/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx +++ b/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx @@ -747,3 +747,27 @@ test('keeps the applied catalog when the revision is unchanged', async () => { expect(screen.queryByRole('option', { name: '视觉' })).toBeNull(); expect(screen.getByRole('option', { name: '快速' })).not.toBeNull(); }); + +test('applies a changed account catalog after an explicit config-changed notification', async () => { + const onReady = vi.fn(); + render(); + await waitFor(() => expect(onReady).toHaveBeenLastCalledWith(true)); + + // 会员升降级只改变账号可用档位,目录 revision 不变;显式 notify 必须重置已应用 revision + // 并强制重新应用,否则锁定列表会保持陈旧(上一条用例锁住「仅靠 focus 不会更新」)。 + vi.mocked(loadClientLlmModels).mockResolvedValue({ + defaultModelId: 'quality', + models: [ + { id: 'quality', displayName: '高质量', agentMode: 'codex' }, + { id: 'vision', displayName: '视觉', agentMode: 'codex' }, + ], + revision: 1, + }); + act(() => notifyLlmConfigChanged()); + await waitFor(() => expect(loadClientLlmModels).toHaveBeenCalledTimes(2)); + fireEvent.click(screen.getByRole('button', { name: '对话模型' })); + await waitFor(() => + expect(screen.getByRole('option', { name: '视觉' })).not.toBeNull(), + ); + expect(screen.queryByRole('option', { name: '快速' })).toBeNull(); +});