Skip to content

Commit d88cb12

Browse files
authored
Remove assistant V2 from feature preview (supabase#30779)
* Remove assistant V2 from feature preview * Hide fix with assistant button in rls editor
1 parent 980ca0a commit d88cb12

File tree

20 files changed

+184
-443
lines changed

20 files changed

+184
-443
lines changed

apps/studio/components/interfaces/App/FeaturePreview/AssistantV2Preview.tsx

Lines changed: 0 additions & 55 deletions
This file was deleted.

apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,8 @@ import { LOCAL_STORAGE_KEYS } from 'lib/constants'
55
import { EMPTY_OBJ } from 'lib/void'
66
import { APISidePanelPreview } from './APISidePanelPreview'
77
import { CLSPreview } from './CLSPreview'
8-
import { AssistantV2Preview } from './AssistantV2Preview'
98

109
export const FEATURE_PREVIEWS = [
11-
{
12-
key: LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2,
13-
name: 'Supabase AI Assistant V2',
14-
content: <AssistantV2Preview />,
15-
discussionsUrl: undefined,
16-
isNew: true,
17-
},
1810
{
1911
key: LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL,
2012
name: 'Project API documentation',
@@ -85,8 +77,3 @@ export const useIsColumnLevelPrivilegesEnabled = () => {
8577
const { flags } = useFeaturePreviewContext()
8678
return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS]
8779
}
88-
89-
export const useIsAssistantV2Enabled = () => {
90-
const { flags } = useFeaturePreviewContext()
91-
return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2]
92-
}

apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useEffect, useState } from 'react'
44

55
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
66
import { useFlag } from 'hooks/ui/useFlag'
7-
import { LOCAL_STORAGE_KEYS } from 'lib/constants'
87
import { TELEMETRY_EVENTS } from 'lib/constants/telemetry'
98
import { useAppStateSnapshot } from 'state/app-state'
109
import { Badge, Button, Modal, ScrollArea, cn } from 'ui'
@@ -42,13 +41,6 @@ const FeaturePreviewModal = () => {
4241
label: selectedFeatureKey,
4342
value: isSelectedFeatureEnabled ? 'disabled' : 'enabled',
4443
})
45-
46-
if (
47-
selectedFeatureKey === LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2 &&
48-
isSelectedFeatureEnabled
49-
) {
50-
snap.setAiAssistantPanel({ open: false })
51-
}
5244
}
5345

