mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
refactor(export): clean up unnecessary fields and simplify data structure
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
8e221a3606
commit
9060663f60
10 changed files with 135 additions and 145 deletions
|
|
@ -28,7 +28,7 @@ export function normalizeSessionData(
|
|||
}
|
||||
});
|
||||
|
||||
// Build index of assistant messages by uuid for response_id mapping
|
||||
// Build index of assistant messages by uuid for usageMetadata merging
|
||||
const assistantMessageIndexByUuid = new Map<string, number>();
|
||||
normalized.forEach((message, index) => {
|
||||
if (message.type === 'assistant') {
|
||||
|
|
@ -66,17 +66,6 @@ export function normalizeSessionData(
|
|||
mergeToolCallData(existingMessage.toolCall, toolCallMessage.toolCall);
|
||||
}
|
||||
|
||||
// Merge response_id from assistant records
|
||||
for (const record of originalRecords) {
|
||||
if (record.type !== 'assistant') continue;
|
||||
if (!record.response_id) continue;
|
||||
|
||||
const existingIndex = assistantMessageIndexByUuid.get(record.uuid);
|
||||
if (existingIndex !== undefined) {
|
||||
normalized[existingIndex].response_id = record.response_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Merge usageMetadata from assistant records
|
||||
for (const record of originalRecords) {
|
||||
if (record.type !== 'assistant') continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue