tui: implement history navigation state initialization
This commit is contained in:
@@ -55,6 +55,8 @@ type model struct {
|
|||||||
agent *sidekick.Sidekick
|
agent *sidekick.Sidekick
|
||||||
pool map[string]*sidekick.Sidekick
|
pool map[string]*sidekick.Sidekick
|
||||||
history []sidekick.Message
|
history []sidekick.Message
|
||||||
|
historyIndex int
|
||||||
|
promptDraft string
|
||||||
transientSteps []string
|
transientSteps []string
|
||||||
currentStream string
|
currentStream string
|
||||||
currentReasoning string
|
currentReasoning string
|
||||||
@@ -178,9 +180,10 @@ func initialModel() model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return model{
|
return model{
|
||||||
textarea: ta,
|
textarea: ta,
|
||||||
agent: agent,
|
agent: agent,
|
||||||
pool: pool,
|
pool: pool,
|
||||||
|
historyIndex: -1,
|
||||||
history: []sidekick.Message{
|
history: []sidekick.Message{
|
||||||
{Role: sidekick.MessageRoleSystem, Content: banner + "\n\nSidekick initialized. " + mcpStats + "\nType a message below."},
|
{Role: sidekick.MessageRoleSystem, Content: banner + "\n\nSidekick initialized. " + mcpStats + "\nType a message below."},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ func TestInitialModel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestHistoryStateInitialization(t *testing.T) {
|
||||||
|
m := initialModel()
|
||||||
|
if m.historyIndex != -1 {
|
||||||
|
t.Errorf("expected historyIndex to be -1, got %d", m.historyIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestModelUpdate(t *testing.T) {
|
func TestModelUpdate(t *testing.T) {
|
||||||
m := initialModel()
|
m := initialModel()
|
||||||
m.ready = true
|
m.ready = true
|
||||||
|
|||||||
Reference in New Issue
Block a user