refactor: Integrate streamId handling for improved resumable functionality for attachments

- Added streamId parameter to various functions to support resumable mode in tool loading and memory processing.
- Updated related methods to ensure proper handling of attachments and responses based on the presence of streamId, enhancing the overall streaming experience.
- Improved logging and attachment management to accommodate both standard and resumable modes.
This commit is contained in:
Danny Avila 2025-12-12 20:06:55 -05:00
parent 98f2025f6f
commit 9fc225a347
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
6 changed files with 55 additions and 19 deletions

View file

@ -189,12 +189,8 @@ export default function useResumableSSE(
}
if (data.sync != null) {
const textPart = data.resumeState?.aggregatedContent?.find(
(p: { type: string }) => p.type === 'text',
);
console.log('[ResumableSSE] SYNC received', {
runSteps: data.resumeState?.runSteps?.length ?? 0,
contentLength: textPart?.text?.length ?? 0,
});
const runId = v4();
@ -231,9 +227,6 @@ export default function useResumableSSE(
);
}
const textPart = data.resumeState.aggregatedContent?.find(
(p: { type: string }) => p.type === 'text',
);
console.log('[ResumableSSE] SYNC update', {
userMsgId,
serverResponseId,
@ -241,7 +234,6 @@ export default function useResumableSSE(
foundMessageId: responseIdx >= 0 ? messages[responseIdx]?.messageId : null,
messagesCount: messages.length,
aggregatedContentLength: data.resumeState.aggregatedContent?.length,
textContentLength: textPart?.text?.length ?? 0,
});
if (responseIdx >= 0) {