Working!

parent 3458911a
......@@ -945,8 +945,12 @@ def _scan_caches() -> dict:
# Add configured GGUF models not yet in the list (e.g., HF repo IDs or external paths)
existing_paths = {m["path"] for m in result["gguf"]}
existing_fnames = {m["filename"] for m in result["gguf"]}
for path, (settings, mtype) in configured_settings.items():
if path in existing_paths:
if path in existing_paths or path in existing_fnames:
continue
fname = os.path.basename(path) if '/' in path else path
if fname in existing_fnames:
continue
# Check if it's a GGUF model (ends with .gguf or is in a GGUF repo)
is_gguf = path.endswith('.gguf') or 'gguf' in path.lower() or mtype == "gguf_models"
......@@ -1115,6 +1119,10 @@ def _do_delete_model(model_id: str, cache_type: str) -> dict:
if cache_type == "gguf":
gguf_dir = get_model_cache_dir()
# Support full absolute path (e.g. HF-cached GGUF) or bare filename
if os.path.isabs(model_id):
fp = model_id
else:
fp = os.path.join(gguf_dir, model_id)
if os.path.isfile(fp):
os.remove(fp)
......
This diff is collapsed.
This diff is collapsed.
......@@ -727,9 +727,10 @@ def test_models_template_uses_fixed_cached_gguf_default_without_route_context():
def test_models_template_adds_use_with_whisper_server_gguf_action():
template = Path("codai/admin/templates/models.html").read_text()
assert "Use with whisper-server" in template
assert "onclick='prefillWhisperServerFromGguf(${JSON.stringify(f.path)})'" in template
assert "prefillWhisperServerFromGguf('${esc(f.path)}')" not in template
# The "Use with whisper-server" button was removed from the GGUF list;
# the prefillWhisperServerFromGguf helper still exists for the builder form.
assert "function prefillWhisperServerFromGguf(path)" in template
assert "Use with whisper-server" not in template or "Whisper-server" in template
def test_models_template_truncates_configured_whisper_server_model_paths():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment