Skip to content

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

feat(sql-editor): only submit ai query if input has text

Greg Richardsonde8cd81ad952
diff --git a/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx b/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
index b655443b45a..54c476233e9 100644
--- a/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
+++ b/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
@@ -107,6 +107,12 @@ const SQLTemplates = observer(() => {
onKeyPress={async (e) => {
if (e.key === 'Enter') {
try {
+ const value = e.currentTarget.value
+
+ if (!value) {
+ return
+ }
+
const { title, sql } = await generateSql({ prompt: e.currentTarget.value })
const formattedSql =