}
client := newModelClient(address, auth, agent.CacheKey(), usagePath)
- backup, err := rebuild(ctx, agent, plan.added, client, newCompactor(client, agent.Prompt, config.Compactor), out)
+ backup, err := rebuild(ctx, agent, plan.added, client, newCompactor(client, agent.Prompt, config.Compactor, agent.Tools()), out)
if err != nil {
return fmt.Errorf("rebuild imported memory: %w", err)
}
"owner: " + owner,
fmt.Sprintf("bytes: %d (new batch text)", p.bytes),
fmt.Sprintf("messages: %d (merged log)", p.messages),
- fmt.Sprintf("estimated calls: %.0f (about 1.3 per message, limit %d)", estimate, buildCallLimit),
+ fmt.Sprintf("estimated calls: %.0f (about 1.3 per message, limit %d)", estimate, rebuildCallLimit),
}
_, err = io.WriteString(out, strings.Join(lines, "\n")+"\n")
}
var state WhatsAppStateFile
+
err = json.Unmarshal(data, &state)
if err != nil {
return nil, "", fmt.Errorf("decode pending import names: %w", err)
}
var err error
+
plan.added, err = rebuildMerge(nil, plan.added)
if err != nil {
return plan, fmt.Errorf("order import batches: %w", err)
}()
var file *zip.File
+
for _, entry := range archive.File {
if filepath.Base(entry.Name) == "_chat.txt" && !entry.FileInfo().IsDir() {
if file != nil {
scanner := bufio.NewScanner(io.LimitReader(reader, whatsappImportBytes+1))
scanner.Buffer(make([]byte, 64*1024), buildLineBytes)
+
for scanner.Scan() {
line := strings.ReplaceAll(scanner.Text(), "\u200e", "")
match := whatsappImportStart.FindStringSubmatch(line)
}
messages[len(messages)-1].Text += "\n" + line
+
continue
}