Spaces:
Sleeping
Sleeping
final try 64
Browse files- app/api.py +2 -0
- app/automigration.py +2 -1
- app/backend/models/db_service.py +3 -0
app/api.py
CHANGED
|
@@ -13,6 +13,7 @@ from app.backend.controllers.users import create_user, authenticate_user, check_
|
|
| 13 |
from app.backend.controllers.schemas import SUser
|
| 14 |
from app.backend.controllers.chats import create_new_chat
|
| 15 |
from fastapi.templating import Jinja2Templates
|
|
|
|
| 16 |
|
| 17 |
# TODO: implement a better TextHandler
|
| 18 |
# TODO: optionally implement DocHandler
|
|
@@ -26,6 +27,7 @@ api.mount("/pdfs", StaticFiles(directory=os.path.join(base_path, "temp_storage",
|
|
| 26 |
api.mount("/static", StaticFiles(directory=os.path.join(base_path, "frontend", "static")), name="static")
|
| 27 |
templates = Jinja2Templates(directory=os.path.join(base_path, "frontend", "templates"))
|
| 28 |
|
|
|
|
| 29 |
def initialize_rag() -> RagSystem:
|
| 30 |
global rag
|
| 31 |
if rag is None:
|
|
|
|
| 13 |
from app.backend.controllers.schemas import SUser
|
| 14 |
from app.backend.controllers.chats import create_new_chat
|
| 15 |
from fastapi.templating import Jinja2Templates
|
| 16 |
+
from app.backend.models.db_service import check_tables
|
| 17 |
|
| 18 |
# TODO: implement a better TextHandler
|
| 19 |
# TODO: optionally implement DocHandler
|
|
|
|
| 27 |
api.mount("/static", StaticFiles(directory=os.path.join(base_path, "frontend", "static")), name="static")
|
| 28 |
templates = Jinja2Templates(directory=os.path.join(base_path, "frontend", "templates"))
|
| 29 |
|
| 30 |
+
print(check_tables())
|
| 31 |
def initialize_rag() -> RagSystem:
|
| 32 |
global rag
|
| 33 |
if rag is None:
|
app/automigration.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
from app.backend.models.db_service import automigrate
|
| 2 |
|
| 3 |
if __name__ == '__main__':
|
| 4 |
automigrate()
|
|
|
|
|
|
| 1 |
+
from app.backend.models.db_service import automigrate, check_tables
|
| 2 |
|
| 3 |
if __name__ == '__main__':
|
| 4 |
automigrate()
|
| 5 |
+
print(check_tables())
|
app/backend/models/db_service.py
CHANGED
|
@@ -11,6 +11,9 @@ def table_exists(name: str) -> bool:
|
|
| 11 |
def create_tables() -> None:
|
| 12 |
Base.metadata.create_all(engine)
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
def drop_tables() -> None:
|
| 15 |
# for now the order matters, so
|
| 16 |
# TODO: add cascade deletion for models
|
|
|
|
| 11 |
def create_tables() -> None:
|
| 12 |
Base.metadata.create_all(engine)
|
| 13 |
|
| 14 |
+
def check_tables() -> list[str]:
|
| 15 |
+
return Base.metadata.tables.keys()
|
| 16 |
+
|
| 17 |
def drop_tables() -> None:
|
| 18 |
# for now the order matters, so
|
| 19 |
# TODO: add cascade deletion for models
|