Chat: use cached endpoint model ids before probing

This commit is contained in:
red person
2026-06-02 15:00:58 +03:00
committed by GitHub
parent 5029c8570e
commit fd89d098a1
2 changed files with 82 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_chat_context_uses_cached_models_before_live_model_probe():
source = (ROOT / "routes" / "chat_helpers.py").read_text()
assert "def _normalize_model_id_from_cache" in source
assert "cached_models" in source
assert "norm = _normalize_model_id_from_cache(sess) or normalize_model_id" in source
def test_cached_model_match_keeps_basename_normalization():
source = (ROOT / "routes" / "chat_helpers.py").read_text()
assert "def _match_cached_model_id" in source
assert "os.path.basename(requested.rstrip(\"/\"))" in source
assert "os.path.basename(model_id.rstrip(\"/\")) == req_base" in source