- Model URLs are the repo path (case-insensitive, canonical redirect); /models/<id> redirects - Header with avatar, org/name + copy, task/format/arch/language/license pills, user tags, cross-links to the Hub (files @ sha, commits, community, base model) and tabs: rendered model card at the pinned commit, files, jobs - Sidebar: download card, local copy, model tree with related local models - Metadata gains author avatar and base relation (refetched once) - Proxy matcher excludes only exact /login and /api/auth/ paths Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
579 B
TypeScript
15 lines
579 B
TypeScript
import { eq } from "drizzle-orm";
|
|
import { notFound, permanentRedirect } from "next/navigation";
|
|
import { db } from "@/lib/db/client";
|
|
import { models } from "@/lib/db/schema";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/** Old URL scheme (/models/<id>): redirect to /<org>/<name>. */
|
|
export default async function LegacyModelPage({ params }: PageProps<"/models/[id]">) {
|
|
const { id } = await params;
|
|
const model = await db().query.models.findFirst({ columns: { repoId: true }, where: eq(models.id, id) });
|
|
if (!model) notFound();
|
|
permanentRedirect(`/${model.repoId}`);
|
|
}
|