Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/protocol/persistence/checkpoint-saver.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ export class CdsCheckpointSaver extends BaseCheckpointSaver {
}

const prepared = copyCheckpoint(checkpoint)
for (const msg of prepared.channel_values.messages ?? []) {
delete msg.additional_kwargs
if (Array.isArray(prepared.channel_values.messages)) {
// copyCheckpoint only creates a shallow copy, so we need to modify a copy of messages
prepared.channel_values.messages = prepared.channel_values.messages.map((msg) => {
if (!msg?.additional_kwargs) return msg
return { ...msg, additional_kwargs: {} }
})
}
const [, serializedCheckpoint] = await this.serde.dumpsTyped(prepared)
const [, serializedMetadata] = await this.serde.dumpsTyped(metadata)
Expand Down
Loading