Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .agents/scripts/speech-to-speech-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ cmd_start() {
case "$gpu" in
mps) mode="local-mac" ;;
cuda) mode="cuda" ;;
*) mode="cuda" ;;
cpu)
mode="server"
print_warning "CPU-only host detected; defaulting to --server mode"
;;
*) mode="server" ;;
esac
print_info "Auto-detected mode: $mode"
fi
Expand Down Expand Up @@ -314,7 +318,7 @@ cmd_docker_start() {
fi

print_info "Starting with Docker..."
(cd "$S2S_DIR" && docker compose up -d) || exit
(cd "$S2S_DIR" && docker compose up -d) || return 1
print_success "Docker containers started"
print_info "Ports: ${DEFAULT_RECV_PORT} (recv), ${DEFAULT_SEND_PORT} (send)"
return 0
Expand Down Expand Up @@ -388,10 +392,10 @@ cmd_stop() {
fi

# Stop Docker if running
if [[ -f "${S2S_DIR}/docker-compose.yml" ]]; then
if command -v docker &>/dev/null && [[ -f "${S2S_DIR}/docker-compose.yml" ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding command -v docker &>/dev/null before attempting Docker operations significantly improves the script's robustness. This prevents errors if Docker is not installed on the system, providing a more graceful failure or alternative path. This is a good practice for dependency checks.

Suggested change
if command -v docker &>/dev/null && [[ -f "${S2S_DIR}/docker-compose.yml" ]]; then
if command -v docker &>/dev/null &>/dev/null && [[ -f "${S2S_DIR}/docker-compose.yml" ]]; then

if docker compose -f "${S2S_DIR}/docker-compose.yml" ps --quiet 2>/dev/null | grep -q .; then
print_info "Stopping Docker containers..."
(cd "$S2S_DIR" && docker compose down) || exit
(cd "$S2S_DIR" && docker compose down) || return 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the previous comment, changing || exit to || return 1 here ensures consistent and proper error handling within the function, preventing the entire script from exiting prematurely if the docker compose down command fails. This is crucial for maintaining script control flow.

Suggested change
(cd "$S2S_DIR" && docker compose down) || return 1
(cd "$S2S_DIR" && docker compose down) || return 1

print_success "Docker containers stopped"
fi
fi
Expand Down Expand Up @@ -543,7 +547,7 @@ cmd_help() {
echo " $0 start --local-mac"
echo " $0 start --cuda --language auto --background"
echo " $0 start --server"
echo " $0 client --host 192.168.1.100"
echo " $0 client --host <server-ip>"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Replacing the hardcoded IP address with a generic placeholder like <server-ip> in the help message improves the reusability and clarity of the example. This makes the documentation more adaptable and less confusing for users in different network environments.

Suggested change
echo " $0 client --host <server-ip>"
echo " $0 client --host <server-ip>"

echo " $0 start \$($0 config low-latency)"
echo " $0 stop"
echo ""
Expand Down
4 changes: 3 additions & 1 deletion .agents/tools/voice/speech-to-speech.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ Model selection: `--stt_model_name <model>` (any Whisper checkpoint on HF Hub)

Model selection: `--lm_model_name <model>` or `--mlx_lm_model_name <model>`

API keys: Store `OPENAI_API_KEY` via `aidevops secret set OPENAI_API_KEY` (gopass encrypted) or in `~/.config/aidevops/credentials.sh` (600 permissions). See `tools/credentials/api-key-setup.md`.

### TTS (Text to Speech)

| Implementation | Flag | Best For |
Expand Down Expand Up @@ -177,7 +179,7 @@ python -m unidic download
### Requirements

- Python 3.10+
- PyTorch 2.4+ (CUDA) or 2.10+ (macOS)
- PyTorch 2.4+ (CUDA and macOS)
- `uv` package manager (recommended)
- CUDA 12.1+ (for GPU) or Apple Silicon (for MPS)
- `sounddevice` for local audio I/O
Expand Down
Loading