mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-04-16 07:06:38 +00:00
upgraded tools
This commit is contained in:
parent
2077fa0042
commit
deef35abf0
@ -24,6 +24,7 @@ import requests
|
||||
from tqdm import tqdm
|
||||
import traceback
|
||||
import sys
|
||||
from lollms.console import MainMenu
|
||||
|
||||
__author__ = "parisneo"
|
||||
__github__ = "https://github.com/ParisNeo/lollms-webui"
|
||||
@ -325,7 +326,8 @@ class ModelProcess:
|
||||
print("No model loaded. Waiting for new configuration instructions")
|
||||
|
||||
self.ready = True
|
||||
ASCIIColors.print(ASCIIColors.color_bright_blue,f"Listening on :http://{self.config['host']}:{self.config['port']}")
|
||||
ASCIIColors.blue(f"Your personal data is stored here :{self.lollms_paths.personal_path}")
|
||||
ASCIIColors.blue(f"Listening on :http://{self.config['host']}:{self.config['port']}")
|
||||
while True:
|
||||
try:
|
||||
if not self.generate_queue.empty():
|
||||
@ -470,11 +472,16 @@ class ModelProcess:
|
||||
class LoLLMsAPPI():
|
||||
def __init__(self, config:LOLLMSConfig, socketio, config_file_path:str, lollms_paths: LollmsPaths) -> None:
|
||||
self.lollms_paths = lollms_paths
|
||||
self.config = config
|
||||
self.menu = MainMenu(self)
|
||||
|
||||
# Check model
|
||||
if config.model_name is None:
|
||||
self.menu.select_model()
|
||||
|
||||
self.socketio = socketio
|
||||
#Create and launch the process
|
||||
self.process = ModelProcess(self.lollms_paths, config)
|
||||
self.config = config
|
||||
self.binding = self.process.rebuild_binding(self.config)
|
||||
self.mounted_personalities = self.process.rebuild_personalities()
|
||||
if self.config["active_personality_id"]<len(self.mounted_personalities):
|
||||
@ -630,6 +637,37 @@ class LoLLMsAPPI():
|
||||
self._message_id = id
|
||||
|
||||
|
||||
def load_model(self):
|
||||
try:
|
||||
print("update_settings : New model selected")
|
||||
if hasattr(self,"process"):
|
||||
result = self.process.set_config(self.config)
|
||||
print("Set config results:")
|
||||
print(result)
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Couldn't load model.Process returned exception : {ex}")
|
||||
ASCIIColors.error(f"Binding returned this exception : {ex}")
|
||||
ASCIIColors.error(f"{self.config.get_model_path_infos()}")
|
||||
print("Please select a valid model or install a new one from a url")
|
||||
self.menu.select_model()
|
||||
|
||||
|
||||
def load_personality(self):
|
||||
try:
|
||||
print("update_settings : New personality selected")
|
||||
if hasattr(self,"process"):
|
||||
result = self.process.set_config(self.config)
|
||||
print("Set config results:")
|
||||
print(result)
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Couldn't load personality. Please verify your configuration file at {self.configuration_path} or use the next menu to select a valid personality")
|
||||
ASCIIColors.error(f"Binding returned this exception : {ex}")
|
||||
ASCIIColors.error(f"{self.config.get_personality_path_infos()}")
|
||||
print("Please select a valid model or install a new one from a url")
|
||||
self.menu.select_model()
|
||||
self.cond_tk = self.personality.model.tokenize(self.personality.personality_conditioning)
|
||||
self.n_cond_tk = len(self.cond_tk)
|
||||
|
||||
def download_file(self, url, installation_path, callback=None):
|
||||
"""
|
||||
Downloads a file from a URL, reports the download progress using a callback function, and displays a progress bar.
|
||||
|
12
app.py
12
app.py
@ -72,7 +72,6 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
|
||||
self.app = _app
|
||||
self.cancel_gen = False
|
||||
|
||||
|
||||
app.template_folder = "web/dist"
|
||||
|
||||
@ -440,7 +439,11 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
else:
|
||||
self.config["active_personality_id"] = 0
|
||||
self.config["personalities"][self.config["active_personality_id"]] = f"{self.personality_language}/{self.personality_category}/{self.personality_name}"
|
||||
personality_fn = self.lollms_paths.personalities_zoo_path/self.config["personalities"][self.config["active_personality_id"]]
|
||||
|
||||
if self.personality_category!="Custom":
|
||||
personality_fn = self.lollms_paths.personalities_zoo_path/self.config["personalities"][self.config["active_personality_id"]]
|
||||
else:
|
||||
personality_fn = self.lollms_paths.personal_personalities_path/self.config["personalities"][self.config["active_personality_id"]].split("/")[-1]
|
||||
self.personality.load_personality(personality_fn)
|
||||
else:
|
||||
self.config["personalities"].append(f"{self.personality_language}/{self.personality_category}/{self.personality_name}")
|
||||
@ -482,12 +485,15 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
return jsonify({'setting_name': data['setting_name'], "status":True})
|
||||
|
||||
|
||||
|
||||
def apply_settings(self):
|
||||
result = self.process.set_config(self.config)
|
||||
print("Set config results:")
|
||||
print(result)
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
|
||||
def ram_usage(self):
|
||||
"""
|
||||
Returns the RAM usage in bytes.
|
||||
@ -1198,7 +1204,7 @@ if __name__ == "__main__":
|
||||
|
||||
# Configuration loading part
|
||||
config = LOLLMSConfig.autoload(lollms_paths)
|
||||
|
||||
|
||||
# Override values in config with command-line arguments
|
||||
for arg_name, arg_value in vars(args).items():
|
||||
if arg_value is not None:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# =================== Lord Of Large Language Models Configuration file ===========================
|
||||
version: 7
|
||||
binding_name: gpt4all
|
||||
binding_name: c_transformers
|
||||
model_name: ggml-gpt4all-j-v1.3-groovy.bin
|
||||
|
||||
# Host information
|
||||
|
File diff suppressed because one or more lines are too long
1
web/dist/assets/index-d5a22ec2.css
vendored
1
web/dist/assets/index-d5a22ec2.css
vendored
File diff suppressed because one or more lines are too long
1
web/dist/assets/index-f4e7668c.css
vendored
Normal file
1
web/dist/assets/index-f4e7668c.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>GPT4All - WEBUI</title>
|
||||
<script type="module" crossorigin src="/assets/index-5903b487.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-d5a22ec2.css">
|
||||
<script type="module" crossorigin src="/assets/index-76dfba09.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-f4e7668c.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user