5446
function handleCloseFeaturePreviewModal() {

apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/QueryError.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ const QueryError = ({
7272
{open ? 'Hide error details' : 'Show error details'}
7373
</Button>
7474
</CollapsibleTrigger_Shadcn_>
75-
{!hasHipaaAddon && (
75+
{/* [Joshen] Temp hidden as new assistant doesnt support this. Current assistant's UX is not great too tbh so okay to hide this */}
76+
{/* {!hasHipaaAddon && (
7677
<Button
7778
size="tiny"
7879
type="default"
@@ -91,7 +92,7 @@ const QueryError = ({
9192
>
9293
Fix with Assistant
9394
</Button>
94-
)}
95+
)} */}
9596
</div>
9697
<CollapsibleContent_Shadcn_ className="overflow-auto">
9798
{formattedError.length > 0 ? (

apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsx

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { PostgresPolicy } from '@supabase/postgres-meta'
22
import { PermissionAction } from '@supabase/shared-types/out/constants'
33
import { noop } from 'lodash'
4+
import { Edit, MoreVertical, Trash } from 'lucide-react'
45

56
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
67
import { DropdownMenuItemTooltip } from 'components/ui/DropdownMenuItemTooltip'
78
import Panel from 'components/ui/Panel'
89
import { useAuthConfigQuery } from 'data/auth/auth-config-query'
910
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
10-
import { Edit, MoreVertical, Trash } from 'lucide-react'
11+
import { useAppStateSnapshot } from 'state/app-state'
1112
import {
1213
Badge,
1314
Button,
@@ -21,8 +22,6 @@ import {
2122
TooltipContent_Shadcn_,
2223
TooltipTrigger_Shadcn_,
2324
} from 'ui'
24-
import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
25-
import { useAppStateSnapshot } from 'state/app-state'
2625
import { generatePolicyCreateSQL } from './PolicyTableRow.utils'
2726

2827
interface PolicyRowProps {
@@ -39,7 +38,6 @@ const PolicyRow = ({
3938
onSelectDeletePolicy = noop,
4039
}: PolicyRowProps) => {
4140
const { setAiAssistantPanel } = useAppStateSnapshot()
42-
const isAssistantV2Enabled = useIsAssistantV2Enabled()
4341
const canUpdatePolicies = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'policies')
4442

4543
const { project } = useProjectContext()
@@ -106,39 +104,33 @@ const PolicyRow = ({
106104
<DropdownMenuTrigger asChild>
107105
<Button type="default" className="px-1.5" icon={<MoreVertical />} />
108106
</DropdownMenuTrigger>
109-
<DropdownMenuContent
110-
side="bottom"
111-
align="end"
112-
className={cn(isAssistantV2Enabled ? 'w-52' : 'w-40')}
113-
>
107+
<DropdownMenuContent side="bottom" align="end" className="w-52">
114108
<DropdownMenuItem className="gap-x-2" onClick={() => onSelectEditPolicy(policy)}>
115109
<Edit size={14} />
116110
<p>Edit policy</p>
117111
</DropdownMenuItem>
118-
{isAssistantV2Enabled && (
119-
<DropdownMenuItem
120-
className="space-x-2"
121-
onClick={() => {
122-
const sql = generatePolicyCreateSQL(policy)
123-
setAiAssistantPanel({
124-
open: true,
125-
sqlSnippets: [sql],
126-
initialInput: `Update the policy with name "${policy.name}" in the ${policy.schema} schema on the ${policy.table} table. It should...`,
127-
suggestions: {
128-
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:`,
129-
prompts: [
130-
'Tell me how I can improve this policy...',
131-
'Duplicate this policy for another table...',
132-
'Add extra conditions to this policy...',
133-
],
134-
},
135-
})
136-
}}
137-
>
138-
<Edit size={14} />
139-
<p>Edit policy with Assistant</p>
140-
</DropdownMenuItem>
141-
)}
112+
<DropdownMenuItem
113+
className="space-x-2"
114+
onClick={() => {
115+
const sql = generatePolicyCreateSQL(policy)
116+
setAiAssistantPanel({
117+
open: true,
118+
sqlSnippets: [sql],
119+
initialInput: `Update the policy with name "${policy.name}" in the ${policy.schema} schema on the ${policy.table} table. It should...`,
120+
suggestions: {
121+
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:`,
122+
prompts: [
123+
'Tell me how I can improve this policy...',
124+
'Duplicate this policy for another table...',
125+
'Add extra conditions to this policy...',
126+
],
127+
},
128+
})
129+
}}
130+
>
131+
<Edit size={14} />
132+
<p>Edit policy with Assistant</p>
133+
</DropdownMenuItem>
142134
<DropdownMenuSeparator />
143135
<DropdownMenuItemTooltip
144136
className="gap-x-2"

apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Lock, Unlock } from 'lucide-react'
44
import { useQueryState } from 'nuqs'
55

66
import { useParams } from 'common'
7-
import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
87
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
98
import { EditorTablePageLink } from 'data/prefetchers/project.$ref.editor.$id'
109
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
@@ -37,7 +36,6 @@ const PolicyTableRowHeader = ({
3736
const { ref } = useParams()
3837
const { setAiAssistantPanel } = useAppStateSnapshot()
3938

40-
const enableAssistantV2 = useIsAssistantV2Enabled()
4139
const canCreatePolicies = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'policies')
4240
const canToggleRLS = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'tables')
4341

@@ -117,15 +115,10 @@ const PolicyTableRowHeader = ({
117115
type="default"
118116
className="px-1"
119117
onClick={() => {
120-
if (enableAssistantV2) {
121-
setAiAssistantPanel({
122-
open: true,
123-
initialInput: `Create a new policy for the ${table.schema} schema on the ${table.name} table that ...`,
124-
})
125-
} else {
126-
onSelectCreatePolicy()
127-
setEditView('conversation')
128-
}
118+
setAiAssistantPanel({
119+
open: true,
120+
initialInput: `Create a new policy for the ${table.schema} schema on the ${table.name} table that ...`,
121+
})
129122
}}
130123
tooltip={{
131124
content: {

apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
1111
import { useAppStateSnapshot } from 'state/app-state'
1212
import {
1313
Button,
14-
cn,
1514
DropdownMenu,
1615
DropdownMenuContent,
1716
DropdownMenuItem,
1817
DropdownMenuSeparator,
1918
DropdownMenuTrigger,
2019
} from 'ui'
21-
import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
2220

2321
interface FunctionListProps {
2422
schema: string
@@ -38,7 +36,6 @@ const FunctionList = ({
3836
const router = useRouter()
3937
const { project: selectedProject } = useProjectContext()
4038
const { setAiAssistantPanel } = useAppStateSnapshot()
41-
const isAssistantV2Enabled = useIsAssistantV2Enabled()
4239

4340
const { data: functions } = useDatabaseFunctionsQuery({
4441
projectRef: selectedProject?.ref,
@@ -111,10 +108,7 @@ const FunctionList = ({
111108
<DropdownMenuTrigger asChild>
112109
<Button type="default" className="px-1" icon={<MoreVertical />} />
113110
</DropdownMenuTrigger>
114-
<DropdownMenuContent
115-
side="left"
116-
className={cn(isAssistantV2Enabled ? 'w-52' : 'w-40')}
117-
>
111+
<DropdownMenuContent side="left" className="w-52">
118112
{isApiDocumentAvailable && (
119113
<DropdownMenuItem
120114
className="space-x-2"
@@ -128,30 +122,28 @@ const FunctionList = ({
128122
<Edit2 size={14} />
129123
<p>Edit function</p>
130124
</DropdownMenuItem>
131-
{isAssistantV2Enabled && (
132-
<DropdownMenuItem
133-
className="space-x-2"
134-
onClick={() => {
135-
setAiAssistantPanel({
136-
open: true,
137-
initialInput: 'Update this function to do...',
138-
suggestions: {
139-
title:
140-
'I can help you make a change to this function, here are a few example prompts to get you started:',
141-
prompts: [
142-
'Rename this function to ...',
143-
'Modify this function so that it ...',
144-
'Add a trigger for this function that calls it when ...',
145-
],
146-
},
147-
sqlSnippets: [x.complete_statement],
148-
})
149-
}}
150-
>
151-
<Edit size={14} />
152-
<p>Edit function with Assistant</p>
153-
</DropdownMenuItem>
154-
)}
125+
<DropdownMenuItem
126+
className="space-x-2"
127+
onClick={() => {
128+
setAiAssistantPanel({
129+
open: true,
130+
initialInput: 'Update this function to do...',
131+
suggestions: {
132+
title:
133+
'I can help you make a change to this function, here are a few example prompts to get you started:',
134+
prompts: [
135+
'Rename this function to ...',
136+
'Modify this function so that it ...',
137+
'Add a trigger for this function that calls it when ...',
138+
],
139+
},
140+
sqlSnippets: [x.complete_statement],
141+
})
142+
}}
143+
>
144+
<Edit size={14} />
145+
<p>Edit function with Assistant</p>
146+
</DropdownMenuItem>
155147
<DropdownMenuSeparator />
156148
<DropdownMenuItem className="space-x-2" onClick={() => deleteFunction(x)}>
157149
<Trash size={14} className="text-destructive" />

0 commit comments

Comments
 (0)