]> git.giacomolli.uk - onechat/blobdiff - compactor.go
Name the tools that check the Go rules
[onechat] / compactor.go
index e7a68664d8b138f0e3cda1dd391afccf1093845c..be17c15cd43e29b98e433ed4955acbd9cfa22fe3 100644 (file)
@@ -65,15 +65,17 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) {
 
        instructions, err := c.instructions()
        if err != nil {
 
        instructions, err := c.instructions()
        if err != nil {
-               return "", fmt.Errorf("compact node (%d, %d): %w", task.Level, task.Index, err)
+               return "", err
        }
 
        var first []any
        }
 
        var first []any
+
        for _, message := range compactorTexts(task.Context, text) {
                first = append(first, modelUserMessage(message))
        }
 
        var lines []string
        for _, message := range compactorTexts(task.Context, text) {
                first = append(first, modelUserMessage(message))
        }
 
        var lines []string
+
        note := ""
        for len(lines) < compactorTries {
                input := first
        note := ""
        for len(lines) < compactorTries {
                input := first
@@ -82,6 +84,7 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) {
                }
 
                var response ModelResponse
                }
 
                var response ModelResponse
+
                response, err = c.client.Create(ctx, ModelRequest{
                        Model:        c.model.Model,
                        Effort:       c.model.Effort,
                response, err = c.client.Create(ctx, ModelRequest{
                        Model:        c.model.Model,
                        Effort:       c.model.Effort,
@@ -109,7 +112,7 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) {
        }
 
        if len(lines) == 0 {
        }
 
        if len(lines) == 0 {
-               return "", fmt.Errorf("compact node (%d, %d): %w", task.Level, task.Index, err)
+               return "", err
        }
 
        return compactorShortest(lines), nil
        }
 
        return compactorShortest(lines), nil
@@ -157,6 +160,7 @@ func compactorTexts(view, task string) []string {
        whole := len(lines) - len(lines)%compactorBlock
 
        var texts []string
        whole := len(lines) - len(lines)%compactorBlock
 
        var texts []string
+
        for n := 0; n < whole; n += compactorBlock {
                texts = append(texts, viewMessage(n == 0, lines[n:n+compactorBlock]))
        }
        for n := 0; n < whole; n += compactorBlock {
                texts = append(texts, viewMessage(n == 0, lines[n:n+compactorBlock]))
        }