mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-29 10:07:41 +03:00
Add different threshold for genai
This commit is contained in:
parent
231dbb76d0
commit
35b132b68e
@ -23,6 +23,11 @@ export const EmbeddingThreshold = {
|
|||||||
error: 1000,
|
error: 1000,
|
||||||
} as Threshold;
|
} as Threshold;
|
||||||
|
|
||||||
|
export const GenAIThreshold = {
|
||||||
|
warning: 30000,
|
||||||
|
error: 60000,
|
||||||
|
} as Threshold;
|
||||||
|
|
||||||
export const DetectorTempThreshold = {
|
export const DetectorTempThreshold = {
|
||||||
warning: 72,
|
warning: 72,
|
||||||
error: 80,
|
error: 80,
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { FrigateStats } from "@/types/stats";
|
import { FrigateStats } from "@/types/stats";
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { useFrigateStats } from "@/api/ws";
|
import { useFrigateStats } from "@/api/ws";
|
||||||
import { EmbeddingThreshold } from "@/types/graph";
|
import { EmbeddingThreshold, GenAIThreshold, Threshold } from "@/types/graph";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { ThresholdBarGraph } from "@/components/graph/SystemGraph";
|
import { ThresholdBarGraph } from "@/components/graph/SystemGraph";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
@ -50,6 +50,14 @@ export default function EnrichmentMetrics({
|
|||||||
}
|
}
|
||||||
}, [initialStats, updatedStats, statsHistory, lastUpdated, setLastUpdated]);
|
}, [initialStats, updatedStats, statsHistory, lastUpdated, setLastUpdated]);
|
||||||
|
|
||||||
|
const getThreshold = useCallback((key: string) => {
|
||||||
|
if (key.includes("description")) {
|
||||||
|
return GenAIThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EmbeddingThreshold;
|
||||||
|
}, []);
|
||||||
|
|
||||||
// timestamps
|
// timestamps
|
||||||
|
|
||||||
const updateTimes = useMemo(
|
const updateTimes = useMemo(
|
||||||
@ -65,7 +73,11 @@ export default function EnrichmentMetrics({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const series: {
|
const series: {
|
||||||
[key: string]: { name: string; data: { x: number; y: number }[] };
|
[key: string]: {
|
||||||
|
name: string;
|
||||||
|
metrics: Threshold;
|
||||||
|
data: { x: number; y: number }[];
|
||||||
|
};
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
statsHistory.forEach((stats, statsIdx) => {
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
@ -79,6 +91,7 @@ export default function EnrichmentMetrics({
|
|||||||
if (!(key in series)) {
|
if (!(key in series)) {
|
||||||
series[key] = {
|
series[key] = {
|
||||||
name: t("enrichments.embeddings." + rawKey),
|
name: t("enrichments.embeddings." + rawKey),
|
||||||
|
metrics: getThreshold(rawKey),
|
||||||
data: [],
|
data: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -87,7 +100,7 @@ export default function EnrichmentMetrics({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return Object.values(series);
|
return Object.values(series);
|
||||||
}, [statsHistory, t]);
|
}, [statsHistory, t, getThreshold]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -112,7 +125,7 @@ export default function EnrichmentMetrics({
|
|||||||
graphId={`${series.name}-inference`}
|
graphId={`${series.name}-inference`}
|
||||||
name={series.name}
|
name={series.name}
|
||||||
unit="ms"
|
unit="ms"
|
||||||
threshold={EmbeddingThreshold}
|
threshold={series.metrics}
|
||||||
updateTimes={updateTimes}
|
updateTimes={updateTimes}
|
||||||
data={[series]}
|
data={[series]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user