Prevent regenerating message whilst receiving a response
This commit is contained in:
parent
a9112cf3da
commit
f9460416d9
@ -1101,33 +1101,36 @@ Generate a title following these rules:
|
|||||||
self.loading_spinner = None
|
self.loading_spinner = None
|
||||||
|
|
||||||
def regenerate_message(self, message_id, bot_message_box, bot_message_button_container):
|
def regenerate_message(self, message_id, bot_message_box, bot_message_button_container):
|
||||||
self.bot_message_button_container = bot_message_button_container
|
if not self.bot_message:
|
||||||
self.bot_message_view = Gtk.TextView(
|
self.bot_message_button_container = bot_message_button_container
|
||||||
editable=False,
|
self.bot_message_view = Gtk.TextView(
|
||||||
focusable=True,
|
editable=False,
|
||||||
wrap_mode= Gtk.WrapMode.WORD,
|
focusable=True,
|
||||||
margin_top=12,
|
wrap_mode= Gtk.WrapMode.WORD,
|
||||||
margin_bottom=12,
|
margin_top=12,
|
||||||
hexpand=True,
|
margin_bottom=12,
|
||||||
css_classes=["flat"]
|
hexpand=True,
|
||||||
)
|
css_classes=["flat"]
|
||||||
self.bot_message = self.bot_message_view.get_buffer()
|
)
|
||||||
for widget in list(bot_message_box):
|
self.bot_message = self.bot_message_view.get_buffer()
|
||||||
bot_message_box.remove(widget)
|
for widget in list(bot_message_box):
|
||||||
bot_message_box.append(self.bot_message_view)
|
bot_message_box.remove(widget)
|
||||||
history = self.convert_history_to_ollama()[:list(self.chats["chats"][self.chats["selected_chat"]]["messages"].keys()).index(message_id)]
|
bot_message_box.append(self.bot_message_view)
|
||||||
if message_id in self.chats["chats"][self.chats["selected_chat"]]["messages"]:
|
history = self.convert_history_to_ollama()[:list(self.chats["chats"][self.chats["selected_chat"]]["messages"].keys()).index(message_id)]
|
||||||
del self.chats["chats"][self.chats["selected_chat"]]["messages"][message_id]
|
if message_id in self.chats["chats"][self.chats["selected_chat"]]["messages"]:
|
||||||
data = {
|
del self.chats["chats"][self.chats["selected_chat"]]["messages"][message_id]
|
||||||
"model": self.get_current_model(1),
|
data = {
|
||||||
"messages": history,
|
"model": self.get_current_model(1),
|
||||||
"options": {"temperature": self.model_tweaks["temperature"], "seed": self.model_tweaks["seed"]},
|
"messages": history,
|
||||||
"keep_alive": f"{self.model_tweaks['keep_alive']}m"
|
"options": {"temperature": self.model_tweaks["temperature"], "seed": self.model_tweaks["seed"]},
|
||||||
}
|
"keep_alive": f"{self.model_tweaks['keep_alive']}m"
|
||||||
self.switch_send_stop_button(False)
|
}
|
||||||
self.toggle_ui_sensitive(False)
|
self.switch_send_stop_button(False)
|
||||||
thread = threading.Thread(target=self.run_message, args=(data['messages'], data['model'], message_id))
|
self.toggle_ui_sensitive(False)
|
||||||
thread.start()
|
thread = threading.Thread(target=self.run_message, args=(data['messages'], data['model'], message_id))
|
||||||
|
thread.start()
|
||||||
|
else:
|
||||||
|
self.show_toast(_("Message cannot be regenerated while receiving a response"), self.manage_models_overlay)
|
||||||
|
|
||||||
def pull_model_update(self, data, model_name):
|
def pull_model_update(self, data, model_name):
|
||||||
if 'error' in data:
|
if 'error' in data:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user