瀏覽代碼

refac: ollama.db renamed to webui.db

Timothy J. Baek 1 年之前
父節點
當前提交
6d854125cc
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      backend/apps/web/internal/db.py

+ 11 - 1
backend/apps/web/internal/db.py

@@ -1,6 +1,16 @@
 from peewee import *
 from peewee import *
 from config import DATA_DIR
 from config import DATA_DIR
+import os
 
 
 
 
-DB = SqliteDatabase(f"{DATA_DIR}/ollama.db")
+# 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")
+    print("File renamed successfully.")
+else:
+    pass
+
+
+DB = SqliteDatabase(f"{DATA_DIR}/webui.db")
 DB.connect()
 DB.connect()