-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add genui sdk submodule #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
e6f6e7e
2b061ca
5ccdbcc
9865848
f499aee
60c56d9
311f157
769eb17
f2390ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,6 @@ | |
| [submodule "tiny-engine"] | ||
| path = tiny-engine | ||
| url = [email protected]:opentiny/tiny-engine.git | ||
| [submodule "genui-sdk"] | ||
| path = genui-sdk | ||
| url = [email protected]:opentiny/genui-sdk.git | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,11 +39,12 @@ export default defineConfig({ | |
| // 忽略死链检查(true 会跳过 VitePress 的 dead link 报错) | ||
| ignoreDeadLinks: true, | ||
| outDir: 'dist', | ||
| srcExclude: [ | ||
| '**/README*.md', '**/develop-demo-en.md', '**/theme-en.md', | ||
| 'tiny-vue/packages/**/*.md', 'tiny-engine/packages/**/*.md', | ||
| 'tiny-robot/packages/**/*.md', 'next-sdk/packages/**/*.md', | ||
| ], | ||
| srcExclude: [ | ||
| '**/README*.md', '**/develop-demo-en.md', '**/theme-en.md', | ||
| 'tiny-vue/packages/**/*.md', 'tiny-engine/packages/**/*.md', | ||
| 'tiny-robot/packages/**/*.md', 'next-sdk/packages/**/*.md', | ||
| 'genui-sdk/packages/**/*.md', | ||
| ], | ||
| base: process.env.VITEPRESS_BASE || '/', | ||
| head: [['link', { rel: 'icon', href: '/images/logo-mini.svg' }]], | ||
| vite: { | ||
|
|
@@ -75,6 +76,7 @@ export default defineConfig({ | |
| 'tiny-robot/docs/src/:section(guide|components|tools)/:path*': 'tiny-robot/guide/:path*', | ||
| 'tiny-robot/docs/src/examples/:path*': 'tiny-robot/examples/:path*', | ||
| 'next-sdk/docs/:path*': 'next-sdk/:path*', | ||
| 'genui-sdk/docs/src/:section(guide|api)/:path*': 'genui-sdk/guide/:path*', | ||
| 'tiny-vue/examples/sites/demos/pc/webdoc/:path*': 'tiny-vue/guide/:path*', | ||
| 'tiny-engine/docs/:section(getting-started|basic-features|advanced-features|tutorials)/:path*': | ||
| 'tiny-engine/guide/:path*', | ||
|
|
@@ -212,6 +214,22 @@ export default defineConfig({ | |
| ] | ||
| } | ||
| ], | ||
| '/genui-sdk/guide/': [ | ||
| { | ||
| text: '介绍', | ||
| base: '/genui-sdk/guide/', | ||
| items: [ | ||
| { text: '安装指南', link: 'installation' }, | ||
| ] | ||
| }, | ||
| { | ||
| text: 'API文档', | ||
| base: '/genui-sdk/guide/', | ||
| items: [ | ||
| { text: 'API文档', link: 'api' } | ||
| ] | ||
| } | ||
| ], | ||
|
Comment on lines
+218
to
+233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if genui-sdk submodule exists and what markdown files are present
if [ -d "genui-sdk" ]; then
echo "=== Searching for installation.md ==="
find genui-sdk -name "installation.md" -type f 2>/dev/null || echo "Not found"
echo -e "\n=== Searching for api.md ==="
find genui-sdk -name "api.md" -type f 2>/dev/null || echo "Not found"
echo -e "\n=== All markdown files in genui-sdk (up to 2 levels) ==="
find genui-sdk -maxdepth 3 -name "*.md" -type f 2>/dev/null | head -30
echo -e "\n=== Directory structure of genui-sdk/docs (if exists) ==="
if [ -d "genui-sdk/docs" ]; then
ls -la genui-sdk/docs/ 2>/dev/null || echo "Cannot list"
else
echo "genui-sdk/docs does not exist"
fi
else
echo "genui-sdk submodule directory not found"
fiRepository: opentiny/docs Length of output: 271 🏁 Script executed: #!/bin/bash
# Check what actually exists in the genui-sdk directory
echo "=== Contents of genui-sdk (root level) ==="
ls -la genui-sdk/ 2>/dev/null | head -20
echo -e "\n=== Directory structure (tree-like view up to 3 levels) ==="
find genui-sdk -maxdepth 3 -type d 2>/dev/null | head -20
echo -e "\n=== All files in genui-sdk (first 30 files) ==="
find genui-sdk -type f 2>/dev/null | head -30Repository: opentiny/docs Length of output: 330 🏁 Script executed: #!/bin/bash
# Check if genui-sdk is a git submodule and its status
echo "=== Check git configuration for genui-sdk ==="
if [ -f ".gitmodules" ]; then
cat .gitmodules | grep -A 5 "genui-sdk" || echo "No genui-sdk submodule entry found"
else
echo ".gitmodules file not found"
fi
echo -e "\n=== Check git status for submodules ==="
git config --file .gitmodules --get-regexp path || echo "No submodule paths found"
echo -e "\n=== Check if any documentation exists for genui-sdk elsewhere ==="
find . -maxdepth 3 -type d -name "*genui*" 2>/dev/null | grep -v ".git"
echo -e "\n=== Check current config.mts for context (lines around 218-233) ==="
sed -n '210,240p' .vitepress/config.mtsRepository: opentiny/docs Length of output: 1478 🏁 Script executed: #!/bin/bash
# Check if we can verify the remote genui-sdk repository contents
# First, let's see if we can access the remote URL
echo "=== Check remote genui-sdk repository (list files via git ls-remote) ==="
git ls-remote --heads [email protected]:opentiny/genui-sdk.git 2>/dev/null | head -5
echo -e "\n=== Try to fetch submodule info using git ==="
git submodule status genui-sdk 2>/dev/null || echo "Cannot get submodule status"
echo -e "\n=== Check if there's a workaround - look at similar submodule references ==="
grep -n "'/.*-sdk/guide/'" .vitepress/config.mts | head -10
echo -e "\n=== Check if sidebar paths reference actually configured routes ==="
grep -n "'/genui-sdk" .vitepress/config.mts -A 2 -B 2Repository: opentiny/docs Length of output: 1123 🏁 Script executed: #!/bin/bash
# Check the vitepress configuration more thoroughly
echo "=== Check for route definitions in config.mts ==="
grep -n "rewrite" .vitepress/config.mts -A 5 -B 2 || echo "No rewrite rules found"
echo -e "\n=== Check for publicDir or documentation source mappings ==="
grep -n "publicDir\|srcDir\|srcExclude" .vitepress/config.mts
echo -e "\n=== Check if there's a vitepress config for handling submodules ==="
grep -n "submodule\|sdk" .vitepress/config.mts | head -20
echo -e "\n=== Check vitepress docs directory structure ==="
ls -la docs/ 2>/dev/null | head -20
echo -e "\n=== Look for any genui-sdk documentation in the main docs ==="
find docs -type d -name "*genui*" 2>/dev/null || echo "No genui-sdk dir in docs"
echo -e "\n=== Check full route paths in config ==="
grep -n "^[[:space:]]*'/" .vitepress/config.mts | head -15Repository: opentiny/docs Length of output: 1789 🏁 Script executed: #!/bin/bash
# Now let's verify what the actual expected file structure should be based on the rewrite rules
echo "=== Analyzing rewrite rules for genui-sdk ==="
echo "Rewrite rule: 'genui-sdk/docs/src/:section(guide|api)/:path*': 'genui-sdk/guide/:path*'"
echo ""
echo "Expected file mappings:"
echo " installation link should map to: genui-sdk/docs/src/guide/installation.md"
echo " api link should map to: genui-sdk/docs/src/api/api.md"
echo ""
echo "=== Check if similar patterns work in other submodules ==="
ls -la next-sdk/docs/ 2>/dev/null || echo "next-sdk/docs not found"
echo -e "\n=== List actual files in other submodules for comparison ==="
find next-sdk -maxdepth 3 -type f -name "*.md" 2>/dev/null | head -10
echo -e "\n=== Confirm genui-sdk is empty ==="
ls -la genui-sdk/ 2>/dev/null
find genui-sdk -type f 2>/dev/null | wc -lRepository: opentiny/docs Length of output: 642 🏁 Script executed: #!/bin/bash
# Let's check the pattern of the sidebar configuration more carefully
echo "=== Extract the full sidebar configuration for genui-sdk ==="
sed -n '218,233p' .vitepress/config.mts
echo -e "\n=== Check vitepress rewrite rule interpretation ==="
echo "The rewrite rule pattern: 'genui-sdk/docs/src/:section(guide|api)/:path*': 'genui-sdk/guide/:path*'"
echo ""
echo "When link='installation' is clicked in route '/genui-sdk/guide/':"
echo " - Requested path would be: /genui-sdk/guide/installation"
echo " - This should rewrite to look for: genui-sdk/docs/src/guide/installation.md"
echo ""
echo "When link='api' is clicked in route '/genui-sdk/guide/':"
echo " - Requested path would be: /genui-sdk/guide/api"
echo " - This should rewrite to look for: genui-sdk/docs/src/api/api.md"
echo -e "\n=== Verify no other genui-sdk references in config ==="
grep -i "genui" .vitepress/config.mts | wc -l
grep -i "genui" .vitepress/config.mtsRepository: opentiny/docs Length of output: 1282 The genui-sdk submodule is empty and will result in broken links. The sidebar references files (
Initialize the genui-sdk submodule and ensure these documentation files exist at the expected paths. 🤖 Prompt for AI Agents |
||
| '/tiny-vue/guide/': [ | ||
| { | ||
| text: '指南', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ | |
| :tabs="productTabs" | ||
| :activeTab="activeProductTab" | ||
| @tab-change="handleProductTabChange" | ||
| style="width: 500px" | ||
| style="width: 540px" | ||
| /> | ||
| </div> | ||
| </div> | ||
|
|
@@ -286,6 +286,7 @@ import { computed, ref, onMounted, watch } from "vue"; | |
| import { useData, useRoute, useRouter } from "vitepress"; | ||
| import TabNavigation from "./TabNavigation.vue"; | ||
| import { normalizeLink, isActiveRoute, isHomePage } from "../utils/router"; | ||
| import { NavTabFactory } from "../entity"; | ||
|
|
||
| // 获取 VitePress 数据 | ||
| const { site, theme } = useData(); | ||
|
|
@@ -312,37 +313,8 @@ const getModalTabClasses = (tab: TabItem) => ({ | |
|
|
||
| // 转换导航配置为TabNavigation所需格式 | ||
| const navigationTabs = computed(() => { | ||
| if ( | ||
| activeProductTab.value === "next-sdk" && | ||
| route.path.includes("/next-sdk/") | ||
| ) { | ||
| return [{ key: "guide", name: "使用文档", link: "/next-sdk/guide/" }]; | ||
| } else if ( | ||
| activeProductTab.value === "tiny-vue" && | ||
| route.path.includes("/tiny-vue/") | ||
| ) { | ||
| return [{ key: "guide", name: "使用文档", link: "/tiny-vue/guide/introduce" }]; | ||
| } else { | ||
| let configNav: configNavItem[] = []; | ||
| if ( | ||
| activeProductTab.value === "tiny-engine" && | ||
| route.path.includes("/tiny-engine/") | ||
| ) { | ||
| configNav = themeConfig.value.engineNav || []; | ||
| } else { | ||
| configNav = themeConfig.value.nav || []; | ||
| } | ||
| return ( | ||
| configNav?.map((item: configNavItem) => ({ | ||
| key: | ||
| getConfigKey(item.link) || | ||
| item.text.toLowerCase().replace(/\s+/g, "-"), | ||
| name: item.text, | ||
| link: `${prefix}${item.link.slice(1)}`, | ||
| disabled: false, | ||
| })) || [] | ||
| ); | ||
| } | ||
| const navTab = NavTabFactory(activeProductTab.value, route, site, themeConfig.value); | ||
| return navTab.getTabs(); | ||
| }); | ||
|
|
||
| interface TabItem { | ||
|
|
@@ -459,6 +431,14 @@ const productTabs = computed(() => [ | |
| activeProductTab.value === "next-sdk" ? "active" : "normal" | ||
| }-next-sdk.svg`, | ||
| }, | ||
| { | ||
| key: "genui-sdk", | ||
| name: "GenUI-SDK", | ||
| link: `${prefix}genui-sdk/guide/installation`, | ||
| src: `${prefix}images/logo-${ | ||
| activeProductTab.value === "genui-sdk" ? "active" : "normal" | ||
| }-genui-sdk.svg`, | ||
| }, | ||
|
Comment on lines
+434
to
+441
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find all SVG files related to genui-sdk
find . -type f -name "*genui-sdk*" 2>/dev/null | head -20Repository: opentiny/docs Length of output: 140 🏁 Script executed: # Check for logo files in common image directories
fd -t f "logo.*genui-sdk" . 2>/dev/nullRepository: opentiny/docs Length of output: 140 🏁 Script executed: # Search for genui-sdk directory structure
fd -t d "genui-sdk" . --max-depth 3 2>/dev/nullRepository: opentiny/docs Length of output: 69 🏁 Script executed: # Look for installation-related docs
rg "installation" -t md --files . 2>/dev/null | grep -i genuiRepository: opentiny/docs Length of output: 39 🏁 Script executed: # Check the CustomHeader.vue file to see the pattern of other product tabs
fd -t f "CustomHeader.vue" -exec head -n 500 {} \; | tail -n 200Repository: opentiny/docs Length of output: 287 🏁 Script executed: # List the structure of genui-sdk directory
find ./genui-sdk -type f -name "*.md" | head -30Repository: opentiny/docs Length of output: 39 🏁 Script executed: # Check if guide/installation exists
ls -la ./genui-sdk/guide/ 2>/dev/null || echo "guide directory not found"Repository: opentiny/docs Length of output: 82 🏁 Script executed: # Look for installation-related files in genui-sdk
find ./genui-sdk -type f -name "*installation*" 2>/dev/nullRepository: opentiny/docs Length of output: 39 🏁 Script executed: # Check overall structure of genui-sdk
ls -la ./genui-sdk/ 2>/dev/nullRepository: opentiny/docs Length of output: 167 🏁 Script executed: # Check vitepress config files
fd -t f "config" .vitepress/ -e ts -e js -e mtsRepository: opentiny/docs Length of output: 78 🏁 Script executed: # Look at sidebar configuration
fd -t f "sidebar" . -e ts -e js -e mtsRepository: opentiny/docs Length of output: 39 🏁 Script executed: # Check what other product links point to (examine CustomHeader.vue more carefully)
cat -n .vitepress/theme/components/CustomHeader.vue | sed -n '400,500p'Repository: opentiny/docs Length of output: 3395 🏁 Script executed: # Check if there's documentation outside genui-sdk dir
find . -type d -name "guide" | head -10Repository: opentiny/docs Length of output: 39 🏁 Script executed: # Check the vitepress config
cat -n .vitepress/config.mts | head -100Repository: opentiny/docs Length of output: 4483 🏁 Script executed: # Search for genui-sdk in config
rg "genui-sdk" .vitepress/config.mtsRepository: opentiny/docs Length of output: 274 GenUI-SDK logo assets are present, but the documentation target does not exist. The logo files exist, however, the genui-sdk documentation directory is empty. The link Either create the GenUI-SDK documentation at 🤖 Prompt for AI Agents |
||
| { | ||
| key: "tiny-robot", | ||
| name: "TinyRobot", | ||
|
|
@@ -502,6 +482,8 @@ watch( | |
| const path = route.path.replace(new RegExp(`^${site.value.base}`), "/"); | ||
| if (path.includes("/next-sdk/")) { | ||
| activeProductTab.value = "next-sdk"; | ||
| } else if (path.includes("/genui-sdk/")) { | ||
| activeProductTab.value = "genui-sdk"; | ||
| } else if (path.includes("/tiny-robot/")) { | ||
| activeProductTab.value = "tiny-robot"; | ||
| } else if (path.includes("/tiny-vue/")) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from "./nav-tab"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| interface TabItem { | ||
| key: string | ||
| name: string | ||
| link: string | ||
| } | ||
|
|
||
| interface configNavItem { | ||
| text: string | ||
| link: string | ||
| activeMatch?: string | ||
| } | ||
|
|
||
|
|
||
| type NavTabConstructor = new ( | ||
| activeProductTab: string, | ||
| site: any, | ||
| themeConfig?: any | ||
| ) => NavTab | ||
|
|
||
| class NavTab { | ||
| activeProductTab: string | ||
| site: any | ||
| themeConfig?: any | ||
|
|
||
| constructor(activeProductTab: string, site: any, themeConfig?: any) { | ||
| this.activeProductTab = activeProductTab | ||
| this.site = site | ||
| this.themeConfig = themeConfig | ||
| } | ||
|
|
||
| getConfigKey(link: any) { | ||
| return link.replace(/\/$/, '').split('/')[2] | ||
| } | ||
|
|
||
| getTabs(): TabItem[] { | ||
| const prefix = this.site.value.base || '/' | ||
| const { nav } = this.themeConfig | ||
|
|
||
| return ( | ||
| (nav || []).map((item: configNavItem) => ({ | ||
| key: this.getConfigKey(item.link) || item.text.toLowerCase().replace(/\s+/g, '-'), | ||
| name: item.text, | ||
| link: `${prefix}${item.link.slice(1)}`, | ||
| disabled: false | ||
| })) || [] | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| class NextSdkNavTab extends NavTab { | ||
| constructor(activeProductTab: string, site: any, themeConfig?: any) { | ||
| super(activeProductTab, site, themeConfig) | ||
| } | ||
|
|
||
| getTabs(): TabItem[] { | ||
| return [{ key: 'guide', name: '使用文档', link: '/next-sdk/guide/' }] | ||
| } | ||
| } | ||
|
|
||
| class TinyVueNavTab extends NavTab { | ||
| constructor(activeProductTab: string, site: any, themeConfig?: any) { | ||
| super(activeProductTab, site, themeConfig) | ||
| } | ||
|
|
||
| getTabs(): TabItem[] { | ||
| return [{ key: 'guide', name: '使用文档', link: '/tiny-vue/guide/introduce' }] | ||
| } | ||
| } | ||
|
|
||
| class TinyEngineNavTab extends NavTab { | ||
| constructor(activeProductTab: string, site: any, themeConfig?: any) { | ||
| super(activeProductTab, site, themeConfig) | ||
| } | ||
|
|
||
| getTabs(): TabItem[] { | ||
| const prefix = this.site.value.base || '/' | ||
| const { engineNav } = this.themeConfig | ||
|
|
||
| return ( | ||
| (engineNav || []).map((item: configNavItem) => ({ | ||
| key: this.getConfigKey(item.link) || item.text.toLowerCase().replace(/\s+/g, '-'), | ||
| name: item.text, | ||
| link: `${prefix}${item.link.slice(1)}`, | ||
| disabled: false | ||
| })) || [] | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| class GenuiSdkNavTab extends NavTab { | ||
| constructor(activeProductTab: string, site: any, themeConfig?: any) { | ||
| super(activeProductTab, site, themeConfig) | ||
| } | ||
|
|
||
| getTabs(): TabItem[] { | ||
| return [{ key: 'guide', name: '使用文档', link: '/genui-sdk/guide/installation' }] | ||
| } | ||
| } | ||
|
|
||
| const navTabClassMap: Record<string, NavTabConstructor> = { | ||
| 'next-sdk': NextSdkNavTab, | ||
| 'tiny-vue': TinyVueNavTab, | ||
| 'tiny-engine': TinyEngineNavTab, | ||
| 'genui-sdk': GenuiSdkNavTab, | ||
| } | ||
|
|
||
| const navPathMap: Record<string, string> = { | ||
| 'next-sdk': '/next-sdk/', | ||
| 'tiny-vue': '/tiny-vue/', | ||
| 'tiny-engine': '/tiny-engine/', | ||
| 'genui-sdk': '/genui-sdk/', | ||
| } | ||
lhuans marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const NavTabFactory = (activeProductTab: string, route: any, site: any, themeConfig: any) => { | ||
| const isCurrentPath = (path: string) => route.path.includes(path) | ||
|
|
||
| const navPath = navPathMap[activeProductTab] | ||
| const NavTabClass = navTabClassMap[activeProductTab] | ||
|
|
||
| if (NavTabClass && isCurrentPath(navPath)) { | ||
| return new NavTabClass(activeProductTab, site, themeConfig) | ||
| } | ||
|
|
||
| return new NavTab(activeProductTab, site, themeConfig) | ||
| } | ||
|
|
||
| export { NavTabFactory } | ||
Uh oh!
There was an error while loading. Please reload this page.