feat: track plan action when is being executed, also tests (#72)
* feat: track plan action when is being executed, also tests * Update core/agent/agent_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update core/agent/actions.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e5e238efc0
commit
abb3ffc109
@@ -612,21 +612,24 @@ func (a *Agent) consumeJob(job *Job, role string) {
|
||||
|
||||
// If we don't have to reply , run the action!
|
||||
if !chosenAction.Definition().Name.Is(action.ReplyActionName) {
|
||||
result, err := a.runAction(chosenAction, actionParams)
|
||||
if err != nil {
|
||||
//job.Result.Finish(fmt.Errorf("error running action: %w", err))
|
||||
//return
|
||||
// make the LLM aware of the error of running the action instead of stopping the job here
|
||||
result.Result = fmt.Sprintf("Error running tool: %v", err)
|
||||
|
||||
if !chosenAction.Definition().Name.Is(action.PlanActionName) {
|
||||
result, err := a.runAction(chosenAction, actionParams)
|
||||
if err != nil {
|
||||
//job.Result.Finish(fmt.Errorf("error running action: %w", err))
|
||||
//return
|
||||
// make the LLM aware of the error of running the action instead of stopping the job here
|
||||
result.Result = fmt.Sprintf("Error running tool: %v", err)
|
||||
}
|
||||
|
||||
stateResult := ActionState{ActionCurrentState{chosenAction, actionParams, reasoning}, result}
|
||||
job.Result.SetResult(stateResult)
|
||||
job.CallbackWithResult(stateResult)
|
||||
xlog.Debug("Action executed", "agent", a.Character.Name, "action", chosenAction.Definition().Name, "result", result)
|
||||
|
||||
a.addFunctionResultToConversation(chosenAction, actionParams, result)
|
||||
}
|
||||
|
||||
stateResult := ActionState{ActionCurrentState{chosenAction, actionParams, reasoning}, result}
|
||||
job.Result.SetResult(stateResult)
|
||||
job.CallbackWithResult(stateResult)
|
||||
xlog.Debug("Action executed", "agent", a.Character.Name, "action", chosenAction.Definition().Name, "result", result)
|
||||
|
||||
a.addFunctionResultToConversation(chosenAction, actionParams, result)
|
||||
|
||||
//a.currentConversation = append(a.currentConversation, messages...)
|
||||
//a.currentConversation = messages
|
||||
|
||||
|
||||
Reference in New Issue
Block a user