9823761e03c0fb9b70268050526f303d6aa21ca6
Add `cancelStream` method to allow aborting active requests. Store the current `AbortController` on the client instance and reset it when the stream completes or is cancelled. Update `ChatView` to call `cancelStream` on close. Add comprehensive tests for stream cancellation scenarios, including aborting active requests, handling cancellation when no stream is active, clearing the controller after normal completion, and allowing new streams after cancellation.
Ollama Chat Plugin for Obsidian
A plugin that integrates Ollama with Obsidian to create a chat interface that can access your vault content.
Features
- Chat with Ollama models directly in Obsidian
- Vault context search - the assistant can reference your notes
- Tool integration - create files based on chat responses
- Streaming responses
- Customizable model and URL settings
Installation
- Install the plugin via Obsidian's community plugins
- Make sure you have Ollama installed and running
Setup
- Install Ollama: Follow the instructions at ollama.ai to install Ollama
- Start Ollama service:
ollama serve - Pull a model:
ollama pull llama3(or any other model you prefer)
Configuration
- Open the plugin settings via Obsidian's settings panel
- Configure the Ollama URL (default:
http://localhost:11434) - Configure the model name (default:
llama3) - Restart the plugin if needed
Usage
- Click the ribbon icon to open the chat view
- Type your message in the input box
- Press Enter or click Send to send your message
- Click the "New Chat" button to start a fresh conversation
Supported Models
Any model supported by Ollama should work, including:
- llama3
- llama2
- mistral
- codellama
- etc.
Development
To build from source:
npm install
npm run build
Troubleshooting
- Connection issues: Ensure Ollama is running and accessible at the configured URL
- Model not found: Make sure you've pulled the model (
ollama pull <modelname>) - Permission issues: Check that your Obsidian vault has proper write permissions
License
MIT
Description
Languages
JavaScript
59.5%
TypeScript
39.5%
CSS
0.7%
Shell
0.3%