picoclaw/pkg/agent/i18n.go
instax-dutta 63bd30e82b fix: address PR review comments for TLDR feature
- Add TLDRIncludeMessage config option for privacy in group chats
- Add i18n.go with function-based message templates
- Deduplicate executed tools to prevent unbounded growth
- Replace strings.Builder with fmt.Sprintf for cleaner code
- Move deduplication to single pass before generateTLDR call
2026-03-03 18:03:08 +05:30

25 lines
617 B
Go

package agent
import "fmt"
func tldrWithToolsMessage(toolCount int, tools string, iteration int) string {
return fmt.Sprintf("Processed %d tool(s): %s. (%d iteration%s)", toolCount, tools, iteration, pluralize(iteration))
}
func tldrNoToolsMessage(iteration int) string {
return fmt.Sprintf("Processed your request (%d iteration%s)", iteration, pluralize(iteration))
}
func tldrWithMessage(msg string) string {
if len(msg) <= 50 {
return fmt.Sprintf(". Message: \"%s\"", msg)
}
return fmt.Sprintf(". Message: \"%s...\"", msg[:50])
}
func pluralize(n int) string {
if n > 1 {
return "s"
}
return ""
}