fix(sse): prevent errors by returning early if response data is undefined

This commit is contained in:
sheldon guo 2025-02-12 17:25:27 +08:00
parent 69643f4e5b
commit a8c8a3d8ff

View File

@ -53,6 +53,7 @@ export const startMsgSSEStreamWithRetry: () => () => void = () => {
responseType: 'stream', responseType: 'stream',
adapter: 'fetch', adapter: 'fetch',
}); });
if (!res?.data) return;
const stream = res.data; const stream = res.data;
const reader = stream.pipeThrough(new TextDecoderStream()).getReader(); const reader = stream.pipeThrough(new TextDecoderStream()).getReader();
retryTimes = 0; retryTimes = 0;