update default config template with providers and llm sections

This commit is contained in:
leonardotrapani
2026-01-31 20:59:45 +01:00
parent 6d87a0b00f
commit 692339f430
3 changed files with 106 additions and 38 deletions
+86 -37
View File
@@ -623,8 +623,37 @@ func SaveDefaultConfig() error {
configContent := `# Hyprvoice Configuration
# This file is automatically generated with defaults.
# Edit values as needed - changes are applied immediately without daemon restart.
#
# MIGRATION NOTE: If upgrading from an older version, your transcription.api_key
# will be automatically migrated to the new [providers.X] format. Run 'hyprvoice configure'
# to update your config file structure.
# Keywords help both transcription and LLM understand domain-specific terms
# Add names, technical terms, or brand names that might be misheard
keywords = []
# ─────────────────────────────────────────────────────────────────────────────
# Provider API Keys
# Configure API keys for each provider you want to use.
# Keys can also be set via environment variables: OPENAI_API_KEY, GROQ_API_KEY, etc.
# ─────────────────────────────────────────────────────────────────────────────
[providers.openai]
api_key = "" # OpenAI API key (or set OPENAI_API_KEY env var)
[providers.groq]
api_key = "" # Groq API key (or set GROQ_API_KEY env var)
# Uncomment to configure additional providers:
# [providers.mistral]
# api_key = "" # Mistral API key (or set MISTRAL_API_KEY env var)
# [providers.elevenlabs]
# api_key = "" # ElevenLabs API key (or set ELEVENLABS_API_KEY env var)
# ─────────────────────────────────────────────────────────────────────────────
# Audio Recording
# ─────────────────────────────────────────────────────────────────────────────
# Audio Recording Configuration
[recording]
sample_rate = 16000 # Audio sample rate in Hz (16000 recommended for speech)
channels = 1 # Number of audio channels (1 = mono, 2 = stereo)
@@ -634,24 +663,54 @@ func SaveDefaultConfig() error {
channel_buffer_size = 30 # Audio frame buffer size (frames to buffer)
timeout = "5m" # Maximum recording duration (e.g., "30s", "2m", "5m")
# Speech Transcription Configuration
# ─────────────────────────────────────────────────────────────────────────────
# Speech Transcription
# Converts audio to text using speech-to-text APIs
# ─────────────────────────────────────────────────────────────────────────────
[transcription]
provider = "openai" # Transcription service: "openai", "groq-transcription", "groq-translation", "mistral-transcription", or "elevenlabs"
api_key = "" # API key (or set OPENAI_API_KEY/GROQ_API_KEY/MISTRAL_API_KEY/ELEVENLABS_API_KEY environment variable)
language = "" # Language code (empty for auto-detect, "en", "it", "es", "fr", etc.)
provider = "openai" # "openai", "groq-transcription", "groq-translation", "mistral-transcription", "elevenlabs"
language = "" # Language code (empty = auto-detect, "en", "it", "es", "fr", etc.)
model = "whisper-1" # Model: OpenAI="whisper-1", Groq="whisper-large-v3", Mistral="voxtral-mini-latest", ElevenLabs="scribe_v1"
# Text Injection Configuration
# ─────────────────────────────────────────────────────────────────────────────
# LLM Post-Processing (Recommended)
# Cleans up transcribed text: removes stutters, adds punctuation, fixes grammar
# ─────────────────────────────────────────────────────────────────────────────
[llm]
enabled = true # Enable LLM post-processing (highly recommended)
provider = "openai" # "openai" or "groq" (must have API key configured above)
model = "gpt-4o-mini" # OpenAI: "gpt-4o-mini", Groq: "llama-3.3-70b-versatile"
[llm.post_processing]
remove_stutters = true # Remove "um", "uh", repeated words
add_punctuation = true # Add proper punctuation
fix_grammar = true # Fix grammatical errors
remove_filler_words = true # Remove "like", "you know", "basically"
[llm.custom_prompt]
enabled = false # Enable custom instructions for LLM
prompt = "" # Additional instructions (e.g., "Format as bullet points")
# ─────────────────────────────────────────────────────────────────────────────
# Text Injection
# How transcribed text is inserted into applications
# ─────────────────────────────────────────────────────────────────────────────
[injection]
backends = ["ydotool", "wtype", "clipboard"] # Ordered fallback chain (tries each until one succeeds)
ydotool_timeout = "5s" # Timeout for ydotool commands
wtype_timeout = "5s" # Timeout for wtype commands
clipboard_timeout = "3s" # Timeout for clipboard operations
# Desktop Notification Configuration
# ─────────────────────────────────────────────────────────────────────────────
# Desktop Notifications
# ─────────────────────────────────────────────────────────────────────────────
[notifications]
enabled = true # Enable desktop notifications
type = "desktop" # Notification type ("desktop", "log", "none")
type = "desktop" # "desktop", "log", or "none"
# Custom notification messages (optional - defaults shown below)
# Uncomment and modify to customize notification text
@@ -676,39 +735,29 @@ func SaveDefaultConfig() error {
# Emoji-only example (for minimal pill-style notifications):
# [notifications.messages.recording_started]
# title = ""
# body = "🎤"
# [notifications.messages.transcribing]
# title = ""
# body = "⏳"
# [notifications.messages.config_reloaded]
# title = ""
# body = "🔧"
# body = "..."
# Backend explanations:
# - "ydotool": Uses ydotool (requires ydotoold daemon running for ydotool v1.0.0+). Most compatible with Chromium/Electron apps.
# - "wtype": Uses wtype for Wayland. May have issues with some Chromium-based apps.
# - "clipboard": Copies text to clipboard only (most reliable, but requires manual paste).
# ─────────────────────────────────────────────────────────────────────────────
# Reference: Provider Details
# ─────────────────────────────────────────────────────────────────────────────
#
# The backends are tried in order. First successful one wins.
# Example configurations:
# backends = ["clipboard"] # Clipboard only (safest)
# backends = ["wtype", "clipboard"] # wtype with clipboard fallback
# backends = ["ydotool", "wtype", "clipboard"] # Full fallback chain (default)
# Transcription providers:
# - "openai": OpenAI Whisper API (cloud-based, excellent accuracy)
# - "groq-transcription": Groq Whisper API (very fast, models: whisper-large-v3, whisper-large-v3-turbo)
# - "groq-translation": Groq translation to English (always outputs English text, model: whisper-large-v3)
# - "mistral-transcription": Mistral Voxtral API (excellent for European languages, model: voxtral-mini-latest)
# - "elevenlabs": ElevenLabs Scribe API (99 languages, models: scribe_v1, scribe_v2)
#
# Provider explanations:
# - "openai": OpenAI Whisper API (cloud-based, requires OPENAI_API_KEY)
# - "groq-transcription": Groq Whisper API for transcription (fast, requires GROQ_API_KEY)
# Models: whisper-large-v3 or whisper-large-v3-turbo
# - "groq-translation": Groq Whisper API for translation to English (always outputs English text)
# Models: whisper-large-v3 only (turbo not supported for translation)
# - "mistral-transcription": Mistral Voxtral API (excellent for European languages, requires MISTRAL_API_KEY)
# Models: voxtral-mini-latest or voxtral-mini-2507
# - "elevenlabs": ElevenLabs Scribe API (excellent accuracy, 99 languages, requires ELEVENLABS_API_KEY)
# Models: scribe_v1 (99 languages, best accuracy) or scribe_v2 (90 languages, real-time)
# LLM providers (for post-processing):
# - "openai": GPT models (gpt-4o-mini recommended for cost/quality balance)
# - "groq": Fast inference (llama-3.3-70b-versatile recommended)
#
# Language codes: Use empty string ("") for automatic detection, or specific codes like:
# "en" (English), "it" (Italian), "es" (Spanish), "fr" (French), "de" (German), etc.
# For groq-translation, the language field hints at the source audio language for better accuracy.
# Injection backends:
# - "ydotool": Uses ydotool (requires ydotoold daemon). Best for Chromium/Electron apps.
# - "wtype": Uses wtype for Wayland. May have issues with some Chromium apps.
# - "clipboard": Copies to clipboard only (most reliable, requires manual paste).
#
# Language codes: "" (auto-detect), "en", "it", "es", "fr", "de", "pt", etc.
`
if _, err := file.WriteString(configContent); err != nil {
+19
View File
@@ -170,3 +170,22 @@ Key decisions:
- Config saved only if user confirms in TUI summary
- Validation runs before save, errors displayed cleanly
- Next steps shown after successful save
## Task 10: Update default config template - COMPLETE
Updated SaveDefaultConfig() in internal/config/config.go:
- Added `keywords = []` at top level (before any TOML tables)
- Added `[providers.openai]` and `[providers.groq]` sections with api_key
- Added `[llm]` section with enabled = true, provider = "openai", model = "gpt-4o-mini"
- Added `[llm.post_processing]` with all 4 options = true
- Added `[llm.custom_prompt]` with enabled = false
- Added MIGRATION NOTE in header about old format upgrade
- Reorganized with clear section headers (box-drawing chars)
- Removed `transcription.api_key` from default (uses providers map now)
- Simplified and consolidated reference docs at bottom
Key decisions:
- LLM enabled by default with OpenAI gpt-4o-mini (best cost/quality)
- Providers section at top for visibility
- Keywords before any table definitions (TOML syntax requirement)
- Concise comments, full reference at bottom
+1 -1
View File
@@ -199,7 +199,7 @@
"Comments clear",
"Typecheck passes"
],
"passes": false
"passes": true
},
{
"title": "Add LLM processing notification",