mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-26 13:47:03 +02:00
Catch crash when openai compatible endpoints don't return results correctly (#17572)
This commit is contained in:
parent
7d7d99cb70
commit
a29d4382e1
@ -54,9 +54,13 @@ class OpenAIClient(GenAIClient):
|
||||
],
|
||||
timeout=self.timeout,
|
||||
)
|
||||
except TimeoutException as e:
|
||||
if (
|
||||
result is not None
|
||||
and hasattr(result, "choices")
|
||||
and len(result.choices) > 0
|
||||
):
|
||||
return result.choices[0].message.content.strip()
|
||||
return None
|
||||
except (TimeoutException, Exception) as e:
|
||||
logger.warning("OpenAI returned an error: %s", str(e))
|
||||
return None
|
||||
if len(result.choices) > 0:
|
||||
return result.choices[0].message.content.strip()
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user