added strings to import block, removed unnessary calls

This commit is contained in:
Ryan Wang 2026-02-16 02:01:37 -05:00
parent 9d5728ec5b
commit e0b5bbe538
2 changed files with 12 additions and 11 deletions

View file

@ -146,15 +146,15 @@ func (cb *ContextBuilder) LoadBootstrapFiles() string {
"IDENTITY.md", "IDENTITY.md",
} }
var result string var sb strings.Builder
for _, filename := range bootstrapFiles { for _, filename := range bootstrapFiles {
filePath := filepath.Join(cb.workspace, filename) filePath := filepath.Join(cb.workspace, filename)
if data, err := os.ReadFile(filePath); err == nil { if data, err := os.ReadFile(filePath); err == nil {
result += fmt.Sprintf("## %s\n\n%s\n\n", filename, string(data)) fmt.Fprintf(&sb, "## %s\n\n%s\n\n", filename, string(data))
} }
} }
return result return sb.String()
} }
func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary string, currentMessage string, media []string, channel, chatID string) []providers.Message { func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary string, currentMessage string, media []string, channel, chatID string) []providers.Message {

View file

@ -10,6 +10,7 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"strings"
"time" "time"
) )
@ -118,14 +119,14 @@ func (ms *MemoryStore) GetRecentDailyNotes(days int) string {
} }
// Join with separator // Join with separator
var result string var sb strings.Builder
for i, note := range notes { for i, note := range notes {
if i > 0 { if i > 0 {
result += "\n\n---\n\n" sb.WriteString("\n\n---\n\n")
} }
result += note sb.WriteString(note)
} }
return result return sb.String()
} }
// GetMemoryContext returns formatted memory context for the agent prompt. // GetMemoryContext returns formatted memory context for the agent prompt.
@ -150,12 +151,12 @@ func (ms *MemoryStore) GetMemoryContext() string {
} }
// Join parts with separator // Join parts with separator
var result string var sb strings.Builder
for i, part := range parts { for i, part := range parts {
if i > 0 { if i > 0 {
result += "\n\n---\n\n" sb.WriteString("\n\n---\n\n")
} }
result += part sb.WriteString(part)
} }
return fmt.Sprintf("# Memory\n\n%s", result) return "# Memory\n\n" + sb.String()
} }