Initial commit

This commit is contained in:
Sebastian
2025-11-26 19:00:04 +00:00
commit 0ba05b6483
27 changed files with 2517 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
// Servidor: Configuración de Vertex AI con autenticación
// Este archivo SOLO debe importarse en API routes (server-side)
import { VertexAI } from '@google-cloud/vertexai';
// Leer credenciales desde variables de entorno
export const projectId = process.env.GOOGLE_PROJECT_ID!;
export const location = process.env.GOOGLE_LOCATION || 'us-central1';
// Construir objeto de credenciales desde variables de entorno
export const credentials = {
type: 'service_account',
project_id: process.env.GOOGLE_PROJECT_ID,
client_email: process.env.GOOGLE_CLIENT_EMAIL,
private_key: process.env.GOOGLE_PRIVATE_KEY?.replace(/\\n/g, '\n'),
};
console.log(`Configurando Vertex AI - Proyecto: ${projectId}, Location: ${location}`);
// Crear instancia de Vertex AI
export const vertexAI = new VertexAI({
project: projectId,
location: location,
googleAuthOptions: {
credentials: credentials,
},
});
console.log('Cliente de Vertex AI creado correctamente');