Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

add assistant to advisor (#32665)

Saxon Fletcher3d8c0246f5bd
diff --git a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
index ccd9c05ded6..a4471f159cb 100644
--- a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
+++ b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx
@@ -9,7 +9,9 @@ import { LINTER_LEVELS } from 'components/interfaces/Linter/Linter.constants'
import { LintEntity, NoIssuesFound, lintInfoMap } from 'components/interfaces/Linter/Linter.utils'
import { Lint } from 'data/lint/lint-query'
import { useRouter } from 'next/router'
+import { useAppStateSnapshot } from 'state/app-state'
import {
+ AiIconAnimation,
Button,
ResizableHandle,
ResizablePanel,
@@ -41,6 +43,7 @@ const LinterDataGrid = ({
const gridRef = useRef<DataGridHandle>(null)
const { ref } = useParams()
const router = useRouter()
+ const { setAiAssistantPanel } = useAppStateSnapshot()
const [view, setView] = useState<'details' | 'suggestion'>('details')
@@ -237,6 +240,21 @@ const LinterDataGrid = ({
<div className="grid gap-2">
<h3 className="text-sm">Resolve</h3>
<div className="flex items-center gap-2">
+ <Button
+ icon={<AiIconAnimation className="scale-75 w-3 h-3" />}
+ onClick={() => {
+ setAiAssistantPanel({
+ open: true,
+ initialInput: `Summarize the issue and suggest fixes: ${lintInfoMap.find((item) => item.name === selectedLint.name)?.title}
+ \nEntity: ${(selectedLint.metadata && (selectedLint.metadata.entity || (selectedLint.metadata.schema && selectedLint.metadata.name && `${selectedLint.metadata.schema}.${selectedLint.metadata.name}`))) ?? ''}
+ \nSchema: ${selectedLint.metadata?.schema ?? ''}
+ \nIssue: ${selectedLint.detail.replace(/\\`/g, '`')}
+ \nDescription: ${selectedLint.description.replace(/\\`/g, '`')}\n`,
+ })
+ }}
+ >
+ Ask Assistant
+ </Button>
<LintCTA
title={selectedLint.name}
projectRef={ref!}