Browse Source

ignore: compacting

Dax Raad 5 months ago
parent
commit
aa9ebe5d7c

+ 11 - 3
packages/tui/internal/app/app.go

@@ -7,6 +7,7 @@ import (
 	"path/filepath"
 	"path/filepath"
 	"slices"
 	"slices"
 	"strings"
 	"strings"
+	"time"
 
 
 	"log/slog"
 	"log/slog"
 
 
@@ -653,12 +654,12 @@ func getDefaultModel(
 }
 }
 
 
 func (a *App) IsBusy() bool {
 func (a *App) IsBusy() bool {
-	if a.Session.Time.Compacting > 0 {
-		return true
-	}
 	if len(a.Messages) == 0 {
 	if len(a.Messages) == 0 {
 		return false
 		return false
 	}
 	}
+	if a.IsCompacting() {
+		return true
+	}
 	lastMessage := a.Messages[len(a.Messages)-1]
 	lastMessage := a.Messages[len(a.Messages)-1]
 	if casted, ok := lastMessage.Info.(opencode.AssistantMessage); ok {
 	if casted, ok := lastMessage.Info.(opencode.AssistantMessage); ok {
 		return casted.Time.Completed == 0
 		return casted.Time.Completed == 0
@@ -666,6 +667,13 @@ func (a *App) IsBusy() bool {
 	return false
 	return false
 }
 }
 
 
+func (a *App) IsCompacting() bool {
+	if time.Since(time.UnixMilli(int64(a.Session.Time.Compacting))) < time.Second*30 {
+		return true
+	}
+	return false
+}
+
 func (a *App) HasAnimatingWork() bool {
 func (a *App) HasAnimatingWork() bool {
 	for _, msg := range a.Messages {
 	for _, msg := range a.Messages {
 		switch casted := msg.Info.(type) {
 		switch casted := msg.Info.(type) {

+ 1 - 1
packages/tui/internal/components/chat/editor.go

@@ -385,7 +385,7 @@ func (m *editorComponent) Content() string {
 	} else if m.app.IsBusy() {
 	} else if m.app.IsBusy() {
 		keyText := m.getInterruptKeyText()
 		keyText := m.getInterruptKeyText()
 		status := "working"
 		status := "working"
-		if m.app.Session.Time.Compacting > 0 {
+		if m.app.IsCompacting() {
 			status = "compacting"
 			status = "compacting"
 		}
 		}
 		if m.app.CurrentPermission.ID != "" {
 		if m.app.CurrentPermission.ID != "" {