feat(voice): per-account choice between Whisper and the browser; STT_ALLOW_BROWSER
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m40s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-11-01 15:19:20 +01:00
1 parent 55112b940c
commit a927a94a95
21 files changed
+288 -15

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package storage
import "errors"
// Everyone picks how their voice input works: the server's Whisper ("", the default) or the browser's
// recognition ("browser"). The server only offers the choice when it has a Whisper server and the
// browser is allowed (STT_ALLOW_BROWSER); the app applies it (lib/voice.ts).
var ErrInvalidVoiceInput = errors.New("Ungültige Spracheingabe (erlaubt: Whisper-Server oder Browser)")
func (s *Store) migrateVoiceInput() error {
return s.addColumnIfMissing("users", "voice_input", "TEXT NOT NULL DEFAULT ''")
}
// VoiceInput returns the user's choice: "" or "browser".
func (s *Store) VoiceInput(userID string) string {
var v string
_ = s.db.QueryRow(`SELECT voice_input FROM users WHERE id = ?`, userID).Scan(&v)
return v
}
func (s *Store) SetVoiceInput(userID, v string) error {
if v != "" && v != "browser" {
return ErrInvalidVoiceInput
}
_, err := s.db.Exec(`UPDATE users SET voice_input = ? WHERE id = ?`, v, userID)
return err
}