INNER CODE UNIT · JavaScript

buffer

WJZ-P/gemini-skill · src/atlas-provider.js:64

      buffer = buffer.slice(separatorIndex + 2);

      const dataLines = eventBlock
        .split('\n')
        .filter((line) => line.startsWith('data:'))
        .map((line) => line.slice(5).trim());

      if (dataLines.length === 0) continue;
      const payload = dataLines.join('\n');
      if (payload === '[DONE]') return;

      try {
        yield JSON.parse(payload);
      } catch {
        // 忽略非 JSON 的 data 帧,保持流式消费健壮性
      }
    }
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…