generacion de plane exitosa y cambios en BDD
Deploy Function / deploy (push) Successful in 24s

This commit is contained in:
2026-01-22 13:36:32 -06:00
parent 8ef3f24652
commit fdc8b688b3
10 changed files with 393 additions and 11 deletions
+14 -3
View File
@@ -19,12 +19,16 @@ type TipoCicloType =
Database["public"]["Tables"]["planes_estudio"]["Insert"]["tipo_ciclo"];
Deno.serve(async (req) => {
const url = new URL(req.url);
const functionName = url.pathname.split("/").pop();
console.log(
`[${new Date().toISOString()}][${functionName}]: Request received`,
);
if (req.method === "OPTIONS") {
return new Response(null, { status: 204, headers: corsHeaders });
}
const url = new URL(req.url);
const functionName = url.pathname.split("/").pop();
try {
const method = req.method;
if (method !== "POST") {
@@ -143,7 +147,7 @@ Deno.serve(async (req) => {
: {};
const aiStructuredPayload: StructuredResponseOptions = {
model: "gpt-5-mini",
model: "gpt-5-nano",
input: [
{ role: "system", content: systemPrompt },
{ role: "user", content: userPrompt },
@@ -241,6 +245,8 @@ Deno.serve(async (req) => {
)
.single();
// TODO: interaccion con IA y cambio de estado
if (planError) {
throw new Error("Error inserting plan: " + planError.message);
}
@@ -251,6 +257,11 @@ Deno.serve(async (req) => {
plan,
};
console.log(
`[${
new Date().toISOString()
}][${functionName}]: Request processed successfully`,
);
return new Response(
JSON.stringify(jsonResponse),
{