Skip to content

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

chore: update openai and streams examples.

thorwebdev4dd6ab8f8774
diff --git a/examples/edge-functions/supabase/functions/import_map.json b/examples/edge-functions/supabase/functions/import_map.json
index 087feb7c033..be4b4d84118 100644
--- a/examples/edge-functions/supabase/functions/import_map.json
+++ b/examples/edge-functions/supabase/functions/import_map.json
@@ -4,6 +4,7 @@
"nacl": "https://cdn.skypack.dev/[email protected]?dts",
"oak": "https://deno.land/x/[email protected]/mod.ts",
"og_edge": "https://deno.land/x/[email protected]/mod.ts",
+ "openai": "https://esm.sh/[email protected]",
"grammy": "https://deno.land/x/[email protected]/mod.ts",
"react": "https://esm.sh/[email protected]",
"std/server": "https://deno.land/[email protected]/http/server.ts",
@@ -13,6 +14,7 @@
"postgres": "https://deno.land/x/[email protected]/mod.ts",
"puppeteer": "https://deno.land/x/[email protected]/mod.ts",
"React": "https://esm.sh/[email protected]?deno-std=0.177.0",
- "upstash_redis": "https://deno.land/x/[email protected]/mod.ts"
+ "upstash_redis": "https://deno.land/x/[email protected]/mod.ts",
+ "xhr_polyfill": "https://deno.land/x/[email protected]/mod.ts"
}
}
diff --git a/examples/edge-functions/supabase/functions/openai/README.md b/examples/edge-functions/supabase/functions/openai/README.md
index 4433aa6abb1..33894bacb4f 100644
--- a/examples/edge-functions/supabase/functions/openai/README.md
+++ b/examples/edge-functions/supabase/functions/openai/README.md
@@ -9,7 +9,7 @@ cp supabase/.env.local.example supabase/.env.local
## Run locally
```bash
-supabase functions serve --no-verify-jwt --env-file ./supabase/.env.local openai
+supabase functions serve --env-file ./supabase/.env.local --no-verify-jwt
```
Use cURL or Postman to make a POST request to http://localhost:54321/functions/v1/openai.
diff --git a/examples/edge-functions/supabase/functions/openai/index.ts b/examples/edge-functions/supabase/functions/openai/index.ts
index 5bab2eafbb2..a7418d73e19 100644
--- a/examples/edge-functions/supabase/functions/openai/index.ts
+++ b/examples/edge-functions/supabase/functions/openai/index.ts
@@ -1,6 +1,6 @@
-import 'https://deno.land/x/[email protected]/mod.ts'
-import { serve } from 'https://deno.land/[email protected]/http/server.ts'
-import { CreateCompletionRequest } from 'https://esm.sh/[email protected]'
+import 'xhr_polyfill'
+import { serve } from 'std/server'
+import { CreateCompletionRequest } from 'openai'
serve(async (req) => {
const { query } = await req.json()
diff --git a/examples/edge-functions/supabase/functions/streams/README.md b/examples/edge-functions/supabase/functions/streams/README.md
index 52cd230a364..1be0ec27b24 100644
--- a/examples/edge-functions/supabase/functions/streams/README.md
+++ b/examples/edge-functions/supabase/functions/streams/README.md
@@ -3,7 +3,7 @@
## Run locally
```bash
-supabase functions serve --no-verify-jwt streams
+supabase functions serve --no-verify-jwt
```
Use cURL or Postman to make a GET request to http://localhost:54321/functions/v1/streams.
diff --git a/examples/edge-functions/supabase/functions/streams/index.ts b/examples/edge-functions/supabase/functions/streams/index.ts
index 15d3c2ace8e..dafbf83c7d7 100644
--- a/examples/edge-functions/supabase/functions/streams/index.ts
+++ b/examples/edge-functions/supabase/functions/streams/index.ts
@@ -1,4 +1,4 @@
-import { serve } from 'https://deno.land/[email protected]/http/server.ts'
+import { serve } from 'std/server'
const msg = new TextEncoder().encode('data: hello\r\n\r\n')