add interaction api- ui
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
DATABASE_URI="sqlite:///database.db"
|
||||
LANGUAGE_MODEL_API="http://localhost:8080/v1"
|
||||
MODEL_NAME="SmolLM3-Q4_K_M.gguf"
|
||||
MODEL_NAME="SmolLM3-Q4_K_M.gguf"
|
||||
ORIGIN="http://localhost:5173"
|
||||
Binary file not shown.
@@ -1,7 +1,12 @@
|
||||
from contextlib import asynccontextmanager
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from src.app.database import create_db_and_tables
|
||||
|
||||
#TODO : best practice to manage models import
|
||||
from src.app.models.question import Question
|
||||
from src.app.models.knowledge import Knowledge
|
||||
@@ -12,6 +17,8 @@ from .api import router
|
||||
#Test
|
||||
from src.app.faker_seed import faker
|
||||
|
||||
load_dotenv()
|
||||
|
||||
#TODO : alternative @app.on_event("startup") ?
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
@@ -21,4 +28,15 @@ async def lifespan(app: FastAPI):
|
||||
#shutdown
|
||||
|
||||
app = FastAPI(lifespan=lifespan)
|
||||
app.include_router(router)
|
||||
app.include_router(router)
|
||||
|
||||
origin = os.environ.get("ORIGIN")
|
||||
origins = [origin]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
Reference in New Issue
Block a user