fix: fix exploreSettings error

This commit is contained in:
ZhaiSoul 2025-03-13 00:35:57 +08:00
parent 4adf6ee22f
commit a5bd4b8550
3 changed files with 45 additions and 33 deletions

View File

@ -159,7 +159,9 @@ export function SearchTypeContent({
<div className="overflow-x-hidden"> <div className="overflow-x-hidden">
<DropdownMenuSeparator className="mb-3" /> <DropdownMenuSeparator className="mb-3" />
<div className="space-y-0.5"> <div className="space-y-0.5">
<div className="text-md">{t("explore.settings.searchSource.label")}</div> <div className="text-md">
{t("explore.settings.searchSource.label")}
</div>
<div className="space-y-1 text-xs text-muted-foreground"> <div className="space-y-1 text-xs text-muted-foreground">
{t("explore.settings.searchSource.desc")} {t("explore.settings.searchSource.desc")}
</div> </div>

View File

@ -1038,9 +1038,7 @@ function FrigateCameraFeatures({
Started manual on-demand recording. Started manual on-demand recording.
</div> </div>
{!camera.record.enabled || camera.record.alerts.retain.days == 0 ? ( {!camera.record.enabled || camera.record.alerts.retain.days == 0 ? (
<div> <div>{t("manualRecording.recordDisabledTips")}</div>
{t("manualRecording.recordDisabledTips")}
</div>
) : ( ) : (
<OnDemandRetentionMessage camera={camera} /> <OnDemandRetentionMessage camera={camera} />
)} )}
@ -1237,7 +1235,9 @@ function FrigateCameraFeatures({
<PopoverTrigger asChild> <PopoverTrigger asChild>
<div className="cursor-pointer p-0"> <div className="cursor-pointer p-0">
<LuInfo className="size-4" /> <LuInfo className="size-4" />
<span className="sr-only">{t("button.info", {ns: "common"})}</span> <span className="sr-only">
{t("button.info", { ns: "common" })}
</span>
</div> </div>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-80 text-xs"> <PopoverContent className="w-80 text-xs">
@ -1265,7 +1265,9 @@ function FrigateCameraFeatures({
{isRestreamed && {isRestreamed &&
Object.values(camera.live.streams).length > 0 && ( Object.values(camera.live.streams).length > 0 && (
<div className="flex flex-col gap-1"> <div className="flex flex-col gap-1">
<Label htmlFor="streaming-method">{t("stream.title")}</Label> <Label htmlFor="streaming-method">
{t("stream.title")}
</Label>
<Select <Select
value={streamName} value={streamName}
onValueChange={(value) => { onValueChange={(value) => {
@ -1310,7 +1312,9 @@ function FrigateCameraFeatures({
<PopoverTrigger asChild> <PopoverTrigger asChild>
<div className="cursor-pointer p-0"> <div className="cursor-pointer p-0">
<LuInfo className="size-4" /> <LuInfo className="size-4" />
<span className="sr-only">{t("button.info", {ns:"common"})}</span> <span className="sr-only">
{t("button.info", { ns: "common" })}
</span>
</div> </div>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-80 text-xs"> <PopoverContent className="w-80 text-xs">
@ -1339,21 +1343,19 @@ function FrigateCameraFeatures({
{supports2WayTalk ? ( {supports2WayTalk ? (
<> <>
<LuCheck className="size-4 text-success" /> <LuCheck className="size-4 text-success" />
<div> <div>{t("stream.twoWayTalk.available")}</div>
{t("stream.twoWayTalk.available")}
</div>
</> </>
) : ( ) : (
<> <>
<LuX className="size-4 text-danger" /> <LuX className="size-4 text-danger" />
<div> <div>{t("stream.twoWayTalk.available")}</div>
{t("stream.twoWayTalk.available")}
</div>
<Popover> <Popover>
<PopoverTrigger asChild> <PopoverTrigger asChild>
<div className="cursor-pointer p-0"> <div className="cursor-pointer p-0">
<LuInfo className="size-4" /> <LuInfo className="size-4" />
<span className="sr-only">{t("button.info", {ns: "common"})}</span> <span className="sr-only">
{t("button.info", { ns: "common" })}
</span>
</div> </div>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-80 text-xs"> <PopoverContent className="w-80 text-xs">
@ -1365,7 +1367,9 @@ function FrigateCameraFeatures({
rel="noopener noreferrer" rel="noopener noreferrer"
className="inline" className="inline"
> >
{t("stream.twoWayTalk.tips.documentation")} {t(
"stream.twoWayTalk.tips.documentation",
)}
<LuExternalLink className="ml-2 inline-flex size-3" /> <LuExternalLink className="ml-2 inline-flex size-3" />
</Link> </Link>
</div> </div>
@ -1550,7 +1554,9 @@ function FrigateCameraFeatures({
<PopoverTrigger asChild> <PopoverTrigger asChild>
<div className="cursor-pointer p-0"> <div className="cursor-pointer p-0">
<LuInfo className="size-4" /> <LuInfo className="size-4" />
<span className="sr-only">{t("button.info", {ns: "common"})}</span> <span className="sr-only">
{t("button.info", { ns: "common" })}
</span>
</div> </div>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-80 text-xs"> <PopoverContent className="w-80 text-xs">
@ -1621,7 +1627,9 @@ function FrigateCameraFeatures({
<PopoverTrigger asChild> <PopoverTrigger asChild>
<div className="cursor-pointer p-0"> <div className="cursor-pointer p-0">
<LuInfo className="size-4" /> <LuInfo className="size-4" />
<span className="sr-only">{t("button.info", {ns: "common"})}</span> <span className="sr-only">
{t("button.info", { ns: "common" })}
</span>
</div> </div>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-52 text-xs"> <PopoverContent className="w-52 text-xs">
@ -1660,7 +1668,9 @@ function FrigateCameraFeatures({
<PopoverTrigger asChild> <PopoverTrigger asChild>
<div className="cursor-pointer p-0"> <div className="cursor-pointer p-0">
<LuInfo className="size-4" /> <LuInfo className="size-4" />
<span className="sr-only">{t("button.info", {ns: "common"})}</span> <span className="sr-only">
{t("button.info", { ns: "common" })}
</span>
</div> </div>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-52 text-xs"> <PopoverContent className="w-52 text-xs">
@ -1687,9 +1697,7 @@ function FrigateCameraFeatures({
<div className="flex flex-row items-center gap-2"> <div className="flex flex-row items-center gap-2">
<IoIosWarning className="mr-1 size-8 text-danger" /> <IoIosWarning className="mr-1 size-8 text-danger" />
<p className="text-sm"> <p className="text-sm">{t("stream.lowBandwidth.tips")}</p>
{t("stream.lowBandwidth.tips")}
</p>
</div> </div>
<Button <Button
className={`flex items-center gap-2.5 rounded-lg`} className={`flex items-center gap-2.5 rounded-lg`}
@ -1699,7 +1707,9 @@ function FrigateCameraFeatures({
onClick={() => setLowBandwidth(false)} onClick={() => setLowBandwidth(false)}
> >
<MdOutlineRestartAlt className="size-5 text-primary-variant" /> <MdOutlineRestartAlt className="size-5 text-primary-variant" />
<div className="text-primary-variant">{t("stream.lowBandwidth.resetStream")}</div> <div className="text-primary-variant">
{t("stream.lowBandwidth.resetStream")}
</div>
</Button> </Button>
</div> </div>
)} )}

View File

@ -58,7 +58,7 @@ export default function ExploreSettingsView({
useEffect(() => { useEffect(() => {
if (config) { if (config) {
if (ExploreSettings?.enabled == undefined) { if (exploreSettings?.enabled == undefined) {
setExploreSettings({ setExploreSettings({
enabled: config.semantic_search.enabled, enabled: config.semantic_search.enabled,
reindex: config.semantic_search.reindex, reindex: config.semantic_search.reindex,
@ -87,7 +87,7 @@ export default function ExploreSettingsView({
axios axios
.put( .put(
`config/set?semantic_search.enabled=${ExploreSettings.enabled ? "True" : "False"}&semantic_search.reindex=${ExploreSettings.reindex ? "True" : "False"}&semantic_search.model_size=${ExploreSettings.model_size}`, `config/set?semantic_search.enabled=${exploreSettings.enabled ? "True" : "False"}&semantic_search.reindex=${exploreSettings.reindex ? "True" : "False"}&semantic_search.model_size=${exploreSettings.model_size}`,
{ {
requires_restart: 0, requires_restart: 0,
}, },
@ -131,9 +131,9 @@ export default function ExploreSettingsView({
}); });
}, [ }, [
updateConfig, updateConfig,
ExploreSettings.enabled, exploreSettings.enabled,
ExploreSettings.reindex, exploreSettings.reindex,
ExploreSettings.model_size, exploreSettings.model_size,
t, t,
]); ]);
@ -202,8 +202,8 @@ export default function ExploreSettingsView({
<Switch <Switch
id="enabled" id="enabled"
className="mr-3" className="mr-3"
disabled={ExploreSettings.enabled === undefined} disabled={exploreSettings.enabled === undefined}
checked={ExploreSettings.enabled === true} checked={exploreSettings.enabled === true}
onCheckedChange={(isChecked) => { onCheckedChange={(isChecked) => {
handleSearchConfigChange({ enabled: isChecked }); handleSearchConfigChange({ enabled: isChecked });
}} }}
@ -219,8 +219,8 @@ export default function ExploreSettingsView({
<Switch <Switch
id="reindex" id="reindex"
className="mr-3" className="mr-3"
disabled={ExploreSettings.reindex === undefined} disabled={exploreSettings.reindex === undefined}
checked={ExploreSettings.reindex === true} checked={exploreSettings.reindex === true}
onCheckedChange={(isChecked) => { onCheckedChange={(isChecked) => {
handleSearchConfigChange({ reindex: isChecked }); handleSearchConfigChange({ reindex: isChecked });
}} }}
@ -263,7 +263,7 @@ export default function ExploreSettingsView({
</div> </div>
</div> </div>
<Select <Select
value={ExploreSettings.model_size} value={exploreSettings.model_size}
onValueChange={(value) => onValueChange={(value) =>
handleSearchConfigChange({ handleSearchConfigChange({
model_size: value as SearchModelSize, model_size: value as SearchModelSize,
@ -273,7 +273,7 @@ export default function ExploreSettingsView({
<SelectTrigger className="w-20"> <SelectTrigger className="w-20">
{t( {t(
"explore.semanticSearch.modelSize." + "explore.semanticSearch.modelSize." +
ExploreSettings.model_size, exploreSettings.model_size,
)} )}
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>