diff --git a/.env.example b/.env.example index 6a40fdd..7df9ef3 100644 --- a/.env.example +++ b/.env.example @@ -17,3 +17,9 @@ POSTGRES_URL=**** # Instructions to create a Redis store here: # https://vercel.com/docs/redis REDIS_URL=**** + +# Get your DeepSeek API Key here for chat and image models +DEEPSEEK_API_KEY=**** + +# Supabase PostgreSQL database +SUPABASE_POSTGRES_URL=**** diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 7c66256..03fb851 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest env: AUTH_SECRET: ${{ secrets.AUTH_SECRET }} - POSTGRES_URL: ${{ secrets.POSTGRES_URL }} + SUPABASE_POSTGRES_URL: ${{ secrets.SUPABASE_POSTGRES_URL }} BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }} REDIS_URL: ${{ secrets.REDIS_URL }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 02a0ffa..b755e9a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,5 +15,5 @@ "source.fixAll": "explicit" // "source.organizeImports": "explicit" }, - "cSpell.words": ["deepseek"] + "cSpell.words": ["deepseek", "SUPABASE"] } diff --git a/drizzle.config.ts b/drizzle.config.ts index 7c4a841..0ec27ce 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -11,6 +11,6 @@ export default defineConfig({ dialect: 'postgresql', dbCredentials: { // biome-ignore lint: Forbidden non-null assertion. - url: process.env.POSTGRES_URL!, + url: process.env.SUPABASE_POSTGRES_URL!, }, }); diff --git a/lib/db/helpers/01-core-to-parts.ts b/lib/db/helpers/01-core-to-parts.ts index 81c2693..1c6575c 100644 --- a/lib/db/helpers/01-core-to-parts.ts +++ b/lib/db/helpers/01-core-to-parts.ts @@ -16,11 +16,11 @@ config({ path: '.env.local', }); -if (!process.env.POSTGRES_URL) { - throw new Error('POSTGRES_URL environment variable is not set'); +if (!process.env.SUPABASE_POSTGRES_URL) { + throw new Error('SUPABASE_POSTGRES_URL environment variable is not set'); } -const client = postgres(process.env.POSTGRES_URL); +const client = postgres(process.env.SUPABASE_POSTGRES_URL); const db = drizzle(client); const BATCH_SIZE = 100; // Process 100 chats at a time diff --git a/lib/db/migrate.ts b/lib/db/migrate.ts index 1280e75..deed34a 100644 --- a/lib/db/migrate.ts +++ b/lib/db/migrate.ts @@ -8,11 +8,11 @@ config({ }); const runMigrate = async () => { - if (!process.env.POSTGRES_URL) { - throw new Error('POSTGRES_URL is not defined'); + if (!process.env.SUPABASE_POSTGRES_URL) { + throw new Error('SUPABASE_POSTGRES_URL is not defined'); } - const connection = postgres(process.env.POSTGRES_URL, { max: 1 }); + const connection = postgres(process.env.SUPABASE_POSTGRES_URL, { max: 1 }); const db = drizzle(connection); console.log('⏳ Running migrations...'); diff --git a/lib/db/queries.ts b/lib/db/queries.ts index 2f8b2b2..adc085e 100644 --- a/lib/db/queries.ts +++ b/lib/db/queries.ts @@ -38,8 +38,11 @@ import { ChatSDKError } from '../errors'; // use the Drizzle adapter for Auth.js / NextAuth // https://authjs.dev/reference/adapter/drizzle +// const client = postgres(process.env.POSTGRES_URL!); + +// 使用 Supabase 的 PostgreSQL // biome-ignore lint: Forbidden non-null assertion. -const client = postgres(process.env.POSTGRES_URL!); +const client = postgres(process.env.SUPABASE_POSTGRES_URL!, { prepare: false }); const db = drizzle(client); export async function getUser(email: string): Promise> {