mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-24 18:26:51 +03:00
Tweaks (#24418)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* don't display audio transcription provider message as health notice * show remote provider for audio transcription in health pane * adjust trigger and notifications messages to be consistent with the rest of the settings UI * disable save buttons when there are no changes in config editor * fix audio manager crash when a camera is added at runtime The audio processor and the camera maintainer both poll the same `add` config update on their own one second timers, and the maintainer is what creates `camera_metrics[name]`. When the audio processor got there first it looked the new camera up before that entry existed, and the `KeyError` took down the whole `frigate.audio_manager` process. Whether it happens depends purely on which poll fires first, so cloning a camera from the UI fails or succeeds at random. `spawn_if_needed` now skips a camera whose metrics aren't there yet and picks it up on the next poll, the same way it already waits on a late ffmpeg update. `AudioEventMaintainer` holds the `CameraMetrics` object now instead of indexing the manager dict on every audio chunk, which drops the IPC round trips and means a removed camera can't `KeyError` out of `detect_audio` after the maintainer pops the entry. The audio process is also registered with the watchdog, since a crash there previously left audio detection dead for every camera until a full restart, and it now receives the shared `DataProcessorMetrics` so `AudioTranscriptionRealTimeProcessor` gets the same type as the other real time processors. * fix stationary max_frames dropping other tracked objects When `max_frames` was set for a label, deregistering one object rebuilt norfair's list with a filter that kept an object only if it was both not the target and already on its way out, so every other healthy object of that label was dropped along with it. Any car leaving the frame took the rest of the cars with it and they came back as new tracked objects a few frames later. The filter now removes only the target, and objects that are expiring are still reaped by norfair on the next update. * fix test * fix skip_motion_threshold permanently disabling motion detection The skip check returned before the two `accumulateWeighted` calls at the end of `detect`, so a skipped frame never made it into the background and setting `calibrating` there only picked a faster alpha for calls that never ran. `avg_frame` starts as an all zero image and a normally lit scene differs from black across nearly the whole frame, so the cameras I tested measure 0.84 to 0.98 against it. Any `skip_motion_threshold` below that number skips the first frame, leaves the background black, and skips every frame after it. Motion detection is dead for that camera until the setting is removed or Frigate restarts, with no motion boxes, no motion recordings, and no regions for the tracker since the detector stays calibrating. Startup isn't the only way in. `update_mask` zeroes the background on any motion config change, and once a camera has calibrated the first IR switch or PTZ move freezes the background on the old scene, so it can't transition to the new one, which is the case the option exists for. The frame is now blended in before the early return at the same 0.2 alpha the calibrating path uses elsewhere, so a large scene change is still suppressed while the background catches up, about a second on a 5 fps camera, and then motion comes back. * dump ffmpeg logs on every restart The record watchdog restarted ffmpeg without flushing its `LogPipe`, so a camera whose recording segments went stale never showed a single line of ffmpeg output. The dump now happens in `start_or_restart_ffmpeg` right after the stop, which covers the stale record path, the record crash path, and the audio restart. `reset_capture_thread` and the audio `log_and_restart` fallback keep their own dumps since both pass `ffmpeg_process=None`. * dump ffmpeg logs once per restart The audio restart path dumped the log pipe itself before calling the helper, so the restart dump printed a second "last 100 lines" heading over an already drained deque and split the tail that `stop_ffmpeg` flushed into its own section. The heading is now only printed when there's something under it, and the audio path leaves the dump to the restart so each failure produces one section. * keep all logpipe dumps consistent
This commit is contained in:
+12
-2
@@ -483,7 +483,7 @@ class FrigateApp:
|
||||
|
||||
def start_audio_processor(self) -> None:
|
||||
self.audio_process = AudioProcessor(
|
||||
self.config, self.camera_metrics, self.stop_event
|
||||
self.config, self.camera_metrics, self.embeddings_metrics, self.stop_event
|
||||
)
|
||||
self.audio_process.start()
|
||||
self.processes["audio_detector"] = self.audio_process.pid or 0
|
||||
@@ -556,10 +556,20 @@ class FrigateApp:
|
||||
"output",
|
||||
lambda: OutputProcess(self.config, self.stop_event),
|
||||
),
|
||||
(
|
||||
"audio_process",
|
||||
"audio_detector",
|
||||
lambda: AudioProcessor(
|
||||
self.config,
|
||||
self.camera_metrics,
|
||||
self.embeddings_metrics,
|
||||
self.stop_event,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
for attr, key, factory in specs:
|
||||
if not hasattr(self, attr):
|
||||
if getattr(self, attr, None) is None:
|
||||
continue
|
||||
|
||||
def on_restart(
|
||||
|
||||
+46
-31
@@ -11,6 +11,7 @@ from typing import Any
|
||||
|
||||
import numpy as np
|
||||
|
||||
from frigate.camera import CameraMetrics
|
||||
from frigate.comms.detections_updater import DetectionPublisher, DetectionTypeEnum
|
||||
from frigate.comms.inter_process import InterProcessRequestor
|
||||
from frigate.config import CameraConfig, CameraInput, FrigateConfig
|
||||
@@ -36,6 +37,7 @@ from frigate.data_processing.common.audio_transcription.model import (
|
||||
from frigate.data_processing.real_time.audio_transcription import (
|
||||
AudioTranscriptionRealTimeProcessor,
|
||||
)
|
||||
from frigate.data_processing.types import DataProcessorMetrics
|
||||
from frigate.ffmpeg_presets import parse_preset_input
|
||||
from frigate.log import LogPipe, suppress_stderr_during
|
||||
from frigate.util.builtin import get_ffmpeg_arg_list, load_labels
|
||||
@@ -86,6 +88,7 @@ class AudioProcessor(FrigateProcess):
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
camera_metrics: DictProxy,
|
||||
embeddings_metrics: DataProcessorMetrics,
|
||||
stop_event: MpEvent,
|
||||
):
|
||||
super().__init__(
|
||||
@@ -93,8 +96,38 @@ class AudioProcessor(FrigateProcess):
|
||||
)
|
||||
|
||||
self.camera_metrics = camera_metrics
|
||||
self.embeddings_metrics = embeddings_metrics
|
||||
self.config = config
|
||||
|
||||
def spawn_if_needed(self, camera: CameraConfig) -> None:
|
||||
"""Start an audio maintainer for the camera once everything it needs
|
||||
has arrived. Returning early leaves the camera for the next poll."""
|
||||
name = camera.name
|
||||
if name is None or name in self.audio_threads:
|
||||
return
|
||||
if not camera.enabled or not camera.audio.enabled:
|
||||
return
|
||||
# ffmpeg update may not have arrived yet
|
||||
if not any("audio" in i.roles for i in camera.ffmpeg.inputs):
|
||||
return
|
||||
# the camera maintainer creates metrics on its own poll of the same
|
||||
# add update and may not have gotten there yet
|
||||
metrics = self.camera_metrics.get(name)
|
||||
if metrics is None:
|
||||
return
|
||||
thread = AudioEventMaintainer(
|
||||
camera,
|
||||
self.config,
|
||||
metrics,
|
||||
self.embeddings_metrics,
|
||||
self.transcription_model_runner,
|
||||
self.stop_event, # type: ignore[arg-type]
|
||||
self.genai_manager,
|
||||
)
|
||||
self.audio_threads[name] = thread
|
||||
thread.start()
|
||||
self.logger.info(f"Audio maintainer started for {name}")
|
||||
|
||||
def __stop_audio_thread(self, camera: str) -> None:
|
||||
thread = self.audio_threads.pop(camera, None)
|
||||
if thread is None:
|
||||
@@ -150,29 +183,8 @@ class AudioProcessor(FrigateProcess):
|
||||
],
|
||||
)
|
||||
|
||||
def spawn_if_needed(camera: CameraConfig) -> None:
|
||||
name = camera.name
|
||||
if name is None or name in self.audio_threads:
|
||||
return
|
||||
if not camera.enabled or not camera.audio.enabled:
|
||||
return
|
||||
# ffmpeg update may not have arrived yet; wait for next poll
|
||||
if not any("audio" in i.roles for i in camera.ffmpeg.inputs):
|
||||
return
|
||||
thread = AudioEventMaintainer(
|
||||
camera,
|
||||
self.config,
|
||||
self.camera_metrics,
|
||||
self.transcription_model_runner,
|
||||
self.stop_event, # type: ignore[arg-type]
|
||||
self.genai_manager,
|
||||
)
|
||||
self.audio_threads[name] = thread
|
||||
thread.start()
|
||||
self.logger.info(f"Audio maintainer started for {name}")
|
||||
|
||||
for camera in self.config.cameras.values():
|
||||
spawn_if_needed(camera)
|
||||
self.spawn_if_needed(camera)
|
||||
|
||||
self.logger.info(f"Audio processor started (pid: {self.pid})")
|
||||
|
||||
@@ -182,15 +194,14 @@ class AudioProcessor(FrigateProcess):
|
||||
updated_topics = config_subscriber.check_for_updates()
|
||||
|
||||
# stop maintainers for removed cameras so their ffmpeg process is
|
||||
# torn down and they stop touching camera_metrics (which the camera
|
||||
# maintainer has already popped for the removed camera)
|
||||
# torn down
|
||||
for removed_camera in updated_topics.get(
|
||||
CameraConfigUpdateEnum.remove.name, []
|
||||
):
|
||||
self.__stop_audio_thread(removed_camera)
|
||||
|
||||
for camera in self.config.cameras.values():
|
||||
spawn_if_needed(camera)
|
||||
self.spawn_if_needed(camera)
|
||||
|
||||
config_subscriber.stop()
|
||||
|
||||
@@ -212,7 +223,8 @@ class AudioEventMaintainer(threading.Thread):
|
||||
self,
|
||||
camera: CameraConfig,
|
||||
config: FrigateConfig,
|
||||
camera_metrics: DictProxy,
|
||||
metrics: CameraMetrics,
|
||||
embeddings_metrics: DataProcessorMetrics,
|
||||
audio_transcription_model_runner: AudioTranscriptionModelRunner | None,
|
||||
stop_event: threading.Event,
|
||||
genai_manager: Any = None,
|
||||
@@ -221,7 +233,11 @@ class AudioEventMaintainer(threading.Thread):
|
||||
|
||||
self.config = config
|
||||
self.camera_config = camera
|
||||
self.camera_metrics = camera_metrics
|
||||
# hold the metrics object rather than indexing the manager dict per
|
||||
# chunk, which costs an IPC round trip and breaks once the camera
|
||||
# maintainer pops the entry on removal
|
||||
self.metrics = metrics
|
||||
self.embeddings_metrics = embeddings_metrics
|
||||
self.stop_event = stop_event
|
||||
# per-camera stop signal so a single maintainer can be torn down at
|
||||
# runtime (e.g. on camera removal) without stopping the whole process
|
||||
@@ -265,7 +281,7 @@ class AudioEventMaintainer(threading.Thread):
|
||||
camera_config=self.camera_config,
|
||||
requestor=self.requestor,
|
||||
model_runner=self.audio_transcription_model_runner,
|
||||
metrics=self.camera_metrics[self.camera_config.name],
|
||||
metrics=self.embeddings_metrics,
|
||||
stop_event=self.stop_event,
|
||||
genai_manager=self.genai_manager,
|
||||
)
|
||||
@@ -291,8 +307,8 @@ class AudioEventMaintainer(threading.Thread):
|
||||
audio_as_float: np.ndarray = audio.astype(np.float32)
|
||||
rms, dBFS = self.calculate_audio_levels(audio_as_float)
|
||||
|
||||
self.camera_metrics[self.camera_config.name].audio_rms.value = rms
|
||||
self.camera_metrics[self.camera_config.name].audio_dBFS.value = dBFS
|
||||
self.metrics.audio_rms.value = rms
|
||||
self.metrics.audio_dBFS.value = dBFS
|
||||
|
||||
audio_detections: list[tuple[str, float]] = []
|
||||
|
||||
@@ -377,7 +393,6 @@ class AudioEventMaintainer(threading.Thread):
|
||||
return
|
||||
|
||||
time.sleep(self.camera_config.ffmpeg.retry_interval)
|
||||
self.logpipe.dump()
|
||||
self.start_or_restart_ffmpeg()
|
||||
|
||||
if self.audio_listener is None or self.audio_listener.stdout is None:
|
||||
|
||||
@@ -144,6 +144,14 @@ class LogPipe(threading.Thread):
|
||||
self.pipeReader.close()
|
||||
|
||||
def dump(self) -> None:
|
||||
if not self.deque:
|
||||
return
|
||||
|
||||
self.logger.log(
|
||||
self.level,
|
||||
"The following ffmpeg logs include the last 100 lines prior to exit.",
|
||||
)
|
||||
|
||||
while len(self.deque) > 0:
|
||||
self.logger.log(self.level, self.deque.popleft())
|
||||
|
||||
|
||||
@@ -188,8 +188,12 @@ class ImprovedMotionDetector(MotionDetector):
|
||||
self.config.skip_motion_threshold is not None
|
||||
and pct_motion > self.config.skip_motion_threshold
|
||||
):
|
||||
# force a recalibration so we transition to the new background
|
||||
# recalibrate so we transition to the new background. the frame
|
||||
# still has to be blended in here, otherwise the background stays
|
||||
# frozen and every subsequent frame skips as well
|
||||
self.calibrating = True
|
||||
cv2.accumulateWeighted(resized_frame, self.avg_frame, 0.2)
|
||||
self.motion_frame_count = 0
|
||||
return []
|
||||
|
||||
# once the motion is less than 5% and the number of contours is < 4, assume its calibrated
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
"""Tests for audio maintainer spawning on runtime camera adds."""
|
||||
|
||||
import threading
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.events.audio import AudioProcessor
|
||||
|
||||
|
||||
def _build_config() -> FrigateConfig:
|
||||
return FrigateConfig(
|
||||
**{
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"cameras": {
|
||||
"front_door": {
|
||||
"ffmpeg": {
|
||||
"inputs": [
|
||||
{
|
||||
"path": "rtsp://10.0.0.1:554/video",
|
||||
"roles": ["detect", "audio"],
|
||||
}
|
||||
]
|
||||
},
|
||||
"audio": {"enabled": True},
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class TestAudioSpawnIfNeeded(unittest.TestCase):
|
||||
def _processor(self, config: FrigateConfig, camera_metrics: dict) -> AudioProcessor:
|
||||
processor = AudioProcessor.__new__(AudioProcessor)
|
||||
processor.config = config
|
||||
processor.camera_metrics = camera_metrics
|
||||
processor.embeddings_metrics = MagicMock()
|
||||
processor.audio_threads = {}
|
||||
processor.transcription_model_runner = None
|
||||
processor.genai_manager = None
|
||||
processor.stop_event = threading.Event()
|
||||
processor.logger = MagicMock()
|
||||
return processor
|
||||
|
||||
def test_skips_camera_whose_metrics_have_not_been_created_yet(self):
|
||||
"""The camera maintainer creates metrics on its own poll of the add
|
||||
update, so the audio processor can see the camera first."""
|
||||
config = _build_config()
|
||||
processor = self._processor(config, {})
|
||||
|
||||
with patch("frigate.events.audio.AudioEventMaintainer") as maintainer:
|
||||
processor.spawn_if_needed(config.cameras["front_door"])
|
||||
|
||||
maintainer.assert_not_called()
|
||||
assert processor.audio_threads == {}
|
||||
|
||||
def test_spawns_once_metrics_exist_and_passes_the_metrics_object(self):
|
||||
config = _build_config()
|
||||
metrics = object()
|
||||
processor = self._processor(config, {"front_door": metrics})
|
||||
|
||||
with patch("frigate.events.audio.AudioEventMaintainer") as maintainer:
|
||||
processor.spawn_if_needed(config.cameras["front_door"])
|
||||
|
||||
assert maintainer.call_args.args[2] is metrics
|
||||
assert "front_door" in processor.audio_threads
|
||||
maintainer.return_value.start.assert_called_once()
|
||||
|
||||
def test_does_not_respawn_for_a_camera_already_running(self):
|
||||
config = _build_config()
|
||||
processor = self._processor(config, {"front_door": object()})
|
||||
processor.audio_threads["front_door"] = MagicMock()
|
||||
|
||||
with patch("frigate.events.audio.AudioEventMaintainer") as maintainer:
|
||||
processor.spawn_if_needed(config.cameras["front_door"])
|
||||
|
||||
maintainer.assert_not_called()
|
||||
|
||||
def test_skips_camera_whose_ffmpeg_update_has_not_arrived_yet(self):
|
||||
"""The add update carries the camera before its ffmpeg inputs are
|
||||
applied, so the audio role can be briefly missing."""
|
||||
config = _build_config()
|
||||
camera = config.cameras["front_door"]
|
||||
camera.ffmpeg.inputs[0].roles = ["detect"]
|
||||
processor = self._processor(config, {"front_door": object()})
|
||||
|
||||
with patch("frigate.events.audio.AudioEventMaintainer") as maintainer:
|
||||
processor.spawn_if_needed(camera)
|
||||
|
||||
maintainer.assert_not_called()
|
||||
@@ -73,6 +73,35 @@ class TestImprovedMotionDetector(unittest.TestCase):
|
||||
"Motion boxes should be empty when scene change exceeds skip threshold",
|
||||
)
|
||||
|
||||
def _bright_frame(self, offset: int) -> np.ndarray:
|
||||
"""Produce a bright frame with a small dark object that moves."""
|
||||
frame = np.full((self.frame_shape[0], self.frame_shape[1]), 200, dtype=np.uint8)
|
||||
x = 10 + (offset * 5) % 60
|
||||
frame[40:60, x : x + 15] = 20
|
||||
return frame
|
||||
|
||||
def test_skip_motion_threshold_recovers_after_skip(self):
|
||||
"""Skipped frames must still be blended into the background.
|
||||
|
||||
A bright scene differs from the zeroed background across the whole
|
||||
frame, so the first frames are skipped. The background has to catch up
|
||||
anyway, otherwise motion detection never returns.
|
||||
"""
|
||||
self.config.skip_motion_threshold = 0.5
|
||||
self.config.improve_contrast = False
|
||||
self.detector.config = self.config
|
||||
self.detector.update_mask()
|
||||
|
||||
boxes = [len(self.detector.detect(self._bright_frame(i))) for i in range(40)]
|
||||
|
||||
self.assertEqual(boxes[0], 0, "First frame should exceed the skip threshold")
|
||||
self.assertGreater(
|
||||
self.detector.avg_frame.max(),
|
||||
0,
|
||||
"Background was never updated while frames were skipped",
|
||||
)
|
||||
self.assertTrue(any(boxes), "Motion detection never recovered after a skip")
|
||||
|
||||
def test_skip_motion_threshold_does_not_affect_calibration(self):
|
||||
"""Even when skipping, the detector should go into calibrating state."""
|
||||
self.config.skip_motion_threshold = 0.4
|
||||
|
||||
@@ -324,9 +324,7 @@ class NorfairTracker(ObjectTracker):
|
||||
):
|
||||
tracker = self.get_tracker(obj["label"])
|
||||
tracker.tracked_objects = [
|
||||
o
|
||||
for o in tracker.tracked_objects
|
||||
if str(o.global_id) != track_id and o.hit_counter < 0
|
||||
o for o in tracker.tracked_objects if str(o.global_id) != track_id
|
||||
]
|
||||
|
||||
del self.track_id_map[track_id]
|
||||
|
||||
@@ -49,6 +49,9 @@ def start_or_restart_ffmpeg(
|
||||
if ffmpeg_process is not None:
|
||||
stop_ffmpeg(ffmpeg_process, logger)
|
||||
|
||||
# flush after the stop so the logs cover ffmpeg's output up to exit
|
||||
logpipe.dump()
|
||||
|
||||
if frame_size is None:
|
||||
process = sp.Popen(
|
||||
ffmpeg_cmd,
|
||||
|
||||
@@ -319,9 +319,6 @@ class CameraWatchdog(threading.Thread):
|
||||
f"Capture thread for {self.config.name} did not exit in time"
|
||||
)
|
||||
|
||||
self.logger.error(
|
||||
"The following ffmpeg logs include the last 100 lines prior to exit."
|
||||
)
|
||||
self.logpipe.dump()
|
||||
self.logger.info("Restarting ffmpeg...")
|
||||
self.start_ffmpeg_detect()
|
||||
@@ -543,7 +540,6 @@ class CameraWatchdog(threading.Thread):
|
||||
f"{self.config.name}/status/{role.value}", "offline"
|
||||
)
|
||||
|
||||
p["logpipe"].dump()
|
||||
p["process"] = start_or_restart_ffmpeg(
|
||||
p["cmd"], self.logger, p["logpipe"], ffmpeg_process=p["process"]
|
||||
)
|
||||
|
||||
@@ -56,3 +56,14 @@ export async function waitForErrorMarker(
|
||||
.poll(() => hasErrorMarkers(page), { timeout: timeoutMs })
|
||||
.toBe(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a trailing comment so the editor content differs from the
|
||||
* loaded config. The save buttons are disabled until then.
|
||||
*/
|
||||
export async function makeMonacoEdit(page: Page): Promise<void> {
|
||||
const editor = page.locator(".monaco-editor").first();
|
||||
await editor.click();
|
||||
await page.keyboard.press("ControlOrMeta+End");
|
||||
await page.keyboard.type("# edited by e2e", { delay: 0 });
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { installWsFrameCapture, waitForWsFrame } from "../helpers/ws-frames";
|
||||
import { grantClipboardPermissions, readClipboard } from "../helpers/clipboard";
|
||||
import {
|
||||
getMonacoVisibleText,
|
||||
makeMonacoEdit,
|
||||
replaceMonacoValue,
|
||||
waitForErrorMarker,
|
||||
} from "../helpers/monaco";
|
||||
@@ -71,6 +72,7 @@ test.describe("Config Editor — Save @medium", () => {
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await makeMonacoEdit(frigateApp.page);
|
||||
await frigateApp.page.getByLabel("Save Only").click();
|
||||
await expect
|
||||
.poll(() => capture.capturedUrl(), { timeout: 5_000 })
|
||||
@@ -92,6 +94,7 @@ test.describe("Config Editor — Save @medium", () => {
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await makeMonacoEdit(frigateApp.page);
|
||||
await frigateApp.page.getByLabel("Save Only").click();
|
||||
await expect(frigateApp.page.getByText(/Invalid field/i)).toBeVisible({
|
||||
timeout: 5_000,
|
||||
@@ -117,6 +120,7 @@ test.describe("Config Editor — Save and Restart @medium", () => {
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
await makeMonacoEdit(frigateApp.page);
|
||||
await frigateApp.page.getByLabel("Save & Restart").click();
|
||||
const dialog = frigateApp.page.getByRole("alertdialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
@@ -140,6 +144,7 @@ test.describe("Config Editor — Save and Restart @medium", () => {
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
await makeMonacoEdit(frigateApp.page);
|
||||
await frigateApp.page.getByLabel("Save & Restart").click();
|
||||
const dialog = frigateApp.page.getByRole("alertdialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
@@ -1208,9 +1208,8 @@
|
||||
"desc": "Frigate can natively send push notifications to your device when it is running in the browser or installed as a PWA."
|
||||
},
|
||||
"notificationUnavailable": {
|
||||
"title": "Notifications Unavailable",
|
||||
"desc": "Web push notifications require a secure context (<code>https://…</code>). This is a browser limitation. Access Frigate securely to use notifications.",
|
||||
"descPwa": "On iOS, web push notifications are only available when Frigate is installed to your Home Screen. Open the <strong>Share</strong> menu, choose <strong>Add to Home Screen</strong>, then open Frigate from the new icon to register this device for notifications."
|
||||
"desc": "Web push notifications require a secure context (https://…). This is a browser limitation. Access Frigate securely to use notifications.",
|
||||
"descPwa": "On iOS, web push notifications are only available when Frigate is installed to your Home Screen. Open the Share menu, choose Add to Home Screen, then open Frigate from the new icon to register this device for notifications."
|
||||
},
|
||||
"globalSettings": {
|
||||
"title": "Global Settings",
|
||||
@@ -1316,7 +1315,6 @@
|
||||
"triggers": {
|
||||
"documentTitle": "Triggers",
|
||||
"semanticSearch": {
|
||||
"title": "Semantic Search is disabled",
|
||||
"desc": "Semantic Search must be enabled to use Triggers."
|
||||
},
|
||||
"management": {
|
||||
|
||||
@@ -45,7 +45,6 @@ const audioTranscription: SectionConfigOverrides = {
|
||||
fieldMessages: [
|
||||
{
|
||||
key: "genai-provider-ignores-local-settings",
|
||||
health: (ctx) => ctx.fullConfig.audio_transcription?.enabled === true,
|
||||
field: "device",
|
||||
messageKey: "configMessages.audioTranscription.genaiProviderSelected",
|
||||
severity: "info",
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
} from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { LuCheck, LuExternalLink, LuX } from "react-icons/lu";
|
||||
import { CiCircleAlert } from "react-icons/ci";
|
||||
import { ConfigFieldMessage } from "../ConfigFieldMessage";
|
||||
import { Link } from "react-router-dom";
|
||||
import { toast } from "sonner";
|
||||
import useSWR from "swr";
|
||||
@@ -44,8 +44,7 @@ import {
|
||||
import { formatUnixTimestampToDateTime } from "@/utils/dateUtil";
|
||||
import { use24HourTime } from "@/hooks/use-date-utils";
|
||||
import FilterSwitch from "@/components/filter/FilterSwitch";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useDateLocale } from "@/hooks/use-date-locale";
|
||||
import { useDocDomain } from "@/hooks/use-doc-domain";
|
||||
import { isPWA } from "@/utils/isPWA";
|
||||
@@ -467,37 +466,19 @@ export default function NotificationsSettingsExtras({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Alert variant="destructive">
|
||||
<CiCircleAlert className="size-5" />
|
||||
<AlertTitle>
|
||||
{t("notification.notificationUnavailable.title")}
|
||||
</AlertTitle>
|
||||
<AlertDescription>
|
||||
<Trans
|
||||
ns="views/settings"
|
||||
i18nKey={
|
||||
requiresPwaInstall
|
||||
? "notification.notificationUnavailable.descPwa"
|
||||
: "notification.notificationUnavailable.desc"
|
||||
}
|
||||
/>
|
||||
<div className="mt-3 flex items-center">
|
||||
<Link
|
||||
to={getLocaleDocUrl(
|
||||
requiresPwaInstall
|
||||
? "configuration/notifications"
|
||||
: "configuration/authentication",
|
||||
)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline"
|
||||
>
|
||||
{t("readTheDocumentation", { ns: "common" })}{" "}
|
||||
<LuExternalLink className="ml-2 inline-flex size-3" />
|
||||
</Link>
|
||||
</div>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
<ConfigFieldMessage
|
||||
messageKey={
|
||||
requiresPwaInstall
|
||||
? "notification.notificationUnavailable.descPwa"
|
||||
: "notification.notificationUnavailable.desc"
|
||||
}
|
||||
severity="warning"
|
||||
docLink={
|
||||
requiresPwaInstall
|
||||
? "configuration/notifications"
|
||||
: "configuration/authentication"
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</SettingsGroupCard>
|
||||
</div>
|
||||
|
||||
@@ -287,6 +287,7 @@ function ConfigEditor() {
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
disabled={!hasChanges}
|
||||
className="flex items-center gap-2"
|
||||
aria-label={t("saveAndRestart")}
|
||||
onClick={handleSaveAndRestart}
|
||||
@@ -299,6 +300,7 @@ function ConfigEditor() {
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
disabled={!hasChanges}
|
||||
className="flex items-center gap-2"
|
||||
aria-label={t("saveOnly")}
|
||||
onClick={() => onHandleSaveConfig("saveonly")}
|
||||
|
||||
@@ -451,6 +451,9 @@ export interface FrigateConfig {
|
||||
audio_transcription: {
|
||||
enabled: boolean;
|
||||
device: "GPU" | "CPU";
|
||||
model: "whisper" | string;
|
||||
model_size: "small" | "large" | null;
|
||||
language: string | null;
|
||||
};
|
||||
|
||||
auth: {
|
||||
|
||||
@@ -581,7 +581,7 @@ function enrichmentSpecs(config: FrigateConfig): EnrichmentSpec[] {
|
||||
enabled: config.audio_transcription.enabled || anyCameraTranscribes,
|
||||
requested: config.audio_transcription.device ?? "CPU",
|
||||
explicit: true,
|
||||
remote: false,
|
||||
remote: config.audio_transcription.model !== "whisper",
|
||||
nvidiaOnly: true,
|
||||
presenceOnly: true,
|
||||
},
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import useSWR from "swr";
|
||||
import axios from "axios";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import Heading from "@/components/ui/heading";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import {
|
||||
@@ -42,7 +41,7 @@ import { use24HourTime } from "@/hooks/use-date-utils";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useTriggers } from "@/api/ws";
|
||||
import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name";
|
||||
import { CiCircleAlert } from "react-icons/ci";
|
||||
import { ConfigFieldMessage } from "@/components/config-form/ConfigFieldMessage";
|
||||
import { useDocDomain } from "@/hooks/use-doc-domain";
|
||||
import { isDesktop } from "react-device-detect";
|
||||
|
||||
@@ -459,26 +458,11 @@ export default function TriggerView({
|
||||
camera: cameraName,
|
||||
})}
|
||||
</p>
|
||||
<Alert variant="destructive">
|
||||
<CiCircleAlert className="size-5" />
|
||||
<AlertTitle>{t("triggers.semanticSearch.title")}</AlertTitle>
|
||||
<AlertDescription>
|
||||
<Trans ns="views/settings">
|
||||
triggers.semanticSearch.desc
|
||||
</Trans>
|
||||
<div className="mt-3 flex items-center">
|
||||
<Link
|
||||
to={getLocaleDocUrl("configuration/semantic_search")}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline"
|
||||
>
|
||||
{t("readTheDocumentation", { ns: "common" })}{" "}
|
||||
<LuExternalLink className="ml-2 inline-flex size-3" />
|
||||
</Link>
|
||||
</div>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
<ConfigFieldMessage
|
||||
messageKey="triggers.semanticSearch.desc"
|
||||
severity="warning"
|
||||
docLink="configuration/semantic_search"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user