Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Fix chat tools by explicitly adding them in the prompt

Pedro Ladeira56c1e80ed6a2
diff --git a/apps/web/lib/ai/build-system-prompt.ts b/apps/web/lib/ai/build-system-prompt.ts
index c1ef51965a..f722d749e0 100644
--- a/apps/web/lib/ai/build-system-prompt.ts
+++ b/apps/web/lib/ai/build-system-prompt.ts
@@ -11,16 +11,15 @@ export type GlobalChatContext = {
const CONTEXT_SYSTEM_PROMPTS: Record<SupportChatContext, string> = {
app: `You are a helpful Dub support assistant helping users manage their Dub workspaces and links.
Focus on: link shortening, custom domains, analytics, click tracking, API usage, workspace management, billing, and integrations.
+ When the user asks about their specific workspace data — such as their plan, usage, links count, billing cycle, or payment status — call getWorkspaceDetails with the workspace's ID before answering. Use this real data in your response instead of guessing or citing generic documentation.
When a user has a billing issue, account access problem, or a bug that can't be resolved through documentation, first call requestSupportTicket (to show them an upload form), then after the user confirms, call createSupportTicket.`,
partners: `You are a helpful Dub Partners support assistant helping affiliate partners with their programs.
Focus on: payouts, referral tracking, commission structure, partner links, bank account setup, payout countries, program enrollment, and affiliate performance.
+ When the user asks about their specific program data — such as earnings, commissions, payouts, minimum payout amount, holding period, or payout history — call getProgramPerformance with the program's ID before answering. Use this real data in your response instead of guessing or citing generic documentation.
When a user has a payout dispute, tax compliance issue, or a problem that can't be resolved through documentation, first call requestSupportTicket (to show them an upload form), then after the user confirms, call createSupportTicket.
Always try to provide the program's support email for program-specific issues.`,
- docs: `You are a helpful Dub developer support assistant helping developers integrate Dub into their applications.
- Focus on: SDK installation and usage, webhooks, conversion tracking, rate limits, API authentication, link creation, analytics API, and integration guides.
- When a user has a complex integration issue that can't be resolved through documentation, first call requestSupportTicket (to show them an upload form), then after the user confirms, call createSupportTicket.`,
};
const BASE_SYSTEM_PROMPT = `
diff --git a/apps/web/lib/ai/get-program-performance.ts b/apps/web/lib/ai/get-program-performance.ts
index ebaee1a4b3..8087cd0d4a 100644
--- a/apps/web/lib/ai/get-program-performance.ts
+++ b/apps/web/lib/ai/get-program-performance.ts
@@ -130,7 +130,6 @@ export const getProgramPerformanceTool = tool({
payouts,
});
- console.log(data);
return data;
},
});
diff --git a/apps/web/ui/support/types.ts b/apps/web/ui/support/types.ts
index 3dead90166..b8488b93d4 100644
--- a/apps/web/ui/support/types.ts
+++ b/apps/web/ui/support/types.ts
@@ -1,10 +1,9 @@
export type SupportChatVariant = "embedded" | "bubble";
-export type SupportChatContext = "app" | "partners" | "docs";
+export type SupportChatContext = "app" | "partners";
-const CONTEXT_MAP: Record<string, Exclude<SupportChatContext, undefined>> = {
+const CONTEXT_MAP: Record<string, SupportChatContext> = {
app: "app",
partners: "partners",
- docs: "docs",
};
export function parseSupportChatVariant(
@@ -16,5 +15,5 @@ export function parseSupportChatVariant(
export function parseSupportChatContext(
value: string | undefined,
): SupportChatContext {
- return (value && CONTEXT_MAP[value]) || CONTEXT_MAP.docs;
+ return (value && CONTEXT_MAP[value]) || "app";
}