The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add AI support guidance for nonprofit discount requests (#4174)
Pedro Ladeira73c5ee9c9904
diff --git a/apps/web/lib/ai/build-system-prompt.ts b/apps/web/lib/ai/build-system-prompt.tsindex bfbbc9bfba..e8b53f0f90 100644--- a/apps/web/lib/ai/build-system-prompt.ts+++ b/apps/web/lib/ai/build-system-prompt.ts@@ -27,6 +27,7 @@ const BASE_SYSTEM_PROMPT = `ALWAYS call the findRelevantDocs tool before answering any question — no exceptions. Do not answer from memory.For plan hierarchy and plan feature questions, use the Dub Plans section below (and call getPlanComparison when details are needed). Do not infer plan order from plan names.For any partner payout question (pending, timing, schedule, failed, or retry/resend), follow the partner payout rules below instead — they override the docs-first and ticket-escalation rules for those questions.+ For non-profit discount requests, follow the non-profit discount rules below instead — they override the docs-first rules for those questions (docs do not cover this).Ground every answer in the content retrieved by findRelevantDocs.Respond in concise, clear markdown. Strictly avoid using headings (h1, h2, h3, h4, h5, h6) in your responses.If you find a relevant article, include a link to it in your response.@@ -50,6 +51,19 @@ const PARTNERS_PAYOUT_PROMPT = `- Offer to create a Dub support ticket (call requestSupportTicket, then createSupportTicket once the user confirms) so Dub can investigate further.`.trim();+const NONPROFIT_DISCOUNT_PROMPT = `+ Non-profit discounts:+ ONLY apply these rules when the user clearly identifies as a non-profit / nonprofit organization (or equivalent: charity, 501(c)(3), NGO) AND asks for a discount or pricing reduction.+ Do NOT mention non-profit discounts for general discount requests, student/startup asks, or other organization types — never volunteer this offer.++ When the trigger above is met:+ - Do not conclude that Dub does not offer a non-profit discount just because documentation is silent — docs do not cover this.+ - Briefly explain that Dub can consider a non-profit discount after verification, and ask them to provide documentation confirming their non-profit status.+ - Then call requestSupportTicket so they can attach that documentation via the upload form.+ - After the user submits the form and confirms, call createSupportTicket as usual.+ - Tell them that once their non-profit status is confirmed, the team will respond back with the discount.+ `.trim();+function buildAccountSpecificPrompt(context: GlobalChatContext): string[] {if (!context.accountType) return [];@@ -80,6 +94,7 @@ export function buildSystemPrompt(globalContext?: GlobalChatContext): string {? CONTEXT_SYSTEM_PROMPTS[globalContext.chatLocation]: null,BASE_SYSTEM_PROMPT,+ NONPROFIT_DISCOUNT_PROMPT,globalContext?.accountType === "partner" ? PARTNERS_PAYOUT_PROMPT : null,...accountSpecificPrompts,].filter((section): section is string => Boolean(section));