mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-24 22:37:08 +03:00
fix genai and classification error paths
- Catch all httpx errors in the Ollama plugin so a dropped connection no longer ends the embeddings thread - Strip only a trailing /v1 from the llama.cpp base_url - Cap the timestamp top-up loop in state example generation, which looped forever on zero-length review items - Run state example generation in a thread under the example collection lock - Stage example frames in a system temp dir so a leftover dataset/temp folder can't become a training class - Report face training success only after the image is written, and return 404 when the event has no face attributes or snapshot - Move VLM watch setup inside the runner's try block, build the runner before claiming the watch slot, bound max_duration_minutes, and reject non-string labels and zones from the chat tool
This commit is contained in:
@@ -110,6 +110,13 @@ class LlamaCppClient(GenAIClient):
|
||||
"""POST with the configured auth headers injected."""
|
||||
return requests.post(url, headers=self._auth_headers(), **kwargs)
|
||||
|
||||
def _server_url(self) -> str | None:
|
||||
"""Return the configured base_url without a trailing slash or /v1."""
|
||||
if not self.genai_config.base_url:
|
||||
return None
|
||||
|
||||
return self.genai_config.base_url.rstrip("/").removesuffix("/v1")
|
||||
|
||||
def _fetch_llama_props(self, base_url: str, model: str) -> dict[str, Any]:
|
||||
"""Fetch /props from a llama.cpp server, with llama-swap fallback.
|
||||
|
||||
@@ -143,16 +150,10 @@ class LlamaCppClient(GenAIClient):
|
||||
self._supports_tools = False
|
||||
self._supports_reasoning = False
|
||||
|
||||
base_url = (
|
||||
self.genai_config.base_url.rstrip("/")
|
||||
if self.genai_config.base_url
|
||||
else None
|
||||
)
|
||||
base_url = self._server_url()
|
||||
|
||||
if base_url is None:
|
||||
return None
|
||||
else:
|
||||
base_url = base_url.replace("/v1", "") # Strip /v1 if included in base_url
|
||||
|
||||
if not self.validate_model:
|
||||
# Probe path
|
||||
@@ -506,11 +507,7 @@ class LlamaCppClient(GenAIClient):
|
||||
|
||||
def _fetch_models_data(self) -> list[dict[str, Any]]:
|
||||
"""Return the raw /v1/models entries, or an empty list if unreachable."""
|
||||
base_url = self.provider or (
|
||||
self.genai_config.base_url.rstrip("/")
|
||||
if self.genai_config.base_url
|
||||
else None
|
||||
)
|
||||
base_url = self.provider or self._server_url()
|
||||
|
||||
if base_url is None:
|
||||
return []
|
||||
|
||||
Reference in New Issue
Block a user