SIGN IN SIGN UP

feat: replace whisper.cpp with Grok STT for Telegram audio (#265) (#266)

* feat: replace whisper.cpp with Grok STT for Telegram audio (#265)

Swap the local whisper.cpp pipeline for xAI's POST /v1/stt endpoint.
Removes whisper-cli, ffmpeg, and ggml model download requirements; the
API auto-detects Telegram's OGG/Opus container and reuses the existing
GROK_API_KEY / GROK_BASE_URL resolution.

* fix: sanitize Telegram audio filename to prevent path traversal

Telegram senders control message.audio.file_name, so a crafted value
like "../../etc/something" would escape the mkdtemp directory when
joined via path.join. Strip POSIX/Windows separators and null bytes
from the basename, fall back to input<ext> for empty/dot-only names,
and add a defense-in-depth guard that refuses writes outside tempDir.
I
Ismail Pelaseyed committed
28565fbb172c7f1d78f9b3bbdb36e8574fca1b13
Parent: 4cd6798
Committed by GitHub <noreply@github.com> on 4/17/2026, 1:19:42 PM