mirror of
https://github.com/supabase/supabase.git
synced 2026-05-06 08:56:46 -04:00
chore: import edge runtime types. (#22722)
* chore: import edge runtime types. * chore: remove versions. --------- Co-authored-by: Bobbie Soedirgo <bobbie@soedirgo.dev>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/// <reference types="https://esm.sh/@supabase/functions-js@2.3.1/src/edge-runtime.d.ts" />
|
||||
/// <reference types="https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts" />
|
||||
|
||||
import { createClient } from "npm:@supabase/supabase-js@2.42.0";
|
||||
import { Database, Tables } from "../_shared/database.types.ts";
|
||||
|
||||
@@ -15,6 +16,7 @@ const supabase = createClient<Database>(
|
||||
Deno.env.get("SUPABASE_URL")!,
|
||||
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!,
|
||||
);
|
||||
|
||||
const model = new Supabase.ai.Session("gte-small");
|
||||
|
||||
Deno.serve(async (req) => {
|
||||
@@ -33,7 +35,9 @@ Deno.serve(async (req) => {
|
||||
});
|
||||
|
||||
// Store in DB
|
||||
const { error } = await supabase.from("embeddings").update({ embedding }).eq(
|
||||
const { error } = await supabase.from("embeddings").update({
|
||||
embedding: JSON.stringify(embedding),
|
||||
}).eq(
|
||||
"id",
|
||||
id,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/// <reference types="https://esm.sh/@supabase/functions-js@2.3.1/src/edge-runtime.d.ts" />
|
||||
/// <reference types="https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts" />
|
||||
|
||||
import { createClient } from "npm:@supabase/supabase-js@2.42.0";
|
||||
import { Database } from "../_shared/database.types.ts";
|
||||
|
||||
@@ -6,6 +7,7 @@ const supabase = createClient<Database>(
|
||||
Deno.env.get("SUPABASE_URL")!,
|
||||
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!,
|
||||
);
|
||||
|
||||
const model = new Supabase.ai.Session("gte-small");
|
||||
|
||||
Deno.serve(async (req) => {
|
||||
@@ -20,7 +22,7 @@ Deno.serve(async (req) => {
|
||||
// Query embeddings.
|
||||
const { data: result, error } = await supabase
|
||||
.rpc("query_embeddings", {
|
||||
embedding,
|
||||
embedding: JSON.stringify(embedding),
|
||||
match_threshold: 0.8,
|
||||
})
|
||||
.select("content")
|
||||
|
||||
Reference in New Issue
Block a user