set defaults

This commit is contained in:
afjcjsbx 2026-03-10 23:01:05 +01:00
parent 9e3633a4bf
commit 9e15b6f076
3 changed files with 28 additions and 21 deletions

View file

@ -1201,7 +1201,10 @@ func (al *AgentLoop) runLLMIteration(
// Send tool feedback to chat channel if enabled
if al.cfg.Agents.Defaults.IsToolFeedbackEnabled() && opts.Channel != "" {
feedbackPreview := utils.Truncate(string(argsJSON), al.cfg.Agents.Defaults.GetToolFeedbackMaxArgsLength())
feedbackPreview := utils.Truncate(
string(argsJSON),
al.cfg.Agents.Defaults.GetToolFeedbackMaxArgsLength(),
)
feedbackMsg := fmt.Sprintf("\U0001f527 `%s`\n```\n%s\n```", tc.Name, feedbackPreview)
fbCtx, fbCancel := context.WithTimeout(ctx, 3*time.Second)
_ = al.bus.PublishOutbound(fbCtx, bus.OutboundMessage{

View file

@ -207,7 +207,7 @@ type AgentDefaults struct {
SummarizeTokenPercent int `json:"summarize_token_percent" env:"PICOCLAW_AGENTS_DEFAULTS_SUMMARIZE_TOKEN_PERCENT"`
MaxMediaSize int `json:"max_media_size,omitempty" env:"PICOCLAW_AGENTS_DEFAULTS_MAX_MEDIA_SIZE"`
Routing *RoutingConfig `json:"routing,omitempty"`
ToolFeedback *ToolFeedbackConfig `json:"tool_feedback,omitempty"`
ToolFeedback ToolFeedbackConfig `json:"tool_feedback,omitempty"`
}
// ToolFeedbackConfig controls whether tool execution details are sent to the
@ -229,7 +229,7 @@ func (d *AgentDefaults) GetMaxMediaSize() int {
// GetToolFeedbackMaxArgsLength returns the max args preview length for tool feedback messages.
func (d *AgentDefaults) GetToolFeedbackMaxArgsLength() int {
if d.ToolFeedback != nil && d.ToolFeedback.MaxArgsLength > 0 {
if d.ToolFeedback.MaxArgsLength > 0 {
return d.ToolFeedback.MaxArgsLength
}
return 300
@ -237,7 +237,7 @@ func (d *AgentDefaults) GetToolFeedbackMaxArgsLength() int {
// IsToolFeedbackEnabled returns true when tool feedback messages should be sent to the chat.
func (d *AgentDefaults) IsToolFeedbackEnabled() bool {
return d.ToolFeedback != nil && d.ToolFeedback.Enabled
return d.ToolFeedback.Enabled
}
// GetModelName returns the effective model name for the agent defaults.

View file

@ -35,6 +35,10 @@ func DefaultConfig() *Config {
MaxToolIterations: 50,
SummarizeMessageThreshold: 20,
SummarizeTokenPercent: 75,
ToolFeedback: ToolFeedbackConfig{
Enabled: true,
MaxArgsLength: 300,
},
},
},
Bindings: []AgentBinding{},