Enhances model loading in settings display
Modifies display method to load models asynchronously in the background Improves user experience by: - Removing async modifier from display method - Handling model loading as a background task - Adding error handling for model loading - Preparing to update UI dynamically when models are loaded
This commit is contained in:
1 file changed
+12
-3
+12
-3
@@ -25,14 +25,23 @@ export class FreewritingCleanupSettingTab extends PluginSettingTab {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
async display(): Promise<void> {
|
||||
display(): void {
|
||||
const { containerEl } = this;
|
||||
containerEl.empty();
|
||||
|
||||
containerEl.createEl('h2', { text: 'Freewriting Cleanup Settings' });
|
||||
|
||||
// Load models asynchronously
|
||||
await this.loadModels();
|
||||
// Load models asynchronously in the background
|
||||
this.loadModels()
|
||||
.then(() => {
|
||||
// Update dropdown UI when models are loaded
|
||||
if (this.modelDropdown) {
|
||||
this.populateModelDropdown(this.modelDropdown);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error loading models in background:', error);
|
||||
});
|
||||
|
||||
// MARK: - API Configuration
|
||||
|
||||
|
||||
Reference in new issue
Block a user