]> git.giacomolli.uk - onechat/blobdiff - agent.go
Accept owner photos and image files in Telegram
[onechat] / agent.go
index dbcabd24321ffc33ed4607a00159239d598786b9..97d668585dd42d36e7816c3d2870e0d950b613d0 100644 (file)
--- a/agent.go
+++ b/agent.go
@@ -80,6 +80,16 @@ type Agent struct {
        config AgentConfig
 }
 
+// Images returns the shared data-directory image store, also for a child.
+func (a *Agent) Images() *ImageStore {
+       root := a.dir
+       if a.config.Parent != "" {
+               root = filepath.Dir(filepath.Dir(root))
+       }
+
+       return &ImageStore{dir: filepath.Join(filepath.Dir(root), imageDirName)}
+}
+
 // CacheKey returns the prompt cache key of every model call of the agent.
 func (a *Agent) CacheKey() string {
        return "onechat-" + a.config.ID