Delete plaintext config via API. Catch any offline model loading exception

This commit is contained in:
Debanjum Singh Solanky 2023-10-18 03:23:17 -07:00
parent 53abd1a506
commit 6631fc38db
3 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,4 @@
import { App, Notice, PluginSettingTab, request, Setting, TFile } from 'obsidian';
import { App, Notice, PluginSettingTab, Setting, TFile } from 'obsidian';
import Khoj from 'src/main';
import { updateContentIndex } from './utils';

View file

@ -186,6 +186,10 @@ if not state.demo:
state.content_index.markdown = None
elif content_type == "org":
state.content_index.org = None
elif content_type == "plaintext":
state.content_index.plaintext = None
else:
logger.warning(f"Request to delete unknown content type: {content_type} via API")
try:
save_config_to_file_updated_state()

View file

@ -106,7 +106,7 @@ class ConversationProcessorConfigModel:
if self.offline_chat.enable_offline_chat:
try:
self.gpt4all_model.loaded_model = download_model(self.offline_chat.chat_model)
except ValueError as e:
except Exception as e:
self.offline_chat.enable_offline_chat = False
self.gpt4all_model.loaded_model = None
logger.error(f"Error while loading offline chat model: {e}", exc_info=True)