diff --git a/frigate/config/camera/genai.py b/frigate/config/camera/genai.py index 721eeb60d8..902c94c42b 100644 --- a/frigate/config/camera/genai.py +++ b/frigate/config/camera/genai.py @@ -41,8 +41,7 @@ class GenAIConfig(FrigateBaseModel): title="Model", description="The model to use from the provider for generating descriptions or summaries.", ) - provider: GenAIProviderEnum | None = Field( - default=None, + provider: GenAIProviderEnum = Field( title="Provider", description="The GenAI provider to use (for example: ollama, gemini, openai).", ) diff --git a/web/src/components/config-form/sections/section-special-cases.ts b/web/src/components/config-form/sections/section-special-cases.ts index 2b71ea4a20..d8121aea8b 100644 --- a/web/src/components/config-form/sections/section-special-cases.ts +++ b/web/src/components/config-form/sections/section-special-cases.ts @@ -15,7 +15,7 @@ import { JsonObject, JsonValue } from "@/types/configForm"; * Sections that require special handling at the global level. * Add new section paths here as needed. */ -const SPECIAL_CASE_SECTIONS = ["motion", "detectors"] as const; +const SPECIAL_CASE_SECTIONS = ["motion", "detectors", "genai"] as const; /** * Check if a section requires special case handling. @@ -53,6 +53,29 @@ export function modifySchemaForSection( return schemaWithoutDefault; } + if (sectionPath === "genai") { + const additional = schema.additionalProperties; + if ( + additional && + typeof additional === "object" && + !Array.isArray(additional) + ) { + const props = (additional as RJSFSchema).properties; + if (props && typeof props.provider === "object") { + return { + ...schema, + additionalProperties: { + ...additional, + properties: { + ...props, + provider: { ...(props.provider as object), default: "openai" }, + }, + }, + }; + } + } + } + return schema; }