DT-118: Implement "Fix with AI" for SQL query optimization#119
Merged
DT-118: Implement "Fix with AI" for SQL query optimization#119
Conversation
kigiri
reviewed
Apr 14, 2026
api/fix-query.ts
Outdated
|
|
||
| export async function analyzeQueryWithAI(metric: unknown, schema: unknown) { | ||
| const payload = JSON.stringify({ schema, metrics: [metric] }, null, 2) | ||
| const prompt = promptTemplate.replace('{{QUERY_METRICS_JSON}}', payload) |
Member
There was a problem hiding this comment.
rename QUERY_METRICS_JSON by QUERY_DETAILS_JSON
kigiri
reviewed
Apr 14, 2026
| await withDeploymentTableAccess(ctx, deployment) | ||
| const schema = DatabaseSchemasCollection.get(deployment) | ||
| try { | ||
| const analysis = await analyzeQueryWithAI(metric, schema) |
Member
There was a problem hiding this comment.
I would convert markdown to HTML here in the backend instead of doing it in the front end
kigiri
reviewed
Apr 14, 2026
web/pages/DeploymentPage.tsx
Outdated
| const data = fixQueryApi.data | ||
| if (!data) return | ||
| untracked(() => { | ||
| if (!analysisCache.value.has(data.id)) { |
Member
There was a problem hiding this comment.
use .peek() instead of untracked
kigiri
reviewed
Apr 15, 2026
| if (!data) return | ||
| const cashe = analysisCache.peek() | ||
|
|
||
| if (!cashe.has(data.id)) { |
kigiri
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Implement AI-based SQL query optimization analysis feature