dictation-service/scripts/toggle-conversation.sh
Kade Heyborne 73a15d03cd
Fix dictation service: state detection, async processing, and performance optimizations
- Fix state detection priority: dictation now takes precedence over conversation
- Fix critical bug: event loop was created but never started, preventing async coroutines from executing
- Optimize audio processing: reorder AcceptWaveform/PartialResult checks
- Switch to faster Vosk model: vosk-model-en-us-0.22-lgraph for 2-3x speed improvement
- Reduce block size from 8000 to 4000 for lower latency
- Add filtering to remove spurious 'the', 'a', 'an' words from start/end of transcriptions
- Update toggle-dictation.sh to properly clean up conversation lock file
- Improve batch audio processing for better responsiveness
2025-12-04 11:49:07 -07:00

30 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Toggle Conversation Service Control Script
# This script creates/removes the conversation lock file to control AI conversation state
# Set environment variables for GUI access
export DISPLAY=${DISPLAY:-:1}
export XAUTHORITY=${XAUTHORITY:-/run/user/1000/gdm/Xauthority}
DICTATION_DIR="/mnt/storage/Development/dictation-service"
DICTATION_LOCK_FILE="$DICTATION_DIR/listening.lock"
CONVERSATION_LOCK_FILE="$DICTATION_DIR/conversation.lock"
if [ -f "$CONVERSATION_LOCK_FILE" ]; then
# Stop conversation
rm "$CONVERSATION_LOCK_FILE"
notify-send "🤖 Conversation Stopped" "AI conversation ended"
echo "$(date): AI conversation stopped" >> /tmp/conversation.log
else
# Stop dictation if running, then start conversation
if [ -f "$DICTATION_LOCK_FILE" ]; then
rm "$DICTATION_LOCK_FILE"
echo "$(date): Dictation stopped (conversation mode)" >> /tmp/dictation.log
fi
# Start conversation
touch "$CONVERSATION_LOCK_FILE"
notify-send "🤖 Conversation Started" "AI conversation mode enabled - Start speaking"
echo "$(date): AI conversation started" >> /tmp/conversation.log
fi