b4ca0cf600
- 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.
34 lines
824 B
Python
34 lines
824 B
Python
# main.py
|
|
|
|
import asyncio
|
|
import uvicorn
|
|
from entrypoint.init_db import init_db
|
|
|
|
from backend.main import app as fastapi_app
|
|
|
|
async def main_async():
|
|
# Inicia tareas de fondo controladas desde aquí
|
|
print("🔄 Lanzando tareas en segundo plano...")
|
|
tareas = []
|
|
|
|
# Configura y lanza el servidor FastAPI
|
|
print("🚀 Lanzando servidor FastAPI...")
|
|
config = uvicorn.Config(app=fastapi_app, host="0.0.0.0", port=8000, reload=True)
|
|
server = uvicorn.Server(config)
|
|
|
|
# Ejecuta servidor (bloqueante)
|
|
await server.serve()
|
|
|
|
# Cancela tareas si se cae el servidor
|
|
for task in tareas:
|
|
task.cancel()
|
|
|
|
def main():
|
|
print("🛠️ Inicializando base de datos...")
|
|
init_db()
|
|
|
|
print("✅ Iniciando sistema...")
|
|
asyncio.run(main_async())
|
|
|
|
if __name__ == "__main__":
|
|
main() |