Enha: interrupt llm and tool both
This commit is contained in:
6
bot.go
6
bot.go
@@ -745,7 +745,7 @@ func sendMsgToLLM(body io.Reader) {
|
|||||||
}
|
}
|
||||||
interrupt:
|
interrupt:
|
||||||
if interruptResp { // read bytes, so it would not get into beginning of the next req
|
if interruptResp { // read bytes, so it would not get into beginning of the next req
|
||||||
interruptResp = false
|
// interruptResp = false
|
||||||
logger.Info("interrupted bot response", "chunk_counter", counter)
|
logger.Info("interrupted bot response", "chunk_counter", counter)
|
||||||
streamDone <- true
|
streamDone <- true
|
||||||
break
|
break
|
||||||
@@ -799,6 +799,7 @@ func showSpinner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func chatRound(r *models.ChatRoundReq) error {
|
func chatRound(r *models.ChatRoundReq) error {
|
||||||
|
interruptResp = false
|
||||||
botRespMode = true
|
botRespMode = true
|
||||||
go showSpinner()
|
go showSpinner()
|
||||||
updateStatusLine()
|
updateStatusLine()
|
||||||
@@ -964,6 +965,9 @@ out:
|
|||||||
}
|
}
|
||||||
// Strip think blocks before parsing for tool calls
|
// Strip think blocks before parsing for tool calls
|
||||||
respTextNoThink := thinkBlockRE.ReplaceAllString(respText.String(), "")
|
respTextNoThink := thinkBlockRE.ReplaceAllString(respText.String(), "")
|
||||||
|
if interruptResp {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if findCall(respTextNoThink, toolResp.String()) {
|
if findCall(respTextNoThink, toolResp.String()) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
1
tui.go
1
tui.go
@@ -726,6 +726,7 @@ func init() {
|
|||||||
if event.Key() == tcell.KeyF6 {
|
if event.Key() == tcell.KeyF6 {
|
||||||
interruptResp = true
|
interruptResp = true
|
||||||
botRespMode = false
|
botRespMode = false
|
||||||
|
toolRunningMode = false
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if event.Key() == tcell.KeyF7 {
|
if event.Key() == tcell.KeyF7 {
|
||||||
|
|||||||
Reference in New Issue
Block a user