mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-21 09:31:45 +00:00
changed author instead of owner
This commit is contained in:
parent
145437ced0
commit
50ab1f3817
45
app.py
45
app.py
@ -288,7 +288,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
config_data = yaml.load(config_file, Loader=yaml.FullLoader)
|
config_data = yaml.load(config_file, Loader=yaml.FullLoader)
|
||||||
personality_info['name'] = config_data.get('name',"No Name")
|
personality_info['name'] = config_data.get('name',"No Name")
|
||||||
personality_info['description'] = config_data.get('personality_description',"")
|
personality_info['description'] = config_data.get('personality_description',"")
|
||||||
personality_info['author'] = config_data.get('creator', 'ParisNeo')
|
personality_info['author'] = config_data.get('author', 'ParisNeo')
|
||||||
personality_info['version'] = config_data.get('version', '1.0.0')
|
personality_info['version'] = config_data.get('version', '1.0.0')
|
||||||
scripts_path = personality_folder / 'scripts'
|
scripts_path = personality_folder / 'scripts'
|
||||||
personality_info['has_scripts'] = scripts_path.is_dir()
|
personality_info['has_scripts'] = scripts_path.is_dir()
|
||||||
@ -390,49 +390,10 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
self.config["language"]=data['setting_value']
|
self.config["language"]=data['setting_value']
|
||||||
|
|
||||||
elif setting_name== "personality_language":
|
elif setting_name== "personality_language":
|
||||||
back_language = self.config["personality_language"]
|
self.config["personality_language"]=data['setting_value']
|
||||||
if self.config["personality_language"]!=data['setting_value']:
|
|
||||||
self.config["personality_language"]=data['setting_value']
|
|
||||||
personalities_categories_dir = Path(f'./personalities/{self.config["personality_language"]}') # replace with the actual path to the models folder
|
|
||||||
cats = [f.stem for f in personalities_categories_dir.iterdir() if f.is_dir()]
|
|
||||||
|
|
||||||
if len(cats)>0:
|
|
||||||
back_category = self.config["personality_category"]
|
|
||||||
self.config["personality_category"]=cats[0]
|
|
||||||
try:
|
|
||||||
personalities_dir = Path(f'./personalities/{self.config["personality_language"]}/{self.config["personality_category"]}') # replace with the actual path to the models folder
|
|
||||||
pers = [f.stem for f in personalities_dir.iterdir() if f.is_dir()]
|
|
||||||
except Exception as ex:
|
|
||||||
pers=[]
|
|
||||||
if self.config["debug"]:
|
|
||||||
print(f"No personalities found. Using default one {ex}")
|
|
||||||
if len(pers)>0:
|
|
||||||
self.config["personality"]=pers[0]
|
|
||||||
personality_fn = f"personalities/{self.config['personality_language']}/{self.config['personality_category']}/{self.config['personality']}"
|
|
||||||
self.personality.load_personality(personality_fn)
|
|
||||||
else:
|
|
||||||
self.config["personality"]=""
|
|
||||||
self.personality = AIPersonality()
|
|
||||||
|
|
||||||
elif setting_name== "personality_category":
|
elif setting_name== "personality_category":
|
||||||
back_category = self.config["personality_category"]
|
self.config["personality_category"]=data['setting_value']
|
||||||
if self.config["personality_category"]!=data['setting_value']:
|
|
||||||
self.config["personality_category"]=data['setting_value']
|
|
||||||
pers = json.loads(self.list_personalities().data.decode("utf8"))
|
|
||||||
if len(pers)>0:
|
|
||||||
self.config["personality"]=pers[0]
|
|
||||||
personality_fn = f"personalities/{self.config['personality_language']}/{self.config['personality_category']}/{self.config['personality']}"
|
|
||||||
try:
|
|
||||||
self.personality.load_personality(personality_fn)
|
|
||||||
if self.config["debug"]:
|
|
||||||
print(self.personality)
|
|
||||||
except:
|
|
||||||
print(f"couldn't load personality from {personality_fn}")
|
|
||||||
return jsonify({'setting_name': data['setting_name'], "status":False})
|
|
||||||
else:
|
|
||||||
self.config["personality_category"]=back_category
|
|
||||||
return jsonify({'setting_name': data['setting_name'], "status":False})
|
|
||||||
|
|
||||||
elif setting_name== "personality":
|
elif setting_name== "personality":
|
||||||
self.config["personality"]=data['setting_value']
|
self.config["personality"]=data['setting_value']
|
||||||
personality_fn = f"personalities/{self.config['personality_language']}/{self.config['personality_category']}/{self.config['personality']}"
|
personality_fn = f"personalities/{self.config['personality_language']}/{self.config['personality_category']}/{self.config['personality']}"
|
||||||
|
@ -14,3 +14,14 @@ python installations/download_all_personalities.py
|
|||||||
rem Deactivate the virtual environment
|
rem Deactivate the virtual environment
|
||||||
echo deactivating
|
echo deactivating
|
||||||
call %environment_name%\Scripts\deactivate.bat
|
call %environment_name%\Scripts\deactivate.bat
|
||||||
|
|
||||||
|
rem Remove tmp folder
|
||||||
|
set "folder=tmp"
|
||||||
|
|
||||||
|
if exist "%folder%" (
|
||||||
|
echo Folder exists. Deleting...
|
||||||
|
rd /s /q "%folder%"
|
||||||
|
echo Folder deleted.
|
||||||
|
) else (
|
||||||
|
echo Folder does not exist.
|
||||||
|
)
|
@ -9,11 +9,13 @@ def copy_files(source_path, destination_path):
|
|||||||
|
|
||||||
if source_item.is_file():
|
if source_item.is_file():
|
||||||
# Remove destination file if it already exists
|
# Remove destination file if it already exists
|
||||||
if destination_item.exists():
|
try:
|
||||||
destination_item.unlink()
|
if destination_item.exists():
|
||||||
|
destination_item.unlink()
|
||||||
# Copy file from source to destination
|
# Copy file from source to destination
|
||||||
shutil.copy2(str(source_item), str(destination_item))
|
shutil.copy2(str(source_item), str(destination_item))
|
||||||
|
except:
|
||||||
|
print(f"Couldn't install personality {item}")
|
||||||
|
|
||||||
elif source_item.is_dir():
|
elif source_item.is_dir():
|
||||||
# Create destination directory if it does not exist
|
# Create destination directory if it does not exist
|
||||||
|
@ -14,3 +14,14 @@ python installations/download_all_personalities.py
|
|||||||
# Deactivate the virtual environment
|
# Deactivate the virtual environment
|
||||||
echo "deactivating"
|
echo "deactivating"
|
||||||
deactivate
|
deactivate
|
||||||
|
|
||||||
|
# Remove tmp folder
|
||||||
|
folder="tmp"
|
||||||
|
|
||||||
|
if [ -d "$folder" ]; then
|
||||||
|
echo "Folder exists. Deleting..."
|
||||||
|
rm -r "$folder"
|
||||||
|
echo "Folder deleted."
|
||||||
|
else
|
||||||
|
echo "Folder does not exist."
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user