db.py 331 B

12345678910111213141516
  1. from peewee import *
  2. from config import DATA_DIR
  3. import os
  4. # Check if the file exists
  5. if os.path.exists(f"{DATA_DIR}/ollama.db"):
  6. # Rename the file
  7. os.rename(f"{DATA_DIR}/ollama.db", f"{DATA_DIR}/webui.db")
  8. print("File renamed successfully.")
  9. else:
  10. pass
  11. DB = SqliteDatabase(f"{DATA_DIR}/webui.db")
  12. DB.connect()