Merge branch 'main' into lollms-patchy2

This commit is contained in:
AndzejsP 2023-06-20 15:23:54 +03:00
commit 8abfb250f6
7 changed files with 134 additions and 107 deletions

View File

@ -657,7 +657,21 @@ class LoLLMsAPPI():
self._current_ai_message_id=id
self._message_id = id
def load_binding(self):
try:
print("update_settings : New binding selected")
if hasattr(self,"process") and self.process.ready:
result = self.process.set_config(self.config)
if result["status"]:
ASCIIColors.success("OK")
else:
ASCIIColors.error("NOK")
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_model(self):
try:
print("update_settings : New model selected")
@ -678,7 +692,7 @@ class LoLLMsAPPI():
def load_personality(self):
try:
print("update_settings : New personality selected")
if hasattr(self,"process"):
if hasattr(self,"process") and self.process.ready:
result = self.process.set_config(self.config)
if result["status"]:
ASCIIColors.success("OK")

View File

@ -314,7 +314,7 @@ class Discussion:
self.current_message_created_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.current_message_finished_generating_at=datetime.now().strftime('%Y-%m-%d %H:%M:%S')
def add_message(self, sender, content, message_type=0, rank=0, parent=0, binding="", model ="", personality="", created_at=datetime.now().strftime('%Y-%m-%d %H:%M:%S'), finished_generating_at=datetime.now().strftime('%Y-%m-%d %H:%M:%S')):
def add_message(self, sender, content, message_type=0, rank=0, parent=0, binding="", model ="", personality="", created_at=None, finished_generating_at=None):
"""Adds a new message to the discussion
Args:
@ -324,6 +324,11 @@ class Discussion:
Returns:
int: The added message id
"""
if created_at is None:
created_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
if finished_generating_at is None:
finished_generating_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.current_message_binding = binding
self.current_message_model = model
self.current_message_personality = personality
@ -381,13 +386,14 @@ class Discussion:
"finished_generating_at": row[10]
} for row in rows]
def update_message(self, message_id, new_content, current_date_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')):
def update_message(self, message_id, new_content):
"""Updates the content of a message
Args:
message_id (int): The id of the message to be changed
new_content (str): The nex message content
"""
current_date_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.current_message_finished_generating_at = current_date_time
# print(f"{current_date_time}")

9
app.py
View File

@ -311,9 +311,16 @@ class LoLLMsWebUI(LoLLMsAPPI):
for personality_folder in category_folder.iterdir():
pers = personality_folder.stem
if personality_folder.is_dir():
try:
personality_info = {"folder":personality_folder.stem}
config_path = personality_folder / 'config.yaml'
if not config_path.exists():
try:
config_path.parent.rmdir()
ASCIIColors.warning(f"Deleted useless personality: {config_path.parent}")
except:
ASCIIColors.warning(f"Couldn't delete personality")
continue
try:
with open(config_path) as config_file:
config_data = yaml.load(config_file, Loader=yaml.FullLoader)
personality_info['name'] = config_data.get('name',"No Name")

98
web/dist/assets/index-34e61592.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View File

@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-47b6b817.js"></script>
<link rel="stylesheet" href="/assets/index-1760585e.css">
<script type="module" crossorigin src="/assets/index-34e61592.js"></script>
<link rel="stylesheet" href="/assets/index-91dd80ad.css">
</head>
<body>
<div id="app"></div>