Skip to content

sptechcue/pruebas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FinAgent – AI Investment Assistant Demo

Agente conversacional de IA para analistas e inversores.
Stack: FastAPI + React (Vite) · Auth JWT · Render-ready.


Stack

Capa Tecnología
Backend FastAPI, PyJWT, httpx
Frontend React 18, Vite, React Router v6
Auth JWT (Bearer token)
IA OpenAI GPT-4o-mini (configurable)
Deploy Render (servicios separados)

Estructura

ai-agent-demo/
├── backend/
│   ├── main.py              # FastAPI: auth, chat, CORS, market snapshot
│   ├── requirements.txt
│   └── .env.example
└── frontend/
    ├── src/
    │   ├── App.jsx
    │   ├── hooks/useAuth.js
    │   ├── services/api.js
    │   └── pages/
    │       ├── LoginPage.jsx / .css
    │       └── ChatPage.jsx  / .css
    ├── index.html
    ├── vite.config.js
    ├── package.json
    └── .env.example

Correr localmente

Backend

cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env        # editar SECRET_KEY
uvicorn main:app --reload   # → localhost:8000

Frontend

cd frontend
npm install
cp .env.example .env        # VITE_API_URL=http://localhost:8000
npm run dev                 # → localhost:5173

Credenciales demo: demo@finagent.com / demo1234


Variables de entorno

Backend

Variable Descripción Requerida
SECRET_KEY Secreto JWT
ALLOWED_ORIGINS URLs CORS (separadas por coma)
OPENAI_API_KEY API key OpenAI ❌ (modo demo sin ella)

Frontend

Variable Descripción
VITE_API_URL URL del backend

Endpoints

Método Ruta Auth Descripción
GET /health No Estado del servidor
POST /auth/login No Login → JWT
POST /auth/verify JWT Verifica token
POST /agent/chat JWT Consulta al agente IA
GET /agent/history JWT Historial de conversaciones
GET /market/snapshot JWT Datos de mercado (mock)

Deploy en Render

Backend (Web Service)

  • Build: pip install -r requirements.txt
  • Start: uvicorn main:app --host 0.0.0.0 --port $PORT
  • Env vars: SECRET_KEY, ALLOWED_ORIGINS, OPENAI_API_KEY

Frontend (Static Site)

  • Build: npm install && npm run build
  • Publish dir: dist
  • Env vars: VITE_API_URL=https://tu-backend.onrender.com

⚠️ ALLOWED_ORIGINS debe incluir la URL exacta del frontend (sin / al final).


Próximos pasos

  • PostgreSQL + SQLAlchemy en lugar del mock de usuarios
  • Refresh tokens
  • Historial de conversaciones persistente
  • Integración con API financiera real (Alpha Vantage, Yahoo Finance)
  • Tests con pytest y Vitest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors