diff --git a/src/main.py b/src/main.py index d82d242e..d8c4c30c 100644 --- a/src/main.py +++ b/src/main.py @@ -7,6 +7,7 @@ from typing import Optional import uvicorn from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse +from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates # Internal Packages @@ -20,15 +21,21 @@ from src.processor.conversation.gpt import converse, message_to_prompt model = SearchModels() search_config = SearchConfig() processor_config = ProcessorConfig() +config = {} app = FastAPI() -# app.mount("/views", StaticFiles(directory="./views"), name="views") +app.mount("/views", StaticFiles(directory="views"), name="views") templates = Jinja2Templates(directory="views/") @app.get('/ui', response_class=HTMLResponse) def ui(request: Request): return templates.TemplateResponse("config.html", context={'request': request}) +@app.get('/config') +def config(): + print(config) + return config + @app.get('/search') def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None): if q is None or q == '': @@ -173,6 +180,9 @@ if __name__ == '__main__': # Load config from CLI args = cli(sys.argv[1:]) + # Store the path to the config file. + config = args.config + # Initialize Search from Config model, search_config = initialize_search(args.config, args.regenerate, args.verbose) diff --git a/views/config.html b/views/config.html index d4615945..cec508d8 100644 --- a/views/config.html +++ b/views/config.html @@ -3,49 +3,11 @@