Skip to content

Commit 4169d16

Browse files
committed
feat: add Pages to Workers migration guide to docs
1 parent a12f036 commit 4169d16

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.changeset/crazy-dogs-invent.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'docs-vectorize': minor
3+
---
4+
5+
feat: add Pages to Workers migration guide to docs

apps/docs-vectorize/src/tools/docs-vectorize.tools.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,37 @@ ${result.text}
4242
}
4343
}
4444
)
45+
46+
// Note: this is a tool instead of a prompt because
47+
// prompt support is much less common than tools.
48+
agent.server.tool(
49+
'migrate_pages_to_workers_guide',
50+
`ALWAYS read this guide before migrating Pages projects to Workers.`,
51+
{},
52+
async () => {
53+
const res = await fetch(
54+
'https://0b1a9544.preview.developers.cloudflare.com/workers/prompts/pages-to-workers.txt',
55+
{
56+
cf: { cacheEverything: true, cacheTtl: 3600 },
57+
}
58+
)
59+
60+
if (!res.ok) {
61+
return {
62+
content: [{ type: 'text', text: 'Error: Failed to fetch guide. Please try again.' }],
63+
}
64+
}
65+
66+
return {
67+
content: [
68+
{
69+
type: 'text',
70+
text: await res.text(),
71+
},
72+
],
73+
}
74+
}
75+
)
4576
}
4677

4778
async function queryVectorize(ai: Ai, vectorizeIndex: VectorizeIndex, query: string, topK: number) {

0 commit comments

Comments
 (0)