Virtual terminal!

This commit is contained in:
jeffser
2024-10-07 02:02:27 -06:00
parent fcb956ff23
commit 29a5251d63
7 changed files with 87 additions and 39 deletions

View File

@@ -32,7 +32,7 @@ gi.require_version('GdkPixbuf', '2.0')
from gi.repository import Adw, Gtk, Gdk, GLib, GtkSource, Gio, GdkPixbuf
from . import dialogs, connection_handler
from .custom_widgets import message_widget, chat_widget, model_widget
from .custom_widgets import message_widget, chat_widget, model_widget, terminal_widget
from .internal import config_dir, data_dir, cache_dir, source_dir
logger = logging.getLogger(__name__)
@@ -118,6 +118,9 @@ class AlpacaWindow(Adw.ApplicationWindow):
style_manager = Adw.StyleManager()
terminal_scroller = Gtk.Template.Child()
terminal_dialog = Gtk.Template.Child()
@Gtk.Template.Callback()
def stop_message(self, button=None):
self.chat_list_box.get_current_chat().stop_message()
@@ -368,6 +371,10 @@ class AlpacaWindow(Adw.ApplicationWindow):
clipboard.read_text_async(None, self.cb_text_received)
clipboard.read_texture_async(None, self.cb_image_received)
def run_terminal(self, script:list):
self.terminal_scroller.set_child(terminal_widget.terminal(script))
self.terminal_dialog.present(self)
def convert_model_name(self, name:str, mode:int) -> str: # mode=0 name:tag -> Name (tag) | mode=1 Name (tag) -> name:tag
try:
if mode == 0: