mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-31 04:59:24 +08:00
Fix: validate Mistral OCR model (#17515)
This commit is contained in:
@@ -387,6 +387,17 @@ class MistralParser(RAGFlowPdfParser):
|
||||
def check_installation(self) -> tuple[bool, str]:
|
||||
if not self.api_key:
|
||||
return False, "Mistral API key is not configured."
|
||||
|
||||
try:
|
||||
r = requests.get(f"{self.base_url}/models", headers=self._headers(), timeout=10)
|
||||
self.logger.info(f"[Mistral] API models endpoint reachable, status={r.status_code}")
|
||||
if r.status_code != 200:
|
||||
return False, f"Mistral API check failed: HTTP {r.status_code} {r.text[:200]}"
|
||||
except Exception as exc:
|
||||
reason = f"Mistral API check failed: {exc}"
|
||||
self.logger.warning(reason)
|
||||
return False, reason
|
||||
|
||||
return True, ""
|
||||
|
||||
def _raise_for_status(self, resp, action: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user