]> git.giacomolli.uk - onechat/blobdiff - agent.go
Separate returns from longer statement blocks
[onechat] / agent.go
index 1be2b0a136f54dbfa55573ce4b37e572f9798191..3fc954672e9038e9c2a154ced280d419def63a0a 100644 (file)
--- a/agent.go
+++ b/agent.go
@@ -87,10 +87,15 @@ func (a *Agent) CacheKey() string {
 func (a *Agent) Prompt() (string, error) {
        instructions, err := a.instructions()
        if err != nil {
 func (a *Agent) Prompt() (string, error) {
        instructions, err := a.instructions()
        if err != nil {
-               return "", err
+               return "", fmt.Errorf("read prompt instructions: %w", err)
+       }
+
+       path, err := filepath.Abs(filepath.Join(a.dir, agentInstructionsFileName))
+       if err != nil {
+               return "", fmt.Errorf("find instructions path: %w", err)
        }
 
        }
 
-       return prompt(a.config.Name, instructions), nil
+       return prompt(a.config.Name, path, instructions), nil
 }
 
 // SubagentPrompt returns the system prompt of a subagent of the agent, with the
 }
 
 // SubagentPrompt returns the system prompt of a subagent of the agent, with the