The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Remove assistant V2 from feature preview (#30779)
Joshen Limd88cb127942d
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/AssistantV2Preview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/AssistantV2Preview.tsxdeleted file mode 100644index a10d9531f87..00000000000--- a/apps/studio/components/interfaces/App/FeaturePreview/AssistantV2Preview.tsx+++ /dev/null@@ -1,55 +0,0 @@-import Image from 'next/image'--import { useParams } from 'common'-import { Markdown } from 'components/interfaces/Markdown'-import { BASE_PATH } from 'lib/constants'-import { detectOS } from 'lib/helpers'--export const AssistantV2Preview = () => {- const os = detectOS()- const { ref } = useParams()-- return (- <div className="flex flex-col gap-y-2">- <p className="text-foreground-light text-sm mb-4">- We're changing the way our AI Assistant integrates with the dashboard by making it shared- and accessible universally across the whole dashboard. This hopes to make using the- Assistant as a supporting tool more seamless while you build your project.- </p>- <Image- src={`${BASE_PATH}/img/previews/assistant-v2.png`}- width={1860}- height={970}- alt="api-docs-side-panel-preview"- className="rounded border"- />- <p className="text-foreground-light text-sm mb-4">- The Assistant will also be automatically provided with contexts depending on where you are- in the dashboard to generate more relevant and higher quality outputs. You may also ask for- insights on your own data apart from help with SQL and Postgres!- </p>- <p className="text-foreground-light text-sm mb-4">- We believe that this should further lower the barrier of working with databases especially- if you're not well acquainted with Postgres (yet!), so please do feel free to let us know- what you think in the attached GitHub discussion above!- </p>- <div className="flex flex-col gap-y-2">- <p className="text-sm">Enabling this preview will:</p>- <ul className="list-disc pl-6 text-sm text-foreground-light space-y-1">- <li>- <Markdown- className="text-foreground-light"- content={`Add a button in the top navigation bar where you can access the AI Assistant from anywhere in the dashboard`}- />- </li>- <li>- <Markdown- className="text-foreground-light"- content={`Add a keyboard shortcut (${os === 'macos' ? 'Cmd' : 'Ctrl'} + I) that can also open the Assistant from anywhere in the dashboard`}- />- </li>- </ul>- </div>- </div>- )-}diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsxindex 03ef6fa224f..2d897e8b14e 100644--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx@@ -5,16 +5,8 @@ import { LOCAL_STORAGE_KEYS } from 'lib/constants'import { EMPTY_OBJ } from 'lib/void'import { APISidePanelPreview } from './APISidePanelPreview'import { CLSPreview } from './CLSPreview'-import { AssistantV2Preview } from './AssistantV2Preview'export const FEATURE_PREVIEWS = [- {- key: LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2,- name: 'Supabase AI Assistant V2',- content: <AssistantV2Preview />,- discussionsUrl: undefined,- isNew: true,- },{key: LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL,name: 'Project API documentation',@@ -85,8 +77,3 @@ export const useIsColumnLevelPrivilegesEnabled = () => {const { flags } = useFeaturePreviewContext()return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS]}--export const useIsAssistantV2Enabled = () => {- const { flags } = useFeaturePreviewContext()- return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2]-}diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsxindex 01c76d67997..c04cdd98f66 100644--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx@@ -4,7 +4,6 @@ import { useEffect, useState } from 'react'import { useSendEventMutation } from 'data/telemetry/send-event-mutation'import { useFlag } from 'hooks/ui/useFlag'-import { LOCAL_STORAGE_KEYS } from 'lib/constants'import { TELEMETRY_EVENTS } from 'lib/constants/telemetry'import { useAppStateSnapshot } from 'state/app-state'import { Badge, Button, Modal, ScrollArea, cn } from 'ui'@@ -42,13 +41,6 @@ const FeaturePreviewModal = () => {label: selectedFeatureKey,value: isSelectedFeatureEnabled ? 'disabled' : 'enabled',})-- if (- selectedFeatureKey === LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2 &&- isSelectedFeatureEnabled- ) {- snap.setAiAssistantPanel({ open: false })- }}function handleCloseFeaturePreviewModal() {diff --git a/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/QueryError.tsx b/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/QueryError.tsxindex 8faa934e563..0ac3fa00896 100644--- a/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/QueryError.tsx+++ b/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/QueryError.tsx@@ -72,7 +72,8 @@ const QueryError = ({{open ? 'Hide error details' : 'Show error details'}</Button></CollapsibleTrigger_Shadcn_>- {!hasHipaaAddon && (+ {/* [Joshen] Temp hidden as new assistant doesnt support this. Current assistant's UX is not great too tbh so okay to hide this */}+ {/* {!hasHipaaAddon && (<Buttonsize="tiny"type="default"@@ -91,7 +92,7 @@ const QueryError = ({>Fix with Assistant</Button>- )}+ )} */}</div><CollapsibleContent_Shadcn_ className="overflow-auto">{formattedError.length > 0 ? (diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsxindex f0c174e11e7..22c4bb7e252 100644--- a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsx+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsx@@ -1,13 +1,14 @@import type { PostgresPolicy } from '@supabase/postgres-meta'import { PermissionAction } from '@supabase/shared-types/out/constants'import { noop } from 'lodash'+import { Edit, MoreVertical, Trash } from 'lucide-react'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import { DropdownMenuItemTooltip } from 'components/ui/DropdownMenuItemTooltip'import Panel from 'components/ui/Panel'import { useAuthConfigQuery } from 'data/auth/auth-config-query'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'-import { Edit, MoreVertical, Trash } from 'lucide-react'+import { useAppStateSnapshot } from 'state/app-state'import {Badge,Button,@@ -21,8 +22,6 @@ import {TooltipContent_Shadcn_,TooltipTrigger_Shadcn_,} from 'ui'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'-import { useAppStateSnapshot } from 'state/app-state'import { generatePolicyCreateSQL } from './PolicyTableRow.utils'interface PolicyRowProps {@@ -39,7 +38,6 @@ const PolicyRow = ({onSelectDeletePolicy = noop,}: PolicyRowProps) => {const { setAiAssistantPanel } = useAppStateSnapshot()- const isAssistantV2Enabled = useIsAssistantV2Enabled()const canUpdatePolicies = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'policies')const { project } = useProjectContext()@@ -106,39 +104,33 @@ const PolicyRow = ({<DropdownMenuTrigger asChild><Button type="default" className="px-1.5" icon={<MoreVertical />} /></DropdownMenuTrigger>- <DropdownMenuContent- side="bottom"- align="end"- className={cn(isAssistantV2Enabled ? 'w-52' : 'w-40')}- >+ <DropdownMenuContent side="bottom" align="end" className="w-52"><DropdownMenuItem className="gap-x-2" onClick={() => onSelectEditPolicy(policy)}><Edit size={14} /><p>Edit policy</p></DropdownMenuItem>- {isAssistantV2Enabled && (- <DropdownMenuItem- className="space-x-2"- onClick={() => {- const sql = generatePolicyCreateSQL(policy)- setAiAssistantPanel({- open: true,- sqlSnippets: [sql],- initialInput: `Update the policy with name "${policy.name}" in the ${policy.schema} schema on the ${policy.table} table. It should...`,- suggestions: {- title: `I can help you make a change to the policy "${policy.name}" in the ${policy.schema} schema on the ${policy.table} table, here are a few example prompts to get you started:`,- prompts: [- 'Tell me how I can improve this policy...',- 'Duplicate this policy for another table...',- 'Add extra conditions to this policy...',- ],- },- })- }}- >- <Edit size={14} />- <p>Edit policy with Assistant</p>- </DropdownMenuItem>- )}+ <DropdownMenuItem+ className="space-x-2"+ onClick={() => {+ const sql = generatePolicyCreateSQL(policy)+ setAiAssistantPanel({+ open: true,+ sqlSnippets: [sql],+ initialInput: `Update the policy with name "${policy.name}" in the ${policy.schema} schema on the ${policy.table} table. It should...`,+ suggestions: {+ title: `I can help you make a change to the policy "${policy.name}" in the ${policy.schema} schema on the ${policy.table} table, here are a few example prompts to get you started:`,+ prompts: [+ 'Tell me how I can improve this policy...',+ 'Duplicate this policy for another table...',+ 'Add extra conditions to this policy...',+ ],+ },+ })+ }}+ >+ <Edit size={14} />+ <p>Edit policy with Assistant</p>+ </DropdownMenuItem><DropdownMenuSeparator /><DropdownMenuItemTooltipclassName="gap-x-2"diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsxindex 88d820c5e2f..77204da34d0 100644--- a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx@@ -4,7 +4,6 @@ import { Lock, Unlock } from 'lucide-react'import { useQueryState } from 'nuqs'import { useParams } from 'common'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import { ButtonTooltip } from 'components/ui/ButtonTooltip'import { EditorTablePageLink } from 'data/prefetchers/project.$ref.editor.$id'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'@@ -37,7 +36,6 @@ const PolicyTableRowHeader = ({const { ref } = useParams()const { setAiAssistantPanel } = useAppStateSnapshot()- const enableAssistantV2 = useIsAssistantV2Enabled()const canCreatePolicies = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'policies')const canToggleRLS = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'tables')@@ -117,15 +115,10 @@ const PolicyTableRowHeader = ({type="default"className="px-1"onClick={() => {- if (enableAssistantV2) {- setAiAssistantPanel({- open: true,- initialInput: `Create a new policy for the ${table.schema} schema on the ${table.name} table that ...`,- })- } else {- onSelectCreatePolicy()- setEditView('conversation')- }+ setAiAssistantPanel({+ open: true,+ initialInput: `Create a new policy for the ${table.schema} schema on the ${table.name} table that ...`,+ })}}tooltip={{content: {diff --git a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsxindex 4bb65cd5979..7fef92e064d 100644--- a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx+++ b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx@@ -11,14 +11,12 @@ import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'import { useAppStateSnapshot } from 'state/app-state'import {Button,- cn,DropdownMenu,DropdownMenuContent,DropdownMenuItem,DropdownMenuSeparator,DropdownMenuTrigger,} from 'ui'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'interface FunctionListProps {schema: string@@ -38,7 +36,6 @@ const FunctionList = ({const router = useRouter()const { project: selectedProject } = useProjectContext()const { setAiAssistantPanel } = useAppStateSnapshot()- const isAssistantV2Enabled = useIsAssistantV2Enabled()const { data: functions } = useDatabaseFunctionsQuery({projectRef: selectedProject?.ref,@@ -111,10 +108,7 @@ const FunctionList = ({<DropdownMenuTrigger asChild><Button type="default" className="px-1" icon={<MoreVertical />} /></DropdownMenuTrigger>- <DropdownMenuContent- side="left"- className={cn(isAssistantV2Enabled ? 'w-52' : 'w-40')}- >+ <DropdownMenuContent side="left" className="w-52">{isApiDocumentAvailable && (<DropdownMenuItemclassName="space-x-2"@@ -128,30 +122,28 @@ const FunctionList = ({<Edit2 size={14} /><p>Edit function</p></DropdownMenuItem>- {isAssistantV2Enabled && (- <DropdownMenuItem- className="space-x-2"- onClick={() => {- setAiAssistantPanel({- open: true,- initialInput: 'Update this function to do...',- suggestions: {- title:- 'I can help you make a change to this function, here are a few example prompts to get you started:',- prompts: [- 'Rename this function to ...',- 'Modify this function so that it ...',- 'Add a trigger for this function that calls it when ...',- ],- },- sqlSnippets: [x.complete_statement],- })- }}- >- <Edit size={14} />- <p>Edit function with Assistant</p>- </DropdownMenuItem>- )}+ <DropdownMenuItem+ className="space-x-2"+ onClick={() => {+ setAiAssistantPanel({+ open: true,+ initialInput: 'Update this function to do...',+ suggestions: {+ title:+ 'I can help you make a change to this function, here are a few example prompts to get you started:',+ prompts: [+ 'Rename this function to ...',+ 'Modify this function so that it ...',+ 'Add a trigger for this function that calls it when ...',+ ],+ },+ sqlSnippets: [x.complete_statement],+ })+ }}+ >+ <Edit size={14} />+ <p>Edit function with Assistant</p>+ </DropdownMenuItem><DropdownMenuSeparator /><DropdownMenuItem className="space-x-2" onClick={() => deleteFunction(x)}><Trash size={14} className="text-destructive" />diff --git a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsxindex bc11bf2eccd..3f6010f3dfd 100644--- a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx+++ b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx@@ -5,7 +5,6 @@ import { Search } from 'lucide-react'import { useRouter } from 'next/router'import { useParams } from 'common'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'import Table from 'components/to-be-cleaned/Table'@@ -38,7 +37,6 @@ const FunctionsList = ({const { search } = useParams()const { project } = useProjectContext()const { setAiAssistantPanel } = useAppStateSnapshot()- const isAssistantV2Enabled = useIsAssistantV2Enabled()const { selectedSchema, setSelectedSchema } = useQuerySchemaState()const filterString = search ?? ''@@ -144,28 +142,26 @@ const FunctionsList = ({>Create a new function</ButtonTooltip>- {isAssistantV2Enabled && (- <ButtonTooltip- type="default"- disabled={!canCreateFunctions}- className="px-1 pointer-events-auto"- icon={<AiIconAnimation size={16} />}- onClick={() =>- setAiAssistantPanel({- open: true,- initialInput: `Create a new function for the schema ${selectedSchema} that does ...`,- })- }- tooltip={{- content: {- side: 'bottom',- text: !canCreateFunctions- ? 'You need additional permissions to create functions'- : 'Create with Supabase Assistant',- },- }}- />- )}+ <ButtonTooltip+ type="default"+ disabled={!canCreateFunctions}+ className="px-1 pointer-events-auto"+ icon={<AiIconAnimation size={16} />}+ onClick={() =>+ setAiAssistantPanel({+ open: true,+ initialInput: `Create a new function for the schema ${selectedSchema} that does ...`,+ })+ }+ tooltip={{+ content: {+ side: 'bottom',+ text: !canCreateFunctions+ ? 'You need additional permissions to create functions'+ : 'Create with Supabase Assistant',+ },+ }}+ /></>)}</div>diff --git a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsxindex 8ca577424c5..58c8282bcfd 100644--- a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx+++ b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx@@ -1,6 +1,13 @@-import * as Tooltip from '@radix-ui/react-tooltip'import { PermissionAction } from '@supabase/shared-types/out/constants'import { includes, sortBy } from 'lodash'+import { Check, Edit, Edit2, MoreVertical, Trash, X } from 'lucide-react'++import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'+import Table from 'components/to-be-cleaned/Table'+import { ButtonTooltip } from 'components/ui/ButtonTooltip'+import { useDatabaseTriggersQuery } from 'data/database-triggers/database-triggers-query'+import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { useAppStateSnapshot } from 'state/app-state'import {Badge,Button,@@ -12,15 +19,6 @@ import {TooltipContent_Shadcn_,TooltipTrigger_Shadcn_,} from 'ui'--import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'-import Table from 'components/to-be-cleaned/Table'-import { useDatabaseTriggersQuery } from 'data/database-triggers/database-triggers-query'-import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'-import { Check, X, MoreVertical, Edit3, Trash, Edit, Edit2 } from 'lucide-react'-import { useAppStateSnapshot } from 'state/app-state'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'-import { cn } from 'ui'import { generateTriggerCreateSQL } from './TriggerList.utils'interface TriggerListProps {@@ -40,7 +38,6 @@ const TriggerList = ({}: TriggerListProps) => {const { project } = useProjectContext()const { setAiAssistantPanel } = useAppStateSnapshot()- const isAssistantV2Enabled = useIsAssistantV2Enabled()const { data: triggers } = useDatabaseTriggersQuery({projectRef: project?.ref,@@ -141,40 +138,34 @@ const TriggerList = ({<DropdownMenuTrigger asChild><Button type="default" className="px-1" icon={<MoreVertical />} /></DropdownMenuTrigger>- <DropdownMenuContent- side="bottom"- align="end"- className={cn(isAssistantV2Enabled ? 'w-52' : 'w-36')}- >+ <DropdownMenuContent side="bottom" align="end" className="w-52"><DropdownMenuItem className="space-x-2" onClick={() => editTrigger(x)}><Edit2 size={14} /><p>Edit trigger</p></DropdownMenuItem>- {isAssistantV2Enabled && (- <DropdownMenuItem- className="space-x-2"- onClick={() => {- const sql = generateTriggerCreateSQL(x)- setAiAssistantPanel({- open: true,- initialInput: `Update this trigger which exists on the ${x.schema}.${x.table} table to...`,- suggestions: {- title:- 'I can help you make a change to this trigger, here are a few example prompts to get you started:',- prompts: [- 'Rename this trigger to ...',- 'Change the events this trigger responds to ...',- 'Modify this trigger to run after instead of before ...',- ],- },- sqlSnippets: [sql],- })- }}- >- <Edit size={14} />- <p>Edit with Assistant</p>- </DropdownMenuItem>- )}+ <DropdownMenuItem+ className="space-x-2"+ onClick={() => {+ const sql = generateTriggerCreateSQL(x)+ setAiAssistantPanel({+ open: true,+ initialInput: `Update this trigger which exists on the ${x.schema}.${x.table} table to...`,+ suggestions: {+ title:+ 'I can help you make a change to this trigger, here are a few example prompts to get you started:',+ prompts: [+ 'Rename this trigger to ...',+ 'Change the events this trigger responds to ...',+ 'Modify this trigger to run after instead of before ...',+ ],+ },+ sqlSnippets: [sql],+ })+ }}+ >+ <Edit size={14} />+ <p>Edit with Assistant</p>+ </DropdownMenuItem><DropdownMenuItem className="space-x-2" onClick={() => deleteTrigger(x)}><Trash stroke="red" size={14} /><p>Delete trigger</p>@@ -182,26 +173,18 @@ const TriggerList = ({</DropdownMenuContent></DropdownMenu>) : (- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger asChild>- <Button disabled type="default" icon={<MoreVertical />} />- </Tooltip.Trigger>- <Tooltip.Portal>- <Tooltip.Content side="left">- <Tooltip.Arrow className="radix-tooltip-arrow" />- <div- className={[- 'rounded bg-alternative py-1 px-2 leading-none shadow',- 'border border-background',- ].join(' ')}- >- <span className="text-xs text-foreground">- You need additional permissions to update triggers- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- </Tooltip.Root>+ <ButtonTooltip+ disabled+ type="default"+ className="px-1"+ icon={<MoreVertical />}+ tooltip={{+ content: {+ side: 'bottom',+ text: 'You need additional permissions to update triggers',+ },+ }}+ />)}</div>)}diff --git a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsxindex bca14055c72..8f02b21f250 100644--- a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx+++ b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx@@ -3,7 +3,6 @@ import { noop, partition } from 'lodash'import { Search } from 'lucide-react'import { useState } from 'react'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import AlphaPreview from 'components/to-be-cleaned/AlphaPreview'import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'@@ -34,6 +33,7 @@ const TriggersList = ({deleteTrigger = noop,}: TriggersListProps) => {const { project } = useProjectContext()+ const { setAiAssistantPanel } = useAppStateSnapshot()const { selectedSchema, setSelectedSchema } = useQuerySchemaState()const [filterString, setFilterString] = useState<string>('')@@ -59,9 +59,6 @@ const TriggersList = ({const canCreateTriggers = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'triggers')- const { setAiAssistantPanel } = useAppStateSnapshot()- const isAssistantV2Enabled = useIsAssistantV2Enabled()-if (isLoading) {return <GenericSkeletonLoader />}@@ -126,37 +123,35 @@ const TriggersList = ({>Create a new trigger</ButtonTooltip>- {isAssistantV2Enabled && (- <ButtonTooltip- type="default"- disabled={!canCreateTriggers}- className="px-1 pointer-events-auto"- icon={<AiIconAnimation size={16} />}- onClick={() =>- setAiAssistantPanel({- open: true,- initialInput: `Create a new trigger for the schema ${selectedSchema} that does ...`,- suggestions: {- title:- 'I can help you create a new trigger, here are a few example prompts to get you started:',- prompts: [- 'Create a trigger that logs changes to the users table',- 'Create a trigger that updates updated_at timestamp',- 'Create a trigger that validates email format before insert',- ],- },- })- }- tooltip={{- content: {- side: 'bottom',- text: !canCreateTriggers- ? 'You need additional permissions to create triggers'- : 'Create with Supabase Assistant',+ <ButtonTooltip+ type="default"+ disabled={!canCreateTriggers}+ className="px-1 pointer-events-auto"+ icon={<AiIconAnimation size={16} />}+ onClick={() =>+ setAiAssistantPanel({+ open: true,+ initialInput: `Create a new trigger for the schema ${selectedSchema} that does ...`,+ suggestions: {+ title:+ 'I can help you create a new trigger, here are a few example prompts to get you started:',+ prompts: [+ 'Create a trigger that logs changes to the users table',+ 'Create a trigger that updates updated_at timestamp',+ 'Create a trigger that validates email format before insert',+ ],},- }}- />- )}+ })+ }+ tooltip={{+ content: {+ side: 'bottom',+ text: !canCreateTriggers+ ? 'You need additional permissions to create triggers'+ : 'Create with Supabase Assistant',+ },+ }}+ /></div>)}</div>diff --git a/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/AiMessagePre.tsx b/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/AiMessagePre.tsxindex 8b2003a699a..86d7cabdca8 100644--- a/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/AiMessagePre.tsx+++ b/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/AiMessagePre.tsx@@ -20,6 +20,7 @@ interface AiMessagePreProps {className?: string}+// [DEPRECATED] To deleteexport const AiMessagePre = ({ onDiff, children, className }: AiMessagePreProps) => {const [copied, setCopied] = useState(false)diff --git a/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/Message.tsx b/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/Message.tsxindex e7bbd9dd31c..03c2156d57c 100644--- a/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/Message.tsx+++ b/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/Message.tsx@@ -21,6 +21,7 @@ interface MessageProps {action?: React.ReactNode}+// [DEPRECATED] To deleteconst Message = memo(function Message({name,role,diff --git a/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/index.tsx b/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/index.tsxindex d27eebd1d8f..0424b2d477b 100644--- a/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/index.tsx+++ b/apps/studio/components/interfaces/SQLEditor/AiAssistantPanel/index.tsx@@ -51,6 +51,7 @@ interface AiAssistantPanelProps {onClose: () => void}+// [DEPRECATED] To deleteexport const AiAssistantPanel = ({selectedMessage,existingSql,diff --git a/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx b/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsxindex 08c0dfd01ff..4b05881848d 100644--- a/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx+++ b/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx@@ -12,7 +12,6 @@ import { useAppStateSnapshot } from 'state/app-state'import { useSqlEditorV2StateSnapshot } from 'state/sql-editor-v2'import { cn } from 'ui'import { Admonition } from 'ui-patterns'-import { useIsAssistantV2Enabled } from '../App/FeaturePreview/FeaturePreviewContext'import { untitledSnippetTitle } from './SQLEditor.constants'import type { IStandaloneCodeEditor } from './SQLEditor.types'import { createSqlSnippetSkeletonV2 } from './SQLEditor.utils'@@ -42,7 +41,6 @@ const MonacoEditor = ({const project = useSelectedProject()const snapV2 = useSqlEditorV2StateSnapshot()- const isAssistantV2Enabled = useIsAssistantV2Enabled()const { setAiAssistantPanel } = useAppStateSnapshot()const [intellisenseEnabled] = useLocalStorageQuery(@@ -77,24 +75,22 @@ const MonacoEditor = ({},})- if (isAssistantV2Enabled) {- editor.addAction({- id: 'explain-code',- label: 'Explain Code',- contextMenuGroupId: 'operation',- contextMenuOrder: 1,- run: () => {- const selectedValue = (editorRef?.current as any)- .getModel()- .getValueInRange((editorRef?.current as any)?.getSelection())- setAiAssistantPanel({- open: true,- sqlSnippets: [selectedValue],- initialInput: 'Can you explain this section to me in more detail?',- })- },- })- }+ editor.addAction({+ id: 'explain-code',+ label: 'Explain Code',+ contextMenuGroupId: 'operation',+ contextMenuOrder: 1,+ run: () => {+ const selectedValue = (editorRef?.current as any)+ .getModel()+ .getValueInRange((editorRef?.current as any)?.getSelection())+ setAiAssistantPanel({+ open: true,+ sqlSnippets: [selectedValue],+ initialInput: 'Can you explain this section to me in more detail?',+ })+ },+ })editor.onDidChangeCursorSelection(({ selection }) => {const noSelection =diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsxindex a958b2ffcb8..620c265b844 100644--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx@@ -6,7 +6,6 @@ import dynamic from 'next/dynamic'import { useRouter } from 'next/router'import { useCallback, useEffect, useMemo, useRef, useState } from 'react'import { toast } from 'sonner'-import { format } from 'sql-formatter'import { Separator } from '@ui/components/SidePanel/SidePanel'import { useParams } from 'common'@@ -35,14 +34,12 @@ import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'import { isRoleImpersonationEnabled, useGetImpersonatedRole } from 'state/role-impersonation-state'import { getSqlEditorV2StateSnapshot, useSqlEditorV2StateSnapshot } from 'state/sql-editor-v2'import {- AiIconAnimation,Button,DropdownMenu,DropdownMenuContent,DropdownMenuRadioGroup,DropdownMenuRadioItem,DropdownMenuTrigger,- ImperativePanelHandle,ResizableHandle,ResizablePanel,ResizablePanelGroup,@@ -52,9 +49,7 @@ import {cn,} from 'ui'import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'-import { useIsAssistantV2Enabled } from '../App/FeaturePreview/FeaturePreviewContext'import { subscriptionHasHipaaAddon } from '../Billing/Subscription/Subscription.utils'-import { AiAssistantPanel } from './AiAssistantPanel'import AISchemaSuggestionPopover from './AISchemaSuggestionPopover'import { DiffActionBar } from './DiffActionBar'import {@@ -106,7 +101,6 @@ const SQLEditor = () => {const databaseSelectorState = useDatabaseSelectorStateSnapshot()const queryClient = useQueryClient()- const isAssistantV2Enabled = useIsAssistantV2Enabled()const { open } = appSnap.aiAssistantPanelconst { mutate: formatQuery } = useFormatQueryMutation()@@ -121,26 +115,20 @@ const SQLEditor = () => {const editorRef = useRef<IStandaloneCodeEditor | null>(null)const monacoRef = useRef<Monaco | null>(null)const diffEditorRef = useRef<IStandaloneDiffEditor | null>(null)- const aiPanelRef = useRef<ImperativePanelHandle>(null)const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: organization?.slug })const { data: databases, isSuccess: isSuccessReadReplicas } = useReadReplicasQuery({projectRef: ref,})- // Customers on HIPAA plans should not have access to Supabase AI- const hasHipaaAddon = subscriptionHasHipaaAddon(subscription)-- // [Joshen] This eventually needs to be in the app state- const [isAiOpen, setIsAiOpen] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_OPEN, true)- const isAssistantOpen = (!isAssistantV2Enabled && isAiOpen) || (isAssistantV2Enabled && open)-const [showPotentialIssuesModal, setShowPotentialIssuesModal] = useState(false)const [queryHasDestructiveOperations, setQueryHasDestructiveOperations] = useState(false)const [queryHasUpdateWithoutWhere, setQueryHasUpdateWithoutWhere] = useState(false)const isOptedInToAI = useOrgOptedIntoAi()const [selectedSchemas] = useSchemasForAi(project?.ref!)+ // Customers on HIPAA plans should not have access to Supabase AI+ const hasHipaaAddon = subscriptionHasHipaaAddon(subscription)const includeSchemaMetadata = isOptedInToAI || !IS_PLATFORMconst [isAcceptDiffLoading, setIsAcceptDiffLoading] = useState(false)@@ -411,33 +399,11 @@ const SQLEditor = () => {try {const snippet = snapV2.snippets[id]const result = snapV2.results[id]?.[0]- if (isAssistantV2Enabled) {- appSnap.setAiAssistantPanel({- open: true,- sqlSnippets: [snippet.snippet.content.sql.replace(sqlAiDisclaimerComment, '').trim()],- initialInput: `Help me to debug the attached sql snippet which gives the following error: \n\n${result.error.message}`,- })- } else {- const { solution, sql } = await debugSql({- sql: snippet.snippet.content.sql.replace(sqlAiDisclaimerComment, '').trim(),- errorMessage: result.error.message,- entityDefinitions,- })-- const formattedSql =- sqlAiDisclaimerComment +- '\n\n' +- format(sql, {- language: 'postgresql',- keywordCase: 'lower',- })- setDebugSolution(solution)- setSourceSqlDiff({- original: snippet.snippet.content.sql,- modified: formattedSql,- })- setSelectedDiffType(DiffType.Modification)- }+ appSnap.setAiAssistantPanel({+ open: true,+ sqlSnippets: [snippet.snippet.content.sql.replace(sqlAiDisclaimerComment, '').trim()],+ initialInput: `Help me to debug the attached sql snippet which gives the following error: \n\n${result.error.message}`,+ })} catch (error: unknown) {// [Joshen] There's a tendency for the SQL debug to chuck a lengthy error message// that's not relevant for the user - so we prettify it here by avoiding to return the@@ -693,7 +659,7 @@ const SQLEditor = () => {direction="vertical"autoSaveId={LOCAL_STORAGE_KEYS.SQL_EDITOR_SPLIT_SIZE}>- {(isAssistantOpen || isDiffOpen) && !hasHipaaAddon && (+ {(open || isDiffOpen) && !hasHipaaAddon && (<AISchemaSuggestionPopoveronClickSettings={() => {appSnap.setShowAiSettingsModal(true)@@ -729,41 +695,6 @@ const SQLEditor = () => {)}<ResizablePanel maxSize={70}><div className="flex-grow overflow-y-auto border-b h-full">- {!isAssistantV2Enabled && !isAiOpen && (- <motion.button- layoutId="ask-ai-input-icon"- transition={{ duration: 0.1 }}- className="group absolute z-10 rounded-lg right-[24px] top-4 transition-all duration-200 ease-out"- onClick={() => {- if (isAssistantV2Enabled) {- const state = getSqlEditorV2StateSnapshot()- const snippet = state.snippets[id]- const editor = editorRef.current- const selection = editor?.getSelection()- const selectedValue = selection- ? editor?.getModel()?.getValueInRange(selection)- : undefined- const sql = snippet- ? (selectedValue || editorRef.current?.getValue()) ??- snippet.snippet.content.sql- : selectedValue || editorRef.current?.getValue()-- appSnap.setAiAssistantPanel({- open: true,- sqlSnippets: sql ? [sql] : [],- initialInput: sql- ? `Help me make a change to the attached sql snippet`- : '',- })- } else {- aiPanelRef.current?.expand()- }- }}- >- <AiIconAnimation loading={false} allowHoverEffect />- </motion.button>- )}-{isLoading ? (<div className="flex h-full w-full items-center justify-center"><Loader2 className="animate-spin text-brand" />@@ -895,28 +826,6 @@ const SQLEditor = () => {</ResizablePanel></ResizablePanelGroup></ResizablePanel>-- {!isAssistantV2Enabled && (- <>- <ResizableHandle withHandle />- <ResizablePanel- ref={aiPanelRef}- collapsible- collapsedSize={0}- minSize={31}- maxSize={40}- onCollapse={() => setIsAiOpen(false)}- onExpand={() => setIsAiOpen(true)}- >- <AiAssistantPanel- existingSql={editorRef.current?.getValue() || ''}- includeSchemaMetadata={includeSchemaMetadata}- onDiff={updateEditorWithCheckForDiff}- onClose={() => aiPanelRef.current?.collapse()}- />- </ResizablePanel>- </>- )}</ResizablePanelGroup></>)diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsxindex 6285bcc5761..66cc136d935 100644--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx@@ -1,7 +1,8 @@-import { useParams } from 'common'import Link from 'next/link'import { useMemo } from 'react'+import { useParams } from 'common'+import AssistantButton from 'components/layouts/AppLayout/AssistantButton'import BranchDropdown from 'components/layouts/AppLayout/BranchDropdown'import EnableBranchingButton from 'components/layouts/AppLayout/EnableBranchingButton/EnableBranchingButton'import OrganizationDropdown from 'components/layouts/AppLayout/OrganizationDropdown'@@ -17,14 +18,11 @@ import BreadcrumbsView from './BreadcrumbsView'import { FeedbackDropdown } from './FeedbackDropdown'import HelpPopover from './HelpPopover'import NotificationsPopoverV2 from './NotificationsPopoverV2/NotificationsPopover'-import AssistantButton from 'components/layouts/AppLayout/AssistantButton'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder = true }: any) => {const { ref: projectRef } = useParams()const selectedProject = useSelectedProject()const selectedOrganization = useSelectedOrganization()- const isAssistantV2Enabled = useIsAssistantV2Enabled()const isBranchingEnabled = selectedProject?.is_branch_enabled === trueconst { data: subscription } = useOrgSubscriptionQuery({@@ -127,7 +125,7 @@ const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder =</div></div></div>- {isAssistantV2Enabled && !!projectRef && (+ {!!projectRef && (<div className="border-l flex-0 h-full"><AssistantButton /></div>diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsxindex 256621653f9..06089b1163e 100644--- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx+++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx@@ -1,4 +1,3 @@-import { useParams } from 'common'import { Home, User } from 'icons'import { isUndefined } from 'lodash'import { Command, FileText, FlaskConical, Search, Settings } from 'lucide-react'@@ -7,10 +6,8 @@ import Link from 'next/link'import { useRouter } from 'next/router'import { useState } from 'react'-import {- useIsAPIDocsSidePanelEnabled,- useIsAssistantV2Enabled,-} from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'+import { useParams } from 'common'+import { useIsAPIDocsSidePanelEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import { useProjectLintsQuery } from 'data/lint/lint-query'import { ProjectIndexPageLink } from 'data/prefetchers/project.$ref'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'@@ -73,7 +70,6 @@ const NavigationBar = () => {const navLayoutV2 = useFlag('navigationLayoutV2')const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()- const isFunctionsAssistantEnabled = useIsAssistantV2Enabled()const [userDropdownOpen, setUserDropdownOpenState] = useState(false)const [allowNavPanelToExpand] = useLocalStorageQuery(@@ -120,37 +116,7 @@ const NavigationBar = () => {)}- const CommandButton = !isFunctionsAssistantEnabled ? (- <NavigationIconButton- size="tiny"- onClick={() => {- setCommandMenuOpen(true)- snap.setNavigationPanelOpen(false)- }}- type="text"- icon={<Search size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />}- rightText={- <div- className={cn(- 'flex items-center gap-1',- 'h-6 py-1.5 px-2 leading-none',- 'bg-surface-100 text-foreground-lighter',- 'border border-default rounded-md',- 'shadow-xs shadow-background-surface-100'- )}- >- {os === 'macos' || true ? ( // todo: issue with `os` and hydration fail- <Command size={11.5} strokeWidth={1.5} />- ) : (- <p className="text-xs">CTRL</p>- )}- <p className="text-xs">K</p>- </div>- }- >- Search- </NavigationIconButton>- ) : (+ const CommandButton = (<HoverCard_Shadcn_ openDelay={10}><HoverCardTrigger_Shadcn_ asChild><NavigationIconButtondiff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsxindex 81c7849f019..d467a4f6fd6 100644--- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx+++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx@@ -1,9 +1,8 @@-import { useParams } from 'common'import Head from 'next/head'import { useRouter } from 'next/router'import { forwardRef, Fragment, PropsWithChildren, ReactNode, useEffect } from 'react'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'+import { useParams } from 'common'import ProjectAPIDocs from 'components/interfaces/ProjectAPIDocs/ProjectAPIDocs'import { AiAssistantPanel } from 'components/ui/AIAssistantPanel/AIAssistantPanel'import AISettingsModal from 'components/ui/AISettingsModal'@@ -96,7 +95,6 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayoutconst { open } = aiAssistantPanelconst navLayoutV2 = useFlag('navigationLayoutV2')- const isAssistantV2Enabled = useIsAssistantV2Enabled()const projectName = selectedProject?.nameconst organizationName = selectedOrganization?.name@@ -120,10 +118,10 @@ const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<ProjectLayoute.stopPropagation()}}- if (isAssistantV2Enabled) window.addEventListener('keydown', handler)+ window.addEventListener('keydown', handler)return () => window.removeEventListener('keydown', handler)// eslint-disable-next-line react-hooks/exhaustive-deps- }, [isAssistantV2Enabled, open])+ }, [open])return (<AppLayout>diff --git a/apps/studio/lib/constants/index.ts b/apps/studio/lib/constants/index.tsindex bfca4e0614c..efffcd60df1 100644--- a/apps/studio/lib/constants/index.ts+++ b/apps/studio/lib/constants/index.ts@@ -33,7 +33,6 @@ export const LOCAL_STORAGE_KEYS = {UI_PREVIEW_NAVIGATION_LAYOUT: 'supabase-ui-preview-nav-layout',UI_PREVIEW_API_SIDE_PANEL: 'supabase-ui-api-side-panel',UI_PREVIEW_CLS: 'supabase-ui-cls',- UI_PREVIEW_ASSISTANT_V2: 'supabase-ui-assistant-v2',UI_ONBOARDING_NEW_PAGE_SHOWN: 'supabase-ui-onboarding-new-page-shown',SQL_SCRATCH_PAD_BANNER_ACKNOWLEDGED: 'supabase-sql-scratch-pad-banner-acknowledged',diff --git a/apps/studio/pages/project/[ref]/auth/policies.tsx b/apps/studio/pages/project/[ref]/auth/policies.tsxindex b6e38e3e40d..2db8fb416a5 100644--- a/apps/studio/pages/project/[ref]/auth/policies.tsx+++ b/apps/studio/pages/project/[ref]/auth/policies.tsx@@ -4,7 +4,6 @@ import { partition } from 'lodash'import { Search } from 'lucide-react'import { useState } from 'react'-import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'import { AIPolicyEditorPanel } from 'components/interfaces/Auth/Policies/AIPolicyEditorPanel'import Policies from 'components/interfaces/Auth/Policies/Policies'import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'@@ -20,7 +19,6 @@ import { useTablesQuery } from 'data/tables/tables-query'import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'import { useUrlState } from 'hooks/ui/useUrlState'import { PROTECTED_SCHEMAS } from 'lib/constants/schemas'-import { useAppStateSnapshot } from 'state/app-state'import type { NextPageWithLayout } from 'types'import { Input } from 'ui'@@ -66,8 +64,6 @@ const AuthPoliciesPage: NextPageWithLayout = () => {}>()const { schema = 'public', search: searchString = '' } = paramsconst { project } = useProjectContext()- const isAssistantV2Enabled = useIsAssistantV2Enabled()- const { setAiAssistantPanel } = useAppStateSnapshot()const [selectedTable, setSelectedTable] = useState<string>()const [showPolicyAiEditor, setShowPolicyAiEditor] = useState(false)