v4 Schritt 1: optimale Kontextfenster automatisch ermitteln
- hw_math: max_ctx_for() (Umkehrung der ctx-Heuristik) + extract_params_b + recommend_ctx. - cookbook.py: optimal_ctx pro Datei in analyze + evaluate. - models.py status: params_b + optimal_ctx pro Modell (psutil-RAM). - models.js Konfig-Modal: Empfehlung + 'Optimal uebernehmen'. - cookbook.js Modal: 'Empfohlener Kontext ... uebernehmen'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+9
-1
@@ -16,8 +16,10 @@ from auth import auth
|
||||
from config import CMD_TEMPLATE, CONFIG_PATH, DEFAULT_TTL, LLAMA_SWAP_URL, MODELS_DIR, TOKEN
|
||||
from jobengine import JOBS, start_job
|
||||
from llamaswap import _swap_get, read_config, write_config
|
||||
from hw_math import extract_params_b, max_ctx_for
|
||||
import re
|
||||
import os
|
||||
import psutil
|
||||
|
||||
router = APIRouter(prefix="/api", dependencies=[Depends(auth)])
|
||||
|
||||
@@ -54,6 +56,10 @@ class UpdateReq(BaseModel):
|
||||
@router.get("/status")
|
||||
def status():
|
||||
cfg = read_config()
|
||||
try:
|
||||
ram_gb = psutil.virtual_memory().total / (1024 ** 3)
|
||||
except Exception: # noqa: BLE001
|
||||
ram_gb = 0
|
||||
configured = {}
|
||||
for name, spec in (cfg.get("models") or {}).items():
|
||||
spec = spec or {}
|
||||
@@ -94,7 +100,9 @@ def status():
|
||||
"size_bytes": size_bytes,
|
||||
"quant": quant,
|
||||
"caps": caps,
|
||||
"filename": filename
|
||||
"filename": filename,
|
||||
"params_b": extract_params_b(filename or name),
|
||||
"optimal_ctx": (max_ctx_for(extract_params_b(filename or name), quant or "Q4_K_M", ram_gb) if ram_gb else None),
|
||||
}
|
||||
}
|
||||
swap_ok = True
|
||||
|
||||
Reference in New Issue
Block a user