mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-23 06:12:22 +00:00
new UI
This commit is contained in:
parent
84c0283fb8
commit
43e84d3ce3
@ -67,9 +67,14 @@ def add_events(sio:socketio):
|
||||
pass
|
||||
if lollmsElfServer.config.force_output_language_to_be and lollmsElfServer.config.force_output_language_to_be.lower().strip() !="english":
|
||||
welcome_message = lollmsElfServer.personality.fast_gen(f"!@>instruction: Translate the following text to {lollmsElfServer.config.force_output_language_to_be.lower()}:\n{lollmsElfServer.personality.welcome_message}\n!@>translation:")
|
||||
|
||||
else:
|
||||
welcome_message = lollmsElfServer.personality.welcome_message
|
||||
|
||||
try:
|
||||
nb_tokens = len(lollmsElfServer.model.tokenize(welcome_message))
|
||||
except:
|
||||
nb_tokens = None
|
||||
message = lollmsElfServer.session.get_client(client_id).discussion.add_message(
|
||||
message_type = MSG_TYPE.MSG_TYPE_FULL.value if lollmsElfServer.personality.include_welcome_message_in_disucssion else MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_AI.value,
|
||||
sender_type = SENDER_TYPES.SENDER_TYPES_AI.value,
|
||||
@ -82,7 +87,9 @@ def add_events(sio:socketio):
|
||||
model = lollmsElfServer.config.model_name,
|
||||
personality = lollmsElfServer.config.personalities[lollmsElfServer.config.active_personality_id],
|
||||
created_at = None,
|
||||
finished_generating_at=None
|
||||
started_generating_at = None,
|
||||
finished_generating_at = None,
|
||||
nb_tokens = nb_tokens
|
||||
)
|
||||
|
||||
await lollmsElfServer.sio.emit('discussion_created',
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d1f6f079423a433768cb6978b7988e60619896bf
|
||||
Subproject commit 31cc452f583db584cc48a91a37e76142adbc87e0
|
@ -349,6 +349,10 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
client.discussion = self.db.load_last_discussion()
|
||||
|
||||
prompt = text
|
||||
try:
|
||||
nb_tokens = len(self.model.tokenize(prompt))
|
||||
except:
|
||||
nb_tokens = None
|
||||
ump = self.config.discussion_prompt_separator +self.config.user_name.strip() if self.config.use_user_name_in_discussions else self.personality.user_message_prefix
|
||||
message = client.discussion.add_message(
|
||||
message_type = MSG_TYPE.MSG_TYPE_FULL.value,
|
||||
@ -356,7 +360,8 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
sender = ump.replace(self.config.discussion_prompt_separator,"").replace(":",""),
|
||||
content = prompt,
|
||||
metadata = None,
|
||||
parent_message_id=self.message_id
|
||||
parent_message_id=self.message_id,
|
||||
nb_tokens=nb_tokens
|
||||
)
|
||||
|
||||
ASCIIColors.green("Starting message generation by "+self.personality.name)
|
||||
@ -784,7 +789,9 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
'personality': self.config["personalities"][self.config["active_personality_id"]],
|
||||
|
||||
'created_at': client.discussion.current_message.created_at,
|
||||
'started_generating_at': client.discussion.current_message.started_generating_at,
|
||||
'finished_generating_at': client.discussion.current_message.finished_generating_at,
|
||||
'nb_tokens': client.discussion.current_message.nb_tokens,
|
||||
|
||||
'open': open
|
||||
}, to=client_id
|
||||
@ -799,8 +806,11 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
):
|
||||
client = self.session.get_client(client_id)
|
||||
client.discussion.current_message.finished_generating_at=datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
client.discussion.current_message.nb_tokens = self.nb_received_tokens
|
||||
mtdt = json.dumps(metadata, indent=4) if metadata is not None and type(metadata)== list else metadata
|
||||
if self.nb_received_tokens==1:
|
||||
client.discussion.current_message.started_generating_at=datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
run_async(
|
||||
partial(self.sio.emit,'update_message', {
|
||||
"sender": self.personality.name,
|
||||
@ -809,7 +819,9 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
'ui': ui,
|
||||
'discussion_id':client.discussion.discussion_id,
|
||||
'message_type': MSG_TYPE.MSG_TYPE_STEP_END.value,
|
||||
'started_generating_at': client.discussion.current_message.started_generating_at,
|
||||
'finished_generating_at': client.discussion.current_message.finished_generating_at,
|
||||
'nb_tokens': client.discussion.current_message.nb_tokens,
|
||||
'parameters':parameters,
|
||||
'metadata':metadata
|
||||
}, to=client_id
|
||||
@ -824,7 +836,9 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
'ui': ui,
|
||||
'discussion_id':client.discussion.discussion_id,
|
||||
'message_type': msg_type.value if msg_type is not None else MSG_TYPE.MSG_TYPE_CHUNK.value if self.nb_received_tokens>1 else MSG_TYPE.MSG_TYPE_FULL.value,
|
||||
'started_generating_at': client.discussion.current_message.started_generating_at,
|
||||
'finished_generating_at': client.discussion.current_message.finished_generating_at,
|
||||
'nb_tokens': client.discussion.current_message.nb_tokens,
|
||||
'parameters':parameters,
|
||||
'metadata':metadata
|
||||
}, to=client_id
|
||||
@ -843,6 +857,10 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
client.generated_text=client.generated_text.split("!@>")[0]
|
||||
# Send final message
|
||||
client.discussion.current_message.finished_generating_at=datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
try:
|
||||
client.discussion.current_message.nb_tokens = len(self.model.tokenize(client.generated_text))
|
||||
except:
|
||||
client.discussion.current_message.nb_tokens = None
|
||||
run_async(
|
||||
partial(self.sio.emit,'close_message', {
|
||||
"sender": self.personality.name,
|
||||
@ -854,7 +872,9 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
'personality':self.config["personalities"][self.config["active_personality_id"]],
|
||||
|
||||
'created_at': client.discussion.current_message.created_at,
|
||||
'started_generating_at': client.discussion.current_message.started_generating_at,
|
||||
'finished_generating_at': client.discussion.current_message.finished_generating_at,
|
||||
'nb_tokens': client.discussion.current_message.nb_tokens,
|
||||
|
||||
}, to=client_id
|
||||
)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit cbfb542712c640b8c60ab1f539f96e5cfd805879
|
||||
Subproject commit 5eb465d2da637c83acad2907ad519c2aed973c9e
|
File diff suppressed because one or more lines are too long
BIN
web/dist/connection_lost.wav
vendored
BIN
web/dist/connection_lost.wav
vendored
Binary file not shown.
BIN
web/dist/connection_recovered.wav
vendored
BIN
web/dist/connection_recovered.wav
vendored
Binary file not shown.
2
web/dist/index.html
vendored
2
web/dist/index.html
vendored
@ -6,7 +6,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-e8bbde88.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-32236cca.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-c1351dff.css">
|
||||
</head>
|
||||
<body>
|
||||
|
@ -226,6 +226,8 @@
|
||||
<p v-if="message.binding">Binding: <span class="font-thin">{{ message.binding }}</span></p>
|
||||
<p v-if="message.model">Model: <span class="font-thin">{{ message.model }}</span></p>
|
||||
<p v-if="message.seed">Seed: <span class="font-thin">{{ message.seed }}</span></p>
|
||||
<p v-if="message.nb_tokens">Number of tokens: <span class="font-thin"
|
||||
:title="'Number of Tokens: ' + message.nb_tokens">{{ message.nb_tokens }}</span></p>
|
||||
<p v-if="time_spent">Time spent: <span class="font-thin"
|
||||
:title="'Finished generating: ' + finished_generating_at_parsed">{{ time_spent }}</span></p>
|
||||
</div>
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 0ab60ec2564b3e3ee47d8b60c42d9dd35ed350a0
|
||||
Subproject commit c3bf3175967036b5b70ab8e02c48a136109221d2
|
Loading…
Reference in New Issue
Block a user