summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2024-11-23 18:34:02 +0300
committerGrail Finder <wohilas@gmail.com>2024-11-23 18:34:02 +0300
commit6625a8103bb70833e2399567cbbe7f3b4a8da429 (patch)
tree9e5c76cc406a6fa6b12405da957363fb78ae2f21 /main.go
parent692e0ada4b6115078485a9bc867c99d2c85d8dd9 (diff)
Feat: add switch between sys promptsHEADmaster
Diffstat (limited to 'main.go')
-rw-r--r--main.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/main.go b/main.go
index c7528f5..e8f9f3a 100644
--- a/main.go
+++ b/main.go
@@ -102,6 +102,27 @@ func main() {
return
}
})
+ sysModal := tview.NewModal().
+ SetText("Switch sys msg:").
+ AddButtons(sysLabels).
+ SetDoneFunc(func(buttonIndex int, buttonLabel string) {
+ switch buttonLabel {
+ case "cancel":
+ pages.RemovePage("sys")
+ return
+ default:
+ sysMsg, ok := sysMap[buttonLabel]
+ if !ok {
+ logger.Warn("no such sys msg", "name", buttonLabel)
+ pages.RemovePage("sys")
+ return
+ }
+ chatBody.Messages[0].Content = sysMsg
+ // replace textview
+ textView.SetText(chatToText(showSystemMsgs))
+ pages.RemovePage("sys")
+ }
+ })
editArea := tview.NewTextArea().
SetPlaceholder("Replace msg...")
editArea.SetBorder(true).SetTitle("input")
@@ -218,6 +239,11 @@ func main() {
textArea.SetText("pressed ctrl+e", true)
return nil
}
+ if event.Key() == tcell.KeyCtrlS {
+ // switch sys prompt
+ pages.AddPage("sys", sysModal, true, true)
+ return nil
+ }
// cannot send msg in editMode or botRespMode
if event.Key() == tcell.KeyEscape && !editMode && !botRespMode {
fromRow, fromColumn, _, _ := textArea.GetCursor()