Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ pnpm-debug.log*
/assets/secrets
/worker/functions/

.idea
.idea
/public/*
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 3 additions & 5 deletions src/components/ModelCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]);

Expand Down
9 changes: 8 additions & 1 deletion src/pages/workers-ai/models/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
---

<StarlightPage frontmatter={{ title: "Models", tableOfContents: false }}>
Expand Down
Loading