Skip to content

NVR with realtime local object detection for IP cameras

Small genai fix (#14850)

Josh Hawkins0d59754be29d
diff --git a/docs/docs/configuration/genai.md b/docs/docs/configuration/genai.md
index 2ee27f7242..2ec9a62763 100644
--- a/docs/docs/configuration/genai.md
+++ b/docs/docs/configuration/genai.md
@@ -3,9 +3,13 @@ id: genai
title: Generative AI
---
-Generative AI can be used to automatically generate descriptive text based on the thumbnails of your tracked objects. This helps with [Semantic Search](/configuration/semantic_search) in Frigate to provide more context about your tracked objects.
+Generative AI can be used to automatically generate descriptive text based on the thumbnails of your tracked objects. This helps with [Semantic Search](/configuration/semantic_search) in Frigate to provide more context about your tracked objects. Descriptions are accessed via the _Explore_ view in the Frigate UI by clicking on a tracked object's thumbnail.
-Semantic Search must be enabled to use Generative AI. Descriptions are accessed via the _Explore_ view in the Frigate UI by clicking on a tracked object's thumbnail.
+:::info
+
+Semantic Search must be enabled to use Generative AI.
+
+:::
## Configuration
diff --git a/frigate/api/event.py b/frigate/api/event.py
index ac414cdde6..cf0ac26cc9 100644
--- a/frigate/api/event.py
+++ b/frigate/api/event.py
@@ -996,9 +996,11 @@ def regenerate_description(
status_code=404,
)
+ camera_config = request.app.frigate_config.cameras[event.camera]
+
if (
request.app.frigate_config.semantic_search.enabled
- and request.app.frigate_config.genai.enabled
+ and camera_config.genai.enabled
):
request.app.event_metadata_updater.publish((event.id, params.source))
diff --git a/frigate/genai/__init__.py b/frigate/genai/__init__.py
index e2d509383c..74fae9fea5 100644
--- a/frigate/genai/__init__.py
+++ b/frigate/genai/__init__.py
@@ -54,11 +54,10 @@ class GenAIClient:
def get_genai_client(genai_config: GenAIConfig) -> Optional[GenAIClient]:
"""Get the GenAI client."""
- if genai_config.enabled:
- load_providers()
- provider = PROVIDERS.get(genai_config.provider)
- if provider:
- return provider(genai_config)
+ load_providers()
+ provider = PROVIDERS.get(genai_config.provider)
+ if provider:
+ return provider(genai_config)
return None
diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx
index f158df3291..f56074a52a 100644
--- a/web/src/components/overlay/detail/SearchDetailDialog.tsx
+++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx
@@ -477,7 +477,7 @@ function ObjectDetailsTab({
onChange={(e) => setDesc(e.target.value)}
/>
<div className="flex w-full flex-row justify-end gap-2">
- {config?.genai.enabled && (
+ {config?.cameras[search.camera].genai.enabled && (
<div className="flex items-center">
<Button
className="rounded-r-none border-r-0"
diff --git a/web/src/types/frigateConfig.ts b/web/src/types/frigateConfig.ts
index 1d54b4e7e2..5c5971fc08 100644
--- a/web/src/types/frigateConfig.ts
+++ b/web/src/types/frigateConfig.ts
@@ -77,6 +77,13 @@ export interface CameraConfig {
cmd: string;
roles: string[];
}[];
+ genai: {
+ enabled: string;
+ prompt: string;
+ object_prompts: { [key: string]: string };
+ required_zones: string[];
+ objects: string[];
+ };
live: {
height: number;
quality: number;