Skip to content

Build and run agents you can see, understand and trust.

Support both v0 and v1 in agentscope documentation (#686)

DavdGao2e1faf8f8b1c
diff --git a/docs/tutorial/_static/css/gallery.css b/docs/tutorial/_static/css/gallery.css
index bedf6e4cc..38b3c0d0a 100644
--- a/docs/tutorial/_static/css/gallery.css
+++ b/docs/tutorial/_static/css/gallery.css
@@ -144,4 +144,20 @@ td .highlight-python.notranslate {
.language-switch-button:hover {
color: #2758DA;
-}
\ No newline at end of file
+}
+
+.version-select {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: transparent;
+ font-size: 14px;
+ border: 1px solid rgb(238, 235, 238);
+ margin-inline: 16px;
+ padding: 8px;
+ height: fit-content;
+ box-sizing: border-box;
+ font-weight: 600;
+ border-radius: 6px;
+ fill: rgb(238, 235, 238);
+}
diff --git a/docs/tutorial/_static/language_switch.js b/docs/tutorial/_static/language_switch.js
index 8fb43e27e..a78474442 100644
--- a/docs/tutorial/_static/language_switch.js
+++ b/docs/tutorial/_static/language_switch.js
@@ -1,7 +1,15 @@
-function switchLanguage() {
+function switchV1Language() {
if (window.location.href.includes("zh_CN")) {
window.location.href = "https://doc.agentscope.io";
} else {
window.location.href = "https://doc.agentscope.io/zh_CN";
}
}
+
+
+function navigateToV0(version) {
+ if (version === "v0") {
+ const suffix = window.location.href.includes("zh_CN") ? "/zh_CN" : "/en";
+ window.location.href = "https://doc.agentscope.io/v0" + suffix;
+ }
+}
diff --git a/docs/tutorial/_templates/components/language-switch.html b/docs/tutorial/_templates/components/language-switch.html
index c146a725c..666819865 100644
--- a/docs/tutorial/_templates/components/language-switch.html
+++ b/docs/tutorial/_templates/components/language-switch.html
@@ -1,5 +1,5 @@
{# _templates/components/language-switch.html #}
-<button onclick="switchLanguage()" class="language-switch-button" title="Switch to Chinese">
+<button onclick="switchV1Language()" class="language-switch-button" title="Switch to Chinese">
<script>
document.write(window.location.href.includes("zh_CN") ? "En": "中");
</script>
diff --git a/docs/tutorial/_templates/sidebar/navigation.html b/docs/tutorial/_templates/sidebar/navigation.html
new file mode 100644
index 000000000..14bd283ec
--- /dev/null
+++ b/docs/tutorial/_templates/sidebar/navigation.html
@@ -0,0 +1,16 @@
+<div class="sidebar-tree">
+ <p class="caption" role="heading">
+ <span class="caption-text">
+ Version
+ </span>
+ <ul>
+ <li>
+ <select class="version-select" onchange="navigateToV0(this.value)">
+ <option value="v1" selected>Stable(v1.0)</option>
+ <option value="v0">v0.1.x</option>
+ </select>
+ </li>
+ </ul>
+ </p>
+ {{ furo_navigation_tree }}
+</div>