]> git.giacomolli.uk - onechat/blobdiff - compactor.go
Sync agent queue replacements before success
[onechat] / compactor.go
index 6738955143a59125c77f01dd73a938eb0a3dd203..64ff1fd60635611daded0d43aff2cd55e6d5754a 100644 (file)
@@ -56,12 +56,12 @@ func newCompactor(client *ModelClient, instructions func() (string, error), mode
 func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) {
        text, err := compactorTask(task)
        if err != nil {
-               return "", err
+               return "", fmt.Errorf("prepare compaction task: %w", err)
        }
 
        instructions, err := c.instructions()
        if err != nil {
-               return "", err
+               return "", fmt.Errorf("read compaction instructions: %w", err)
        }
 
        source := task.Context + "\n" + text
@@ -110,7 +110,7 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) {
        }
 
        if len(lines) == 0 {
-               return "", err
+               return "", fmt.Errorf("summarize node: %w", err)
        }
 
        return compactorShortest(lines), nil