From 7757dfe47eef894fc5723e1fd5d2c7da31415c53 Mon Sep 17 00:00:00 2001 From: Fini Date: Wed, 29 Apr 2026 09:50:52 +0800 Subject: [PATCH] fix(ai): 'wallet app' triggers fintech unless Apple-Wallet pass context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous fix removed 'wallet app' from the fintech phrase list to stop Apple-Wallet-pass briefs from being routed to a fintech style guide. But that swung too far: bare 'design a wallet app' or 'wallet app to send money' are common fintech briefs that don't carry a 'crypto'/ 'digital'/'payment' modifier and now fell back to generic neutrals. Hybrid rule: 'wallet app' triggers fintech UNLESS the brief also mentions an Apple-Wallet-style context word (pass / passes / boarding / ticket / tickets / ticketing / gift card / coupon / loyalty). Real fintech briefs that center on a wallet app rarely use any of those words; Apple Wallet briefs almost always do. Verified: - 'design a wallet app' / 'wallet app to send money' / 'wallet app with QR code support' → fintech ✓ - 'Apple Wallet app for boarding passes' / 'wallet app pass viewer' / 'wallet app to store concert tickets' / 'wallet app for loyalty cards' → neutral fallback ✓ - crypto/digital/payment wallet, wallet payment(s), wallet connect, budget tracker — unchanged ✓ --- .../ai/orchestrator-prompt-optimizer.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/web/src/services/ai/orchestrator-prompt-optimizer.ts b/apps/web/src/services/ai/orchestrator-prompt-optimizer.ts index 5705b9c6e..f00f3bc80 100644 --- a/apps/web/src/services/ai/orchestrator-prompt-optimizer.ts +++ b/apps/web/src/services/ai/orchestrator-prompt-optimizer.ts @@ -456,14 +456,8 @@ function inferTagsFromPrompt(prompt: string): string[] { // "budget tracker", "expense tracker") still match without forcing // fintech onto every UI that mentions a budget. // Wallet phrase triggers: every left-side modifier is unambiguously - // financial. Right-side patterns are intentionally restricted to - // `wallet payment(s)` and `wallet connect`, which are unambiguous - // fintech contexts. We deliberately exclude `wallet app` and - // `wallet pass`: both occur in Apple Wallet briefs that are about - // boarding passes, event tickets, gift cards, vaccination cards, or - // generic-iOS pass viewers — those are not fintech UI and shouldn't - // route to a fintech style guide. Real fintech briefs almost always - // qualify the wallet ("crypto wallet app", "payment wallet flow"). + // financial; right-side patterns 'wallet payment(s)' / 'wallet connect' + // are also unambiguous fintech. if ( /\b(crypto|digital|payment|hot|cold|hardware|web3)\s+wallet\b|\bwallet\s+(payments?|connect)\b/.test( lower, @@ -471,6 +465,18 @@ function inferTagsFromPrompt(prompt: string): string[] { ) { tags.push('fintech'); } + // 'wallet app' on its own usually means a fintech wallet ("design a + // wallet app to send money"), but in Apple-Wallet contexts it's the + // generic iOS feature for boarding passes, event tickets, gift cards, + // vaccination cards, and loyalty cards — none of which are fintech UI. + // Trigger fintech for 'wallet app' UNLESS the prompt also mentions an + // Apple-Wallet-style pass/ticket/coupon/loyalty context. + if ( + /\bwallet\s+app\b/.test(lower) && + !/\b(pass|passes|boarding|ticket|tickets|ticketing|gift\s+card|coupon|loyalty)\b/.test(lower) + ) { + tags.push('fintech'); + } if (/\b(budget|expense)\s+(tracker|app|report|management|manager|tracking)\b/.test(lower)) { tags.push('fintech'); }