wip
This commit is contained in:
@@ -61,7 +61,11 @@ Deno.serve(async (req) => {
|
||||
// 1) Upload a Supabase Storage
|
||||
const supabase_paths: string[] = [];
|
||||
for (const file of inputForm.files ?? []) {
|
||||
const path = `${crypto.randomUUID()}-${(file.name)}`;
|
||||
const safeName = file.name
|
||||
.normalize("NFD") // 1. Descompone letras de tildes (í -> i + ´)
|
||||
.replace(/[\u0300-\u036f]/g, "") // 2. Borra las tildes
|
||||
.replace(/[^a-zA-Z0-9.-]/g, "_"); // 3. Reemplaza espacios y símbolos raros por "_"
|
||||
const path = `${crypto.randomUUID()}-${safeName}`;
|
||||
const { data, error } = await supabase.storage
|
||||
.from(SUPABASE_BUCKET)
|
||||
.upload(path, file, {
|
||||
@@ -119,7 +123,7 @@ Deno.serve(async (req) => {
|
||||
|
||||
type SuccessResponse = {
|
||||
ok: true;
|
||||
openai_raw: unknown;
|
||||
openai_raw: OpenAITypes.OpenAI.Responses.Response;
|
||||
supabase_paths: string[];
|
||||
openai_file_ids: string[];
|
||||
options: unknown;
|
||||
@@ -132,6 +136,7 @@ Deno.serve(async (req) => {
|
||||
openai_file_ids, // IDs en OpenAI
|
||||
options: inputForm.options, // opciones usadas
|
||||
};
|
||||
response.openai_raw.output.
|
||||
|
||||
return json(response);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user