The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Rearrange opt-in modal
Terry Sutton71311c47af2f
diff --git a/studio/components/interfaces/SQLEditor/AISettingsModal.tsx b/studio/components/interfaces/SQLEditor/AISettingsModal.tsxindex 9d6b0e7b218..cf705722865 100644--- a/studio/components/interfaces/SQLEditor/AISettingsModal.tsx+++ b/studio/components/interfaces/SQLEditor/AISettingsModal.tsx@@ -1,9 +1,8 @@import { ModalProps } from '@ui/components/Modal/Modal'-import { useLocalStorageQuery, useSelectedOrganization } from 'hooks'+import { useLocalStorageQuery, useSelectedOrganization, useStore } from 'hooks'import { IS_PLATFORM } from 'lib/constants'import Link from 'next/link'import { Alert, IconExternalLink, Modal, Toggle } from 'ui'-export interface AISettingsModalProps {visible: boolean}@@ -16,30 +15,22 @@ const AISettingsModal = (props: ModalProps) => {'supabase_sql-editor-ai-schema-enabled',true)+ const { ui } = useStore()const includeSchemaMetadata = (isOptedInToAI || !IS_PLATFORM) && hasEnabledAISchema+ const handleOptInToggle = () => {+ setHasEnabledAISchema((prev) => !prev)+ ui.setNotification({ category: 'success', message: 'Successfully saved settings' })+ }+return (<Modal header="SQL Editor AI Settings" hideFooter closable {...props}><div className="flex flex-col items-start justify-between gap-4 px-6 py-3">- <div className="flex items-center justify-between">- <div>- <p className="text-sm">Include database metadata in AI requests</p>- <p className="text-sm text-scale-1000">- Includes table names, column names and their corresponding data types in the request.- This will generate queries that are more relevant to your project.- </p>- </div>- <Toggle- disabled={IS_PLATFORM && !isOptedInToAI}- checked={includeSchemaMetadata}- onChange={() => setHasEnabledAISchema((prev) => !prev)}- />- </div>{IS_PLATFORM && !isOptedInToAI && selectedOrganization && (<Alertvariant="warning"- title="This option requires the OpenAI data opt-in on your organization"+ title="This option is only available if your organization has opted-in to sending anonymous data to OpenAI."><Link href={`/org/${selectedOrganization.slug}/general`} passHref><a className="flex flex-row gap-1 items-center" target="_blank" rel="noopener">@@ -49,6 +40,20 @@ const AISettingsModal = (props: ModalProps) => {</Link></Alert>)}+ <div className="flex justify-between gap-8 mr-8 my-4">+ <Toggle+ disabled={IS_PLATFORM && !isOptedInToAI}+ checked={includeSchemaMetadata}+ onChange={handleOptInToggle}+ />+ <div className="grid gap-2">+ <p className="text-sm">Include anonymous database metadata in AI queries</p>+ <p className="text-sm text-scale-1000">+ Includes table names, column names and their corresponding data types in the request.+ This will generate queries that are more relevant to your project.+ </p>+ </div>+ </div></div></Modal>)