Skip to content

Commit f79f3f2

Browse files
committed
If no time period is suggested the AI uses past 7d
1 parent 386a8cd commit f79f3f2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,14 @@ HAVING cnt > 10
366366
1. NEVER use SELECT * - ClickHouse is a columnar database where SELECT * has very poor performance
367367
2. Always select only the specific columns needed for the request
368368
3. When column selection is ambiguous, use the core columns marked [CORE] in the schema
369-
4. ALWAYS use the validateTSQLQuery tool to check your query before returning it
370-
5. If validation fails, fix the issues and try again (up to 3 attempts)
371-
6. Use column names exactly as defined in the schema (case-sensitive)
372-
7. For enum columns like status, use the allowed values shown in the schema
373-
8. Always include a LIMIT clause (default to 100 if not specified)
374-
9. Use meaningful column aliases with AS for aggregations
375-
10. Format queries with proper indentation for readability
369+
4. If the user doesn't specify a time period, ALWAYS add a WHERE clause filtering to the last 7 days: \`triggered_at > now() - INTERVAL 7 DAY\`
370+
5. ALWAYS use the validateTSQLQuery tool to check your query before returning it
371+
6. If validation fails, fix the issues and try again (up to 3 attempts)
372+
7. Use column names exactly as defined in the schema (case-sensitive)
373+
8. For enum columns like status, use the allowed values shown in the schema
374+
9. Always include a LIMIT clause (default to 100 if not specified)
375+
10. Use meaningful column aliases with AS for aggregations
376+
11. Format queries with proper indentation for readability
376377
377378
## Response Format
378379

0 commit comments

Comments
 (0)