Files
runny 9058149576
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
refactor: 项目更名 WeKnora → Academy
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名)
- 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块)
- docreader proto 描述符采用等长替换,保持序列化字节布局有效
- Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像
- 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
2026-11-13 20:52:51 +08:00

68 lines
3.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: ui-builder
description: 当用户需要可视化界面时生成单文件 HTML 交互界面(学习进度看板、课程地图、练习题页、数据报表、操作指引页等),作为会话产物自动保存并可在沙箱面板中预览。触发词包括:做个看板、生成页面、可视化、练习页、报表、指引页。
---
# UI 构建(单文件 HTML 产物)
用户需要"看得见的界面"时,用本技能生成**一个自包含的 HTML 文件**写入产物目录。
文件会被自动收集为会话产物,并在前端沙箱面板中渲染(允许脚本,opaque origin)。
## 生成流程
1. **先取数,后生成。** 界面上的数据必须来自真实查询:
- 培训资料 → `search_knowledge`
- 表格/数据库 → `data_schema` + `data_analysis`(只读 SELECT)
- 学习/业务数据 → 已挂载的 MCP 工具(如 `get_student_progress`)
- 禁止编造数据;查不到的字段要标注"暂无数据"。
2. 生成一个 HTML 文件写入产物目录:优先使用环境变量
`ACADEMY_SKILL_OUTPUT_DIR`(未设置时用 `/workspace/output`)。
3. 文件名语义化并以 `.html` 结尾,例如 `progress-dashboard.html`、`quiz-fire-safety.html`。
4. 在回答末尾引用产物让前端渲染入口卡片:
`![界面预览](sandbox:progress-dashboard.html)`
## 硬性约束(运行环境是 opaque origin 沙箱 iframe)
- **单文件自包含**:所有 CSS/JS 内联;不得引用本地其它文件。
- **体量纪律**:整个文件控制在 250 行 / 30KB 以内;图表优先用内联 SVG 或纯 CSS
实现,仅当确有必要才引一个 ESM CDN 库;样式精炼不堆砌,信息密度优先。
(生成输出预算有限,体量超限会被截断导致文件损坏)
- **外部库仅限 ESM CDN**:`https://esm.sh/...`、`https://cdn.jsdelivr.net/...`,
用 `<script type="module">` + import 引入;库失败时界面必须仍可读。
- **数据内嵌**:查询结果写入
`<script id="embedded-data" type="application/json">{ ... }</script>`,
页面脚本从该节点读取;便于用户校对数据来源。
- **禁用浏览器存储**:不要读写 `localStorage`/`sessionStorage`
(宿主已注入内存垫片,但刷新即丢失,依赖它会坏)。
- **禁止**:向外部地址发请求、提交表单、要求凭证的调用、任何写操作。
- **响应式**:容器宽度 420px~1200px 都要可用;优先 flex/grid,避免固定宽度。
- **中文文案**,语言风格与企业培训场景一致;配色克制,状态色语义正确
(红=风险/未完成,绿=已完成)。
## 宿主桥接(wkui 协议,可选能力探测)
宿主页面若启用了桥接,iframe 内会有 `window.wkui`。用前必须探测:
```js
if (window.wkui && window.wkui.version >= 1) {
// 把一句话送进对话(例如"就按这个方案执行")
window.wkui.sendChat('请把研发部的明细展开');
// 只读数据请求(返回 Promise),kind 仅支持三种:
// session-artifacts / message-artifacts / artifact-text
const res = await window.wkui.requestData({ kind: 'session-artifacts' });
}
```
- `window.wkui` 不存在时界面必须完整可用(桥接是增强,不是依赖)。
- 按钮触发 `sendChat` 前给用户可见反馈(如按钮态变化)。
## 界面类型速查
| 类型 | 必备元素 |
|---|---|
| 学习进度看板 | 总完成率大数字、按课程/部门分组条形、逾期醒目提示 |
| 练习题页 | 题干+选项按钮、提交后逐题对错与解析、得分汇总 |
| 数据报表 | 表格+图表(可用内联 SVG 或 ESM CDN 图表库)、数据截止时间标注 |
| 操作指引 | 步骤条、图文区块、可折叠详情 |