Add private realtime Talk for OpenClaw

This commit is contained in:
Mikei386
2026-09-03 22:52:15 +02:00
parent 42ec28c9f6
commit 0a68df22eb
10 changed files with 829 additions and 11 deletions
+3 -2
View File
@@ -11,7 +11,7 @@ RUN apt-get update \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_NATIVE=ON \
-DWHISPER_BUILD_TESTS=OFF \
-DWHISPER_BUILD_SERVER=OFF \
-DWHISPER_BUILD_SERVER=ON \
&& cmake --build /opt/whisper.cpp/build --config Release -j"$(nproc)" \
&& apt-get purge -y --auto-remove build-essential cmake git \
&& rm -rf /var/lib/apt/lists/* /root/.cache \
@@ -25,7 +25,8 @@ RUN chmod 0755 /usr/local/bin/mike-ai-whisper-entrypoint
ENV WHISPER_HOST=0.0.0.0 \
WHISPER_PORT=8084 \
WHISPER_CLI=/opt/whisper.cpp/build/bin/whisper-cli \
WHISPER_MODEL=/models/ggml-large-v3-turbo.bin \
WHISPER_MODEL=/models/ggml-small.bin \
WHISPER_SERVER_URL=http://127.0.0.1:8085 \
WHISPER_THREADS=8 \
WHISPER_LANGUAGE=de \
FFMPEG_BIN=/usr/bin/ffmpeg
+43 -3
View File
@@ -1,8 +1,8 @@
#!/bin/sh
set -eu
model=${WHISPER_MODEL:-/models/ggml-large-v3-turbo.bin}
model_url=${WHISPER_MODEL_URL:-https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo.bin}
model=${WHISPER_MODEL:-/models/ggml-small.bin}
model_url=${WHISPER_MODEL_URL:-https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin}
model_dir=$(dirname "$model")
mkdir -p "$model_dir"
@@ -22,4 +22,44 @@ if [ ! -s "$model" ]; then
gosu whisper mv "$partial" "$model"
fi
exec gosu whisper python /app/stt_worker.py
server_port=${WHISPER_SERVER_PORT:-8085}
server_log=/tmp/whisper-server.log
gosu whisper /opt/whisper.cpp/build/bin/whisper-server \
--model "$model" \
--threads "${WHISPER_THREADS:-8}" \
--language "${WHISPER_LANGUAGE:-de}" \
--host 127.0.0.1 \
--port "$server_port" \
--inference-path /inference \
--no-gpu >"$server_log" 2>&1 &
server_pid=$!
worker_pid=""
cleanup() {
[ -z "$worker_pid" ] || kill "$worker_pid" 2>/dev/null || true
kill "$server_pid" 2>/dev/null || true
}
trap cleanup EXIT INT TERM
# Der Modell-Load dauert beim Containerstart kurz. Der HTTP-Wrapper wird erst
# freigegeben, wenn whisper-server tatsächlich Antworten annimmt.
i=0
until curl --fail --silent "http://127.0.0.1:${server_port}/" >/dev/null; do
i=$((i + 1))
if ! kill -0 "$server_pid" 2>/dev/null; then
cat "$server_log"
exit 1
fi
if [ "$i" -ge 180 ]; then
echo "whisper-server did not become ready" >&2
cat "$server_log"
exit 1
fi
sleep 1
done
export WHISPER_SERVER_URL="http://127.0.0.1:${server_port}"
gosu whisper python /app/stt_worker.py &
worker_pid=$!
wait "$worker_pid"