Skip to content

Commit 28f8cee

Browse files
authored
Fix for errors returned from searching time specific queries (#2525)
* Fix for errors returned from searching time specific queries * Adds prompt patterns
1 parent 87b3603 commit 28f8cee

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

apps/webapp/app/v3/services/aiRunFilterService.server.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ export class AIRunFilterService {
175175
- "using large machine" → machines: ["large-1x", "large-2x"]
176176
- "root only" → rootOnly: true
177177
178+
Time-specific patterns:
179+
- "around 8am today" → from/to: 7am-9am today (1-2 hour window around the time)
180+
- "at 2pm yesterday" → from/to: 2pm-2:59pm yesterday (exact hour)
181+
- "this morning" → from/to: 6am-12pm today
182+
- "this afternoon" → from/to: 12pm-6pm today
183+
- "this evening" → from/to: 6pm-10pm today
184+
- "started around X" / "that started at X" → same as time filtering (treat "started" as temporal filter)
185+
- "began around X" / "ran at X" → same as time filtering
186+
187+
When handling specific times:
188+
- "around" adds ±1 hour buffer (e.g., "around 8am" = 7am-9am)
189+
- "at" means exact hour (e.g., "at 2pm" = 2pm-2:59pm)
190+
- For relative days: "today" = current date, "yesterday" = current date - 1 day
191+
- Convert times to ISO format for from/to filters
192+
178193
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.
179194
180195
Unless they specify they only want root runs, set rootOnly to false.

apps/webapp/evals/aiRunFilter.eval.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,37 @@ evalite("AI Run Filter", {
216216
},
217217
}),
218218
},
219+
// Time-specific queries with hours
220+
{
221+
input: "tasks that started around 8am today",
222+
expected: JSON.stringify({
223+
success: true,
224+
filters: {
225+
from: new Date(new Date().toDateString() + " 07:00:00").getTime(),
226+
to: new Date(new Date().toDateString() + " 09:00:00").getTime(),
227+
},
228+
}),
229+
},
230+
{
231+
input: "runs that started at 2pm yesterday",
232+
expected: JSON.stringify({
233+
success: true,
234+
filters: {
235+
from: new Date(new Date(Date.now() - 24*60*60*1000).toDateString() + " 14:00:00").getTime(),
236+
to: new Date(new Date(Date.now() - 24*60*60*1000).toDateString() + " 14:59:59").getTime(),
237+
},
238+
}),
239+
},
240+
{
241+
input: "any runs started this morning",
242+
expected: JSON.stringify({
243+
success: true,
244+
filters: {
245+
from: new Date(new Date().toDateString() + " 06:00:00").getTime(),
246+
to: new Date(new Date().toDateString() + " 12:00:00").getTime(),
247+
},
248+
}),
249+
},
219250
// Ambiguous cases that should return errors
220251
{
221252
input: "Show me something",

0 commit comments

Comments
 (0)