feat: rewrite voice-assistant in Go

Replace Python voice assistant with Go for smaller container images.
Uses handler-base Go module for NATS, health, telemetry, and all service clients.

- Full pipeline: STT → embed → Milvus → rerank → LLM → TTS
- Base64 audio encode/decode
- Dockerfile: multi-stage golang:1.25-alpine → scratch
- CI: Gitea Actions with lint/test/release/docker/notify
This commit is contained in:
2026-02-19 18:00:58 -05:00
parent e028d078d8
commit 2e66cac1e9
12 changed files with 413 additions and 3258 deletions

49
main_test.go Normal file
View File

@@ -0,0 +1,49 @@
package main
import (
"testing"
)
func TestStrVal(t *testing.T) {
m := map[string]any{"key": "value"}
if got := strVal(m, "key", ""); got != "value" {
t.Errorf("strVal(key) = %q", got)
}
if got := strVal(m, "missing", "def"); got != "def" {
t.Errorf("strVal(missing) = %q", got)
}
}
func TestBoolVal(t *testing.T) {
m := map[string]any{"flag": true}
if got := boolVal(m, "flag", false); !got {
t.Error("expected true")
}
if got := boolVal(m, "missing", false); got {
t.Error("expected false fallback")
}
}
func TestGetEnvHelpers(t *testing.T) {
t.Setenv("VA_TEST", "hello")
if got := getEnv("VA_TEST", "x"); got != "hello" {
t.Errorf("getEnv = %q", got)
}
t.Setenv("VA_PORT", "9090")
if got := getEnvInt("VA_PORT", 0); got != 9090 {
t.Errorf("getEnvInt = %d", got)
}
t.Setenv("VA_FLAG", "true")
if got := getEnvBool("VA_FLAG", false); !got {
t.Error("getEnvBool should be true")
}
}
func TestTruncate(t *testing.T) {
if got := truncate("hello world", 5); got != "hello..." {
t.Errorf("truncate = %q", got)
}
if got := truncate("hi", 10); got != "hi" {
t.Errorf("truncate short = %q", got)
}
}