Skip to content

Commit f5dc56e

Browse files
committed
feat(文档): 接入 VitePress 与 GitHub Pages 部署
- 添加 VitePress 配置、文档构建脚本与 Pages workflow - 修复架构文档运行流程图链接,并补充本地预览说明 feat(agent-runtime): 支持 Python venv 沙箱执行命令 - 新增 python-runtime 工具并接入 workspace 工厂 - 补充 requirements.txt 与开发环境 venv 自动检测 fix(web): 修复空会话列表与会话用量展示问题 - 无历史会话时自动创建首个会话 - 修正 TaskConsole 中 sessionView 的重复引用
1 parent 94dd558 commit f5dc56e

19 files changed

Lines changed: 2050 additions & 18 deletions

File tree

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ EMBEDDING_OUTPUT_TYPE=dense
1313
EMBEDDING_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
1414
EMBEDDING_API_KEY=
1515

16+
# Agent execute_command sandbox: Python venv with numpy/pandas/matplotlib/scikit-learn.
17+
# Default auto-detects repo `.venv` (also checks npm INIT_CWD). Override with absolute path:
18+
# WORKSPACE_PYTHON_VENV=/path/to/dataagent/.venv
19+
# WORKSPACE_COMMAND_TIMEOUT_MS=120000
20+
1621
STORAGE_ROOT_DIR=storage
1722
METADATA_DB_PATH=storage/metadata/workbench.sqlite
1823
SECRET_MASTER_KEY=replace-with-a-long-random-local-key

.github/workflows/docs.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
- ".github/workflows/docs.yml"
9+
- "package.json"
10+
- "package-lock.json"
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 22
33+
cache: npm
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Build docs
39+
run: npm run docs:build
40+
41+
- name: Upload Pages artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs/.vitepress/dist
45+
46+
deploy:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.venv/
2+
venv/
13
node_modules/
24
**/node_modules/
35
dist/
@@ -15,5 +17,6 @@ storage/
1517
.env.*
1618
!.env.example
1719
*.tsbuildinfo
18-
package-lock.json.win.bak
19-
package-lock.json.*.bak
20+
docs/.vitepress/dist/
21+
docs/.vitepress/cache/
22+
docs/public/assets/

apps/web/src/app/data-tasks/components/task-console/TaskConsole.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,10 @@ function ConclusionZone({
509509
? `${Math.round((runUsage.toolCalls.success / runUsage.toolCalls.total) * 100)}%`
510510
: "—";
511511

512+
const sessionView = useMemo(
513+
() => deriveLiveSessionView(sessionUsage, liveRun),
514+
[liveRun, sessionUsage],
515+
);
512516
const tokenReported = sessionView.tokenUsageReported;
513517
const displayTokens = sessionView.tokens;
514518
const displayModels = sessionView.models;

apps/web/src/app/data-tasks/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,9 @@ function DataTaskWorkspace({
710710
.then((response) => {
711711
if (cancelled) return;
712712
if (response.sessions.length === 0) {
713+
const first = createChatSession();
714+
setSessions([first]);
715+
setActiveSessionId(first.id);
713716
setSessionSyncError(null);
714717
return;
715718
}

docs/.vitepress/config.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { defineConfig } from "vitepress";
2+
3+
export default defineConfig({
4+
title: "Open Data Agent",
5+
description: "面向数据分析场景的 AI 工作台文档",
6+
lang: "zh-CN",
7+
base: "/dataagent/",
8+
srcDir: ".",
9+
srcExclude: ["README.md", "assets/**"],
10+
cleanUrls: false,
11+
themeConfig: {
12+
logo: "/assets/readme/hero.svg",
13+
siteTitle: "Open Data Agent",
14+
nav: [
15+
{ text: "产品概览", link: "/zh/overview" },
16+
{ text: "快速开始", link: "/zh/quick-start" },
17+
{ text: "GitHub", link: "https://github.com/datagallery-lab/dataagent" }
18+
],
19+
sidebar: [
20+
{
21+
text: "入门",
22+
items: [
23+
{ text: "文档首页", link: "/zh/" },
24+
{ text: "产品概览", link: "/zh/overview" },
25+
{ text: "快速开始", link: "/zh/quick-start" },
26+
{ text: "能力全览", link: "/zh/capabilities" }
27+
]
28+
},
29+
{
30+
text: "使用指南",
31+
items: [
32+
{ text: "Web 工作台", link: "/zh/guides/web-workbench" },
33+
{ text: "TUI", link: "/zh/guides/tui" },
34+
{ text: "数据源", link: "/zh/guides/data-sources" }
35+
]
36+
},
37+
{
38+
text: "参考",
39+
items: [
40+
{ text: "支持的数据源", link: "/zh/reference/supported-datasources" },
41+
{ text: "REST API", link: "/zh/reference/rest-api" },
42+
{ text: "配置 API", link: "/zh/reference/configuration-api" },
43+
{ text: "Agent Runtime", link: "/zh/reference/agent-runtime" }
44+
]
45+
},
46+
{
47+
text: "架构与安全",
48+
items: [
49+
{ text: "架构概览", link: "/zh/architecture/overview" },
50+
{ text: "安全说明", link: "/zh/security" }
51+
]
52+
}
53+
],
54+
socialLinks: [{ icon: "github", link: "https://github.com/datagallery-lab/dataagent" }],
55+
search: {
56+
provider: "local"
57+
},
58+
footer: {
59+
message: "Apache-2.0 Licensed",
60+
copyright: "Copyright © DataGallery Lab"
61+
}
62+
}
63+
});

docs/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,19 @@
3434
- 不保留来源敏感叙述。
3535
- 修改文档后运行 `npm run smoke:docs`
3636

37+
## 本地预览与 GitHub Pages
38+
39+
本地预览:
40+
41+
```bash
42+
npm run docs:dev
43+
npm run docs:build
44+
npm run docs:preview
45+
```
46+
47+
推送到 `main` 后,`.github/workflows/docs.yml` 会把站点发布到 GitHub Pages:
48+
49+
`https://datagallery-lab.github.io/dataagent/`
50+
51+
私有仓库需要先启用 GitHub Pages(Settings → Pages → Source 选 **GitHub Actions**),并确认当前 GitHub 计划允许私有仓使用 Pages;站点是否对外公开可在 Pages 设置里单独控制。
52+

docs/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
layout: home
3+
hero:
4+
name: Open Data Agent
5+
text: 中文文档
6+
tagline: 面向数据分析场景的 AI 工作台
7+
actions:
8+
- theme: brand
9+
text: 开始阅读
10+
link: /zh/
11+
- theme: alt
12+
text: 快速开始
13+
link: /zh/quick-start
14+
features:
15+
- title: 本地优先
16+
details: 在本地运行 Web 工作台、TUI 与后端 Runtime,数据与凭据留在你的环境内。
17+
- title: 只读 SQL 边界
18+
details: Agent 先理解 schema,再在受控策略下执行只读查询,过程可追溯。
19+
- title: 统一工作台
20+
details: 自然语言提问、数据源管理、分析追溯与产出沉淀在同一工作流中完成。
21+
---

docs/zh/architecture/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Web 工作台 / TUI / 其他客户端
1313
-> Metadata 与审计存储
1414
```
1515

16-
精选架构图可参考仓库首页使用的运行流程图:[`docs/assets/readme/runtime-flow.png`](../../assets/readme/runtime-flow.png)
16+
精选架构图可参考仓库首页使用的运行流程图:[`docs/assets/readme/runtime-flow.svg`](../../assets/readme/runtime-flow.svg)
1717

1818
## 主要模块
1919

0 commit comments

Comments
 (0)