Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

4.8 KB
Raw Blame
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="robots" content="noindex">
  <title data-i18n="widget_demo.meta_title">3D Agent Widget Demo</title>
  <style>
    body {
      font-family: sans-serif;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2rem;
      background-color: #f0f0f0;
      padding: 2rem;
    }
    .demo-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 2rem;
      width: 100%;
      max-width: 1200px;
    }
    .widget-card {
      background: white;
      border-radius: 8px;
      box-shadow: 0 4px 8px rgba(0,0,0,0.1);
      padding: 1rem;
    }
    h2 {
      margin-top: 0;
    }
    .widget-container {
      width: 100%;
      height: 420px;
      border: 1px solid #ccc;
      border-radius: 8px;
      overflow: hidden; /* Ensures the iframe stays within the rounded corners */
    }
    .instructions {
      width: 100%;
      max-width: 800px;
      margin-top: 2rem;
    }
    textarea {
      width: 100%;
      box-sizing: border-box;
      height: 200px;
      padding: 10px;
      border: 1px solid #ccc;
      border-radius: 4px;
      font-family: monospace;
      font-size: 14px;
      resize: vertical;
    }
    code {
      background: #e0e0e0;
      padding: 2px 4px;
      border-radius: 3px;
    }
  </style>
</head>
<body>

  <h1 data-i18n="widget_demo.3d_agent_widget_demo">3D Agent Widget Demo</h1>

  <div class="demo-grid">
    <div class="widget-card">
      <h2 data-i18n="widget_demo.default">Default</h2>
      <div class="widget-container">
        <div class="threews-widget" data-agent-id="041cb44a-3c58-4d56-b083-d5234563456a"></div>
      </div>
    </div>
    <div class="widget-card">
      <h2 data-i18n="widget_demo.dark_background">Dark background</h2>
      <div class="widget-container">
        <div class="threews-widget" data-agent-id="041cb44a-3c58-4d56-b083-d5234563456a" data-background="dark"></div>
      </div>
    </div>
    <div class="widget-card">
      <h2 data-i18n="widget_demo.nameplate_hidden">Nameplate hidden</h2>
      <div class="widget-container">
        <div class="threews-widget" data-agent-id="041cb44a-3c58-4d56-b083-d5234563456a" data-nameplate="false"></div>
      </div>
    </div>
  </div>

  <div class="instructions">
    <h2 data-i18n="widget_demo.how_to_use_it">How to use it</h2>
    <p data-i18n-html="widget_demo.copy_and_paste_this_code_into_your">Copy and paste this code into your website. Customize it with <code>data-*</code> attributes.</p>
    <textarea readonly>
<div class="threews-widget" 
     data-agent-id="YOUR_AGENT_ID" 
     data-background="transparent"
     data-nameplate="true"
     style="width: 400px; height: 500px;">
</div>
<script src="https://three.ws/dist/widget.js" defer></script>
    </textarea>
    <p data-i18n="widget_demo.available_options">Available options:</p>
    <ul>
      <li data-i18n-html="widget_demo.required_the_id_of_the_agent_to"><code>data-agent-id</code>: (Required) The ID of the agent to display.</li>
      <li data-i18n-html="widget_demo.set_the_background_can_be_default_or"><code>data-background</code>: Set the background. Can be <code>transparent</code> (default), <code>dark</code>, or <code>light</code>.</li>
      <li data-i18n-html="widget_demo.set_to_to_hide_the_agent_s"><code>data-nameplate</code>: Set to <code>false</code> to hide the agent's name.</li>
    </ul>
  </div>

  <div class="instructions">
    <h2 data-i18n="widget_demo.dynamic_loading">Dynamic Loading</h2>
    <p data-i18n="widget_demo.the_widget_script_automatically_detects_new">The widget script automatically detects new widgets added to the page. Click the button to add another agent.</p>
    <button id="addWidgetBtn" data-i18n="widget_demo.add_another_widget">Add Another Widget</button>
    <div id="dynamic-container" style="margin-top: 1rem;"></div>
  </div>

  <script>
    document.getElementById('addWidgetBtn').addEventListener('click', () => {
      const container = document.getElementById('dynamic-container');
      const newWidget = document.createElement('div');
      newWidget.className = 'widget-card';
      newWidget.innerHTML = `
        <h2>Dynamically Added</h2>
        <div class="widget-container">
          <div class="threews-widget" data-agent-id="041cb44a-3c58-4d56-b083-d5234563456a" data-background="light"></div>
        </div>
      `;
      // To prevent adding too many, let's just replace the content
      container.innerHTML = ''; 
      container.appendChild(newWidget);
    });
  </script>

  <script src="/dist/widget.js" defer></script>

	<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
	<script type="module" src="/i18n.js"></script>
</body>
</html>