feat: Cookbook-Download-Fix, Live-Update-Konsole, Profi-Highlight, OpenCode-Guide
Backend: - hf_bin() + HF_DOWNLOAD_ENV zentral in config.py; install-recipe und install-model in cookbook.py nutzten weiter das fehlende `hf` + falsches XET-Env -> Haupt-Installationsweg war ebenso kaputt, jetzt konsistent gefixt Frontend: - Server: laufende Updates (LLM-Engine/OS) live auf der Server-Seite mitlesbar, inkl. klarer Fertig-/Fehlgeschlagen-Meldung (onJobs + Aktueller-Vorgang-Karte) - Cookbook/Profi-Modus: meistgeladenes, passendes Modell wird als "★ Beste Wahl für dein System" hervorgehoben (analog zu den Templates) - Verbinden: OpenCode korrekt per opencode.json (@ai-sdk/openai-compatible) statt irrefuehrender Felder; erklaert "Connect to API"-Fehler (LAN-IP statt localhost) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+5
-5
@@ -12,7 +12,7 @@ from ruamel.yaml.scalarstring import LiteralScalarString
|
||||
|
||||
from auth import auth
|
||||
from hw_math import evaluate_fit, max_ctx_for
|
||||
from config import MODELS_DIR, CMD_TEMPLATE, DEFAULT_TTL
|
||||
from config import MODELS_DIR, CMD_TEMPLATE, DEFAULT_TTL, HF_DOWNLOAD_ENV, hf_bin
|
||||
from llamaswap import read_config, write_config
|
||||
from jobengine import start_job, JOBS
|
||||
from recipes import RECIPES, UPGRADES
|
||||
@@ -149,7 +149,7 @@ def install_recipe(req: InstallRecipeReq):
|
||||
if not recipe:
|
||||
raise HTTPException(404, "Setup nicht gefunden.")
|
||||
ram_gb = psutil.virtual_memory().total / (1024 ** 3)
|
||||
env = {"HF_XET_HIGH_PERFORMANCE": "1"}
|
||||
env = dict(HF_DOWNLOAD_ENV)
|
||||
if req.hf_token:
|
||||
env["HF_TOKEN"] = req.hf_token
|
||||
cfg = read_config()
|
||||
@@ -160,7 +160,7 @@ def install_recipe(req: InstallRecipeReq):
|
||||
continue # kein GGUF im Repo gefunden -> Modell ueberspringen (Rest installiert trotzdem)
|
||||
target = MODELS_DIR / m["repo"].split("/")[-1]
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
args = ["hf", "download", m["repo"], file, "--local-dir", str(target)]
|
||||
args = [hf_bin(), "download", m["repo"], file, "--local-dir", str(target)]
|
||||
jid = start_job(args, f"download {m['name']}", env=env)
|
||||
JOBS[jid]["result_path"] = str(target / file)
|
||||
job_ids.append(jid)
|
||||
@@ -226,12 +226,12 @@ def install_model(req: InstallModelReq):
|
||||
if not file:
|
||||
raise HTTPException(404, "Keine GGUF-Datei im Repo gefunden.")
|
||||
ram_gb = psutil.virtual_memory().total / (1024 ** 3)
|
||||
env = {"HF_XET_HIGH_PERFORMANCE": "1"}
|
||||
env = dict(HF_DOWNLOAD_ENV)
|
||||
if req.hf_token:
|
||||
env["HF_TOKEN"] = req.hf_token
|
||||
target = MODELS_DIR / req.repo.split("/")[-1]
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
jid = start_job(["hf", "download", req.repo, file, "--local-dir", str(target)],
|
||||
jid = start_job([hf_bin(), "download", req.repo, file, "--local-dir", str(target)],
|
||||
f"download {req.repo.split('/')[-1]}", env=env)
|
||||
JOBS[jid]["result_path"] = str(target / file)
|
||||
cfg = read_config()
|
||||
|
||||
+4
-13
@@ -13,26 +13,18 @@ from pydantic import BaseModel
|
||||
from ruamel.yaml.scalarstring import LiteralScalarString
|
||||
|
||||
from auth import auth
|
||||
from config import CMD_TEMPLATE, CONFIG_PATH, DEFAULT_TTL, LLAMA_SWAP_URL, MODELS_DIR, TOKEN
|
||||
from config import (CMD_TEMPLATE, CONFIG_PATH, DEFAULT_TTL, HF_DOWNLOAD_ENV, LLAMA_SWAP_URL,
|
||||
MODELS_DIR, TOKEN, hf_bin)
|
||||
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, estimate_memory_gb
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import psutil
|
||||
|
||||
router = APIRouter(prefix="/api", dependencies=[Depends(auth)])
|
||||
|
||||
|
||||
def _hf_bin() -> str:
|
||||
"""Pfad zur `hf`-CLI. Bevorzugt die im venv installierte (neben dem laufenden
|
||||
Python), da der Dienst-PATH das venv/bin meist nicht enthaelt. Faellt sonst auf
|
||||
ein global installiertes `hf` zurueck."""
|
||||
cand = os.path.join(os.path.dirname(sys.executable), "hf")
|
||||
return cand if os.path.exists(cand) else "hf"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Request-Modelle
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -148,9 +140,8 @@ def download(req: DownloadReq):
|
||||
sub = req.subdir or req.repo.split("/")[-1]
|
||||
target = MODELS_DIR / sub
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
args = [_hf_bin(), "download", req.repo, req.file, "--local-dir", str(target)]
|
||||
# XET deaktivieren: mit aktivem XET haengt der Download reproduzierbar bei ~6 MB (siehe CLAUDE.md).
|
||||
env = {"HF_HUB_DISABLE_XET": "1"}
|
||||
args = [hf_bin(), "download", req.repo, req.file, "--local-dir", str(target)]
|
||||
env = dict(HF_DOWNLOAD_ENV)
|
||||
if req.hf_token:
|
||||
env["HF_TOKEN"] = req.hf_token
|
||||
job_id = start_job(args, f"download {req.repo}/{req.file}", env=env)
|
||||
|
||||
Reference in New Issue
Block a user