fix: remove tab switching, filter AI thinking from responses
All checks were successful
CI / build (push) Successful in 1m44s

- Remove Tab/Shift+Tab for tab switching (use only Ctrl+T)
- Tab key now inserts tab character in chat/terminal input
- Filter <think...> blocks from AI responses (MiniMax etc.)
- Filter << >> reasoning blocks from AI responses

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-20 00:39:35 +02:00
parent 82b281641d
commit 5a33dfcd73
2 changed files with 35 additions and 20 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
"regexp"
"strings"
"time"
@@ -127,7 +128,7 @@ func (o *Orchestrator) Send(userMessage string) (string, error) {
return "", fmt.Errorf("no response from AI")
}
content := chatResp.Choices[0].Message.Content
content := cleanAIResponse(chatResp.Choices[0].Message.Content)
o.history = append(o.history, Message{
Role: "assistant",
Content: content,
@@ -222,6 +223,31 @@ func (o *Orchestrator) ClearHistory() {
o.Workflow.Reset()
}
func cleanAIResponse(content string) string {
thinkRe := regexp.MustCompile(`(?s)<[Tt]hink[^>]*>.*?</[Tt]hink>`)
content = thinkRe.ReplaceAllString(content, "")
lines := strings.Split(content, "\n")
var clean []string
inBlock := false
for _, line := range lines {
trimmed := strings.TrimSpace(line)
if trimmed == "<<" || trimmed == "<<<" {
inBlock = true
continue
}
if trimmed == ">>" || trimmed == ">>>" {
inBlock = false
continue
}
if inBlock {
continue
}
clean = append(clean, line)
}
result := strings.TrimSpace(strings.Join(clean, "\n"))
return result
}
func getProviderBaseURL(name string) string {
switch name {
case "minimax":