AI assistant
Grimoire’s assistant uses a local Ollama instance.
The Rust backend issues HTTP requests to http://localhost:11434. Examples include /api/chat for conversation and embedding endpoints used for RAG.
See:
There are no API keys for that path. If Ollama is installed and models are pulled, the app talks to your machine only.
Chat streaming
The chat Tauri command sends messages to Ollama with stream: true.
Tokens are pushed to the UI incrementally via the chat:token Tauri event until the stream completes (same module as above).
Models and settings
-
The chat UI keeps a model field. The app ships with a default selection in the frontend; you can choose any model Ollama exposes.
-
Keep model in memory maps to Ollama’s
keep_alive. When enabled it is-1so the model is not unloaded after each request; otherwise Ollama’s default timeout applies. SeeOllamaChatRequestinchat.rs. -
Inference options (
temperature,top_p,top_k,repeat_penalty,num_ctx) are forwarded in the Ollama request body. -
Thread usage is capped (
num_thread) so the OS keeps headroom.
Embedding model
AppConfig in Rust tracks embedding_model (used for note, file, and Wikipedia embeddings).
If the key is missing in SQLite, the code falls back to nomic-embed-text.
When does “Use notes” see your latest edits?
After each explicit save (Ctrl+S / the editor save path), the app persists the note and then runs note indexing so full-text search, semantic search, and RAG all target the saved version. In practice you can save and then ask the assistant about that note without a separate “rebuild index” step, as long as Ollama is up and the note is unlocked (locked / encrypted-inaccessible notes are not indexed the same way — see Privacy & security). Very long notes may still show Indexing… in the editor while embeddings finish.
Context toggles (chat panel)
The Svelte chat UI persists these booleans in localStorage. Keys are prefixed with grimoire:chat:.
| Toggle | Role |
|---|---|
| Use notes | When on, relevant notes are injected as RAG context (useNotes). |
| Use Wikipedia | Wikipedia articles in RAG when the feature is enabled (useWiki). |
| Use files | External file / scanner context (useFiles). |
| Use view | Current board/table view context (useViewContext). |
| Feature guide | Injects the built-in markdown feature guide describing shortcuts and views (useFeatureGuide). |
Source: src/lib/Chat.svelte (prefs and tooltips).
Common errors
| Kind | What to do |
|---|---|
OllamaUnavailable | Start Ollama (ollama serve). |
EmbeddingFailed | Pull the configured embedding model (ollama pull <model>). |
These strings are formatted in Chat.svelte and shared error helpers when the backend returns structured AppError kinds.
Send selection to chat
Ctrl+Shift+Enter (Cmd+Shift+Enter on macOS) sends the current editor selection to chat.
Implemented in keyboardService.svelte.js.
See also
- Getting started — first LLM walkthrough
- Vault & data — where embeddings are stored
- Privacy & security — local-only defaults, locked content, audit log
- Views & surfaces — chat panel and context surfaces
- Settings glossary — LLM, Hardware, Wikipedia, File Scanner
- Keyboard shortcuts — global bindings
- Troubleshooting — consolidated FAQ (links here instead of duplicating error tables)