From acf32e1a1e8c006af01c531a40ab61e3095ae402 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Tue, 19 Aug 2025 06:49:55 -0600 Subject: [PATCH] Various Fixes (#19615) * Don't write to write None response to file * fix genai config migration * Fix JP6 build * Include base image ARG --- .github/workflows/ci.yml | 30 ------------------------------ docker/main/Dockerfile | 1 + docker/main/install_deps.sh | 10 +++++++--- frigate/genai/__init__.py | 2 +- frigate/util/config.py | 2 +- 5 files changed, 10 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44f472beb..032ca1c5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,36 +77,6 @@ jobs: rpi.tags=${{ steps.setup.outputs.image-name }}-rpi *.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64 *.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64,mode=max - jetson_jp5_build: - if: false - runs-on: ubuntu-22.04 - name: Jetson Jetpack 5 - steps: - - name: Check out code - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Set up QEMU and Buildx - id: setup - uses: ./.github/actions/setup - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push TensorRT (Jetson, Jetpack 5) - env: - ARCH: arm64 - BASE_IMAGE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime - SLIM_BASE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime - TRT_BASE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime - uses: docker/bake-action@v6 - with: - source: . - push: true - targets: tensorrt - files: docker/tensorrt/trt.hcl - set: | - tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp5 - *.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp5 - *.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp5,mode=max jetson_jp6_build: runs-on: ubuntu-22.04-arm name: Jetson Jetpack 6 diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index ca93f4a3b..d555d99b9 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -212,6 +212,7 @@ COPY docker/main/rootfs/ / # Frigate deps (ffmpeg, python, nginx, go2rtc, s6-overlay, etc) FROM slim-base AS deps ARG TARGETARCH +ARG BASE_IMAGE ARG DEBIAN_FRONTEND # http://stackoverflow.com/questions/48162574/ddg#49462622 diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index bd9f363e9..59e348985 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -34,9 +34,13 @@ rm /tmp/libedgetpu1-max.deb # install mesa-teflon-delegate from bookworm-backports # Only available for arm64 at the moment if [[ "${TARGETARCH}" == "arm64" ]]; then - echo "deb http://deb.debian.org/debian bookworm-backports main" | tee /etc/apt/sources.list.d/bookworm-backports.list - apt-get -qq update - apt-get -qq install --no-install-recommends --no-install-suggests -y mesa-teflon-delegate/bookworm-backports + if [[ "${BASE_IMAGE}" == *"nvcr.io/nvidia/tensorrt"* ]]; then + echo "Info: Skipping apt-get commands because BASE_IMAGE includes 'nvcr.io/nvidia/tensorrt' for arm64." + else + echo "deb http://deb.debian.org/debian bookworm-backports main" | tee /etc/apt/sources.list.d/bookworm-backbacks.list + apt-get -qq update + apt-get -qq install --no-install-recommends --no-install-suggests -y mesa-teflon-delegate/bookworm-backports + fi fi # ffmpeg -> amd64 diff --git a/frigate/genai/__init__.py b/frigate/genai/__init__.py index 4a9789097..46c3bd8a0 100644 --- a/frigate/genai/__init__.py +++ b/frigate/genai/__init__.py @@ -115,7 +115,7 @@ Sequence details: response = self._send(context_prompt, thumbnails) - if debug_save: + if debug_save and response: with open( os.path.join( CLIPS_DIR, "genai-requests", review_data["id"], "response.txt" diff --git a/frigate/util/config.py b/frigate/util/config.py index 5b4671b75..5ae17d975 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -380,7 +380,7 @@ def migrate_017_0(config: dict[str, dict[str, Any]]) -> dict[str, dict[str, Any] new_object_config["genai"] = {} for key in global_genai.keys(): - if key not in ["provider", "base_url", "api_key"]: + if key not in ["enabled", "model", "provider", "base_url", "api_key"]: new_object_config["genai"][key] = global_genai[key] else: new_genai_config[key] = global_genai[key]