MCPcopy Create free account
hub / github.com/dwgx/WindsurfAPI / parseChatFrames

Function parseChatFrames

test/chat-cache-hit.test.js:31–41  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

29}
30
31function parseChatFrames(raw) {
32 return raw
33 .split('\n\n')
34 .filter(Boolean)
35 .filter(frame => !frame.startsWith(':'))
36 .map(frame => {
37 const dataLine = frame.split('\n').find(line => line.startsWith('data: '));
38 const payload = dataLine?.slice(6) || '';
39 return payload === '[DONE]' ? '[DONE]' : JSON.parse(payload);
40 });
41}
42
43afterEach(() => {
44 cacheClear();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected