This commit is contained in:
2026-04-03 01:24:37 -03:00
parent cae9312db1
commit db3b94a6a1
5 changed files with 34 additions and 6 deletions

View File

@@ -350,6 +350,7 @@ class ChtWindow(Adw.ApplicationWindow):
self._waveform_engine.reset()
self._waveform_widget.set_peaks(None, 0.05)
self._transcriber.reset()
self._agent.clear_history()
self._transcript_order.clear()
self._transcript_rows.clear()
self._transcript_texts.clear()
@@ -539,7 +540,7 @@ class ChtWindow(Adw.ApplicationWindow):
clear_btn = Gtk.Button(label="Clear")
clear_btn.add_css_class("flat")
clear_btn.connect("clicked", lambda b: self._agent_output_view.get_buffer().set_text(""))
clear_btn.connect("clicked", self._on_clear_agent_output)
header.append(clear_btn)
box.append(header)
@@ -600,6 +601,11 @@ class ChtWindow(Adw.ApplicationWindow):
self._lang_dropdown.connect("notify::selected", self._on_lang_changed)
actions_box.append(self._lang_dropdown)
self._history_toggle = Gtk.CheckButton(label="Chat")
self._history_toggle.set_tooltip_text("Include conversation history in prompts")
self._history_toggle.connect("toggled", lambda b: setattr(self._agent, "include_history", b.get_active()))
actions_box.append(self._history_toggle)
outer.append(actions_box)
# Text entry + send
@@ -775,7 +781,7 @@ class ChtWindow(Adw.ApplicationWindow):
self._send_message(msg)
return True
elif keyval == Gdk.KEY_Delete:
self._agent_output_view.get_buffer().set_text("")
self._on_clear_agent_output(None)
return True
return False
@@ -989,6 +995,9 @@ class ChtWindow(Adw.ApplicationWindow):
buf.apply_tag(tag, buf.get_iter_at_mark(mark), it)
buf.delete_mark(mark)
def _on_clear_agent_output(self, _button):
self._agent_output_view.get_buffer().set_text("")
def _on_lang_changed(self, dropdown, _pspec):
idx = dropdown.get_selected()
lang_names = list(LANGUAGES.keys())