fix(chat): remove unnecessary nil check in history loading

Simplify the condition for initializing chat history, assuming loadChatHistory always returns a non-nil slice.
This commit is contained in:
Gregory Gauthier 2026-03-04 11:19:50 +00:00
parent b5e1733952
commit 875e34669c

View File

@ -104,7 +104,7 @@ Be concise and action-oriented. After every tool call, wait for the result.`
} }
history := loadChatHistory() history := loadChatHistory()
if history == nil || len(history) == 0 { if len(history) == 0 {
history = []map[string]string{systemPrompt} history = []map[string]string{systemPrompt}
} else if history[0]["role"] != "system" { } else if history[0]["role"] != "system" {
history = append([]map[string]string{systemPrompt}, history...) history = append([]map[string]string{systemPrompt}, history...)