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.

increase ticket details length limit

Pedro Ladeira01dd128fd150
diff --git a/apps/web/app/api/ai/support-chat/route.ts b/apps/web/app/api/ai/support-chat/route.ts
index b16da66b19..5f20a6a961 100644
--- a/apps/web/app/api/ai/support-chat/route.ts
+++ b/apps/web/app/api/ai/support-chat/route.ts
@@ -35,17 +35,10 @@ export const POST = withSession(async ({ req, session }) => {
}
const attachmentIds: string[] | undefined = rawAttachmentIds;
- const MAX_TICKET_DETAILS_LENGTH = 2000;
- const rawTicketDetails = body.ticketDetails;
- if (rawTicketDetails !== undefined) {
- if (
- typeof rawTicketDetails !== "string" ||
- rawTicketDetails.length > MAX_TICKET_DETAILS_LENGTH
- ) {
- return new Response("Invalid ticketDetails", { status: 400 });
- }
+ if (body.ticketDetails !== undefined && typeof body.ticketDetails !== "string") {
+ return new Response("Invalid ticketDetails", { status: 400 });
}
- const ticketDetails: string | undefined = rawTicketDetails;
+ const ticketDetails: string | undefined = body.ticketDetails?.slice(0, 4982);
const { success } = await ratelimit(5, "30 s").limit(
`support-chat:${session.user.id}`,
diff --git a/apps/web/lib/ai/create-support-ticket.ts b/apps/web/lib/ai/create-support-ticket.ts
index 1243ac260b..b407998375 100644
--- a/apps/web/lib/ai/create-support-ticket.ts
+++ b/apps/web/lib/ai/create-support-ticket.ts
@@ -47,20 +47,14 @@ export function createSupportTicketTool(options: CreateSupportTicketOptions) {
session.user.id,
);
- const DETAILS_LIMIT = 1000;
- const rawDetails = ticketDetails?.trim();
- const boundedDetails = rawDetails
- ? rawDetails.length > DETAILS_LIMIT
- ? `${rawDetails.slice(0, DETAILS_LIMIT)}… (truncated)`
- : rawDetails
- : undefined;
+ const details = ticketDetails?.trim();
const components: Array<Record<string, unknown>> = [
- ...(boundedDetails
+ ...(details
? [
{
componentText: {
- text: `User description: ${boundedDetails}`,
+ text: `User description: ${details}`,
},
},
{