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">
<DropdownMenuSeparator className="mb-3" />
<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">
{t("explore.settings.searchSource.desc")}
</div>

View File

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

View File

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