mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 13:22:12 +00:00
Delete plaintext config via API. Catch any offline model loading exception
This commit is contained in:
@@ -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 Khoj from 'src/main';
|
||||||
import { updateContentIndex } from './utils';
|
import { updateContentIndex } from './utils';
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,10 @@ if not state.demo:
|
|||||||
state.content_index.markdown = None
|
state.content_index.markdown = None
|
||||||
elif content_type == "org":
|
elif content_type == "org":
|
||||||
state.content_index.org = None
|
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:
|
try:
|
||||||
save_config_to_file_updated_state()
|
save_config_to_file_updated_state()
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class ConversationProcessorConfigModel:
|
|||||||
if self.offline_chat.enable_offline_chat:
|
if self.offline_chat.enable_offline_chat:
|
||||||
try:
|
try:
|
||||||
self.gpt4all_model.loaded_model = download_model(self.offline_chat.chat_model)
|
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.offline_chat.enable_offline_chat = False
|
||||||
self.gpt4all_model.loaded_model = None
|
self.gpt4all_model.loaded_model = None
|
||||||
logger.error(f"Error while loading offline chat model: {e}", exc_info=True)
|
logger.error(f"Error while loading offline chat model: {e}", exc_info=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user