From ce87b9100ae5715384a0adab8896445aeef1092b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 7 May 2026 08:47:57 -0500 Subject: [PATCH] make genai provider required and add special case for UI prevent validation errors from appearing on initial creation of genai provider by setting the first option in the select dropdown as default --- frigate/config/camera/genai.py | 3 +-- .../sections/section-special-cases.ts | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) 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; }