Skip to content

Commit e75ec71

Browse files
committed
add gateway to playground
1 parent 17a1b42 commit e75ec71

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

site/ai-playground/src/server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ export class Playground extends AIChatAgent<Env, PlaygroundState> {
6767
) {
6868
const tools = this.mcp.getAITools();
6969

70-
const workersai = createWorkersAI({ binding: this.env.AI });
70+
const workersai = createWorkersAI({
71+
binding: this.env.AI,
72+
gateway: {
73+
id: "playground"
74+
}
75+
});
7176

7277
await this.ensureDestroy();
7378
const stream = createUIMessageStream({

site/ai-playground/wrangler.jsonc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "../../node_modules/wrangler/config-schema.json",
23
"name": "workers-ai-playground",
34
"main": "src/server.ts",
45
"compatibility_date": "2025-10-08",
@@ -9,7 +10,8 @@
910
"run_worker_first": ["/api/*", "/agents/*"]
1011
},
1112
"ai": {
12-
"binding": "AI"
13+
"binding": "AI",
14+
"remote": true
1315
},
1416
"durable_objects": {
1517
"bindings": [
@@ -19,7 +21,6 @@
1921
}
2022
]
2123
},
22-
2324
"migrations": [
2425
{
2526
"new_sqlite_classes": ["Playground"],

0 commit comments

Comments
 (0)