Standardize action results

This commit is contained in:
mudler
2025-03-01 17:27:07 +01:00
parent 8492c95cb6
commit 5b4f618ca3
22 changed files with 108 additions and 67 deletions

View File

@@ -242,9 +242,12 @@ func (a *Agent) Memory() RAGDB {
func (a *Agent) runAction(chosenAction Action, params action.ActionParams) (result string, err error) {
for _, action := range a.systemInternalActions() {
if action.Definition().Name == chosenAction.Definition().Name {
if result, err = action.Run(a.actionContext, params); err != nil {
res, err := action.Run(a.actionContext, params)
if err != nil {
return "", fmt.Errorf("error running action: %w", err)
}
result = res.Result
}
}