Spaces:
Building
Building
Update controllers/admin_controller.py
Browse files
controllers/admin_controller.py
CHANGED
@@ -2,7 +2,7 @@ from fastapi import APIRouter, Request
|
|
2 |
from core import service_config, llm_models
|
3 |
from llm_model import LLMModel
|
4 |
from log import log
|
5 |
-
import
|
6 |
|
7 |
router = APIRouter()
|
8 |
|
@@ -35,10 +35,8 @@ async def reload_config(request: Request):
|
|
35 |
|
36 |
temp_instance = LLMModel()
|
37 |
|
38 |
-
# 🆕 Yeni proje ekleniyor
|
39 |
if current_project is None:
|
40 |
log(f"🆕 Yeni proje '{project_name}' tespit edildi, yükleme başlatılıyor...")
|
41 |
-
|
42 |
temp_instance.setup(service_config, llm_config, temp_path)
|
43 |
|
44 |
if os.path.exists(project_path):
|
@@ -51,14 +49,12 @@ async def reload_config(request: Request):
|
|
51 |
log(f"✅ Yeni proje '{project_name}' başarıyla yüklendi ve belleğe alındı.")
|
52 |
return
|
53 |
|
54 |
-
# 🔄 Var olan projede değişiklik varsa güncelle
|
55 |
if current_project == incoming_project:
|
56 |
log(f"ℹ️ '{project_name}' için değişiklik bulunamadı, işlem atlandı.")
|
57 |
return
|
58 |
|
59 |
log(f"🔄 '{project_name}' güncellemesi tespit edildi, güncelleme başlatılıyor...")
|
60 |
|
61 |
-
# Ana model değiştiyse yükle
|
62 |
if current_project["llm"]["model_base"] != llm_config["model_base"]:
|
63 |
temp_instance.setup(service_config, llm_config, temp_path)
|
64 |
else:
|
@@ -82,4 +78,4 @@ async def reload_config(request: Request):
|
|
82 |
return {
|
83 |
"status": "accepted",
|
84 |
"message": f"'{project_name}' için güncelleme arka planda başlatıldı. İşlem loglardan takip edilebilir."
|
85 |
-
}
|
|
|
2 |
from core import service_config, llm_models
|
3 |
from llm_model import LLMModel
|
4 |
from log import log
|
5 |
+
import os, shutil, threading
|
6 |
|
7 |
router = APIRouter()
|
8 |
|
|
|
35 |
|
36 |
temp_instance = LLMModel()
|
37 |
|
|
|
38 |
if current_project is None:
|
39 |
log(f"🆕 Yeni proje '{project_name}' tespit edildi, yükleme başlatılıyor...")
|
|
|
40 |
temp_instance.setup(service_config, llm_config, temp_path)
|
41 |
|
42 |
if os.path.exists(project_path):
|
|
|
49 |
log(f"✅ Yeni proje '{project_name}' başarıyla yüklendi ve belleğe alındı.")
|
50 |
return
|
51 |
|
|
|
52 |
if current_project == incoming_project:
|
53 |
log(f"ℹ️ '{project_name}' için değişiklik bulunamadı, işlem atlandı.")
|
54 |
return
|
55 |
|
56 |
log(f"🔄 '{project_name}' güncellemesi tespit edildi, güncelleme başlatılıyor...")
|
57 |
|
|
|
58 |
if current_project["llm"]["model_base"] != llm_config["model_base"]:
|
59 |
temp_instance.setup(service_config, llm_config, temp_path)
|
60 |
else:
|
|
|
78 |
return {
|
79 |
"status": "accepted",
|
80 |
"message": f"'{project_name}' için güncelleme arka planda başlatıldı. İşlem loglardan takip edilebilir."
|
81 |
+
}
|