From 6a6bc5379a3a4620df07b4bb196ec0ded636fc8b Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Tue, 24 Mar 2026 16:13:42 +0900 Subject: Add get current note, edit fule(but broken for now), and update chat to have markdown --- .rules/changelog/2026-03/24/13.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .rules/changelog/2026-03/24/13.md (limited to '.rules') diff --git a/.rules/changelog/2026-03/24/13.md b/.rules/changelog/2026-03/24/13.md new file mode 100644 index 0000000..db16775 --- /dev/null +++ b/.rules/changelog/2026-03/24/13.md @@ -0,0 +1,22 @@ +# Changelog — 2026-03-24 #13 + +## New Tools: Get Current Note & Edit File + +### Added +- **`get_current_note` tool** (`src/tools.ts`): Returns the vault-relative path of the currently active note via `workspace.getActiveFile()`. No approval required. +- **`edit_file` tool** (`src/tools.ts`): Atomic find-and-replace on vault files using `vault.process()`. Accepts `file_path`, `old_text`, and `new_text`. Requires user approval. Only replaces the first occurrence. + +### Changed +- **System prompt** (`src/ollama-client.ts`): Updated to teach the AI the `get_current_note → read_file → edit_file` workflow and to reference both new tools. + +## Markdown Rendering in Assistant Bubbles + +### Added +- **Markdown rendering** (`src/chat-view.ts`): Assistant chat bubbles now render their content as markdown after streaming completes using Obsidian's `MarkdownRenderer.render()`. During streaming, plain text is shown for performance. +- **`finalizeBubble()` method** (`src/chat-view.ts`): New method that clears a streaming bubble's plain text and replaces it with rendered markdown. +- **`bubbleContent` Map** (`src/chat-view.ts`): Tracks accumulated raw text per bubble so it can be rendered as markdown upon finalization. +- **Markdown CSS** (`styles.css`): Scoped typography rules for `.ai-organizer-markdown` inside assistant bubbles — compact margins, scaled-down headings (1.05–1.15em), styled code blocks, tables, blockquotes, lists, and images to fit narrow sidebar bubbles. + +### Changed +- Bubble finalization logic consolidated into `finalizeBubble()` — replaced inline finalization in `onCreateBubble`, post-response, and error handlers. +- Proper cleanup of `bubbleContent` map in clear chat, close, error, and approval handlers. -- cgit v1.2.3