The plugin hard-capped streaming responses at 1000 chunks. For large
models like qwen2.5:32b generating detailed answers, this limit was
easily exceeded, causing the response to stop mid-sentence.
The Ollama stream already terminates naturally when the model sends the
final done signal, so the artificial chunk limit served no purpose.
- src/chat-view.ts: Remove chunkCount tracking and MAX_STREAM_CHUNKS
constant. Let the stream run until Ollama signals completion.
- src/types.ts: Add isThinking flag to ChatMessage to track transient
'model is working' state.
- src/chat-view.ts: Set isThinking: true on the assistant placeholder
message when user sends input. Clear it when the first stream chunk
arrives or on error. Update render() to show a spinner + 'Thinking…'
text while isThinking is active.
- styles.css: Add ollama-thinking-indicator class with a CSS spinner
animation and muted italic text styling.
- src/chat-view.ts: Add getIcon() returning 'bot' for the view tab icon.
Improve render() with role-specific CSS classes (user vs assistant) and
message header structure for better styling hooks.
- src/main.ts: Add ribbon icon ('bot') in the left sidebar that opens the
chat view with a single click.
- styles.css (new): Modern chat UI with message bubbles, distinct user and
assistant themes using Obsidian CSS variables, sticky input bar, styled
send button with accent color, and emoji role indicators.
- install.sh: Copy styles.css into the plugin directory and verify its
presence during installation.
- README.md: Include styles.css in manual install instructions.
- __mocks__/obsidian.ts: Add addRibbonIcon() mock for test compatibility.
- tests/chat-view.test.ts: Add getIcon() assertion.
- src/ollama-client.ts: Detect HTTP 404 on /api/chat and throw a descriptive
ApiError with the model name and the exact ollama pull command needed.
- src/error-handler.ts: For API_ERROR type, return the error message directly
instead of prefixing with 'API error: ', so the user-friendly 404 message
is shown cleanly in the Obsidian notice.
- tests/ollama-client.test.ts: Update 404 assertions to match the new
descriptive error message.
- src/semantic-cache.ts: Replace require('chromadb') with static import and
use proper ChromaClient/Collection types instead of any. Fix camelCase
API parameters (queryEmbeddings, nResults) and wrap single embedding into
Embedding[] for upsert. Fix clearCache to call client.reset() instead of
collection.reset() (matches actual chromadb API).
- src/workflow-engine/workflow-engine.ts: Fix unnecessary escapes in regex,
remove redundant 'as unknown' assertion, handle never type in template
literal, and add type annotations to replace callback to satisfy
no-unsafe-argument and no-base-to-string rules.
- tests/semantic-cache.test.ts: Update mocks to include client.reset() and
adjust clearCache assertions to match new implementation.
- Bundle chromadb into main.js via esbuild instead of externalizing it.
Obsidian's renderer cannot resolve bare require('chromadb') against a
plugin-local node_modules. By bundling, the client library is inlined and
works out of the box with just manifest.json + main.js.
- Remove eager cache initialization from OllamaClient constructor to avoid
unhandled promise rejections when chromadb/ChromaDB is unavailable.
- Fix 'Failed to execute fetch on Window: Illegal invocation' by wrapping
the default fetch fallback in an arrow function:
this.fetchFn = fetchFn ?? ((url, init) => fetch(url, init));
This preserves the window binding when fetch is called later.
- Update install.sh and README to remove the obsolete node_modules/chromadb
copy step.
- Update ollama-client-cache tests to reflect that cache initialization is
no longer eager.
Replace dynamic ESM import with require() for chromadb to ensure
Electron can resolve the package against the plugin's node_modules.
Also wrap default fetch fallback in an arrow function to avoid
potential strict mode issues with global fetch.
The install script ran npm install --production, which skips devDependencies.
Since typescript, esbuild, and other build tools live in devDependencies,
npm run build would fail with 'tsc: command not found'.
Switched to plain npm install so all dependencies are available at build
time. Only the necessary runtime dep (chromadb) is copied to the plugin
folder — obsidian stays out since it's a type stub.
The root cause: Obsidian's plugin loader expects main.js at the plugin root
alongside manifest.json. The previous 'dist/' output + shim approach caused
'Cannot find module ./dist/main.js' because dist/ was either missing or not
resolved correctly in Obsidian's module loader.
Changes:
- build: use esbuild to bundle all source into a single main.js (61KB)
tsc --noEmit for type checking; esbuild for the actual bundle
- main.js: no longer a shim — it's the fully bundled plugin
- package.json: added esbuild as devDependency; obsidian moved to devDeps
- install.sh: remove dist/ copy step, add cleanup of old dist/ from vault
- README.md: updated manual install steps to reflect bundling
- package.json: move obsidian from dependencies to devDependencies
(it is a type stub — having it in dependencies risks shadowing
Obsidian's built-in API if node_modules is present in the plugin folder)
- main.js: explicitly extract default export from dist/main.js so the
shim works with both plugin.default and direct-export loader patterns
Obsidian's plugin loader expects main.js at the plugin root alongside
manifest.json — it does not resolve subdirectory paths in the 'main'
field. Added a thin CommonJS shim that re-exports from dist/main.js.
- main.js: new entry shim (module.exports = require('./dist/main.js'))
- manifest.json: 'main' changed from 'dist/main.js' to 'main.js'
- install.sh: copy main.js shim to plugin folder, verify its presence
- README.md: add main.js to manual install instructions
- manifest.json: fix 'main' from 'src/main.js' to 'dist/main.js'
(TypeScript compiles to dist/, not src/ — Obsidian could not find the entry point)
- manifest.json: set isDesktopOnly to true (plugin requires a local Ollama server)
- package.json: remove unused node-fetch dependency (ESM-only, conflicts with CommonJS build)
- src/semantic-cache.ts: use dynamic import for chromadb instead of top-level import
(prevents plugin load crash when chromadb is not installed; cache defaults to disabled)
- install.sh: new script that installs deps, builds, and copies the plugin into a vault
- README.md: add quick install, manual install, and expanded troubleshooting sections
Update the plugin entrypoint and TypeScript output directory to use dist instead of writing generated JavaScript into src.
Remove previously checked-in compiled source files and add coverage for the Ollama client and tool executor.
Introduce ConversationStateManager to handle short, medium, and long-term
context for improved conversation flow. Update ChatView to use this manager
and refactor input handling to accept values directly for better testability.
Update OllamaClient with non-streaming chat support and improved error
handling for malformed chunks. Enhance vault indexer with caching, better
scoring, and stop word filtering. Refactor main plugin entry point and
semantic cache initialization for robustness.
Standardize error message extraction to handle non-Error objects.
Add explicit return types and interface definitions to VaultIndexer.
Update SemanticCacheService to use any types where necessary.
Rename SemanticCache to SemanticCacheService and adjust imports.
Implement semantic caching for Ollama chat responses using ChromaDB to store and retrieve embeddings. The cache can be
enabled/disabled in settings and includes configurable similarity threshold, embedding model, and ChromaDB URL. Added
cache clear functionality and error handling for cache operations.
Update chromaUrl to chromaURL throughout the codebase to ensure consistent naming convention for the Chroma database URL
configuration parameter. This change affects the semantic cache service implementation and related tests.
The change updates the configuration property name from `chromaUrl` to `chromaURL` in:
- SemanticCacheService class
- Test files (chat-view.test.ts, ollama-client-cache.test.ts, semantic-cache.test.ts)
This maintains consistency with other URL configuration parameters in the codebase and improves code readability.
This commit adds semantic caching functionality to speed up repeated queries and implements a complete indexing pipeline
for processing vault files. The changes include:
- Added semantic cache service using ChromaDB for storing and retrieving cached responses
- Implemented indexing pipeline with extraction, normalization, and vectorization steps
- Added cache configuration settings to the plugin
- Updated Ollama client to support cache integration
- Added tests for all new indexing components
- Extended vault indexer with indexing pipeline support
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.
Simplify message construction and update logic in chat-view.js
Add abort controller support and improve error handling in ollama-client.js
Remove unused sanitizeFilePath function from utils.js
Export LogLevel enum in utils.js
Improve vault indexing to process all batches
Increase test coverage across multiple modules (91.2% statements, 82.85% branches, 82.35% functions, 93.1% lines)
Update abort controller handling in OllamaClient to properly clean up previous controllers
Remove unused imports and constants: MODEL_NAME_REGEX, MouseEvent, DEFAULT_SETTINGS, convertMarkdownToHtml
Refactor event handler naming to be more consistent
```