X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/2daf91497c2cc70d7156f7c0d99b1451933a818a..016d46008fc9726d2617e4e3ea098113f34c7636:/compactor.go?ds=sidebyside diff --git a/compactor.go b/compactor.go index efb183f..be17c15 100644 --- a/compactor.go +++ b/compactor.go @@ -69,11 +69,13 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) { } var first []any + for _, message := range compactorTexts(task.Context, text) { first = append(first, modelUserMessage(message)) } var lines []string + 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 + response, err = c.client.Create(ctx, ModelRequest{ Model: c.model.Model, Effort: c.model.Effort, @@ -157,6 +160,7 @@ func compactorTexts(view, task string) []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])) }