feat(m2): LLM chat via Ollama — streaming responses with migration context #3

Open
pyr0ball wants to merge 6 commits from feat/m2-llm-chat into feat/m1-system-presence
Owner

Summary

  • New llm.rs module: build_system_prompt() (migration context baked into system prompt) + chat_stream() (Ollama NDJSON streaming via reqwest::Response::chunk())
  • New chat Tauri command: builds message list from config, spawns background stream, emits robin:chat-token / robin:chat-done / robin:chat-error
  • ChatPanel.vue: streaming-aware send() accumulates tokens into pre-inserted message by index; thinking state disables input while Robin is responding; error fallback if Ollama is unreachable

Test plan

  • Build: npm run build (TypeScript clean)
  • On Xander's CachyOS with Ollama running (ollama serve, model llama3.2 pulled): open Robin, type a question, verify tokens stream in
  • With Ollama stopped: verify error message appears in chat
  • Send a second message after first completes — verify thinking state resets
  • Open panel, ask question, close panel mid-response — verify no crash on re-open

Notes

  • Chat is single-turn for M2 (system prompt + current message only) — multi-turn memory is M4
  • Ollama URL and model configurable in ~/.config/robin/config.toml (defaults: http://localhost:11434, llama3.2)
  • Base branch is feat/m1-system-presence — will rebase onto main after M1 merges
## Summary - New `llm.rs` module: `build_system_prompt()` (migration context baked into system prompt) + `chat_stream()` (Ollama NDJSON streaming via `reqwest::Response::chunk()`) - New `chat` Tauri command: builds message list from config, spawns background stream, emits `robin:chat-token` / `robin:chat-done` / `robin:chat-error` - `ChatPanel.vue`: streaming-aware `send()` accumulates tokens into pre-inserted message by index; `thinking` state disables input while Robin is responding; error fallback if Ollama is unreachable ## Test plan - [ ] Build: `npm run build` (TypeScript clean) - [ ] On Xander's CachyOS with Ollama running (`ollama serve`, model `llama3.2` pulled): open Robin, type a question, verify tokens stream in - [ ] With Ollama stopped: verify error message appears in chat - [ ] Send a second message after first completes — verify thinking state resets - [ ] Open panel, ask question, close panel mid-response — verify no crash on re-open ## Notes - Chat is single-turn for M2 (system prompt + current message only) — multi-turn memory is M4 - Ollama URL and model configurable in `~/.config/robin/config.toml` (defaults: `http://localhost:11434`, `llama3.2`) - Base branch is `feat/m1-system-presence` — will rebase onto main after M1 merges
pyr0ball added 6 commits 2026-05-19 07:29:24 -07:00
- Replace `let _ = app.emit(...)` with logged warnings so dropped chat-done/chat-token events surface in logs instead of silently hanging the frontend
- Switch streaming buffer from String to Vec<u8> so multi-byte UTF-8 sequences split across TCP chunks are accumulated correctly before converting to str
- Use `.context("stream read error")` (anyhow) instead of manual anyhow::anyhow! for the chunk read error path
- Rename test parse_empty_token_is_handled -> parse_empty_content_chunk_deserializes (more precise)
- Add malformed_json_fails_to_parse test
pyr0ball added this to the M2: LLM Chat milestone 2026-05-19 07:35:45 -07:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/m2-llm-chat:feat/m2-llm-chat
git checkout feat/m2-llm-chat

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout feat/m1-system-presence
git merge --no-ff feat/m2-llm-chat
git checkout feat/m2-llm-chat
git rebase feat/m1-system-presence
git checkout feat/m1-system-presence
git merge --ff-only feat/m2-llm-chat
git checkout feat/m2-llm-chat
git rebase feat/m1-system-presence
git checkout feat/m1-system-presence
git merge --no-ff feat/m2-llm-chat
git checkout feat/m1-system-presence
git merge --squash feat/m2-llm-chat
git checkout feat/m1-system-presence
git merge --ff-only feat/m2-llm-chat
git checkout feat/m1-system-presence
git merge feat/m2-llm-chat
git push origin feat/m1-system-presence
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/robin#3
No description provided.