From dc8dc941e877e29fb18d1526d5ff81195e03778f Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Sun, 10 May 2026 18:33:29 -0300 Subject: [PATCH] fix(analytics): precise SQL matching for auto/ prefix models Replaced LIKE 'auto%' with (model = 'auto' OR model LIKE 'auto/%') to prevent false matches from unrelated model names (e.g., 'autopilot-v2'). --- src/app/api/analytics/auto-routing/route.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/api/analytics/auto-routing/route.ts b/src/app/api/analytics/auto-routing/route.ts index 2026b62902..65fe319303 100644 --- a/src/app/api/analytics/auto-routing/route.ts +++ b/src/app/api/analytics/auto-routing/route.ts @@ -20,7 +20,7 @@ export async function GET(request: Request) { ` SELECT COUNT(*) as count FROM usage_logs - WHERE model LIKE 'auto%' OR model LIKE 'auto/%' + WHERE model = 'auto' OR model LIKE 'auto/%' ` ) .get() as { count: number }; @@ -37,7 +37,7 @@ export async function GET(request: Request) { END as variant, COUNT(*) as count FROM usage_logs - WHERE model LIKE 'auto%' + WHERE model = 'auto' OR model LIKE 'auto/%' GROUP BY variant ORDER BY count DESC ` @@ -55,7 +55,7 @@ export async function GET(request: Request) { ` SELECT provider, COUNT(*) as count FROM usage_logs - WHERE model LIKE 'auto%' + WHERE model = 'auto' OR model LIKE 'auto/%' GROUP BY provider ORDER BY count DESC LIMIT 10