]> git.giacomolli.uk - onechat/blobdiff - daemon.go
Keep time limits with their operations
[onechat] / daemon.go
index 2a93f1dfbdd699ec48eac3a300e7b4cc802a1109..137cc6f42a8e833ec5da6a6481847356b20ca565 100644 (file)
--- a/daemon.go
+++ b/daemon.go
@@ -493,6 +493,27 @@ func daemonRunRequest(l *TurnLoop, whatsapp *WhatsApp, request SocketRequest, an
                _, err := l.Submit(terminalSource, request.Text)
 
                return err
                _, err := l.Submit(terminalSource, request.Text)
 
                return err
+       case "image":
+               if !filepath.IsAbs(request.Path) {
+                       return errors.New("use /image PATH [caption]")
+               }
+
+               data, err := imageReadFile(request.Path)
+               if err != nil {
+                       return fmt.Errorf("read terminal image: %w", err)
+               }
+
+               name, err := l.agent.Images().Save(data)
+               if err != nil {
+                       return fmt.Errorf("store terminal image: %w", err)
+               }
+
+               _, err = l.Submit(terminalSource, imageText([]string{name}, request.Text))
+               if err != nil {
+                       return fmt.Errorf("submit terminal image: %w", err)
+               }
+
+               return nil
        case "interrupt":
                if !l.Interrupt() {
                        return errors.New("no turn runs")
        case "interrupt":
                if !l.Interrupt() {
                        return errors.New("no turn runs")