For the complete documentation index, see llms.txt. This page is also available as Markdown.

ReactJS(JavaScript)

使用 @convai/experience-embed 组件将 Convai 的像素流集成到您的 React JavaScript 应用中。

import React, { useRef } from 'react';
import { PixelStreamComponent } from '@convai/experience-embed';

function App() {
  const pixelStreamRef = useRef(null);

  const handleStart = async () => {
    await pixelStreamRef.current?.initializeExperience();
  };

  return (
    <>
      <PixelStreamComponent
        ref={pixelStreamRef}
        expId="您的体验 ID"
        InitialScreen={<div>加载中...</div>}
      />
      <button onClick={handleStart}>开始体验</button>
    </>
  );
}

最后更新于

这有帮助吗?