Time shouldn't be part of the Hud, but always rendered
Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
@@ -3,7 +3,6 @@ package agent
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/mudler/local-agent-framework/action"
|
"github.com/mudler/local-agent-framework/action"
|
||||||
"github.com/mudler/local-agent-framework/xlog"
|
"github.com/mudler/local-agent-framework/xlog"
|
||||||
@@ -196,7 +195,6 @@ func (a *Agent) prepareHUD() PromptHUD {
|
|||||||
CurrentState: *a.currentState,
|
CurrentState: *a.currentState,
|
||||||
PermanentGoal: a.options.permanentGoal,
|
PermanentGoal: a.options.permanentGoal,
|
||||||
ShowCharacter: a.options.showCharacter,
|
ShowCharacter: a.options.showCharacter,
|
||||||
Time: time.Now().Format(time.RFC3339),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ type PromptHUD struct {
|
|||||||
CurrentState action.StateResult `json:"current_state"`
|
CurrentState action.StateResult `json:"current_state"`
|
||||||
PermanentGoal string `json:"permanent_goal"`
|
PermanentGoal string `json:"permanent_goal"`
|
||||||
ShowCharacter bool `json:"show_character"`
|
ShowCharacter bool `json:"show_character"`
|
||||||
Time string `json:"time"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Character struct {
|
type Character struct {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package agent
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/mudler/local-agent-framework/action"
|
"github.com/mudler/local-agent-framework/action"
|
||||||
"github.com/sashabaranov/go-openai"
|
"github.com/sashabaranov/go-openai"
|
||||||
@@ -28,10 +29,12 @@ func renderTemplate(templ string, hud *PromptHUD, actions Actions, reasoning str
|
|||||||
Actions []action.ActionDefinition
|
Actions []action.ActionDefinition
|
||||||
Reasoning string
|
Reasoning string
|
||||||
Messages []openai.ChatCompletionMessage
|
Messages []openai.ChatCompletionMessage
|
||||||
|
Time string
|
||||||
}{
|
}{
|
||||||
Actions: definitions,
|
Actions: definitions,
|
||||||
HUD: hud,
|
HUD: hud,
|
||||||
Reasoning: reasoning,
|
Reasoning: reasoning,
|
||||||
|
Time: time.Now().Format(time.RFC3339),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -42,7 +45,7 @@ func renderTemplate(templ string, hud *PromptHUD, actions Actions, reasoning str
|
|||||||
|
|
||||||
const innerMonologueTemplate = `"This is not a typical conversation between an assistant and an user.
|
const innerMonologueTemplate = `"This is not a typical conversation between an assistant and an user.
|
||||||
You are thinking out loud by yourself now, and you are evaluating the current situation.
|
You are thinking out loud by yourself now, and you are evaluating the current situation.
|
||||||
Considering the goal and the persistent goal, if you have one, and do something, or decide to plan something for later on. If you have the action available, you might also decide to engage a conversation with the user by notifying him."`
|
Considering the goal and the persistent goal (if you have one) do an action or decide to plan something for later on. If possible for you, you might also decide to engage a conversation with the user by notifying him."`
|
||||||
|
|
||||||
const hudTemplate = `{{with .HUD }}{{if .ShowCharacter}}The assistant acts like an human, has a character and the replies and actions might be influenced by it.
|
const hudTemplate = `{{with .HUD }}{{if .ShowCharacter}}The assistant acts like an human, has a character and the replies and actions might be influenced by it.
|
||||||
{{if .Character.Name}}This is the assistant name: {{.Character.Name}}
|
{{if .Character.Name}}This is the assistant name: {{.Character.Name}}
|
||||||
@@ -54,13 +57,13 @@ const hudTemplate = `{{with .HUD }}{{if .ShowCharacter}}The assistant acts like
|
|||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
This is your current state:
|
This is your current state:
|
||||||
Current time: {{.Time}}
|
|
||||||
NowDoing: {{if .CurrentState.NowDoing}}{{.CurrentState.NowDoing}}{{else}}Nothing{{end}}
|
NowDoing: {{if .CurrentState.NowDoing}}{{.CurrentState.NowDoing}}{{else}}Nothing{{end}}
|
||||||
DoingNext: {{if .CurrentState.DoingNext}}{{.CurrentState.DoingNext}}{{else}}Nothing{{end}}
|
DoingNext: {{if .CurrentState.DoingNext}}{{.CurrentState.DoingNext}}{{else}}Nothing{{end}}
|
||||||
Your permanent goal is: {{if .PermanentGoal}}{{.PermanentGoal}}{{else}}Nothing{{end}}
|
Your permanent goal is: {{if .PermanentGoal}}{{.PermanentGoal}}{{else}}Nothing{{end}}
|
||||||
Your current goal is: {{if .CurrentState.Goal}}{{.CurrentState.Goal}}{{else}}Nothing{{end}}
|
Your current goal is: {{if .CurrentState.Goal}}{{.CurrentState.Goal}}{{else}}Nothing{{end}}
|
||||||
You have done: {{range .CurrentState.DoneHistory}}{{.}} {{end}}
|
You have done: {{range .CurrentState.DoneHistory}}{{.}} {{end}}
|
||||||
You have a short memory with: {{range .CurrentState.Memories}}{{.}} {{end}}{{end}}`
|
You have a short memory with: {{range .CurrentState.Memories}}{{.}} {{end}}{{end}}
|
||||||
|
Current time: is {{.Time}}`
|
||||||
|
|
||||||
const pickSelfTemplate = `You can take any of the following tools:
|
const pickSelfTemplate = `You can take any of the following tools:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user