Small genai fix (#14850)

* Ensure the regenerate button shows when genai is only enabled at the camera level

* update docs
This commit is contained in:
Josh Hawkins 2024-11-07 14:27:55 -06:00 committed by GitHub
parent 15bd26c9b1
commit 0d59754be2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 9 deletions

View File

@ -3,9 +3,13 @@ id: genai
title: Generative AI 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 ## Configuration

View File

@ -996,9 +996,11 @@ def regenerate_description(
status_code=404, status_code=404,
) )
camera_config = request.app.frigate_config.cameras[event.camera]
if ( if (
request.app.frigate_config.semantic_search.enabled 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)) request.app.event_metadata_updater.publish((event.id, params.source))

View File

@ -54,11 +54,10 @@ class GenAIClient:
def get_genai_client(genai_config: GenAIConfig) -> Optional[GenAIClient]: def get_genai_client(genai_config: GenAIConfig) -> Optional[GenAIClient]:
"""Get the GenAI client.""" """Get the GenAI client."""
if genai_config.enabled: load_providers()
load_providers() provider = PROVIDERS.get(genai_config.provider)
provider = PROVIDERS.get(genai_config.provider) if provider:
if provider: return provider(genai_config)
return provider(genai_config)
return None return None

View File

@ -477,7 +477,7 @@ function ObjectDetailsTab({
onChange={(e) => setDesc(e.target.value)} onChange={(e) => setDesc(e.target.value)}
/> />
<div className="flex w-full flex-row justify-end gap-2"> <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"> <div className="flex items-center">
<Button <Button
className="rounded-r-none border-r-0" className="rounded-r-none border-r-0"

View File

@ -77,6 +77,13 @@ export interface CameraConfig {
cmd: string; cmd: string;
roles: string[]; roles: string[];
}[]; }[];
genai: {
enabled: string;
prompt: string;
object_prompts: { [key: string]: string };
required_zones: string[];
objects: string[];
};
live: { live: {
height: number; height: number;
quality: number; quality: number;