rony-chat-bot/internal/i18n/i18n_test.go
Victor Hugo Vargas f33708534a feat: bootstrap rony-chat-bot Go module
Initial implementation of the bot:

- cmd/chat-bot: CLI entrypoint (serve, reindex, ask, version)
- internal/agent: LLM provider client + agent runner with RAG injection
- internal/config: YAML config loader (providers, RAG, persona, server)
- internal/i18n: response-language detection (EN/ES)
- internal/persona: persona system prompt assembly from YAML
- internal/portfolio: heading-based chunker + SQLite FTS5 indexer
- internal/server: chi router with /api/chat (SSE), /api/health, /api/info,
  /api/reindex, middleware (RequestID, Logging, CORS, RateLimit)
- internal/streaming: SSE protocol helpers (start, chunk, sources, done, error)
- web/: drop-in vanilla-JS chat widget (no build, no deps) + demo + README
- bench/: reproducible driver benchmark (modernc vs mattn SQLite)
- configs/portfolio-bot.yaml: llama.cpp default provider, SQLite RAG, canine persona
- docs/architecture.md / .es.md: aligned with SQLite FTS5 + llama.cpp decisions
- data/projects/README*.md: project data documentation
- README.md / .es.md: updated for current implementation

All tests pass (go test ./...). Bot is functional end-to-end with the
configured LLM provider.
2026-07-17 00:56:06 -07:00

24 lines
No EOL
568 B
Go

package i18n
import "testing"
func TestDetect(t *testing.T) {
cases := []struct {
in, want string
}{
{"Hola, ¿qué proyectos tienes?", "es"},
{"háblame de rony-llm-agent", "es"},
{"¿cuáles son tus skills?", "es"},
{"What projects do you have?", "en"},
{"Tell me about rony-llm-agent", "en"},
{"How does the chat bot work?", "en"},
{"lorem ipsum dolor sit amet", "en"}, // no markers → en
{"", "en"},
}
for _, c := range cases {
got := Detect(c.in)
if got != c.want {
t.Errorf("Detect(%q) = %q, want %q", c.in, got, c.want)
}
}
}