Initial commit — Sistema Generador de Guiones V4.0
Pipeline completo: URL → Whisper → GPT-4o → pgvector → Supabase Frontend Vue 3 + Tailwind, Backend Express + Vercel serverless functions
This commit is contained in:
22
frontend/src/lib/api.js
Normal file
22
frontend/src/lib/api.js
Normal file
@ -0,0 +1,22 @@
|
||||
const BASE = '/api'
|
||||
|
||||
async function request(path, options = {}) {
|
||||
const res = await fetch(`${BASE}${path}`, {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
...options,
|
||||
})
|
||||
const data = await res.json()
|
||||
if (!res.ok) throw new Error(data.error || `Error ${res.status}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export const api = {
|
||||
guiones: {
|
||||
listar: (params = {}) => request('/guiones?' + new URLSearchParams(params)),
|
||||
obtener: (id) => request(`/guiones/${id}`),
|
||||
},
|
||||
analizar: (body) => request('/analizar', { method: 'POST', body: JSON.stringify(body) }),
|
||||
nichos: () => request('/nichos'),
|
||||
clientes: () => request('/clientes'),
|
||||
stats: () => request('/stats'),
|
||||
}
|
||||
Reference in New Issue
Block a user