mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-01 16:42:18 +03:00
Settings UI tweaks (#22547)
* fix genai settings ui - add roles widget to select roles for genai providers - add dropdown in semantic search to allow selection of embeddings genai provider * tweak grouping to prioritize fieldOrder before groups previously, groups were always rendered first. now fieldOrder is respected, and any fields in a group will cause the group and all the fields in that group to be rendered in order. this allows moving the enabled switches to the top of the section * mobile tweaks stack buttons, add more space on profiles pane, and move the overridden badge beneath the description * language consistency * prevent camera config sections from being regenerated for profiles * conditionally import axengine module to match other detectors * i18n * update vscode launch.json for new integrated browser * formatting
This commit is contained in:
@@ -98,8 +98,8 @@ function normalizeNullableSchema(schema: RJSFSchema): RJSFSchema {
|
||||
: ["null"];
|
||||
const { anyOf: _anyOf, oneOf: _oneOf, ...rest } = schemaObj;
|
||||
const merged: Record<string, unknown> = {
|
||||
...rest,
|
||||
...normalizedNonNullObj,
|
||||
...rest,
|
||||
type: mergedType,
|
||||
};
|
||||
// When unwrapping a nullable enum, add null to the enum list so
|
||||
@@ -110,6 +110,39 @@ function normalizeNullableSchema(schema: RJSFSchema): RJSFSchema {
|
||||
return merged as RJSFSchema;
|
||||
}
|
||||
|
||||
// Handle anyOf where a plain string branch subsumes a string-enum branch
|
||||
// (e.g. Union[StrEnum, str] or Union[StrEnum, str, None]).
|
||||
// Collapse to a single string type with enum values preserved as `examples`.
|
||||
const stringBranches = anyOf.filter(
|
||||
(item) =>
|
||||
isSchemaObject(item) &&
|
||||
(item as Record<string, unknown>).type === "string",
|
||||
);
|
||||
const enumBranch = stringBranches.find((item) =>
|
||||
Array.isArray((item as Record<string, unknown>).enum),
|
||||
);
|
||||
const plainStringBranch = stringBranches.find(
|
||||
(item) => !Array.isArray((item as Record<string, unknown>).enum),
|
||||
);
|
||||
|
||||
if (
|
||||
enumBranch &&
|
||||
plainStringBranch &&
|
||||
anyOf.length === stringBranches.length + (hasNull ? 1 : 0)
|
||||
) {
|
||||
const enumValues = (enumBranch as Record<string, unknown>).enum as
|
||||
| unknown[]
|
||||
| undefined;
|
||||
const { anyOf: _anyOf, oneOf: _oneOf, ...rest } = schemaObj;
|
||||
return {
|
||||
...rest,
|
||||
type: hasNull ? ["string", "null"] : "string",
|
||||
...(enumValues && enumValues.length > 0
|
||||
? { examples: enumValues }
|
||||
: {}),
|
||||
} as RJSFSchema;
|
||||
}
|
||||
|
||||
return {
|
||||
...schemaObj,
|
||||
anyOf: anyOf
|
||||
@@ -142,8 +175,8 @@ function normalizeNullableSchema(schema: RJSFSchema): RJSFSchema {
|
||||
: ["null"];
|
||||
const { anyOf: _anyOf, oneOf: _oneOf, ...rest } = schemaObj;
|
||||
const merged: Record<string, unknown> = {
|
||||
...rest,
|
||||
...normalizedNonNullObj,
|
||||
...rest,
|
||||
type: mergedType,
|
||||
};
|
||||
// When unwrapping a nullable oneOf enum, add null to the enum list.
|
||||
|
||||
Reference in New Issue
Block a user