9ee8daa295
- Added WebSocket endpoint for real-time chat interactions. - Refactored ChatPage component to utilize WebSocket for sending and receiving messages. - Updated chat service to handle streaming responses from the LLM agent. - Introduced error handling for WebSocket connections and message processing. - Modified Editor_Test to include AppShellWithMenu for better layout. - Adjusted file path in generar_tree.py for correct directory structure. - Created llm_chat_endpoint_v1.py and llm_chat_srvc.py for handling chat requests and responses. - Established logging for WebSocket interactions and errors.
28 lines
726 B
Python
28 lines
726 B
Python
# backend/main.py
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from backend.router_v1 import router
|
|
from backend.domains.llms import llm_chat_ws_endpoint_v1
|
|
|
|
|
|
app = FastAPI(
|
|
title="Fitz Backend",
|
|
description="API para interacción con el frontend y ejecución de tareas",
|
|
version="0.1.0"
|
|
)
|
|
|
|
# Configuración de CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["http://localhost:5173", "http://0.0.0.0:5173"], # Solo permite tu frontend local
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
# Incluye las rutas de tu API
|
|
app.include_router(router, prefix="/api/v1", tags=["v1"])
|
|
app.include_router(llm_chat_ws_endpoint_v1.router)
|