Add initial project files including .gitignore, README, package.json, and TypeScript configuration
- Created .gitignore to exclude unnecessary files - Added README.md with installation and usage instructions - Initialized package.json with dependencies and configurations - Set up tsconfig.json for TypeScript compiler options - Implemented basic index.ts file for logging - Added Supabase function structure in ai-structured directory - Created test files for user authentication and function invocation
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import { supabase } from "./new-user";
|
||||
|
||||
const /* { data, error } */_ = await supabase.auth.signInWithPassword({
|
||||
email: "guillermo.arrieta@lasalle.mx",
|
||||
password: "admin",
|
||||
});
|
||||
|
||||
/* if (error) {
|
||||
console.error("Error signing in:", error);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log("Successfully signed in:", data);
|
||||
} */
|
||||
|
||||
try {
|
||||
|
||||
const response = await supabase.functions.invoke("ai-structured", {
|
||||
body: {
|
||||
response: {
|
||||
model: "gpt-5",
|
||||
input: [
|
||||
{ role: "system", content: "Responde SIEMPRE en JSON válido." },
|
||||
{ role: "user", content: "Dame 3 ideas de proyecto de IA para educación." },
|
||||
],
|
||||
/* conversation: "conv_...", */ // opcional
|
||||
},
|
||||
structured: {
|
||||
type: "json_schema",
|
||||
name: "ideas",
|
||||
strict: true,
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
ideas: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "object",
|
||||
properties: {
|
||||
titulo: { type: "string" },
|
||||
descripcion: { type: "string" }
|
||||
},
|
||||
required: ["titulo", "descripcion"],
|
||||
additionalProperties: false
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ["ideas"],
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
references: {
|
||||
/* vectorStoreIds: ["vs_..."], */ // opcional (file_search) ✅
|
||||
/* openaiFileIds: ["file_..."], */ // opcional (input_file) ✅
|
||||
},
|
||||
usarMCP: false, // opcional ✅
|
||||
},
|
||||
});
|
||||
console.log({ d: response.data, e: response.error });
|
||||
} catch (e: any) {
|
||||
const res = e?.context ?? e?.response;
|
||||
console.log("status", res?.status);
|
||||
if (res?.text) console.log("text", await res.text());
|
||||
else console.log("raw error keys", Object.keys(e ?? {}));
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
|
||||
export const supabase = createClient(Bun.env.SUPABASE_URL!, Bun.env.SUPABASE_ANON_KEY!)
|
||||
/* try {
|
||||
const { data, error } = await supabase.auth.signUp({
|
||||
email: 'guillermo.arrieta@lasalle.mx',
|
||||
password: 'sadfasdfsadfdsasadfsad',
|
||||
})
|
||||
console.log({ data, error })
|
||||
} catch (error) {
|
||||
console.log({ error })
|
||||
} */
|
||||
Reference in New Issue
Block a user