Skip to content

Commit 1e1d54a

Browse files
committed
Strip quotes from AI generated titles
1 parent 7a252dd commit 1e1d54a

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/route.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -770,14 +770,16 @@ export default function Page() {
770770
) : results?.rows && results?.columns ? (
771771
<div className="flex h-full flex-col overflow-hidden">
772772
{results.hiddenColumns && results.hiddenColumns.length > 0 && (
773-
<Callout variant="warning" className="m-2 shrink-0 text-sm">
774-
<code>SELECT *</code> doesn't return all columns because it's slow. The
775-
following columns are not shown:{" "}
776-
<span className="font-mono text-xs">
777-
{results.hiddenColumns.join(", ")}
778-
</span>
779-
. Specify them explicitly to include them.
780-
</Callout>
773+
<div className="p-2">
774+
<Callout variant="warning" className="shrink-0 text-sm">
775+
<code>SELECT *</code> doesn't return all columns because it's slow. The
776+
following columns are not shown:{" "}
777+
<span className="font-mono text-xs">
778+
{results.hiddenColumns.join(", ")}
779+
</span>
780+
. Specify them explicitly to include them.
781+
</Callout>
782+
</div>
781783
)}
782784
<div className="h-full bg-charcoal-900 p-2">
783785
<Card className="h-full overflow-hidden px-0 pb-0">

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query.ai-title.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,16 @@ export async function action({ request, params }: ActionFunctionArgs) {
5353
return json({ success: false as const, error: result.error, title: null }, { status: 500 });
5454
}
5555

56+
// Strip leading/trailing quotes that AI sometimes adds
57+
const title = result.title.replace(/^["']|["']$/g, "");
58+
5659
// If a queryId was provided, update the CustomerQuery record with the title
5760
if (queryId) {
5861
await prisma.customerQuery.update({
5962
where: { id: queryId },
60-
data: { title: result.title },
63+
data: { title },
6164
});
6265
}
6366

64-
return json({ success: true as const, title: result.title, error: null });
67+
return json({ success: true as const, title, error: null });
6568
}

0 commit comments

Comments
 (0)