@@ -14,6 +14,7 @@ import (
1414
1515var HOME_PATH = os .Getenv ("HOME" )
1616var chatID = 1
17+ var chatHistoryTitle = "Chat History <Ctrl-H>"
1718
1819func main () {
1920 db := initDB ()
@@ -38,6 +39,7 @@ func main() {
3839 sendMsgChan := make (chan string )
3940 historyChan := make (chan string )
4041 genFlagChan := make (chan bool )
42+ titleChan := make (chan string )
4143
4244 app := tview .NewApplication ()
4345
@@ -55,15 +57,15 @@ func main() {
5557 geminiClient .startChat (history )
5658 defer geminiClient .client .Close ()
5759
58- go geminiClient .sendMessageToTui (sendMsgChan , historyChan , genFlagChan , db )
60+ go geminiClient .sendMessageToTui (sendMsgChan , historyChan , genFlagChan , titleChan , db )
5961
6062 chatLog := tview .NewTextView ().
6163 SetDynamicColors (true ).
6264 SetRegions (true )
6365 chatLog .SetChangedFunc (func () {
6466 app .Draw ()
6567 chatLog .ScrollToEnd ()
66- }).SetBorder (true ).SetTitle ("Chat History <Ctrl-H>" )
68+ }).SetBorder (true ).SetTitle (chatHistoryTitle )
6769
6870 go func () {
6971 for {
@@ -74,6 +76,13 @@ func main() {
7476 }
7577 }()
7678
79+ go func () {
80+ title := <- titleChan
81+ app .QueueUpdateDraw (func () {
82+ chatLog .SetTitle (chatHistoryTitle + " [" + title + "]" )
83+ })
84+ }()
85+
7786 textArea := tview .NewTextArea ()
7887 textArea .SetInputCapture (func (event * tcell.EventKey ) * tcell.EventKey {
7988 if event .Key () == tcell .KeyCtrlS {
0 commit comments