Skip to content

Commit 2bff117

Browse files
authored
Revert "Feature/assistant mcp" (supabase#36684)
Revert "Feature/assistant mcp (supabase#35318)" This reverts commit 3a50dd1.
1 parent f6692f2 commit 2bff117

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1998
-3784
lines changed

apps/studio/components/interfaces/App/CommandMenu/CommandMenu.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
useQueryTableCommands,
55
useSnippetCommands,
66
} from 'components/layouts/SQLEditorLayout/SqlEditor.Commands'
7+
import { useGenerateSqlCommand } from 'components/interfaces/SqlGenerator/SqlGenerator.Commands'
78
import { useProjectLevelTableEditorCommands } from 'components/layouts/TableEditorLayout/TableEditor.Commands'
89
import { useLayoutNavCommands } from 'components/layouts/useLayoutNavCommands'
910
import { CommandHeader, CommandInput, CommandList, CommandMenu } from 'ui-patterns/CommandMenu'
@@ -18,6 +19,7 @@ import { useSupportCommands } from './Support'
1819
import { orderCommandSectionsByPriority } from './ordering'
1920

2021
export default function StudioCommandMenu() {
22+
useGenerateSqlCommand()
2123
useApiKeysCommands()
2224
useApiUrlCommand()
2325
useProjectLevelTableEditorCommands()

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
77
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
88
import { IS_PLATFORM } from 'lib/constants'
99
import { useAppStateSnapshot } from 'state/app-state'
10+
import { removeTabsByEditor } from 'state/tabs'
1011
import { Badge, Button, Modal, ScrollArea, cn } from 'ui'
1112
import { APISidePanelPreview } from './APISidePanelPreview'
1213
import { CLSPreview } from './CLSPreview'
@@ -57,6 +58,13 @@ const FeaturePreviewModal = () => {
5758
properties: { feature: selectedFeatureKey },
5859
groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' },
5960
})
61+
62+
if (ref && selectedFeatureKey === LOCAL_STORAGE_KEYS.UI_TABLE_EDITOR_TABS) {
63+
removeTabsByEditor(ref, 'table')
64+
}
65+
if (ref && selectedFeatureKey === LOCAL_STORAGE_KEYS.UI_SQL_EDITOR_TABS) {
66+
removeTabsByEditor(ref, 'sql')
67+
}
6068
}
6169

6270
function handleCloseFeaturePreviewModal() {

apps/studio/components/interfaces/Integrations/CronJobs/CronJobScheduleSection.tsx

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { useEffect, useState } from 'react'
33
import { UseFormReturn } from 'react-hook-form'
44
import { useDebounce } from 'use-debounce'
55

6+
import { useCompletion } from 'ai/react'
67
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
7-
import { useSqlCronGenerateMutation } from 'data/ai/sql-cron-mutation'
88
import { useCronTimezoneQuery } from 'data/database-cron-jobs/database-cron-timezone-query'
9+
import { constructHeaders } from 'data/fetchers'
10+
import { BASE_PATH } from 'lib/constants'
911
import {
1012
Accordion_Shadcn_,
1113
AccordionContent_Shadcn_,
@@ -48,13 +50,25 @@ export const CronJobScheduleSection = ({ form, supportsSeconds }: CronJobSchedul
4850
{ name: 'Every Monday at 2 AM', expression: '0 2 * * 1' },
4951
] as const
5052

51-
const { mutate: generateCronSyntax, isLoading: isGeneratingCron } = useSqlCronGenerateMutation({
52-
onSuccess: (expression) => {
53-
form.setValue('schedule', expression, {
54-
shouldValidate: true,
55-
shouldDirty: true,
56-
shouldTouch: true,
57-
})
53+
const {
54+
complete: generateCronSyntax,
55+
isLoading: isGeneratingCron,
56+
stop,
57+
} = useCompletion({
58+
api: `${BASE_PATH}/api/ai/sql/cron`,
59+
onResponse: async (response) => {
60+
if (response.ok) {
61+
// remove quotes from the cron expression
62+
const expression = (await response.text()).trim().replace(/^"|"$/g, '')
63+
form.setValue('schedule', expression, {
64+
shouldValidate: true,
65+
shouldDirty: true,
66+
shouldTouch: true,
67+
})
68+
}
69+
},
70+
onError: (error) => {
71+
console.error('Error generating cron:', error)
5872
},
5973
})
6074

@@ -65,7 +79,12 @@ export const CronJobScheduleSection = ({ form, supportsSeconds }: CronJobSchedul
6579

6680
useEffect(() => {
6781
if (useNaturalLanguage && debouncedValue) {
68-
generateCronSyntax({ prompt: debouncedValue })
82+
constructHeaders().then((headers) =>
83+
generateCronSyntax(debouncedValue, {
84+
headers: { Authorization: headers.get('Authorization') ?? '' },
85+
})
86+
)
87+
return () => stop()
6988
}
7089
// eslint-disable-next-line react-hooks/exhaustive-deps
7190
}, [debouncedValue, useNaturalLanguage])

apps/studio/components/interfaces/Organization/GeneralSettings/AIOptInLevelSelector.tsx

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

apps/studio/components/interfaces/Organization/GeneralSettings/DataPrivacyForm.tsx

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

0 commit comments

Comments
 (0)