Skip to content

Commit f7c6141

Browse files
authored
Merge branch 'production' into agents-1.0
2 parents 731d6bb + 2fb09c9 commit f7c6141

File tree

123 files changed

+2013
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+2013
-397
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
/src/content/changelog/ @cloudflare/pm-changelogs
4949
/src/assets/images/changelog/ @cloudflare/pm-changelogs
50+
/src/assets/images/ @cloudflare/pm-changelogs @cloudflare/pcx-technical-writing
5051

5152
# Cloudflare One
5253

astro.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import starlightLinksValidator from "starlight-links-validator";
88
import icon from "astro-icon";
99
import sitemap from "@astrojs/sitemap";
1010
import react from "@astrojs/react";
11+
1112
import { readdir } from "fs/promises";
13+
import { fileURLToPath } from "url";
1214

1315
import rehypeTitleFigure from "rehype-title-figure";
1416
import rehypeMermaid from "./src/plugins/rehype/mermaid.ts";
1517
import rehypeAutolinkHeadings from "./src/plugins/rehype/autolink-headings.ts";
1618
import rehypeExternalLinks from "./src/plugins/rehype/external-links.ts";
1719
import rehypeHeadingSlugs from "./src/plugins/rehype/heading-slugs.ts";
18-
import { fileURLToPath } from "url";
1920

2021
async function autogenSections() {
2122
const sections = (

public/_redirects

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
/access/ssh/ssh-guide/ /cloudflare-one/connections/connect-networks/use-cases/ssh/ 301
9898

9999
# agents
100-
/agents/build/prompts/ /agents/building-with-ai/prompting/ 301
100+
/agents/build/prompts/ /workers/get-started/prompting/ 301
101101

102102
# ai
103103
/ai/ /use-cases/ai/ 301
@@ -557,7 +557,7 @@
557557
/fundamentals/get-started/setup/ /fundamentals/setup/ 301
558558
/fundamentals/get-started/setup/minimize-downtime/ /fundamentals/performance/minimize-downtime/ 301
559559
/fundamentals/basic-tasks/maintenance-mode/ /fundamentals/performance/minimize-downtime/ 301
560-
/fundamentals/get-started/concepts/what-is-cloudflare/ /fundamentals/concepts/what-is-cloudflare/ 301
560+
/fundamentals/get-started/concepts/what-is-cloudflare/ https://www.cloudflare.com/learning/what-is-cloudflare/ 301
561561
/fundamentals/get-started/concepts/cloudflare-challenges/ /waf/reference/cloudflare-challenges/ 301
562562
/fundamentals/get-started/concepts/accounts-and-zones/ /fundamentals/setup/accounts-and-zones/ 301
563563
/fundamentals/get-started/concepts/cloudflare-ip-addresses/ /fundamentals/concepts/cloudflare-ip-addresses/ 301
@@ -638,6 +638,9 @@
638638
/fundamentals/security/trace-request/how-to/ /fundamentals/trace-request/how-to/ 301
639639
/fundamentals/security/trace-request/limitations/ /fundamentals/trace-request/limitations/ 301
640640
/fundamentals/security/trace-request/changelog/ /fundamentals/trace-request/changelog/ 301
641+
/fundamentals/concepts/what-is-cloudflare/ https://www.cloudflare.com/learning/what-is-cloudflare/ 301
642+
/fundamentals/concepts/the-internet/ https://www.cloudflare.com/learning/network-layer/how-does-the-internet-work/ 301
643+
/fundamentals/concepts/free-plan/ /fundamentals/subscriptions-and-billing/free-plan/ 301
641644

642645
# gateway
643646
/gateway/about/ /cloudflare-one/policies/gateway/ 301
91.9 KB
Loading
245 KB
Loading
44.6 KB
Loading
242 KB
Loading

src/components/ModelCatalog.tsx

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState } from "react";
1+
import { useEffect, useState } from "react";
22
import ModelInfo from "./models/ModelInfo";
33
import ModelBadges from "./models/ModelBadges";
44
import { authorData } from "./models/data";
@@ -19,6 +19,22 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => {
1919
capabilities: [],
2020
});
2121

