db.py 434 Bytes
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
from peewee import *
2
from config import SRC_LOG_LEVELS, DATA_DIR
3
import os
4
import logging
Timothy J. Baek's avatar
Timothy J. Baek committed
5

6
7
log = logging.getLogger(__name__)
log.setLevel(SRC_LOG_LEVELS["DB"])
8

9
10
11
12
# Check if the file exists
if os.path.exists(f"{DATA_DIR}/ollama.db"):
    # Rename the file
    os.rename(f"{DATA_DIR}/ollama.db", f"{DATA_DIR}/webui.db")
13
    log.info("File renamed successfully.")
14
15
16
17
18
else:
    pass


DB = SqliteDatabase(f"{DATA_DIR}/webui.db")
Timothy J. Baek's avatar
Timothy J. Baek committed
19
DB.connect()