update default config template with providers and llm sections
This commit is contained in:
+86
-37
@@ -623,8 +623,37 @@ func SaveDefaultConfig() error {
|
|||||||
configContent := `# Hyprvoice Configuration
|
configContent := `# Hyprvoice Configuration
|
||||||
# This file is automatically generated with defaults.
|
# This file is automatically generated with defaults.
|
||||||
# Edit values as needed - changes are applied immediately without daemon restart.
|
# 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]
|
[recording]
|
||||||
sample_rate = 16000 # Audio sample rate in Hz (16000 recommended for speech)
|
sample_rate = 16000 # Audio sample rate in Hz (16000 recommended for speech)
|
||||||
channels = 1 # Number of audio channels (1 = mono, 2 = stereo)
|
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)
|
channel_buffer_size = 30 # Audio frame buffer size (frames to buffer)
|
||||||
timeout = "5m" # Maximum recording duration (e.g., "30s", "2m", "5m")
|
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]
|
[transcription]
|
||||||
provider = "openai" # Transcription service: "openai", "groq-transcription", "groq-translation", "mistral-transcription", or "elevenlabs"
|
provider = "openai" # "openai", "groq-transcription", "groq-translation", "mistral-transcription", "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 = auto-detect, "en", "it", "es", "fr", etc.)
|
||||||
language = "" # Language code (empty for 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"
|
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]
|
[injection]
|
||||||
backends = ["ydotool", "wtype", "clipboard"] # Ordered fallback chain (tries each until one succeeds)
|
backends = ["ydotool", "wtype", "clipboard"] # Ordered fallback chain (tries each until one succeeds)
|
||||||
ydotool_timeout = "5s" # Timeout for ydotool commands
|
ydotool_timeout = "5s" # Timeout for ydotool commands
|
||||||
wtype_timeout = "5s" # Timeout for wtype commands
|
wtype_timeout = "5s" # Timeout for wtype commands
|
||||||
clipboard_timeout = "3s" # Timeout for clipboard operations
|
clipboard_timeout = "3s" # Timeout for clipboard operations
|
||||||
|
|
||||||
# Desktop Notification Configuration
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Desktop Notifications
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
[notifications]
|
[notifications]
|
||||||
enabled = true # Enable desktop 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)
|
# Custom notification messages (optional - defaults shown below)
|
||||||
# Uncomment and modify to customize notification text
|
# Uncomment and modify to customize notification text
|
||||||
@@ -676,39 +735,29 @@ func SaveDefaultConfig() error {
|
|||||||
# Emoji-only example (for minimal pill-style notifications):
|
# Emoji-only example (for minimal pill-style notifications):
|
||||||
# [notifications.messages.recording_started]
|
# [notifications.messages.recording_started]
|
||||||
# title = ""
|
# title = ""
|
||||||
# body = "🎤"
|
# body = "..."
|
||||||
# [notifications.messages.transcribing]
|
|
||||||
# title = ""
|
|
||||||
# body = "⏳"
|
|
||||||
# [notifications.messages.config_reloaded]
|
|
||||||
# title = ""
|
|
||||||
# body = "🔧"
|
|
||||||
|
|
||||||
# Backend explanations:
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
# - "ydotool": Uses ydotool (requires ydotoold daemon running for ydotool v1.0.0+). Most compatible with Chromium/Electron apps.
|
# Reference: Provider Details
|
||||||
# - "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).
|
|
||||||
#
|
#
|
||||||
# The backends are tried in order. First successful one wins.
|
# Transcription providers:
|
||||||
# Example configurations:
|
# - "openai": OpenAI Whisper API (cloud-based, excellent accuracy)
|
||||||
# backends = ["clipboard"] # Clipboard only (safest)
|
# - "groq-transcription": Groq Whisper API (very fast, models: whisper-large-v3, whisper-large-v3-turbo)
|
||||||
# backends = ["wtype", "clipboard"] # wtype with clipboard fallback
|
# - "groq-translation": Groq translation to English (always outputs English text, model: whisper-large-v3)
|
||||||
# backends = ["ydotool", "wtype", "clipboard"] # Full fallback chain (default)
|
# - "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:
|
# LLM providers (for post-processing):
|
||||||
# - "openai": OpenAI Whisper API (cloud-based, requires OPENAI_API_KEY)
|
# - "openai": GPT models (gpt-4o-mini recommended for cost/quality balance)
|
||||||
# - "groq-transcription": Groq Whisper API for transcription (fast, requires GROQ_API_KEY)
|
# - "groq": Fast inference (llama-3.3-70b-versatile recommended)
|
||||||
# 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)
|
|
||||||
#
|
#
|
||||||
# Language codes: Use empty string ("") for automatic detection, or specific codes like:
|
# Injection backends:
|
||||||
# "en" (English), "it" (Italian), "es" (Spanish), "fr" (French), "de" (German), etc.
|
# - "ydotool": Uses ydotool (requires ydotoold daemon). Best for Chromium/Electron apps.
|
||||||
# For groq-translation, the language field hints at the source audio language for better accuracy.
|
# - "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 {
|
if _, err := file.WriteString(configContent); err != nil {
|
||||||
|
|||||||
@@ -170,3 +170,22 @@ Key decisions:
|
|||||||
- Config saved only if user confirms in TUI summary
|
- Config saved only if user confirms in TUI summary
|
||||||
- Validation runs before save, errors displayed cleanly
|
- Validation runs before save, errors displayed cleanly
|
||||||
- Next steps shown after successful save
|
- 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
@@ -199,7 +199,7 @@
|
|||||||
"Comments clear",
|
"Comments clear",
|
||||||
"Typecheck passes"
|
"Typecheck passes"
|
||||||
],
|
],
|
||||||
"passes": false
|
"passes": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Add LLM processing notification",
|
"title": "Add LLM processing notification",
|
||||||
|
|||||||
Reference in New Issue
Block a user