Enha: icon for collapsed tools
This commit is contained in:
8
bot.go
8
bot.go
@@ -1208,16 +1208,17 @@ func findCall(msg, toolCall string) bool {
|
|||||||
func chatToTextSlice(messages []models.RoleMsg, showSys bool) []string {
|
func chatToTextSlice(messages []models.RoleMsg, showSys bool) []string {
|
||||||
resp := make([]string, len(messages))
|
resp := make([]string, len(messages))
|
||||||
for i := range messages {
|
for i := range messages {
|
||||||
|
icon := fmt.Sprintf("[-:-:b](%d) <%s>:[-:-:-]", i, messages[i].Role)
|
||||||
// Handle tool call indicators (assistant messages with tool call but empty content)
|
// Handle tool call indicators (assistant messages with tool call but empty content)
|
||||||
if (messages[i].Role == cfg.AssistantRole || messages[i].Role == "assistant") && messages[i].ToolCallID != "" && messages[i].Content == "" && len(messages[i].ToolCalls) > 0 {
|
if messages[i].Role == cfg.AssistantRole && len(messages[i].ToolCalls) > 0 {
|
||||||
// This is a tool call indicator - show collapsed
|
// This is a tool call indicator - show collapsed
|
||||||
if toolCollapsed {
|
if toolCollapsed {
|
||||||
toolName := messages[i].ToolCalls[0].Name
|
toolName := messages[i].ToolCalls[0].Name
|
||||||
resp[i] = fmt.Sprintf("[yellow::i][tool call: %s (press Ctrl+T to expand)][-:-:-]", toolName)
|
resp[i] = fmt.Sprintf("%s\n[yellow::i][tool call: %s (press Ctrl+T to expand)][-:-:-]", icon, toolName)
|
||||||
} else {
|
} else {
|
||||||
// Show full tool call info
|
// Show full tool call info
|
||||||
toolName := messages[i].ToolCalls[0].Name
|
toolName := messages[i].ToolCalls[0].Name
|
||||||
resp[i] = fmt.Sprintf("[yellow::i][tool call: %s][-:-:-]\nargs: %s", toolName, messages[i].ToolCalls[0].Args)
|
resp[i] = fmt.Sprintf("%s\n[yellow::i][tool call: %s][-:-:-]\nargs: %s", icon, toolName, messages[i].ToolCalls[0].Args)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -1230,6 +1231,7 @@ func chatToTextSlice(messages []models.RoleMsg, showSys bool) []string {
|
|||||||
}
|
}
|
||||||
// Hide non-shell tool responses when collapsed
|
// Hide non-shell tool responses when collapsed
|
||||||
if toolCollapsed {
|
if toolCollapsed {
|
||||||
|
resp[i] = icon + "\n[yellow::i][tool resp (press Ctrl+T to expand)][-:-:-]\n"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// When expanded, show tool responses
|
// When expanded, show tool responses
|
||||||
|
|||||||
2
tui.go
2
tui.go
@@ -80,7 +80,7 @@ var (
|
|||||||
[yellow]Ctrl+p[white]: props edit form (min-p, dry, etc.)
|
[yellow]Ctrl+p[white]: props edit form (min-p, dry, etc.)
|
||||||
[yellow]Ctrl+v[white]: show API link selection popup to choose current API
|
[yellow]Ctrl+v[white]: show API link selection popup to choose current API
|
||||||
[yellow]Ctrl+r[white]: start/stop recording from your microphone (needs stt server or whisper binary)
|
[yellow]Ctrl+r[white]: start/stop recording from your microphone (needs stt server or whisper binary)
|
||||||
[yellow]Ctrl+t[white]: remove thinking (<think>) and tool messages from context (delete from chat)
|
[yellow]Ctrl+t[white]: (un)collapse tool messages
|
||||||
[yellow]Ctrl+l[white]: show model selection popup to choose current model
|
[yellow]Ctrl+l[white]: show model selection popup to choose current model
|
||||||
[yellow]Ctrl+k[white]: switch tool use (recommend tool use to llm after user msg)
|
[yellow]Ctrl+k[white]: switch tool use (recommend tool use to llm after user msg)
|
||||||
[yellow]Ctrl+a[white]: interrupt tts (needs tts server)
|
[yellow]Ctrl+a[white]: interrupt tts (needs tts server)
|
||||||
|
|||||||
Reference in New Issue
Block a user