Removes DEFAULT_MODEL in favour of a force_model setting configurable via the admin UI. When set, every proxy request's model field is overridden, preventing uncoordinated model switches during lab sessions. Updates schemas, admin API, all three proxy endpoints, frontend, init_db, and docs (README, DOCKERHUB, KURZANLEITUNG).
22 lines
533 B
Python
22 lines
533 B
Python
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv(dotenv_path=os.path.join(os.path.dirname(__file__), '..', '.env'))
|
|
|
|
from database import Base, engine, SessionLocal
|
|
import models
|
|
from crud import get_setting, set_setting
|
|
|
|
def init_db():
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
db = SessionLocal()
|
|
if not get_setting(db, "ollama_url"):
|
|
set_setting(db, "ollama_url", os.getenv("OLLAMA_URL", "http://localhost:11434"))
|
|
db.close()
|
|
|
|
print("Database initialized.")
|
|
|
|
if __name__ == "__main__":
|
|
init_db()
|