INNER CODE UNIT · TypeScript

streamAsyncIterable

rgommezz/react-native-chatgpt · src/api/index.ts:142

        for await (const chunk of streamAsyncIterable(res.body)) {
          const str = new TextDecoder().decode(chunk);
          window.ReactNativeWebView.postMessage(JSON.stringify({type: 'RAW_ACCUMULATED_RESPONSE', payload: str}));
        }
      } catch (e) {
        // Nothing to do here
      }
    };

    true;
  `;
};

/**
 * Calls a global function in the Webview window object to send a streamed message
 */
export function postStreamedMessage({
  accessToken,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…