@@ -14,10 +14,12 @@ import { createAsync, query, useParams } from "@solidjs/router" |
14 | 14 | import { createMemo, createSignal, createUniqueId, For, onMount, Show, type JSX } from "solid-js" |
15 | 15 | import { getRequestEvent } from "solid-js/web" |
16 | 16 | import { LocaleLinks } from "../../component/locale-links" |
| 17 | +import { NotFoundMeta } from "../../component/not-found-meta" |
17 | 18 | import { useI18n } from "../../context/i18n" |
18 | 19 | import { useLanguage } from "../../context/language" |
19 | 20 | import { localizedUrl } from "../../lib/language" |
20 | 21 | import { |
| 22 | + catalogModelPath, |
21 | 23 | findModelCatalogEntry, |
22 | 24 | formatCatalogLabName, |
23 | 25 | isKnownCatalogLab, |
@@ -47,7 +49,7 @@ import { |
47 | 49 | } from "../stats-shell" |
48 | 50 |
|
49 | 51 | const statsUnfurlPath = "banner.png" |
50 | | -const glmFlashCatalogId = "zhipuai/glm-5.3-flash" |
| 52 | +const glmFlashPath = "/data/zhipuai/glm-5-3-flash" |
51 | 53 | const glmFlashModel = "glm-5.3-flash" |
52 | 54 | const shortMonths = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"] as const |
53 | 55 |
|
@@ -110,10 +112,10 @@ export default function StatsModel() { |
110 | 112 | const modelTitle = createMemo(() => i18n.t("model.title", { model: searchModelName() })) |
111 | 113 | const modelDescription = createMemo(() => i18n.t("model.description", { model: searchModelName() })) |
112 | 114 | const modelPath = createMemo(() => { |
113 | | - const fallback = formerName() |
114 | | - ? glmFlashCatalogId |
115 | | - : [labParam(), stats()?.slug ?? canonicalModel()].filter((part) => part.length > 0).join("/") |
116 | | - return `/data/${catalogEntry()?.id ?? fallback}` |
| 115 | + const entry = catalogEntry() |
| 116 | + if (entry) return catalogModelPath(entry) |
| 117 | + if (formerName()) return glmFlashPath |
| 118 | + return `/data/${providerSlug(labParam())}/${stats()?.slug ?? providerSlug(canonicalModel())}` |
117 | 119 | }) |
118 | 120 | const modelUrl = createMemo(() => localizedUrl(language.locale(), modelPath())) |
119 | 121 | const statsUnfurlUrl = new URL(statsUnfurlPath, localizedUrl("en", "/data/")).toString() |
@@ -152,24 +154,32 @@ export default function StatsModel() { |
152 | 154 |
|
153 | 155 | return ( |
154 | 156 | <main data-page="stats" data-theme={themePreference()}> |
155 | | - <Title>{modelTitle()}</Title> |
156 | | - <Meta name="description" content={modelDescription()} /> |
157 | | - <LocaleLinks path={modelPath()} /> |
158 | | - <Meta property="og:type" content="website" /> |
159 | | - <Meta property="og:site_name" content="OpenCode" /> |
160 | | - <Meta property="og:title" content={modelTitle()} /> |
161 | | - <Meta property="og:description" content={modelDescription()} /> |
162 | | - <Meta property="og:url" content={modelUrl()} /> |
163 | | - <Meta property="og:image" content={statsUnfurlUrl} /> |
164 | | - <Meta property="og:image:type" content="image/png" /> |
165 | | - <Meta property="og:image:width" content="1200" /> |
166 | | - <Meta property="og:image:height" content="630" /> |
167 | | - <Meta property="og:image:alt" content={i18n.t("app.unfurlAlt")} /> |
168 | | - <Meta name="twitter:card" content="summary_large_image" /> |
169 | | - <Meta name="twitter:title" content={modelTitle()} /> |
170 | | - <Meta name="twitter:description" content={modelDescription()} /> |
171 | | - <Meta name="twitter:image" content={statsUnfurlUrl} /> |
172 | | - <Meta name="twitter:image:alt" content={i18n.t("app.unfurlAlt")} /> |
| 157 | + {/* Server-rendered head tags are never removed, so render them once data has loaded. */} |
| 158 | + <Show when={page()}> |
| 159 | + <Title>{modelTitle()}</Title> |
| 160 | + <Meta name="description" content={modelDescription()} /> |
| 161 | + <Show |
| 162 | + when={catalogEntry() || stats()} |
| 163 | + fallback={<NotFoundMeta unavailable={page()?.catalog.labs.length === 0} />} |
| 164 | + > |
| 165 | + <LocaleLinks path={modelPath()} /> |
| 166 | + <Meta property="og:type" content="website" /> |
| 167 | + <Meta property="og:site_name" content="OpenCode" /> |
| 168 | + <Meta property="og:title" content={modelTitle()} /> |
| 169 | + <Meta property="og:description" content={modelDescription()} /> |
| 170 | + <Meta property="og:url" content={modelUrl()} /> |
| 171 | + <Meta property="og:image" content={statsUnfurlUrl} /> |
| 172 | + <Meta property="og:image:type" content="image/png" /> |
| 173 | + <Meta property="og:image:width" content="1200" /> |
| 174 | + <Meta property="og:image:height" content="630" /> |
| 175 | + <Meta property="og:image:alt" content={i18n.t("app.unfurlAlt")} /> |
| 176 | + <Meta name="twitter:card" content="summary_large_image" /> |
| 177 | + <Meta name="twitter:title" content={modelTitle()} /> |
| 178 | + <Meta name="twitter:description" content={modelDescription()} /> |
| 179 | + <Meta name="twitter:image" content={statsUnfurlUrl} /> |
| 180 | + <Meta name="twitter:image:alt" content={i18n.t("app.unfurlAlt")} /> |
| 181 | + </Show> |
| 182 | + </Show> |
173 | 183 | <Header |
174 | 184 | githubStars={githubStars() ?? githubLink.fallbackStars} |
175 | 185 | links={modelHeaderLinks()} |
@@ -325,7 +335,7 @@ function ModelHero(props: { |
325 | 335 | current |
326 | 336 | label={modelName()} |
327 | 337 | options={labModels().map((model) => ({ |
328 | | - href: language.route(`${import.meta.env.BASE_URL}${model.id}`), |
| 338 | + href: language.route(catalogModelPath(model)), |
329 | 339 | label: model.name, |
330 | 340 | value: model.id, |
331 | 341 | }))} |
|