1.9 KiB
1.9 KiB
Web Interface
The gbtheme web interface provides the front‑end experience for end users. It consists of three core HTML pages and a set of JavaScript modules that handle real‑time communication with the bot server.
Pages
| Page | Purpose |
|---|---|
index.html |
Application shell, loads the main JavaScript bundle and displays the navigation bar. |
chat.html |
Primary conversation view – shows the chat transcript, input box, and typing indicator. |
login.html |
Simple authentication screen used when the bot is configured with a login flow. |
JavaScript Modules
- app.js – Initializes the WebSocket connection, routes incoming bot messages to the UI, and sends user input (
TALK) back to the server. - websocket.js – Low‑level wrapper around the browser’s
WebSocketAPI, handling reconnection logic and ping/pong keep‑alive.
Interaction Flow
- Load –
index.htmlloadsapp.js, which creates aWebSockettows://<host>/ws. - Handshake – The server sends a
HELLOmessage containing bot metadata (name, version). - User Input – When the user presses Enter in the chat input,
app.jssends aTALKJSON payload. - Bot Response – The server streams
MESSAGEevents;app.jsappends them to the chat window. - Typing Indicator – While the LLM processes, the server sends a
TYPINGevent; the UI shows an animated ellipsis.
Customization Points
- CSS Variables – Override colors, fonts, and spacing in
css/main.css(:root { --primary-color: … }). - HTML Layout – Replace the
<header>or<footer>sections inindex.htmlto match branding. - JS Hooks – Add custom event listeners in
app.js(e.g., analytics onMESSAGEreceipt).
All files are located under the theme’s web/ and js/ directories as described in the Theme Structure.