Skip to content

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

Merge branch 'master' into feat/new-ai-query-button

Greg Richardsonc36bd8b8d977
diff --cc packages/ui/src/components/Command/GenerateSQL/GenerateSQL.tsx
index 709aefe401c,4ad23f9fcff..bd018484210
--- a/packages/ui/src/components/Command/GenerateSQL/GenerateSQL.tsx
+++ b/packages/ui/src/components/Command/GenerateSQL/GenerateSQL.tsx
@@@ -284,17 -234,54 +234,63 @@@ const GenerateSQL = () =>
<div className="[overflow-anchor:auto] h-px w-full"></div>
</div>
+
<div className="absolute bottom-0 w-full bg-scale-200 py-3">
+ {allowSendingSchemaMetadata && (
+ <>
+ {messages.length === 0 ? (
+ <div className="flex items-center justify-between px-6 py-3">
+ <div>
+ <p className="text-sm">
+ Include table names, column names and their corresponding data types in
+ conversation
+ </p>
+ <p className="text-sm text-scale-1100">
+ This will generate answers that are more relevant to your project during the
+ current conversation
+ </p>
+ </div>
+ <Toggle
+ disabled={!isOptedInToAI || isLoading || isResponding}
+ checked={includeSchemaMetadata}
+ onChange={() =>
+ setIncludeSchemaMetadata((prev) => {
+ includeSchemaMetadataRef.current = !prev
+ return !prev
+ })
+ }
+ />
+ </div>
+ ) : (
+ <div className="flex items-center justify-between px-6 py-3">
+ <div>
+ <p className="text-sm">
+ Table names, column names and their corresponding data types{' '}
+ <span
+ className={cn(includeSchemaMetadata ? 'text-brand-900' : 'text-amber-900')}
+ >
+ {includeSchemaMetadata ? 'are' : 'are not'} included
+ </span>{' '}
+ in this conversation
+ </p>
+ <p className="text-sm text-scale-1100">
+ Start a new conversation to change this configuration
+ </p>
+ </div>
+ </div>
+ )}
+ </>
+ )}
<Input
+ inputRef={(inputElement) => {
+ if (inputElement) {
+ // We need to delay the focus until the end of the call stack
+ // due to order of operations
+ setTimeout(() => {
+ inputElement.focus()
+ }, 0)
+ }
+ }}
className="bg-scale-100 rounded mx-3"
autoFocus
placeholder={