File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
supabase/functions/vercel-ai-chat Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1- /// <reference types="https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts" />
2- import { createClient } from "https://esm.sh/@supabase/[email protected] .5 " ; 1+ /// <reference types="https://esm.sh/v135/ @supabase/functions-js@2.3.1 /src/edge-runtime.d.ts" />
2+ import { createClient } from "https://esm.sh/@supabase/[email protected] .7 " ; 33import { corsHeaders } from "../_shared/cors.ts" ;
44
55const session = new Supabase . ai . Session ( "llama3" ) ;
@@ -18,9 +18,7 @@ Deno.serve(async (req: Request) => {
1818 { global : { headers : { Authorization : authHeader } } } ,
1919 ) ;
2020 // Get user
21- const { data : { user } , error } = await supabase . auth . getUser (
22- authHeader . split ( "Bearer " ) [ 1 ] ,
23- ) ;
21+ const { data : { user } , error } = await supabase . auth . getUser ( ) ;
2422 if ( error ) throw error ;
2523 if ( ! user ) throw new Error ( "no user" ) ;
2624 const userId = user . id ;
@@ -38,7 +36,12 @@ Deno.serve(async (req: Request) => {
3836 ` . trim ( ) ;
3937
4038 // Get the output as a stream
41- const output = await session . run ( prompt , { stream : true } ) ;
39+ const output =
40+ ( await session . run ( prompt , { stream : true } ) ) as AsyncGenerator <
41+ { response : string | null } ,
42+ never ,
43+ void
44+ > ;
4245
4346 // Create a stream
4447 const stream = new ReadableStream ( {
You can’t perform that action at this time.
0 commit comments