4a5ca98c13
- Auto-translate non-Latin messages via OpenAI-compatible API - Config in ~/.hircrc (created on first run, disabled by default) - Translation shown in italic below original message - Arrow up/down for input history (50 entries) - Long lines wrap properly on window redraw - /ctcp command for sending CTCP requests - Updated README with AI translation docs
959 B
959 B
TODO
AI-powered auto-translation of non-Swedish/English messages
Config file: ~/.hircrc
# AI translation settings
ai_type=ollama # ollama, vllm, or openai
ai_host=localhost
ai_port=11434
ai_key= # API key (required for openai)
ai_model=llama3
ai_target_lang=english # translate into this language
ai_skip_langs=swedish,english # don't translate these
Implementation plan
- Parse ~/.hircrc on startup
- Detect messages that aren't in skip_langs (heuristic: non-Latin chars, or let the LLM decide)
- Show original message immediately
- Fork a child process that calls the AI API (OpenAI-compatible /v1/chat/completions endpoint — works for ollama, vllm, and openai)
- Prompt: "Translate to {target_lang}. Reply with only the translation: {text}"
- When child returns, insert translated line in italic below original in the scrollback
- Only visible locally, not sent to channel
- 1-5 sec delay is acceptable