diff --git a/src/features/catalog/GainMeter.tsx b/src/features/catalog/GainMeter.tsx
index 2c62a99..5e91555 100644
--- a/src/features/catalog/GainMeter.tsx
+++ b/src/features/catalog/GainMeter.tsx
@@ -1,6 +1,6 @@
import { translate } from '@docusaurus/Translate';
import React from 'react';
-import Link from '@docusaurus/Link';
+import CatalogLink from './CatalogLink';
import styles from './GainMeter.module.css';
export default function GainMeter({
@@ -8,6 +8,8 @@ export default function GainMeter({
label,
valueHref,
valueLabel,
+ version = '',
+ returnTo,
layout = 'stacked',
max = 100,
}: {
@@ -15,6 +17,8 @@ export default function GainMeter({
label?: React.ReactNode;
valueHref?: string;
valueLabel?: string;
+ version?: string;
+ returnTo?: string;
layout?: 'stacked' | 'inline';
max?: number;
}) {
@@ -37,9 +41,15 @@ export default function GainMeter({
>
{label && {label}}
{value != null && valueHref ? (
-
+
{summary.recipes.map((r) => (
- {model.displayName || model.name} - +
@@ -171,12 +183,14 @@ export default function ModelCard(props: Props) {{variant.description}
}-
@@ -162,11 +167,9 @@ export default function RecipeOverview({
const baseline = recipes.find(
(r) => r.variant.id === tuning.baseline.split('@')[0],
);
- const report = reportUrl(
- recipe,
- tuning,
- currentLocale === 'en' ? 'en' : 'zh',
- );
+ const report = reportUrl(recipe, tuning)
+ ? reportHref(recipe, version, returnTo, tuning.report)
+ : null;
const rows = tuning.workloads.length
? tuning.workloads
: tuning.uplift == null
@@ -195,16 +198,18 @@ export default function RecipeOverview({
id="catalog.gainRelativeToBaseline"
values={{
baseline: baseline ? (
-
{tuning.baseline}
-
+
) : (
tuning.baseline ||
translate({
@@ -218,12 +223,19 @@ export default function RecipeOverview({
{report && (
-
+
- - {context === 'catalog' ? r.variant.id : r.model.displayName || r.model.name} - +
diff --git a/src/features/catalog/ReportPage.tsx b/src/features/catalog/ReportPage.tsx
index dd9c4ce..afe35f1 100644
--- a/src/features/catalog/ReportPage.tsx
+++ b/src/features/catalog/ReportPage.tsx
@@ -18,8 +18,8 @@ export default function ReportPage() {
const history = useHistory();
const target = recipeTabHref(browser ? location.search : '', 'performance');
useEffect(() => {
- if (browser) history.replace(siteHref(target));
- }, [browser, history, target, siteHref]);
+ if (browser) history.replace(siteHref(target), location.state);
+ }, [browser, history, target, siteHref, location.state]);
return (
- {r.tuning[0]?.baseline} → {r.tuning[0]?.optimized}
+ {tuning?.baseline} → {tuning?.optimized}
{fullscreenError}
+
{translate({ id: 'site.97a3583c6b16', message: '基线与调优对照' })}
+
{error}{' '}
) : !data ? ( -+
{translate({ id: 'site.ab325d7067a1', message: '正在读取报告数据…' })}
) : ( diff --git a/src/features/catalog/components.tsx b/src/features/catalog/components.tsx index e29b639..d6a38fb 100644 --- a/src/features/catalog/components.tsx +++ b/src/features/catalog/components.tsx @@ -2,7 +2,7 @@ import { translateCopy } from '@site/src/lib/translate-copy'; import { translate } from '@docusaurus/Translate'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import React, { useId, useState } from 'react'; -import Link from '@docusaurus/Link'; +import CatalogLink from './CatalogLink'; import { baselineInfo, config, @@ -157,7 +157,13 @@ export function SourceState({ ); } -export function Stats({ catalog }: { catalog: Catalog }) { +export function Stats({ + catalog, + returnTo, +}: { + catalog: Catalog; + returnTo?: string; +}) { const s = stats(catalog); const percent = (value: number | null) => value == null @@ -198,9 +204,13 @@ export function Stats({ catalog }: { catalog: Catalog }) { 'BEST IMPROVEMENT', percent(s.bestImprovement), s.bestRecipe ? ( - +