DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix(embedding): recognize keyless OpenAI-bound Lemonade (#1568)
Bingxi Zhao (Frank)532d12ce6be6
diff --git a/deeptutor/services/config/provider_runtime.py b/deeptutor/services/config/provider_runtime.pyindex 634d5c1d3..26ca30e73 100644--- a/deeptutor/services/config/provider_runtime.py+++ b/deeptutor/services/config/provider_runtime.py@@ -1034,12 +1034,18 @@ def _resolve_embedding_provider(# model name is mistaken for a remote embedding vendor (#1568).try:endpoint = urlparse(api_base if "://" in api_base else f"http://{api_base}")- lemonade_endpoint = endpoint.port == 13305 and endpoint.path.rstrip("/").endswith(- ("/v1/embeddings", "/api/v1/embeddings")+ lemonade_endpoint = (+ endpoint.port == 13305+ and endpoint.path.rstrip("/").endswith(("/v1/embeddings", "/api/v1/embeddings"))+ and (+ (endpoint.hostname or "").lower()+ in {"localhost", "127.0.0.1", "::1", "lemonade"}+ or (endpoint.hostname or "").lower().endswith(".local")+ ))except ValueError:lemonade_endpoint = False- if lemonade_endpoint and hint in {None, "custom"}:+ if lemonade_endpoint and hint in {None, "custom", "openai"}:return "lemonade"if hint and hint in EMBEDDING_PROVIDERS:return hintdiff --git a/tests/services/config/test_embedding_runtime.py b/tests/services/config/test_embedding_runtime.pyindex bc621b51b..f034beead 100644--- a/tests/services/config/test_embedding_runtime.py+++ b/tests/services/config/test_embedding_runtime.py@@ -161,6 +161,51 @@ def test_legacy_custom_lemonade_endpoint_stays_keyless() -> None:assert get_embedding_config(catalog=catalog).api_key == ""+def test_explicit_openai_binding_to_local_lemonade_is_keyless() -> None:+ catalog = _build_catalog(+ embedding_profile={+ "id": "embedding-p",+ "binding": "openai",+ "base_url": "http://lemonade:13305/api/v1/embeddings",+ "api_key": "",+ "models": [+ {+ "id": "embedding-m",+ "model": "Qwen3-Embedding-0.6B-GGUF",+ }+ ],+ }+ )++ resolved = resolve_embedding_runtime_config(catalog=catalog)+ assert resolved.provider_name == "lemonade"+ assert resolved.provider_mode == "local"+ assert get_embedding_config(catalog=catalog).api_key == ""+++def test_remote_openai_compatible_endpoint_still_requires_key() -> None:+ catalog = _build_catalog(+ embedding_profile={+ "id": "embedding-p",+ "binding": "openai",+ "base_url": "https://api.example.com:13305/api/v1/embeddings",+ "api_key": "",+ "models": [+ {+ "id": "embedding-m",+ "model": "Qwen3-Embedding-0.6B-GGUF",+ }+ ],+ }+ )++ resolved = resolve_embedding_runtime_config(catalog=catalog)+ assert resolved.provider_name == "openai"+ assert resolved.provider_mode != "local"+ with pytest.raises(ValueError, match="Embedding API key not set"):+ get_embedding_config(catalog=catalog)++def test_embedding_orcarouter_binding_uses_default_endpoint() -> None:catalog = _build_catalog(embedding_profile={