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:
AlexKucera committed 2025-10-24 11:04:35 +02:00
1 parent 3d1227dc45
commit 5c8314a986
1 file changed
+12 -3
+12 -3
View File
@@ -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