remove openai sdk package

This commit is contained in:
Saxon Fletcher committed 2025-05-06 14:37:01 +10:00
1 parent 8e057a5827
commit ab78633a01
8 files changed
+684 -226

No files matched your search

@@ -75,7 +75,6 @@ export const AIOptInLevelSelector = ({
</div>
)
// Conditional rendering with FormItemLayout remains the same
return (
<FormItemLayout
label={label}
@@ -91,6 +90,4 @@ export const AIOptInLevelSelector = ({
{content}
</FormItemLayout>
)
return content
}
@@ -11,11 +11,9 @@ import { toast } from 'sonner'
import { useParams, useSearchParamsShallow } from 'common/hooks'
import { subscriptionHasHipaaAddon } from 'components/interfaces/Billing/Subscription/Subscription.utils'
import { Markdown } from 'components/interfaces/Markdown'
import OptInToOpenAIToggle from 'components/interfaces/Organization/GeneralSettings/OptInToOpenAIToggle'
import { SQL_TEMPLATES } from 'components/interfaces/SQLEditor/SQLEditor.queries'
import { useCheckOpenAIKeyQuery } from 'data/ai/check-api-key-query'
import { constructHeaders } from 'data/fetchers'
import { useOrganizationUpdateMutation } from 'data/organizations/organization-update-mutation'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { useTablesQuery } from 'data/tables/tables-query'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
@@ -36,7 +36,7 @@ export const AIOptInModal = ({ visible, onCancel }: AIOptInModalProps) => {
return (
<Dialog open={visible} onOpenChange={onOpenChange}>
<DialogContent size="xlarge">
<DialogContent size="large">
<Form_Shadcn_ {...form}>
<form id="ai-opt-in-form" onSubmit={form.handleSubmit(onSubmit)}>
<DialogHeader padding="small">
-1
View File
@@ -23,7 +23,6 @@
},
"dependencies": {
"@ai-sdk/amazon-bedrock": "^2.2.8",
"@ai-sdk/openai": "^1.3.18",
"@dagrejs/dagre": "^1.0.4",
"@deno/eszip": "0.83.0",
"@dnd-kit/core": "^6.1.0",
@@ -1,4 +1,5 @@
import { openai } from '@ai-sdk/openai'
import { bedrock } from '@ai-sdk/amazon-bedrock'
import pgMeta from '@supabase/pg-meta'
import { streamText } from 'ai'
import { executeSql } from 'data/sql/execute-sql-query'
@@ -6,14 +7,14 @@ import { NextApiRequest, NextApiResponse } from 'next'
import { getTools } from '../sql/tools'
export const maxDuration = 30
const openAiKey = process.env.OPENAI_API_KEY
const awsAccessKeyId = process.env.AWS_ACCESS_KEY_ID
const pgMetaSchemasList = pgMeta.schemas.list()
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (!openAiKey) {
if (!awsAccessKeyId) {
return new Response(
JSON.stringify({
error: 'No OPENAI_API_KEY set. Create this environment variable to use AI features.',
error: 'No AWS_ACCESS_KEY_ID set. Create this environment variable to use AI features.',
}),
{ status: 400, headers: { 'Content-Type': 'application/json' } }
)
@@ -64,7 +65,7 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
: { result: [] }
const result = await streamText({
model: openai('gpt-4o-mini-2024-07-18'),
model: bedrock('us.anthropic.claude-3-7-sonnet-20250219-v1:0'),
maxSteps: 5,
tools: getTools({ projectRef, connectionString, authorization, includeSchemaMetadata }),
system: `
@@ -1,10 +1,10 @@
import { openai } from '@ai-sdk/openai'
import { bedrock } from '@ai-sdk/amazon-bedrock'
import { streamText } from 'ai'
import { NextApiRequest, NextApiResponse } from 'next'
import { tool } from 'ai'
import { z } from 'zod'
const openAiKey = process.env.OPENAI_API_KEY
const awsAccessKeyId = process.env.AWS_ACCESS_KEY_ID
export const maxDuration = 30
@@ -47,9 +47,9 @@ const getTools = () => {
}
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (!openAiKey) {
if (!awsAccessKeyId) {
return res.status(400).json({
error: 'No OPENAI_API_KEY set. Create this environment variable to use AI features.',
error: 'No AWS_ACCESS_KEY_ID set. Create this environment variable to use AI features.',
})
}
@@ -68,7 +68,7 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) {
const { messages } = req.body
const result = await streamText({
model: openai('gpt-4o-mini'),
model: bedrock('us.anthropic.claude-3-7-sonnet-20250219-v1:0'),
maxSteps: 7,
system: `
You are a Supabase expert who helps people set up their Supabase project. You specializes in database schema design. You are to help the user design a database schema for their application but also suggest Supabase services they should use.
+5 -5
View File
@@ -1,4 +1,4 @@
import { openai } from '@ai-sdk/openai'
import { bedrock } from '@ai-sdk/amazon-bedrock'
import pgMeta from '@supabase/pg-meta'
import { streamText } from 'ai'
import { executeSql } from 'data/sql/execute-sql-query'
@@ -6,14 +6,14 @@ import { NextApiRequest, NextApiResponse } from 'next'
import { getTools } from '../sql/tools'
export const maxDuration = 30
const openAiKey = process.env.OPENAI_API_KEY
const awsAccessKeyId = process.env.AWS_ACCESS_KEY_ID
const pgMetaSchemasList = pgMeta.schemas.list()
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (!openAiKey) {
if (!awsAccessKeyId) {
return new Response(
JSON.stringify({
error: 'No OPENAI_API_KEY set. Create this environment variable to use AI features.',
error: 'No AWS_ACCESS_KEY_ID set. Create this environment variable to use AI features.',
}),
{
status: 500,
@@ -60,7 +60,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
: { result: [] }
const result = await streamText({
model: openai('gpt-4o-mini-2024-07-18'),
model: bedrock('us.anthropic.claude-3-7-sonnet-20250219-v1:0'),
maxSteps: 5,
tools: getTools({ projectRef, connectionString, authorization, includeSchemaMetadata }),
system: `
+667 -204
View File
File diff suppressed because it is too large. Load diff