diff --git a/.gitignore b/.gitignore index 33301b4013d5966..af686dbaa094373 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ pnpm-debug.log* /assets/secrets /worker/functions/ -.idea \ No newline at end of file +.idea +/public/* diff --git a/package-lock.json b/package-lock.json index 91712586356461c..7298e9762f2c502 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "devDependencies": { "@actions/core": "1.11.1", "@actions/github": "6.0.0", + "@anthropic-ai/claude-code": "0.2.59", "@apidevtools/swagger-parser": "10.1.1", "@astrojs/check": "0.9.4", "@astrojs/react": "4.2.1", @@ -474,6 +475,26 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/@anthropic-ai/claude-code": { + "version": "0.2.59", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-0.2.59.tgz", + "integrity": "sha512-hcUHEiPUmkgU00J4/1dlLgWvf5ZkWOjMpUrXhMq2o143LOElKuTGxPGt2RtmFHKk6DesFZcV/gabZYkcTqraBw==", + "dev": true, + "hasInstallScript": true, + "license": "SEE LICENSE IN README.md", + "bin": { + "claude": "cli.js" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "^0.33.5", + "@img/sharp-linux-arm": "^0.33.5", + "@img/sharp-linux-x64": "^0.33.5", + "@img/sharp-win32-x64": "^0.33.5" + } + }, "node_modules/@apidevtools/json-schema-ref-parser": { "version": "11.7.2", "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.7.2.tgz", diff --git a/package.json b/package.json index cb4751593c08fe8..709c8e337b5fdd5 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "devDependencies": { "@actions/core": "1.11.1", "@actions/github": "6.0.0", + "@anthropic-ai/claude-code": "0.2.59", "@apidevtools/swagger-parser": "10.1.1", "@astrojs/check": "0.9.4", "@astrojs/react": "4.2.1", diff --git a/src/components/ModelCatalog.tsx b/src/components/ModelCatalog.tsx index 2e4070adbd5d5b1..acee931d6d42302 100644 --- a/src/components/ModelCatalog.tsx +++ b/src/components/ModelCatalog.tsx @@ -25,7 +25,7 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => { "@cf/meta/llama-3.1-8b-instruct-fast", ]; - // Sort models by pinned status first, then by created_at date + // Only sort by pinned status (models should already be sorted by created_at in index.astro) const sortedModels = useMemo(() => { return [...models].sort((a, b) => { // First check if either model is pinned @@ -43,10 +43,8 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => { ); } - // If neither is pinned, sort by created_at date (newest first) - const dateA = a.created_at ? new Date(a.created_at) : new Date(0); - const dateB = b.created_at ? new Date(b.created_at) : new Date(0); - return dateB.getTime() - dateA.getTime(); + // For non-pinned models, maintain the original order + return 0; }); }, [models]); diff --git a/src/pages/workers-ai/models/index.astro b/src/pages/workers-ai/models/index.astro index 86ee038e952e6d3..1a32327a5a02576 100644 --- a/src/pages/workers-ai/models/index.astro +++ b/src/pages/workers-ai/models/index.astro @@ -5,7 +5,14 @@ import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro"; import ModelCatalog from "~/components/ModelCatalog.tsx"; const modelData = await getCollection("workers-ai-models"); -const models = modelData.map(({ data }) => data); +let models = modelData.map(({ data }) => data); + +// Sort models by created_at date (newest first) +models = models.sort((a, b) => { + const dateA = a.created_at ? new Date(a.created_at) : new Date(0); + const dateB = b.created_at ? new Date(b.created_at) : new Date(0); + return dateB.getTime() - dateA.getTime(); +}); ---