This commit is contained in:
Saifeddine ALOUI 2023-10-16 01:07:03 +02:00
parent b83424084a
commit 2cb07d0f1e
2 changed files with 5 additions and 29 deletions

View File

@ -13,7 +13,7 @@ from api.db import DiscussionsDB, Discussion
from pathlib import Path
from lollms.config import InstallOption
from lollms.types import MSG_TYPE, SENDER_TYPES
from lollms.extension import LOLLMSExtension
from lollms.extension import LOLLMSExtension, ExtensionBuilder
from lollms.personality import AIPersonality, PersonalityBuilder
from lollms.binding import LOLLMSConfig, BindingBuilder, LLMBinding, ModelBuilder
from lollms.paths import LollmsPaths
@ -1018,39 +1018,15 @@ class LoLLMsAPPI(LollmsApplication):
if extension in loaded_names:
mounted_extensions.append(loaded[loaded_names.index(extension)])
else:
personality_path = self.lollms_paths.personalities_zoo_path/f"{extension}"
extension_path = self.lollms_paths.extensions_zoo_path/f"{extension}"
try:
extension = LOLLMSExtension()
extension = ExtensionBuilder().build_extension(extension_path,self.lollms_paths, self)
mounted_extensions.append(extension)
except Exception as ex:
ASCIIColors.error(f"Personality file not found or is corrupted ({personality_path}).\nReturned the following exception:{ex}\nPlease verify that the personality you have selected exists or select another personality. Some updates may lead to change in personality name or category, so check the personality selection in settings to be sure.")
ASCIIColors.error(f"Personality file not found or is corrupted ({extension_path}).\nReturned the following exception:{ex}\nPlease verify that the personality you have selected exists or select another personality. Some updates may lead to change in personality name or category, so check the personality selection in settings to be sure.")
ASCIIColors.info("Trying to force reinstall")
if self.config["debug"]:
print(ex)
try:
personality = AIPersonality(
personality_path,
self.lollms_paths,
self.config,
self.model,
app = self,
run_scripts=True,
selected_language=personality.split(":")[1] if ":" in personality else None,
installation_option=InstallOption.FORCE_INSTALL)
mounted_extensions.append(personality)
except Exception as ex:
ASCIIColors.error(f"Couldn't load personality at {personality_path}")
trace_exception(ex)
ASCIIColors.info(f"Unmounting personality")
to_remove.append(i)
personality = AIPersonality(None,
self.lollms_paths,
self.config,
self.model,
run_scripts=True,
installation_option=InstallOption.FORCE_INSTALL)
mounted_extensions.append(personality)
ASCIIColors.info("Reverted to default personality")
if self.config["active_personality_id"]>=0 and self.config["active_personality_id"]<len(self.config["personalities"]):
ASCIIColors.success(f'selected model : {self.config["personalities"][self.config["active_personality_id"]]}')
else:

@ -1 +1 @@
Subproject commit dbe6ad863a8f711aff101ea447545a160923c105
Subproject commit 563ff170837d7ed1cb19cf34340a484ff0f64aed