From c195e2ce21295161aa93d915ce6968129fa52f3f Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Thu, 18 Sep 2025 17:15:37 +0100 Subject: [PATCH 1/2] Fix for errors returned from searching time specific queries --- apps/webapp/evals/aiRunFilter.eval.ts | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/apps/webapp/evals/aiRunFilter.eval.ts b/apps/webapp/evals/aiRunFilter.eval.ts index 68f3ac2068..b80328789e 100644 --- a/apps/webapp/evals/aiRunFilter.eval.ts +++ b/apps/webapp/evals/aiRunFilter.eval.ts @@ -216,6 +216,37 @@ evalite("AI Run Filter", { }, }), }, + // Time-specific queries with hours + { + input: "tasks that started around 8am today", + expected: JSON.stringify({ + success: true, + filters: { + from: new Date(new Date().toDateString() + " 07:00:00").getTime(), + to: new Date(new Date().toDateString() + " 09:00:00").getTime(), + }, + }), + }, + { + input: "runs that started at 2pm yesterday", + expected: JSON.stringify({ + success: true, + filters: { + from: new Date(new Date(Date.now() - 24*60*60*1000).toDateString() + " 14:00:00").getTime(), + to: new Date(new Date(Date.now() - 24*60*60*1000).toDateString() + " 14:59:59").getTime(), + }, + }), + }, + { + input: "any runs started this morning", + expected: JSON.stringify({ + success: true, + filters: { + from: new Date(new Date().toDateString() + " 06:00:00").getTime(), + to: new Date(new Date().toDateString() + " 12:00:00").getTime(), + }, + }), + }, // Ambiguous cases that should return errors { input: "Show me something", From becf3e462a60c2d6ff342f32fe825463d30cf9e7 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Thu, 18 Sep 2025 17:38:01 +0100 Subject: [PATCH 2/2] Adds prompt patterns --- .../app/v3/services/aiRunFilterService.server.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/webapp/app/v3/services/aiRunFilterService.server.ts b/apps/webapp/app/v3/services/aiRunFilterService.server.ts index 04a4c227c2..4ce12b9455 100644 --- a/apps/webapp/app/v3/services/aiRunFilterService.server.ts +++ b/apps/webapp/app/v3/services/aiRunFilterService.server.ts @@ -175,6 +175,21 @@ export class AIRunFilterService { - "using large machine" → machines: ["large-1x", "large-2x"] - "root only" → rootOnly: true + Time-specific patterns: + - "around 8am today" → from/to: 7am-9am today (1-2 hour window around the time) + - "at 2pm yesterday" → from/to: 2pm-2:59pm yesterday (exact hour) + - "this morning" → from/to: 6am-12pm today + - "this afternoon" → from/to: 12pm-6pm today + - "this evening" → from/to: 6pm-10pm today + - "started around X" / "that started at X" → same as time filtering (treat "started" as temporal filter) + - "began around X" / "ran at X" → same as time filtering + + When handling specific times: + - "around" adds ±1 hour buffer (e.g., "around 8am" = 7am-9am) + - "at" means exact hour (e.g., "at 2pm" = 2pm-2:59pm) + - For relative days: "today" = current date, "yesterday" = current date - 1 day + - Convert times to ISO format for from/to filters + Use the available tools to look up actual tags, versions, queues, and tasks in the environment when the user mentions them. This will help you provide accurate filter values. Unless they specify they only want root runs, set rootOnly to false.