Ozwell Chatbot Client Demo
Embedded chat with tool execution via MCP JSON-RPC and postMessage
How It Works (Sequence Diagram)
(Gateway or Ollama) participant Widget as Widget (iframe) participant Handler as Tool Handler Browser->>Ozwell: 1. Load ozwell-loader.js Note over Browser,Ozwell: Script tag embed Browser->>Browser: 2. User clicks chat button Browser->>Widget: 3. Create iframe (lazy loading) Note over Widget: Chat widget loads rect rgb(255, 243, 205) Note over Widget: SECURE BOUNDARY
All chat messages stay in iframe Widget->>Widget: User types message Widget->>Ozwell: POST /v1/chat/completions
(stream=true) Note over Widget,Ozwell: Authorization: Bearer agnt_key-... Ozwell->>LLM: Forward request Note over Ozwell,LLM: Gateway or Ollama
(based on config) rect rgb(230, 255, 230) Note over Ozwell,Widget: SSE STREAMING LLM-->>Ozwell: Stream: chunk 1 Ozwell-->>Widget: data: {"delta":{"content":"Hello"}} LLM-->>Ozwell: Stream: chunk 2 Ozwell-->>Widget: data: {"delta":{"content":"!"}} Note over Ozwell: Heartbeat every 25s
: heartbeat LLM-->>Ozwell: Stream: finish_reason=stop Ozwell-->>Widget: data: [DONE] end Widget->>Widget: Parse tool calls from response end Widget->>Handler: 4. MCP JSON-RPC: tools/call Note over Widget,Handler: Only tool calls cross boundary Handler->>Handler: 5. Execute tool (update form) Handler-->>Widget: 6. MCP JSON-RPC response
User Information
Type directly or use chat to update fields
Live Event Log
Watch MCP tool calls and postMessage in action