add field message to recommend presets instead of manual hwaccel args

This commit is contained in:
Josh Hawkins 2026-06-05 23:02:32 -05:00
parent 2f3c79e73f
commit 370b4179ca
3 changed files with 31 additions and 4 deletions

View File

@ -1914,6 +1914,9 @@
"resolutionHigh": "This detect resolution is higher than recommended and may cause increased resource usage without improving detection accuracy. A detect resolution at or below 1080p is recommended for most cameras.",
"globalResolutionMultipleCameras": "A global detect resolution is set while multiple cameras are configured. Unless all cameras share the same resolution and aspect ratio, the detect width and height should be defined per camera to match each camera's native aspect ratio."
},
"ffmpeg": {
"hwaccelManualNotRecommended": "Manual hardware acceleration arguments are not recommended. Unless a specific requirement exists, select the preset that matches your hardware."
},
"objects": {
"genaiNoDescriptionsProvider": "You must configure a GenAI provider with the 'descriptions' role for descriptions to be generated."
},

View File

@ -22,6 +22,27 @@ const ffmpegArgsWidget = (
const ffmpeg: SectionConfigOverrides = {
base: {
sectionDocs: "/configuration/ffmpeg_presets",
fieldMessages: [
{
key: "hwaccel-manual-not-recommended",
field: "hwaccel_args",
position: "after",
messageKey: "configMessages.ffmpeg.hwaccelManualNotRecommended",
severity: "warning",
condition: (ctx) => {
// Manual mode is active when hwaccel_args is an explicit args list
// or a non-preset string
const value = ctx.formData?.hwaccel_args;
if (Array.isArray(value)) {
return value.length > 0;
}
if (typeof value === "string") {
return !value.startsWith("preset-");
}
return false;
},
},
],
fieldDocs: {
hwaccel_args: "/configuration/ffmpeg_presets#hwaccel-presets",
"inputs.hwaccel_args": "/configuration/ffmpeg_presets#hwaccel-presets",

View File

@ -386,11 +386,14 @@ export function FieldTemplate(props: FieldTemplateProps) {
const beforeContent = renderCustom(beforeSpec);
const afterContent = renderCustom(afterSpec);
// Read field-level conditional messages from FieldMessagesContext
// Read field-level conditional messages from FieldMessagesContext.
// For multi-schema fields (anyOf/oneOf), FieldTemplate renders twice for
// the same path (wrapper + inner branch); skip the wrapper pass so the
// message isn't shown twice, mirroring how labels/descriptions dedupe.
const fieldPathStr = pathSegments.join(".");
const fieldMessageSpecs = allFieldMessages.filter(
(m) => m.field === fieldPathStr,
);
const fieldMessageSpecs = isMultiSchemaWrapper
? []
: allFieldMessages.filter((m) => m.field === fieldPathStr);
const beforeMessages = fieldMessageSpecs.filter(
(m) => (m.position ?? "before") === "before",
);