22+
useEffect(() => {
23+
const params = new URLSearchParams(window.location.search);
24+
25+
const search = params.get("search") ?? "";
26+
const authors = params.getAll("authors");
27+
const tasks = params.getAll("tasks");
28+
const capabilities = params.getAll("capabilities");
29+
30+
setFilters({
31+
search,
32+
authors,
33+
tasks,
34+
capabilities,
35+
});
36+
}, []);
37+
2238
const mapped = models.map((model) => ({
2339
model: {
2440
...model,
@@ -43,21 +59,21 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => {
4359
const authors = [...new Set(models.map((model) => model.name.split("/")[1]))];
4460
const capabilities = [
4561
...new Set(
46-
models
47-
.map((model) =>
48-
model.properties
49-
.flatMap(({ property_id, value }) => {
50-
if (property_id === "lora" && value === "true") {
51-
return "LoRA";
52-
}
62+
models.flatMap((model) =>
63+
model.properties
64+
.flatMap(({ property_id, value }) => {
65+
if (property_id === "lora" && value === "true") {
66+
return "LoRA";
67+
}
68+
69+
if (property_id === "function_calling" && value === "true") {
70+
return "Function calling";
71+
}
5372

54-
if (property_id === "function_calling" && value === "true") {
55-
return "Function calling";
56-
}
57-
})
58-
.filter((p) => Boolean(p)),
59-
)
60-
.flat(),
73+
return [];
74+
})
75+
.filter((p) => Boolean(p)),
76+
),
6177
),
6278
];
6379

@@ -102,7 +118,7 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => {
102118

103119
<div className="!mb-8 hidden md:block">
104120
<span className="text-sm font-bold uppercase text-gray-600 dark:text-gray-200">
105-
Model Types
121+
Tasks
106122
</span>
107123

108124
{tasks.map((task) => (
@@ -111,7 +127,8 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => {
111127
type="checkbox"
112128
className="mr-2"
113129
value={task}
114-
onClick={(e) => {
130+
checked={filters.tasks.includes(task)}
131+
onChange={(e) => {
115132
const target = e.target as HTMLInputElement;
116133

117134
if (target.checked) {
@@ -142,8 +159,9 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => {
142159
<input
143160
type="checkbox"
144161
value={capability}
162+
checked={filters.capabilities.includes(capability)}
145163
className="mr-2"
146-
onClick={(e) => {
164+
onChange={(e) => {
147165
const target = e.target as HTMLInputElement;
148166

149167
if (target.checked) {
@@ -177,7 +195,8 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => {
177195
type="checkbox"
178196
className="mr-2"
179197
value={author}
180-
onClick={(e) => {
198+
checked={filters.authors.includes(author)}
199+
onChange={(e) => {
181200
const target = e.target as HTMLInputElement;
182201

183202
if (target.checked) {

src/components/Render.astro

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,49 @@ const props = z.object({
1313
let { file, product, params } = props.parse(Astro.props);
1414
1515
if (!product) {
16-
product = Astro.params.slug?.split("/")[0];
17-
}
16+
const fromSlug = Astro.params.slug?.split("/")[0];
1817
19-
if (!product) {
20-
throw new Error(
21-
`[Render] Unable to infer which folder ${file} is in, please provide a "product" input with your "file" input.`,
22-
);
18+
if (!fromSlug) {
19+
throw new Error(
20+
`[Render] Unable to infer which folder ${file} is in, please provide a "product" input with your "file" input.`,
21+
);
22+
}
23+
24+
product = fromSlug;
2325
}
2426
25-
const partial = await getEntry("partials", `${product}/${file}`);
27+
const id = `${product}/${file}`;
28+
const partial = await getEntry("partials", id);
2629
2730
if (!partial) {
2831
throw new Error(
29-
`[Render] Couldn't find partial: ${file}. Included on ${Astro.params.slug}`,
32+
`[Render] Couldn't find "${id}" included on "${Astro.url.pathname}"`,
3033
);
3134
}
3235
36+
// We currently only enforce parameters if `params` is set in the frontmatter,
37+
// until we can migrate existing `inputParameters` frontmatter to `params`.
3338
if (partial.data.params) {
34-
const expected = partial.data.params;
35-
if (!params)
39+
const expected = partial.data.params.sort();
40+
const optional = expected.filter((p) => p.endsWith("?"));
41+
const received = Object.keys(params ?? {}).sort();
42+
43+
const maximum = expected.length;
44+
const minimum = maximum - optional.length;
45+
46+
if (
47+
received.length < minimum ||
48+
received.length > maximum ||
49+
expected.some((p: string) => {
50+
if (p.endsWith("?")) return false;
51+
52+
return !received.includes(p);
53+
})
54+
) {
3655
throw new Error(
37-
`${file} included on ${Astro.params.slug} expected parameters: ${expected}, got none`,
56+
`[Render] Expected parameters ${JSON.stringify(expected)} but received parameters ${JSON.stringify(received)} for "${file}" included on "${Astro.url.pathname}"`,
3857
);
58+
}
3959
}
4060
4161
const { Content } = await render(partial);

src/components/models/ModelBadges.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const ModelBadges = ({ model }: { model: WorkersAIModelsSchema }) => {
3333
<ul className="m-0 flex list-none items-center gap-2 p-0 text-xs">
3434
{badges.map((badge) => (
3535
<li key={badge.text}>
36-
<span className="sl-badge gray">{badge.text}</span>
36+
<span className="sl-badge default">{badge.text}</span>
3737
</li>
3838
))}
3939
</ul>

0 commit comments

Comments
 (0)