Add chat session history with dropdown UI

Implement persistent chat history using a new ChatHistoryManager class.
Sessions are saved on view close, restored on open, and selectable via a
dropdown in the chat header. Includes delete and clear-all commands,
with automatic title generation from the first user message.
This commit is contained in:
2026-05-21 10:36:55 +02:00
parent 5c2078aebb
commit e7b753014c
7 changed files with 566 additions and 7 deletions
+9 -1
View File
@@ -1,6 +1,7 @@
import { ChatView } from '../src/chat-view';
import { PluginSettings, OllamaMessage, ChatMessage, OllamaTool, ToolCall } from '../src/types';
import { ErrorHandler } from '../src/error-handler';
import { ChatHistoryManager } from '../src/chat-history';
// Mock Obsidian types
interface MockVault {
@@ -114,7 +115,14 @@ describe('ChatView', () => {
app: mockApp,
};
view = new ChatView(mockLeaf as unknown as any, mockSettings);
view = new ChatView(
mockLeaf as unknown as any,
mockSettings,
undefined,
undefined,
undefined,
new ChatHistoryManager()
);
// Obsidian's contentEl has a createEl helper that standard DOM lacks
// Unlike standard DOM, Obsidian elements can create nested elements with createEl
const contentDiv = document.createElement('div') as any;