Skip to content

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

fix: Disable the `convertSqlToSupabaseJs` AI tool (#35280)

Ivan Vasilov21f6f1bb16ae
diff --git a/apps/studio/pages/api/ai/sql/tools.ts b/apps/studio/pages/api/ai/sql/tools.ts
index 8473a7198ff..77fbf78abda 100644
--- a/apps/studio/pages/api/ai/sql/tools.ts
+++ b/apps/studio/pages/api/ai/sql/tools.ts
@@ -2,7 +2,7 @@ import { tool } from 'ai'
import { stripIndent } from 'common-tags'
import { z } from 'zod'
-import { processSql, renderSupabaseJs } from '@supabase/sql-to-rest'
+// import { processSql, renderSupabaseJs } from '@supabase/sql-to-rest'
import { getDatabaseFunctions } from 'data/database-functions/database-functions-query'
import { getDatabasePolicies } from 'data/database-policies/database-policies-query'
import { getEntityDefinitionsSql } from 'data/database/entity-definitions-query'
@@ -54,25 +54,28 @@ export const getTools = ({
}
},
}),
- convertSqlToSupabaseJs: tool({
- description: 'Convert an sql query into supabase-js client code',
- parameters: z.object({
- sql: z
- .string()
- .describe(
- 'The sql statement to convert. Only a subset of statements are supported currently. '
- ),
- }),
- execute: async ({ sql }) => {
- try {
- const statement = await processSql(sql)
- const { code } = await renderSupabaseJs(statement)
- return code
- } catch (error) {
- return `Failed to convert SQL: ${error}`
- }
- },
- }),
+ // [Ivan] The tool relies on `libpg-query` binaries which we've removed intentionally because they couldn't build on MacOS.
+ // Once we figure out a way how to use wasm binaries, we can add it back.
+ //
+ // convertSqlToSupabaseJs: tool({
+ // description: 'Convert an sql query into supabase-js client code',
+ // parameters: z.object({
+ // sql: z
+ // .string()
+ // .describe(
+ // 'The sql statement to convert. Only a subset of statements are supported currently. '
+ // ),
+ // }),
+ // execute: async ({ sql }) => {
+ // try {
+ // const statement = await processSql(sql)
+ // const { code } = await renderSupabaseJs(statement)
+ // return code
+ // } catch (error) {
+ // return `Failed to convert SQL: ${error}`
+ // }
+ // },
+ // }),
getRlsKnowledge: tool({
description:
'Get existing policies and examples and instructions on how to write RLS policies',