Refactor project structure and implement new features

- Removed unused security module and updated import paths.
- Enhanced OpenAI client with streaming capabilities for chat completions.
- Added new backend API endpoints for health check (ping).
- Established a new FastAPI application with CORS configuration.
- Created a new Appshell component for the frontend with navigation links.
- Integrated SVG icons and improved styling for the Appshell component.
- Implemented memory management for conversation history using PostgreSQL.
- Developed abstract classes for AI agents and models, with OpenAI integration.
- Added encryption utilities for secure data handling.
This commit is contained in:
2025-05-06 23:33:41 +02:00
parent 234639a34a
commit b4ca0cf600
51 changed files with 2026 additions and 338 deletions
+36
View File
@@ -0,0 +1,36 @@
from abc import ABC, abstractmethod
from typing import Literal
class MemoryConvABC(ABC):
"""
Interfaz abstracta para memorias de conversación multi-turno.
"""
def __init__(self, k: int = 10):
"""
:param k: Número máximo de turnos (pares user/assistant) a retornar.
"""
self.k = k
@abstractmethod
def guardar_turno(self, rol: Literal["user", "assistant"], contenido: str) -> None:
"""
Guarda un mensaje de un turno de conversación.
Se guarda secuencialmente y se asume que el orden es respetado.
"""
pass
@abstractmethod
def cargar_historial_chat(self) -> list[dict]:
"""
Devuelve los últimos `k*2` mensajes como lista de dicts tipo chat:
[{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]
"""
pass
@abstractmethod
def limpiar(self) -> None:
"""
Limpia completamente la memoria.
"""
pass