This commit is contained in:
saloui 2023-07-05 08:43:54 +02:00
commit 4604d4c08a
7 changed files with 170 additions and 162 deletions

View File

@ -583,6 +583,7 @@ class LoLLMsAPPI(LollmsApplication):
def prepare_reception(self):
self.current_generated_text = ""
self.nb_received_tokens = 0
self.full_text = ""
self.is_bot_text_started = False
@ -683,6 +684,8 @@ class LoLLMsAPPI(LollmsApplication):
if message_type == MSG_TYPE.MSG_TYPE_CHUNK:
self.current_generated_text += chunk
self.nb_received_tokens += 1
ASCIIColors.green(f"Received {self.nb_received_tokens} tokens",end="\r",flush=True)
detected_anti_prompt = False
anti_prompt_to_remove=""
for prompt in self.personality.anti_prompts:
@ -716,6 +719,8 @@ class LoLLMsAPPI(LollmsApplication):
# Stream the generated text to the main process
elif message_type == MSG_TYPE.MSG_TYPE_FULL:
self.current_generated_text = chunk
self.nb_received_tokens += 1
ASCIIColors.green(f"Received {self.nb_received_tokens} tokens",end="\r",flush=True)
self.socketio.emit('message', {
'data': self.current_generated_text,
'user_message_id':self.current_user_message_id,
@ -766,6 +771,7 @@ class LoLLMsAPPI(LollmsApplication):
def _generate(self, prompt, n_predict=50, callback=None):
self.current_generated_text = ""
self.nb_received_tokens = 0
if self.model is not None:
ASCIIColors.info("warmup")
if self.config["override_personality_model_parameters"]:

View File

@ -226,7 +226,7 @@ class DiscussionsDB:
discussion_id = row[0]
discussion_title = row[1]
discussion = {"id": discussion_id, "title":discussion_title, "messages": []}
rows = self.select(f"SELECT sender, content, message_type, rank, parent, binding, model, personality, created_at, finished_generating_at FROM message WHERE discussion_id=?",(discussion_id,))
rows = self.select(f"SELECT sender, content, type, rank, parent, binding, model, personality, created_at, finished_generating_at FROM message WHERE discussion_id=?",(discussion_id,))
for message_row in rows:
sender = message_row[1]
content = message_row[2]
@ -258,18 +258,18 @@ class DiscussionsDB:
discussion_id = row[0]
discussion_title = row[1]
discussion = {"id": discussion_id, "title":discussion_title, "messages": []}
rows = self.select(f"SELECT sender, content, message_type, rank, parent, binding, model, personality, created_at, finished_generating_at FROM message WHERE discussion_id=?",(discussion_id,))
rows = self.select(f"SELECT sender, content, type, rank, parent, binding, model, personality, created_at, finished_generating_at FROM message WHERE discussion_id=?",(discussion_id,))
for message_row in rows:
sender = message_row[1]
content = message_row[2]
content_type = message_row[3]
rank = message_row[4]
parent = message_row[5]
binding = message_row[6]
model = message_row[7]
personality = message_row[8]
created_at = message_row[9]
finished_generating_at = message_row[10]
sender = message_row[0]
content = message_row[1]
content_type = message_row[2]
rank = message_row[3]
parent = message_row[4]
binding = message_row[5]
model = message_row[6]
personality = message_row[7]
created_at = message_row[8]
finished_generating_at = message_row[9]
discussion["messages"].append(
{"sender": sender, "content": content, "type": content_type, "rank": rank, "parent": parent, "binding": binding, "model":model, "personality":personality, "created_at":created_at, "finished_generating_at": finished_generating_at}

7
app.py
View File

@ -52,6 +52,7 @@ import logging
import psutil
from lollms.main_config import LOLLMSConfig
from typing import Optional
import gc
import gc
@ -878,12 +879,14 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.binding = None
self.model = None
gc.collect()
ASCIIColors.info("Reinstalling binding")
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths, InstallOption.FORCE_INSTALL)
ASCIIColors.info("Loading model")
ASCIIColors.info("Binding reinstalled successfully")
try:
ASCIIColors.info("Reloading model")
self.model = self.binding.build_model()
ASCIIColors.info("Model reloaded successfully")
except Exception as ex:
print(f"Couldn't build model: [{ex}]")
self.trace_exception(ex)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

143
web/dist/assets/index-cff54d0e.js vendored Normal file

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-3ae5f636.js"></script>
<link rel="stylesheet" href="/assets/index-54172bba.css">
<script type="module" crossorigin src="/assets/index-cff54d0e.js"></script>
<link rel="stylesheet" href="/assets/index-8884f14a.css">
</head>
<body>
<div id="app"></div>