summaryrefslogtreecommitdiff
path: root/tui.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-01-28 20:40:09 +0300
committerGrail Finder <wohilas@gmail.com>2025-01-28 20:40:09 +0300
commit7bf18dede570116b4508b2c936106ed4bf47d55b (patch)
tree3391b360a859589a2019a8da2cf5c72c8c33d3c3 /tui.go
parent976d6423ac0f0b80efb2c933d8c3e6a816507c54 (diff)
Feat: edit agent png cards
Diffstat (limited to 'tui.go')
-rw-r--r--tui.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/tui.go b/tui.go
index 7645a4f..6766cd5 100644
--- a/tui.go
+++ b/tui.go
@@ -77,11 +77,13 @@ Press Enter to go back
func colorText() {
// INFO: is there a better way to markdown?
- tv := textView.GetText(false)
- cq := quotesRE.ReplaceAllString(tv, `[orange:-:-]$1[-:-:-]`)
+ text := textView.GetText(false)
+ text = quotesRE.ReplaceAllString(text, `[orange:-:-]$1[-:-:-]`)
+ text = starRE.ReplaceAllString(text, `[turquoise::i]$1[-:-:-]`)
+ text = thinkRE.ReplaceAllString(text, `[turquoise::i]$1[-:-:-]`)
// cb := codeBlockColor(cq)
// cb := codeBlockRE.ReplaceAllString(cq, `[blue:black:i]$1[-:-:-]`)
- textView.SetText(starRE.ReplaceAllString(cq, `[turquoise::i]$1[-:-:-]`))
+ textView.SetText(text)
}
func updateStatusLine() {
@@ -91,7 +93,7 @@ func updateStatusLine() {
func initSysCards() ([]string, error) {
labels := []string{}
labels = append(labels, sysLabels...)
- cards, err := pngmeta.ReadDirCards(cfg.SysDir, cfg.UserRole)
+ cards, err := pngmeta.ReadDirCards(cfg.SysDir, cfg.UserRole, logger)
if err != nil {
logger.Error("failed to read sys dir", "error", err)
return nil, err
@@ -116,7 +118,7 @@ func startNewChat() {
logger.Warn("no such sys msg", "name", cfg.AssistantRole)
}
// set chat body
- chatBody.Messages = defaultStarter
+ chatBody.Messages = chatBody.Messages[:2]
textView.SetText(chatToText(cfg.ShowSys))
newChat := &models.Chat{
ID: id + 1,
@@ -186,7 +188,17 @@ func init() {
SetChangedFunc(func() {
app.Draw()
})
- textView.SetBorder(true).SetTitle("chat")
+ // textView.SetBorder(true).SetTitle("chat")
+ textView.SetDoneFunc(func(key tcell.Key) {
+ currentSelection := textView.GetHighlights()
+ if key == tcell.KeyEnter {
+ if len(currentSelection) > 0 {
+ textView.Highlight()
+ } else {
+ textView.Highlight("0").ScrollToHighlight()
+ }
+ }
+ })
focusSwitcher[textArea] = textView
focusSwitcher[textView] = textArea
position = tview.NewTextView().