Fix: continue llm resp; clear status line
This commit is contained in:
@@ -17,11 +17,12 @@
|
|||||||
- option to switch between predefined sys prompts; +
|
- option to switch between predefined sys prompts; +
|
||||||
- sqlite for the bot memory; +
|
- sqlite for the bot memory; +
|
||||||
- rename current chat; +
|
- rename current chat; +
|
||||||
|
- help page with all key bindings; +
|
||||||
- fullscreen textarea option (bothersome to implement);
|
- fullscreen textarea option (bothersome to implement);
|
||||||
- consider adding use /completion of llamacpp, since openai endpoint clearly has template|format issues;
|
- consider adding use /completion of llamacpp, since openai endpoint clearly has template|format issues;
|
||||||
- change temp, min-p and other params from tui;
|
- change temp, min-p and other params from tui;
|
||||||
- help page with all key bindings;
|
|
||||||
- default config file (api url, path to sysprompts, path to log, limits, etc);
|
- default config file (api url, path to sysprompts, path to log, limits, etc);
|
||||||
|
- export whole chat into a json file;
|
||||||
|
|
||||||
### FIX:
|
### FIX:
|
||||||
- bot responding (or haninging) blocks everything; +
|
- bot responding (or haninging) blocks everything; +
|
||||||
@@ -30,6 +31,6 @@
|
|||||||
- Tab is needed to copy paste text into textarea box, use shift+tab to switch focus; (changed tp pgup) +
|
- Tab is needed to copy paste text into textarea box, use shift+tab to switch focus; (changed tp pgup) +
|
||||||
- sometimes bots put additional info around the tool call, have a regexp to match tool call; +
|
- sometimes bots put additional info around the tool call, have a regexp to match tool call; +
|
||||||
- remove all panics from code; +
|
- remove all panics from code; +
|
||||||
- delete last msg: can have unexpected behavior (deletes what appears to be two messages if last bot msg was not generated (should only delete icon in that case));
|
- new chat replaces old ones in db; +
|
||||||
- empty input to continue bot msg gens new msg index and bot icon;
|
- empty input to continue bot msg gens new msg index and bot icon; +
|
||||||
- new chat replaces old ones in db;
|
- delete last msg: can have unexpected behavior (deletes what appears to be two messages if last bot msg was not generated (should only delete icon in that case)) (should use regen instead of delete in that case);
|
||||||
|
|||||||
5
bot.go
5
bot.go
@@ -122,11 +122,14 @@ func chatRound(userMsg, role string, tv *tview.TextView) {
|
|||||||
botRespMode = true
|
botRespMode = true
|
||||||
reader := formMsg(chatBody, userMsg, role)
|
reader := formMsg(chatBody, userMsg, role)
|
||||||
if reader == nil {
|
if reader == nil {
|
||||||
return // any notification in that case?
|
logger.Error("empty reader from msgs", "role", role)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
go sendMsgToLLM(reader)
|
go sendMsgToLLM(reader)
|
||||||
|
if userMsg != "" { // no need to write assistant icon since we continue old message
|
||||||
fmt.Fprintf(tv, fmt.Sprintf("(%d) ", len(chatBody.Messages)))
|
fmt.Fprintf(tv, fmt.Sprintf("(%d) ", len(chatBody.Messages)))
|
||||||
fmt.Fprintf(tv, assistantIcon)
|
fmt.Fprintf(tv, assistantIcon)
|
||||||
|
}
|
||||||
respText := strings.Builder{}
|
respText := strings.Builder{}
|
||||||
out:
|
out:
|
||||||
for {
|
for {
|
||||||
|
|||||||
14
tui.go
14
tui.go
@@ -62,12 +62,7 @@ func init() {
|
|||||||
AddItem(textArea, 0, 10, true).
|
AddItem(textArea, 0, 10, true).
|
||||||
AddItem(position, 0, 1, false)
|
AddItem(position, 0, 1, false)
|
||||||
updateStatusLine := func() {
|
updateStatusLine := func() {
|
||||||
fromRow, fromColumn, toRow, toColumn := textArea.GetCursor()
|
|
||||||
if fromRow == toRow && fromColumn == toColumn {
|
|
||||||
position.SetText(fmt.Sprintf(indexLine, botRespMode, activeChatName))
|
position.SetText(fmt.Sprintf(indexLine, botRespMode, activeChatName))
|
||||||
} else {
|
|
||||||
position.SetText(fmt.Sprintf("Esc: send msg; PgUp/Down: switch focus; F1: manage chats; F2: regen last; F3:delete last msg; F4: edit msg; F5: toggle system; F6: interrupt bot resp; Row: [yellow]%d[white], Column: [yellow]%d[white] - [red]To[white] Row: [yellow]%d[white], To Column: [yellow]%d; bot resp mode: %v", fromRow, fromColumn, toRow, toColumn, botRespMode))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chatOpts := []string{"cancel", "new", "rename current"}
|
chatOpts := []string{"cancel", "new", "rename current"}
|
||||||
chatList, err := loadHistoryChats()
|
chatList, err := loadHistoryChats()
|
||||||
@@ -260,11 +255,10 @@ func init() {
|
|||||||
go chatRound("", userRole, textView)
|
go chatRound("", userRole, textView)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if event.Key() == tcell.KeyF3 {
|
if event.Key() == tcell.KeyF3 && !botRespMode {
|
||||||
// delete last msg
|
// delete last msg
|
||||||
chatBody.Messages = chatBody.Messages[:len(chatBody.Messages)-1]
|
chatBody.Messages = chatBody.Messages[:len(chatBody.Messages)-1]
|
||||||
textView.SetText(chatToText(showSystemMsgs))
|
textView.SetText(chatToText(showSystemMsgs))
|
||||||
botRespMode = false // hmmm; is that correct?
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if event.Key() == tcell.KeyF4 {
|
if event.Key() == tcell.KeyF4 {
|
||||||
@@ -314,8 +308,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
// cannot send msg in editMode or botRespMode
|
// cannot send msg in editMode or botRespMode
|
||||||
if event.Key() == tcell.KeyEscape && !editMode && !botRespMode {
|
if event.Key() == tcell.KeyEscape && !editMode && !botRespMode {
|
||||||
fromRow, fromColumn, _, _ := textArea.GetCursor()
|
position.SetText(fmt.Sprintf(indexLine, botRespMode, activeChatName))
|
||||||
position.SetText(fmt.Sprintf(indexLine, fromRow, fromColumn, botRespMode))
|
|
||||||
// read all text into buffer
|
// read all text into buffer
|
||||||
msgText := textArea.GetText()
|
msgText := textArea.GetText()
|
||||||
if msgText != "" {
|
if msgText != "" {
|
||||||
@@ -333,9 +326,6 @@ func init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if isASCII(string(event.Rune())) && !botRespMode {
|
if isASCII(string(event.Rune())) && !botRespMode {
|
||||||
// botRespMode = false
|
|
||||||
// fromRow, fromColumn, _, _ := textArea.GetCursor()
|
|
||||||
// position.SetText(fmt.Sprintf(indexLine, fromRow, fromColumn, botRespMode))
|
|
||||||
return event
|
return event
|
||||||
}
|
}
|
||||||
return event
|
return event
|
||||||
|
|||||||
Reference in New Issue
Block a user