Skip to content

Commit 06a3df7

Browse files
authored
docs(agent-tars): fix showcase not found (#1708)
1 parent 89b0021 commit 06a3df7

7 files changed

Lines changed: 436 additions & 67 deletions

File tree

multimodal/pnpm-lock.yaml

Lines changed: 413 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

multimodal/websites/docs/docs/en/guide/get-started/sdk.mdx

Lines changed: 0 additions & 11 deletions
This file was deleted.

multimodal/websites/docs/docs/public/netlify.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ to = "https://preview.agent-tars.com/doc/*"
1414
[[redirects]]
1515
from = "/showcase/*"
1616
to = "/showcase"
17+
status = 200
1718

1819
[[redirects]]
1920
from = "/replay/*"
2021
to = "/replay"
22+
status = 200
2123

2224
[[redirects]]
2325
from = "/wechat-intro"

multimodal/websites/docs/docs/zh/guide/get-started/sdk.mdx

Lines changed: 0 additions & 11 deletions
This file was deleted.

multimodal/websites/docs/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"preview": "rspress preview"
99
},
1010
"dependencies": {
11-
"@rspress/core": "2.0.0-beta.31",
12-
"@rspress/theme-default": "2.0.0-beta.31",
11+
"@rspress/core": "2.0.0-beta.34",
1312
"react-icons": "5.5.0",
1413
"framer-motion": "12.19.2",
1514
"tailwindcss": "^3.4.17",
@@ -25,7 +24,6 @@
2524
"@types/react": "^18.2.75",
2625
"@types/react-dom": "^18.2.24",
2726
"@tarko/agent": "workspace:*",
28-
"@rspress/plugin-client-redirects": "2.0.0-beta.31",
2927
"@types/node": "^18.11.17",
3028
"rspress-plugin-mermaid": "^0.3.0"
3129
}

multimodal/websites/docs/rspress.config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import * as path from 'node:path';
22
import { defineConfig } from '@rspress/core';
33
import mermaid from 'rspress-plugin-mermaid';
4-
import { pluginClientRedirects } from '@rspress/plugin-client-redirects';
4+
55
import { SEO_CONFIG } from './src/shared/seoConfig';
66

77
const isProd = process.env.NODE_ENV === 'production';
88

99
export default defineConfig({
10-
root: path.join(__dirname, 'docs'),
1110
lang: 'en',
1211
title: SEO_CONFIG.siteName,
1312
icon: SEO_CONFIG.images.favicon,
@@ -16,7 +15,10 @@ export default defineConfig({
1615
light: '/agent-tars-dark-logo.png',
1716
dark: '/agent-tars-dark-logo.png',
1817
},
18+
// Disable SSG to allow client-side routing for dynamic paths
19+
ssg: false,
1920
route: {
21+
cleanUrls: true,
2022
exclude: isProd
2123
? [
2224
'en/sdk/**',
@@ -79,9 +81,6 @@ export default defineConfig({
7981
fontSize: 16,
8082
},
8183
}),
82-
pluginClientRedirects({
83-
redirects: [],
84-
}),
8584
],
8685
themeConfig: {
8786
darkMode: false,

multimodal/websites/docs/theme/index.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
21
import { Layout as BasicLayout } from '@rspress/core/theme';
32
import { NotFoundLayout } from '../src/components';
43
import { Showcase } from '../src/components/Showcase';
54
import { Replay } from '../src/components/Replay';
65
import { useLocation } from '@rspress/core/runtime';
7-
import { Nav } from '@rspress/theme-default';
6+
import { Nav } from '@rspress/core/theme';
87
import { DYNAMIC_ROUTE } from '../src/shared/types';
98

109
const Layout = () => {
1110
const location = useLocation();
1211

12+
// Debug logging
13+
console.log('🔍 Layout Debug:', {
14+
pathname: location.pathname,
15+
showcaseRoute: DYNAMIC_ROUTE.Showcase,
16+
replayRoute: DYNAMIC_ROUTE.Replay,
17+
startsWithShowcase: location.pathname.startsWith(DYNAMIC_ROUTE.Showcase),
18+
startsWithReplay: location.pathname.startsWith(DYNAMIC_ROUTE.Replay),
19+
});
20+
21+
// Handle showcase routes - both /showcase and /showcase/*
22+
// This needs to be checked BEFORE BasicLayout to override rspress routing
1323
if (location.pathname.startsWith(DYNAMIC_ROUTE.Showcase)) {
24+
console.log('✅ Rendering Showcase component for path:', location.pathname);
1425
return (
1526
<>
1627
<Nav />
@@ -19,7 +30,9 @@ const Layout = () => {
1930
);
2031
}
2132

33+
// Handle replay routes - both /replay and /replay/*
2234
if (location.pathname.startsWith(DYNAMIC_ROUTE.Replay)) {
35+
console.log('✅ Rendering Replay component for path:', location.pathname);
2336
return (
2437
<>
2538
<Nav />
@@ -28,6 +41,7 @@ const Layout = () => {
2841
);
2942
}
3043

44+
console.log('⚠️ Falling back to BasicLayout with NotFoundLayout for path:', location.pathname);
3145
return <BasicLayout NotFoundLayout={NotFoundLayout} />;
3246
};
3347

0 commit comments

Comments
 (0)