Skip to content

Commit 6e3e7c9

Browse files
Production rollout: Azure GPT-5.1 proxy, KV KB fallback, and config assistant demo
- Route backend proxy to Azure GPT-5.1 defaults - Add KV fallback for /api/kb when R2 is unavailable - Add Cloudflare-hostable config assistant demo page - Update deploy docs for Azure vars/secrets and demo deploy flow - Add backend chat + KB fallback tests
1 parent d38c47c commit 6e3e7c9

11 files changed

Lines changed: 1233 additions & 35 deletions

File tree

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Embeddable GenAI-powered web chat widget with client-side agent loop, tool calli
1313
- 💾 Session persistence (IndexedDB / localStorage)
1414
- 🌐 WebMCP support (Chrome 146+) — provider + consumer
1515
- 🎨 Shadow DOM isolation — works on any website
16-
- ☁️ Cloudflare Workers backend (D1, KV, R2, Queues)
16+
- ☁️ Cloudflare Workers backend (D1, KV, Queues; R2 optional)
1717
- 🔑 Hybrid API keys: BYOK + managed
1818

1919
## Quick Start
@@ -115,9 +115,9 @@ See the [Skill Authoring Guide](docs/skills.md) for full documentation on creati
115115
│ │ Queue │ │ Tickets │ │
116116
│ └─────────┘ └───────────┘ │
117117
│ ┌─────────┐ ┌───────────┐ │
118-
│ │ KB (R2) │ │ Admin │ │
118+
│ │ KB (KV/R2)│ │ Admin │ │
119119
│ └─────────┘ └───────────┘ │
120-
│ D1 · KV · R2 · Queues
120+
│ D1 · KV · Queues (R2 opt.)
121121
└──────────────────────────────┘
122122
```
123123

@@ -146,6 +146,13 @@ The widget can discover and use tools registered by the host page or other exten
146146
| `@vibetechnologies/webagent` | Client-side chat widget |
147147
| `@vibetechnologies/webagent-backend` | Cloudflare Workers backend |
148148

149+
## Examples
150+
151+
- `examples/basic/index.html` — minimal static embed example
152+
- `examples/ecommerce/index.html` — e-commerce flavored static demo
153+
- `examples/docs-site/index.html` — docs-focused static demo
154+
- `examples/config-assistant/index.html` — Cloudflare-hostable widget configuration assistant with live preview and copy-paste embed generation
155+
149156
## Development
150157

151158
```bash
@@ -154,6 +161,7 @@ pnpm typecheck # Type-check all packages
154161
pnpm build # Build all packages
155162
pnpm test # Run tests
156163
pnpm dev # Dev mode (all packages)
164+
pnpm --filter @vibetechnologies/webagent-backend dev:azure # Backend with ~/.env.d/azure-dev.env
157165
```
158166

159167
## License

docs/deploy.md

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ npx wrangler d1 create webagent-db
2121
# Create KV namespace
2222
npx wrangler kv namespace create KV
2323

24-
# Create R2 bucket
25-
npx wrangler r2 bucket create webagent-kb
26-
2724
# Create Queue
2825
npx wrangler queues create webagent-emails
26+
27+
# Optional (only if you want KB on R2 instead of KV fallback)
28+
npx wrangler r2 bucket create webagent-kb
2929
```
3030

3131
### 2. Update wrangler.toml
@@ -41,6 +41,10 @@ database_id = "YOUR_D1_DATABASE_ID"
4141
[[kv_namespaces]]
4242
binding = "KV"
4343
id = "YOUR_KV_NAMESPACE_ID"
44+
45+
[vars]
46+
AZURE_DEV_AI_BASE_URL = "https://vibe-dev-ai.cognitiveservices.azure.com/openai/v1"
47+
AZURE_DEV_AI_MODEL = "gpt-5.1"
4448
```
4549

4650
### 3. Set Secrets
@@ -53,6 +57,9 @@ npx wrangler secret put ADMIN_SECRET
5357

5458
# Resend API key for email delivery
5559
npx wrangler secret put RESEND_API_KEY
60+
61+
# Azure dev account key for GPT-5.1 proxying
62+
npx wrangler secret put AZURE_DEV_AI_API_KEY
5663
```
5764

5865
### 4. Run Migrations
@@ -83,6 +90,47 @@ After publishing to npm, the widget is available via:
8390
- unpkg: `https://unpkg.com/@vibetechnologies/webagent/dist/webagent.min.js`
8491
- jsDelivr: `https://cdn.jsdelivr.net/npm/@vibetechnologies/webagent/dist/webagent.min.js`
8592

93+
## Static Demo Deployment (Cloudflare Pages / Workers Assets)
94+
95+
The repository includes a static configuration assistant at `examples/config-assistant/index.html`. It uses a progressive bundle loader:
96+
97+
- **Development / local file usage**: tries `../../packages/widget/dist/webagent.min.js` first so the demo works directly from the repo or a local static server.
98+
- **Production hosting**: falls back to versioned CDN URLs for `@vibetechnologies/webagent`, which makes the page safe to deploy as plain static assets on Cloudflare without copying the widget build output.
99+
100+
### Cloudflare Pages
101+
102+
Deploy the example directory directly:
103+
104+
```bash
105+
pnpm --filter @vibetechnologies/webagent build
106+
npx wrangler pages deploy examples/config-assistant --project-name webagent-config-assistant
107+
```
108+
109+
If you want the demo to call a real backend by default, edit the form defaults in `examples/config-assistant/index.html` before deployment or configure the values in the browser after publishing.
110+
111+
### Cloudflare Workers static assets
112+
113+
Point a Worker at the example directory with Wrangler assets:
114+
115+
```toml
116+
name = "webagent-config-assistant"
117+
compatibility_date = "2025-01-01"
118+
119+
[assets]
120+
directory = "examples/config-assistant"
121+
```
122+
123+
Then deploy:
124+
125+
```bash
126+
pnpm --filter @vibetechnologies/webagent build
127+
npx wrangler deploy
128+
```
129+
130+
### Optional: self-host the widget bundle
131+
132+
If you want Cloudflare to serve the widget bundle instead of the CDN, copy `packages/widget/dist/webagent.min.js` into your static asset directory and update the loader candidates in `examples/config-assistant/index.html` to prefer that hosted path in production.
133+
86134
## Customer API Key Setup
87135

88136
### Create a managed key
@@ -131,6 +179,9 @@ curl -X PUT https://your-worker.workers.dev/api/kb/my-docs \
131179
]'
132180
```
133181

182+
By default this backend can store KB docs in **KV** (free-tier friendly) when no R2 bucket binding is configured.
183+
If you enable and bind R2 later, `/api/kb` automatically uses R2.
184+
134185
### Configure widget to use KB
135186

136187
```html
@@ -149,6 +200,9 @@ curl -X PUT https://your-worker.workers.dev/api/kb/my-docs \
149200
|---|---|---|
150201
| `ADMIN_SECRET` | Yes | Secret for admin API endpoints |
151202
| `RESEND_API_KEY` | Yes | [Resend](https://resend.com) API key for email |
203+
| `AZURE_DEV_AI_API_KEY` | Yes (for Azure GPT-5.1 proxy mode) | Azure OpenAI key used by backend proxy when provider is `azure-openai` |
204+
| `AZURE_DEV_AI_BASE_URL` | Yes (wrangler var) | Azure OpenAI base URL (`.../openai/v1`) |
205+
| `AZURE_DEV_AI_MODEL` | No | Default Azure model/deployment (`gpt-5.1`) |
152206

153207
## Cloudflare Free Tier Limits
154208

0 commit comments

Comments
 (0)