summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
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()