Add AI translation, input history, line wrapping, /ctcp

- 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
This commit is contained in:
2026-04-30 11:39:52 +02:00
parent 2c585a3346
commit 4a5ca98c13
3 changed files with 342 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
# 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