diff --git a/examples/web-page-bot/README.md b/examples/web-page-bot/README.md new file mode 100644 index 000000000..e31f41ca2 --- /dev/null +++ b/examples/web-page-bot/README.md @@ -0,0 +1,48 @@ +# Page Bot Adapter — Embed Demo + +> English | [中文](./README.zh.md) + +A single self-contained HTML page that demos the LangBot **Page Bot** +(`web_page_bot`) embeddable chat widget — the one you drop onto any website with +a single ``. +- `widget.js` is served by LangBot pre-configured for that bot UUID — title, + bubble icon, language and optional Cloudflare Turnstile protection all come + from the bot's config, no page changes needed. +- Messages travel over a WebSocket to the bot's bound pipeline; replies stream + back into the bubble. + +> The widget loads `widget.js` from your LangBot instance, so the **base URL +> must be reachable from the browser** you open this page in. If LangBot runs on +> a server, use its public address instead of `localhost`. diff --git a/examples/web-page-bot/README.zh.md b/examples/web-page-bot/README.zh.md new file mode 100644 index 000000000..9006464d8 --- /dev/null +++ b/examples/web-page-bot/README.zh.md @@ -0,0 +1,44 @@ +# 页面机器人适配器 —— 嵌入演示 + +> [English](./README.md) | 中文 + +一个自包含的单文件 HTML 页面,用于演示 LangBot **页面机器人** +(`web_page_bot`) 的可嵌入聊天组件 —— 也就是你用一行 ``。 +- `widget.js` 由 LangBot 针对该机器人 UUID 预配置后下发 —— 标题、气泡图标、语言 + 以及可选的 Cloudflare Turnstile 防护,全部来自机器人配置,无需改动页面。 +- 消息通过 WebSocket 发往机器人绑定的流水线,回复流式回到气泡中。 + +> 组件会从你的 LangBot 实例加载 `widget.js`,因此 **base URL 必须能从你打开本页 +> 的浏览器访问到**。如果 LangBot 部署在服务器上,请用它的公网地址而非 +> `localhost`。 diff --git a/examples/web-page-bot/index.html b/examples/web-page-bot/index.html new file mode 100644 index 000000000..ef88906f1 --- /dev/null +++ b/examples/web-page-bot/index.html @@ -0,0 +1,205 @@ + + +
+ + +Point this page at a running LangBot instance and a Page Bot you created,
+then load the live embed widget below to chat with it — exactly as your site visitors would.
+Page Bot adapter in the WebUI, then copy its UUID from the embed code.This is exactly what you paste into your own site (before </body>). It updates as you edit the fields above.
<script data-title="LangBot" src="http://localhost:5300/api/v1/embed/<bot-uuid>/widget.js"></script>+
<script> tag pulls widget.js from your LangBot instance, pre-configured for that bot UUID.If the widget loaded correctly, you should see a blue chat bubble in the bottom-right corner.
-Replace the BOT_UUID below with your actual bot UUID.