Add model change callback and improve chat UI robustness
- Persist selected model to settings when changed via dropdown - Reorder chat controls: model selector before mode selector, new chat before delete - Add null guards for modelSelectorEl during async populate - Fix streaming state and empty response handling in tool nudge loop - Expand vault operation keyword detection - Enable text selection in chat messages - Include original error message in chat error display
This commit is contained in:
+9
-14
@@ -121,7 +121,8 @@ describe('ChatView', () => {
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
new ChatHistoryManager()
|
||||
new ChatHistoryManager(),
|
||||
undefined
|
||||
);
|
||||
// Obsidian's contentEl has a createEl helper that standard DOM lacks
|
||||
// Unlike standard DOM, Obsidian elements can create nested elements with createEl
|
||||
@@ -423,13 +424,11 @@ describe('ChatView', () => {
|
||||
})()
|
||||
);
|
||||
|
||||
const handleToolSpy = jest
|
||||
.spyOn(view['toolExecutor'], 'handleToolCall')
|
||||
.mockResolvedValue({
|
||||
success: true,
|
||||
message: 'Found vault context',
|
||||
data: [{ path: 'Prompts.md', title: 'Prompts' }],
|
||||
});
|
||||
const handleToolSpy = jest.spyOn(view['toolExecutor'], 'handleToolCall').mockResolvedValue({
|
||||
success: true,
|
||||
message: 'Found vault context',
|
||||
data: [{ path: 'Prompts.md', title: 'Prompts' }],
|
||||
});
|
||||
jest.spyOn(view['ollamaClient'], 'chat').mockResolvedValue({
|
||||
role: 'assistant',
|
||||
content: 'I found vault context and can now suggest the next organization step.',
|
||||
@@ -441,14 +440,10 @@ describe('ChatView', () => {
|
||||
|
||||
expect(handleToolSpy).toHaveBeenCalled();
|
||||
expect(
|
||||
handleToolSpy.mock.calls.some(
|
||||
([toolCall]) => toolCall.function.name === 'get_vault_stats'
|
||||
)
|
||||
handleToolSpy.mock.calls.some(([toolCall]) => toolCall.function.name === 'get_vault_stats')
|
||||
).toBe(true);
|
||||
expect(
|
||||
handleToolSpy.mock.calls.some(
|
||||
([toolCall]) => toolCall.function.name === 'list_vault_tags'
|
||||
)
|
||||
handleToolSpy.mock.calls.some(([toolCall]) => toolCall.function.name === 'list_vault_tags')
|
||||
).toBe(true);
|
||||
|
||||
const messages = (view as any).messages;
|
||||
|
||||
Reference in New Issue
Block a user