Add more actions, small fixups in the UI, add stop action

This commit is contained in:
mudler
2024-04-15 17:50:51 +02:00
parent 7db2b10bd2
commit 55b7b4a41e
28 changed files with 469 additions and 190 deletions

View File

@@ -3,6 +3,7 @@ package agent
import (
"context"
"fmt"
"time"
"github.com/mudler/local-agent-framework/action"
@@ -22,7 +23,7 @@ type ActionCurrentState struct {
// Actions is something the agent can do
type Action interface {
Run(action.ActionParams) (string, error)
Run(ctx context.Context, action action.ActionParams) (string, error)
Definition() action.ActionDefinition
}
@@ -143,9 +144,9 @@ func (a *Agent) systemInternalActions() Actions {
if a.options.enableHUD {
acts = append(acts, action.NewState())
}
if a.options.canStopItself {
acts = append(acts, action.NewStop())
}
//if a.options.canStopItself {
// acts = append(acts, action.NewStop())
// }
return acts
}
@@ -171,6 +172,7 @@ func (a *Agent) prepareHUD() PromptHUD {
CurrentState: *a.currentState,
PermanentGoal: a.options.permanentGoal,
ShowCharacter: a.options.showCharacter,
Time: time.Now().Format(time.RFC3339),
}
}