feat: Implement main application shell with navigation and color scheme toggle

- Added Appshell component with responsive navbar and main content area
- Integrated ColorSchemeToggle for light/dark mode switching
- Created Welcome component with styled title and introductory text
- Developed ChatPage for LLM interaction with WebSocket support
- Implemented Biblioteca for managing notes with rich text editor
- Added LoginPage for user authentication with error handling
- Introduced MessageList and MessageBubble components for chat messages
- Styled components with CSS modules for consistent design
This commit is contained in:
2025-06-21 02:01:21 +02:00
parent 3d5deef0fb
commit aef8791151
101 changed files with 169 additions and 166 deletions
@@ -0,0 +1,44 @@
# backend/domains/llm/agent_endpoints.py
from fastapi import APIRouter, HTTPException
from fastapi.responses import StreamingResponse
from pydantic import BaseModel
from fastapi.concurrency import run_in_threadpool
from backend.backend_domains.llms.llm_chat_srvc import construir_agente_llm, responder, responder_stream
from domains.Logger.logger_db import LoggerDB, logger
from entrypoint.init_db import db_credencial
LoggerDB(db_credencial, "logger_llm", created_by="sistema")
router = APIRouter()
agente = construir_agente_llm() # inicializa el agente una vez
# 📥 Schema para entrada de prompt
class ChatInput(BaseModel):
prompt: str
# ✅ Endpoint de respuesta simple
@router.post("/chat", summary="Enviar prompt y obtener respuesta completa del agente")
async def chat_endpoint(data: ChatInput):
try:
return await responder(data.prompt, agente)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
except Exception as e:
logger.exception("[ERROR] Fallo durante respuesta del agente:")
raise HTTPException(status_code=500, detail="Error interno al procesar la solicitud.")
# 🔁 Endpoint de streaming
@router.post("/chat-stream", summary="Enviar prompt y recibir respuesta del agente en streaming")
async def chat_stream_endpoint(data: ChatInput):
try:
return StreamingResponse(
responder_stream(data.prompt, agente),
media_type="text/plain"
)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
except Exception as e:
logger.exception("[ERROR] Fallo durante respuesta en streaming:")
raise HTTPException(status_code=500, detail="Error interno en el agente.")