59df2f6856
Update error handling and improve streaming capabilities in the Ollama client and related components. Key changes include: - Simplify error types and improve error handling - Refactor streaming logic to use async generators - Update tool execution and vault indexing - Improve utility functions and types - Update test files to reflect changes
51 lines
854 B
TypeScript
Executable File
51 lines
854 B
TypeScript
Executable File
// Enhanced Obsidian mock for testing
|
|
export class Vault {
|
|
getMarkdownFiles() {
|
|
return [];
|
|
}
|
|
|
|
async read(file: any) {
|
|
return '';
|
|
}
|
|
|
|
async create(path: string, content: string) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export class Workspace {
|
|
getLeaf() {
|
|
return {
|
|
setViewState: jest.fn(),
|
|
};
|
|
}
|
|
}
|
|
|
|
export class App {
|
|
vault = new Vault();
|
|
workspace = new Workspace();
|
|
}
|
|
|
|
export class ItemView {
|
|
contentEl: HTMLElement = document.createElement('div');
|
|
app: App;
|
|
|
|
constructor() {
|
|
this.app = new App();
|
|
}
|
|
}
|
|
|
|
export class Notice {
|
|
static create(message: string) {}
|
|
}
|
|
|
|
// Mock types for DOM elements
|
|
export type TFile = {
|
|
basename: string;
|
|
};
|
|
|
|
// Export additional types that might be used in tests
|
|
export const Plugin: any = jest.fn();
|
|
export const WorkspaceLeaf: any = jest.fn();
|
|
export const Setting: any = jest.fn();
|