mirror of
https://github.com/pionxzh/chatgpt-exporter.git
synced 2026-07-23 09:00:51 -05:00
fix: preserve citations and content references when merging continuation nodes
When thinking models produce commentary + final response messages, mergeContinuationNodes was only keeping the first message's metadata. The content_references (mapping citeturn markers to URLs) on the final message were lost, causing raw citation text in exports. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
16
src/api.ts
16
src/api.ts
@@ -997,6 +997,22 @@ function mergeContinuationNodes(nodes: ConversationNode[]): ConversationNode[] {
|
||||
const separator = prevNode.message.channel !== node.message.channel ? '\n\n' : ''
|
||||
prevNode.message.content.parts[prevNode.message.content.parts.length - 1] += separator + node.message.content.parts[0]
|
||||
prevNode.message.content.parts.push(...node.message.content.parts.slice(1))
|
||||
|
||||
if (node.message.metadata) {
|
||||
const prevMeta = (prevNode.message.metadata ??= {} as any)
|
||||
if (node.message.metadata.citations?.length) {
|
||||
prevMeta.citations = [
|
||||
...(prevMeta.citations || []),
|
||||
...node.message.metadata.citations,
|
||||
]
|
||||
}
|
||||
if (node.message.metadata.content_references?.length) {
|
||||
prevMeta.content_references = [
|
||||
...(prevMeta.content_references || []),
|
||||
...node.message.metadata.content_references,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result.push(node)
|
||||
|
||||
Reference in New Issue
Block a user