mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-19 07:43:09 +00:00
fix: stop tool-result entries from splitting turns and inflating Conversation
Tool results in JSONL are type:"user" entries with no text content. groupIntoTurns was flushing on every type:"user" entry, creating phantom turns that got classified as Conversation. Now only flush when the user entry contains actual text. Fixes #7
This commit is contained in:
parent
b04d1e0ff8
commit
74744f07bb
2 changed files with 44 additions and 11 deletions
|
|
@ -149,18 +149,21 @@ function groupIntoTurns(entries: JournalEntry[], seenMsgIds: Set<string>): Parse
|
|||
|
||||
for (const entry of entries) {
|
||||
if (entry.type === 'user') {
|
||||
if (currentCalls.length > 0) {
|
||||
turns.push({
|
||||
userMessage: currentUserMessage,
|
||||
assistantCalls: currentCalls,
|
||||
timestamp: currentTimestamp,
|
||||
sessionId: currentSessionId,
|
||||
})
|
||||
const text = getUserMessageText(entry)
|
||||
if (text.trim()) {
|
||||
if (currentCalls.length > 0) {
|
||||
turns.push({
|
||||
userMessage: currentUserMessage,
|
||||
assistantCalls: currentCalls,
|
||||
timestamp: currentTimestamp,
|
||||
sessionId: currentSessionId,
|
||||
})
|
||||
}
|
||||
currentUserMessage = text
|
||||
currentCalls = []
|
||||
currentTimestamp = entry.timestamp ?? ''
|
||||
currentSessionId = entry.sessionId ?? ''
|
||||
}
|
||||
currentUserMessage = getUserMessageText(entry)
|
||||
currentCalls = []
|
||||
currentTimestamp = entry.timestamp ?? ''
|
||||
currentSessionId = entry.sessionId ?? ''
|
||||
} else if (entry.type === 'assistant') {
|
||||
const msgId = getMessageId(entry)
|
||||
if (msgId && seenMsgIds.has(msgId)) continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue