diff --git a/src/app.py b/src/app.py index eff2f55..aaf390c 100644 --- a/src/app.py +++ b/src/app.py @@ -10,14 +10,17 @@ app = FastAPI() templates = Jinja2Templates(directory="templates") vector_store = VectorStore() + @app.on_event("startup") async def startup_event(): await vector_store.initialize() + @app.get("/", response_class=HTMLResponse) async def form_get(request: Request): return templates.TemplateResponse("search.html", {"request": request, "results": None}) + @app.post("/", response_class=HTMLResponse) async def form_post(request: Request, query: str = Form(...)): results = await vector_store.search(query, threshold=0.2)