dsh-motion-ui 0.0.0-stage → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/DESIGN.zh-CN.md +56 -0
- package/LICENSE +21 -0
- package/README.md +162 -2
- package/RELEASE-PLAN.zh-CN.md +52 -0
- package/VERIFICATION.md +133 -0
- package/client.js +23645 -0
- package/cordis.patch.yml +3 -0
- package/examples/agent-architecture.json +48 -0
- package/examples/bicycle-explorer.json +108 -0
- package/examples/calculator.json +94 -0
- package/examples/comparison.json +59 -0
- package/examples/conditional-budget.json +148 -0
- package/examples/live-memory-curve.json +251 -0
- package/examples/scene-comparison.json +86 -0
- package/examples/scene-dashboard.json +92 -0
- package/examples/scene-guide.json +56 -0
- package/examples/scene-report.json +61 -0
- package/examples/scene-status.json +70 -0
- package/examples/scene-workbench.json +105 -0
- package/examples/sine-motion.json +49 -0
- package/examples/speed-memory-scatter.json +113 -0
- package/index.js +69 -0
- package/lib/author-expression.js +60 -0
- package/lib/build-info.js +2 -0
- package/lib/canvas-design.js +10 -0
- package/lib/canvas-example.js +46 -0
- package/lib/canvas-export.js +9 -0
- package/lib/canvas-preview.js +31 -0
- package/lib/canvas-system.js +14 -0
- package/lib/catalog.js +92 -0
- package/lib/components.js +28 -0
- package/lib/export-runtime-bundle.js +2 -0
- package/lib/format-number.js +7 -0
- package/lib/freeform.js +13 -0
- package/lib/inspection.js +13 -0
- package/lib/presentation.js +6 -0
- package/lib/protocol.js +295 -0
- package/lib/refinement.js +31 -0
- package/lib/sandbox.js +52 -0
- package/lib/scenes.js +50 -0
- package/lib/store.js +176 -0
- package/lib/stream.js +87 -0
- package/lib/tool-json.js +7 -0
- package/lib/ui-intent.js +14 -0
- package/lib/ui-skill.js +46 -0
- package/lib/visual-audit.js +18 -0
- package/lib/visual-examples.js +28 -0
- package/package.json +75 -4
- package/skills/intelligent-ui/SKILL.md +86 -0
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"title": "一次 Agent 请求如何流转",
|
|
4
|
+
"presentation": {
|
|
5
|
+
"layout": "report",
|
|
6
|
+
"accent": "blue"
|
|
7
|
+
},
|
|
8
|
+
"fallback": "概念结构图:消息经过上下文整理送入模型;模型可以请求工具,工具结果再进入上下文。这是通用教学示意,不表示正在监控实际 DSH 请求。",
|
|
9
|
+
"state": {
|
|
10
|
+
"focus": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"default": "all",
|
|
13
|
+
"options": [
|
|
14
|
+
"all",
|
|
15
|
+
"request",
|
|
16
|
+
"context",
|
|
17
|
+
"model",
|
|
18
|
+
"tools"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"nodes": [
|
|
23
|
+
{
|
|
24
|
+
"id": "scope",
|
|
25
|
+
"type": "text",
|
|
26
|
+
"text": "从一条消息开始,观察上下文、模型和工具如何协作。概念示意,不是实时任务监控。"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "architecture",
|
|
30
|
+
"type": "sandbox",
|
|
31
|
+
"title": "Agent 消息流向",
|
|
32
|
+
"height": 370,
|
|
33
|
+
"stateKeys": [
|
|
34
|
+
"focus"
|
|
35
|
+
],
|
|
36
|
+
"fallback": "消息 → 上下文 → 模型 → 工具 → 上下文。参考资料也可进入上下文。选择某一环节查看职责;箭头表示概念数据流。",
|
|
37
|
+
"html": "<div class=\"map\"><div class=\"kicker\">REQUEST / CONTEXT / ACTION</div><div class=\"diagram-scroll\" tabindex=\"0\" role=\"region\" aria-label=\"结构图,窄屏可横向滚动\"><svg viewBox=\"0 0 640 320\" role=\"img\" aria-labelledby=\"mapTitle mapDesc\"><title id=\"mapTitle\">消息、上下文、模型和工具之间的数据流</title><desc id=\"mapDesc\">消息与参考资料送入上下文,上下文送入模型,模型请求工具,工具结果返回上下文。下方选择框提供相同的环节选择。</desc><defs><marker id=\"arrow\" markerWidth=\"8\" markerHeight=\"8\" refX=\"7\" refY=\"4\" orient=\"auto\"><path d=\"M0 0L8 4L0 8Z\" fill=\"var(--canvas-muted)\"/></marker></defs><g class=\"links\" marker-end=\"url(#arrow)\"><path d=\"M140 146H220\"/><path d=\"M380 136H430V66H480\"/><path d=\"M550 92V215\"/><path d=\"M480 241H416V158H380\"/><path d=\"M300 245V172\"/></g><g class=\"labels\"><text x=\"169\" y=\"135\">输入</text><text x=\"437\" y=\"53\">推理</text><text x=\"559\" y=\"155\">调用</text><text x=\"421\" y=\"197\">结果</text><text x=\"308\" y=\"218\">补充</text></g><g data-node=\"request\" class=\"node\" tabindex=\"0\" role=\"button\" aria-label=\"消息环节\"><rect x=\"20\" y=\"120\" width=\"120\" height=\"52\" rx=\"8\"/><text x=\"80\" y=\"151\">用户消息</text></g><g data-node=\"context\" class=\"node\" tabindex=\"0\" role=\"button\" aria-label=\"上下文环节\"><rect x=\"220\" y=\"120\" width=\"160\" height=\"52\" rx=\"8\"/><text x=\"300\" y=\"151\">上下文整理</text></g><g data-node=\"model\" class=\"node\" tabindex=\"0\" role=\"button\" aria-label=\"模型环节\"><rect x=\"480\" y=\"40\" width=\"140\" height=\"52\" rx=\"8\"/><text x=\"550\" y=\"71\">模型</text></g><g data-node=\"tools\" class=\"node\" tabindex=\"0\" role=\"button\" aria-label=\"工具环节\"><rect x=\"480\" y=\"215\" width=\"140\" height=\"52\" rx=\"8\"/><text x=\"550\" y=\"246\">受授权的工具</text></g><g class=\"source\"><rect x=\"220\" y=\"245\" width=\"160\" height=\"52\" rx=\"8\"/><text x=\"300\" y=\"276\">参考资料</text></g></svg></div><p id=\"description\" aria-live=\"polite\"></p></div>",
|
|
38
|
+
"css": ".map{padding:10px 0}.diagram-scroll{max-width:100%;overflow-x:auto}.diagram-scroll svg{min-width:580px}.kicker{font-size:10px;letter-spacing:1.5px;color:var(--canvas-muted)}svg{display:block;width:100%;margin-top:12px}.links{fill:none;stroke:var(--canvas-muted);stroke-width:1.4;stroke-linejoin:round}.labels{fill:var(--canvas-muted);font-size:11px}.node{cursor:pointer}.node rect,.source rect{fill:var(--canvas-soft);stroke:var(--canvas-line);stroke-width:1.5}.node text,.source text{fill:var(--canvas-ink);font-size:13px;text-anchor:middle}.source rect{stroke-dasharray:3 3}.source text{fill:var(--canvas-muted)}.node[data-selected=true] rect{stroke:var(--canvas-accent);stroke-width:2.5}.node:focus-visible{outline:none}.node:focus-visible rect{stroke:var(--canvas-accent);stroke-width:3}#description{font-size:13px;line-height:1.8;color:var(--canvas-muted);border-left:2px solid var(--canvas-accent);padding-left:12px;min-height:48px}@media(max-width:420px){.labels{font-size:12px}.node text,.source text{font-size:15px}}",
|
|
39
|
+
"script": "const descriptions={all:'各环节通过上下文形成反馈循环;是否执行工具仍取决于宿主的权限流程。',request:'消息环节:表达问题、目标和约束。它是本次请求的起点。',context:'上下文环节:组织消息、相关资料和工具结果,为下一次模型推理提供依据。',model:'模型环节:依据上下文生成回答,或提出需要由宿主处理的工具请求。',tools:'工具环节:在宿主授权范围内执行操作,将结果送回上下文。图形不会自行执行工具。'};for(const node of document.querySelectorAll('[data-node]')){const choose=()=>DSHUI.setState({focus:node.dataset.node});node.addEventListener('click',choose);node.addEventListener('keydown',event=>{if(event.key==='Enter'||event.key===' '){event.preventDefault();choose()}})}DSHUI.subscribe(s=>{for(const node of document.querySelectorAll('[data-node]')){const selected=s.state.focus===node.dataset.node;node.dataset.selected=String(selected);node.setAttribute('aria-pressed',String(selected))}document.getElementById('description').textContent=descriptions[s.state.focus]});"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "focus",
|
|
43
|
+
"type": "select",
|
|
44
|
+
"label": "选择要了解的环节",
|
|
45
|
+
"bind": "state.focus"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"title": "七速自行车 · 拆解与探索",
|
|
4
|
+
"fallback": "交互式结构示意,不按工程比例绘制。拖动拆解程度,观察车架、车轮、传动、刹车和操控系统;选择部件查看职责。七速表示后部有七个可选齿比,此图未精确绘制七片飞轮或真实走线。",
|
|
5
|
+
"presentation": {
|
|
6
|
+
"layout": "guide",
|
|
7
|
+
"accent": "teal"
|
|
8
|
+
},
|
|
9
|
+
"state": {
|
|
10
|
+
"explode": {
|
|
11
|
+
"type": "number",
|
|
12
|
+
"default": 0,
|
|
13
|
+
"min": 0,
|
|
14
|
+
"max": 100,
|
|
15
|
+
"step": 1
|
|
16
|
+
},
|
|
17
|
+
"focus": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "all",
|
|
20
|
+
"options": [
|
|
21
|
+
"all",
|
|
22
|
+
"frame",
|
|
23
|
+
"wheels",
|
|
24
|
+
"drive",
|
|
25
|
+
"brakes",
|
|
26
|
+
"cockpit"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"playing": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"default": false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"derived": {
|
|
35
|
+
"phase": {
|
|
36
|
+
"op": "if",
|
|
37
|
+
"args": [
|
|
38
|
+
{
|
|
39
|
+
"op": "gt",
|
|
40
|
+
"args": [
|
|
41
|
+
{
|
|
42
|
+
"ref": "state.explode"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"const": 50
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"const": "展开观察部件如何配合"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"const": "从整车出发理解五个系统"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"nodes": [
|
|
59
|
+
{
|
|
60
|
+
"id": "intro",
|
|
61
|
+
"type": "text",
|
|
62
|
+
"text": "一辆车,五个协作系统。拖动滑块拆解结构,点击部件名称聚焦探索。示意图,不是工程装配图。"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "bike",
|
|
66
|
+
"type": "sandbox",
|
|
67
|
+
"title": "自行车交互结构示意",
|
|
68
|
+
"height": 560,
|
|
69
|
+
"fallback": "车架连接各系统并承载骑手;车轮支撑与滚动;传动将踩踏转为后轮扭矩;刹车通过摩擦减速;操控系统连接转向与骑手操作。动画仅展示运动关系,不模拟真实物理。",
|
|
70
|
+
"stateKeys": [
|
|
71
|
+
"explode",
|
|
72
|
+
"focus",
|
|
73
|
+
"playing"
|
|
74
|
+
],
|
|
75
|
+
"derivedKeys": [
|
|
76
|
+
"phase"
|
|
77
|
+
],
|
|
78
|
+
"html": "<div class=\"demo\"><div class=\"eyebrow\"><span>MECHANICAL EXPLORER</span><span>01 / BICYCLE</span></div><div class=\"stage\"><svg viewBox=\"0 0 720 360\" role=\"img\" aria-labelledby=\"bikeTitle bikeDesc\"><title id=\"bikeTitle\">自行车拆解示意</title><desc id=\"bikeDesc\">拖动下方拆解滑块,或选择部件名称。每个系统的职责在图下解释。</desc><defs><pattern id=\"grid\" width=\"24\" height=\"24\" patternUnits=\"userSpaceOnUse\"><circle cx=\"1\" cy=\"1\" r=\".8\" fill=\"currentColor\" opacity=\".12\"/></pattern></defs><rect width=\"720\" height=\"360\" fill=\"url(#grid)\"/><path class=\"ground\" d=\"M70 323H650\"/>\n<g data-part=\"wheels\"><g id=\"rearWheel\"><circle cx=\"180\" cy=\"250\" r=\"69\" class=\"tyre\"/><circle cx=\"180\" cy=\"250\" r=\"61\" class=\"rim\"/><g class=\"spokes\" data-wheel=\"rear\"></g><circle cx=\"180\" cy=\"250\" r=\"6\" class=\"hub\"/></g><g id=\"frontWheel\"><circle cx=\"540\" cy=\"250\" r=\"69\" class=\"tyre\"/><circle cx=\"540\" cy=\"250\" r=\"61\" class=\"rim\"/><g class=\"spokes\" data-wheel=\"front\"></g><circle cx=\"540\" cy=\"250\" r=\"6\" class=\"hub\"/></g></g>\n<g data-part=\"frame\" class=\"frame\"><path d=\"M180 250L285 130L340 250Z M285 130L455 115L340 250 M455 115L469 150 M285 130L273 98\"/><path d=\"M253 96L282 96\" class=\"saddle\"/></g>\n<g data-part=\"drive\" class=\"drive\"><path d=\"M180 241L340 231A20 20 0 0 1 340 269L180 259Z\" class=\"chain\"/><circle cx=\"340\" cy=\"250\" r=\"18\"/><circle cx=\"180\" cy=\"250\" r=\"13\"/><path d=\"M340 250L365 276H380 M340 250L322 224H307\"/><path d=\"M173 265L170 283L184 291\"/></g>\n<g data-part=\"cockpit\" class=\"cockpit\"><path d=\"M460 132L486 192L540 250 M454 111L446 85L476 76 M476 76L500 64L524 70\"/><path d=\"M500 64L503 80\" class=\"lever\"/></g>\n<g data-part=\"brakes\" class=\"brakes\"><path d=\"M159 181L171 175L183 181 M520 181L531 175L544 181\"/><path d=\"M503 80Q540 110 531 175 M492 75Q335 25 171 175\" class=\"cable\"/></g>\n<g class=\"partlabels\"><text x=\"96\" y=\"339\">滚动</text><text x=\"310\" y=\"38\">承载 · 转向 · 传动</text><text x=\"568\" y=\"339\">协作</text></g></svg><span class=\"stage-note\">结构与运动关系示意 · 非工程比例</span></div><div class=\"partnav\" role=\"group\" aria-label=\"选择系统\"></div><div class=\"explanation\" aria-live=\"polite\"><span class=\"index\">01—05</span><div><h2 id=\"partTitle\">五个相互连接的系统</h2><p id=\"partText\"></p></div></div><div class=\"foot\"><span id=\"phase\"></span><button id=\"play\" type=\"button\">播放轮转</button></div></div>",
|
|
79
|
+
"css": ".demo{padding:12px 2px;color:var(--canvas-ink)}.eyebrow,.foot{display:flex;justify-content:space-between;gap:12px;align-items:center;color:var(--canvas-muted);font-size:10px;letter-spacing:1.2px}.stage{position:relative;border-radius:16px;margin:18px 0;background:var(--canvas-soft);overflow:hidden}.stage svg{display:block;width:100%;color:var(--canvas-muted)}.ground{stroke:var(--canvas-line);fill:none;stroke-dasharray:3 5}.stage-note{position:absolute;bottom:10px;left:16px;font-size:10px;color:var(--canvas-muted)}[data-part]{transform-origin:center;transition:opacity .18s}.tyre{stroke:var(--canvas-ink);stroke-width:7;fill:none}.rim,.spokes,.hub{stroke:var(--canvas-muted);fill:none;stroke-width:1.2}.frame{stroke:var(--canvas-accent);stroke-width:9;stroke-linejoin:round;stroke-linecap:round;fill:none}.frame .saddle{stroke-width:11}.drive,.cockpit,.brakes{fill:none;stroke:var(--canvas-ink);stroke-width:4;stroke-linecap:round;stroke-linejoin:round}.chain,.cable{stroke-width:1.5}.cockpit{stroke-width:7}.lever{stroke-width:3}.brakes{stroke:var(--canvas-accent);stroke-width:4}.partlabels{font-size:10px;fill:var(--canvas-muted);letter-spacing:2px}.partnav{display:flex;gap:7px;flex-wrap:wrap}.partnav button,#play{border:1px solid var(--canvas-line);background:transparent;color:var(--canvas-muted);padding:5px 12px;border-radius:99px;cursor:pointer;font-size:12px}.partnav button[aria-pressed=true]{background:var(--canvas-accent);border-color:var(--canvas-accent);color:white}.explanation{display:flex;gap:18px;padding:23px 0 18px;min-height:114px}.index{font-size:11px;color:var(--canvas-accent);padding-top:5px;white-space:nowrap}.explanation h2{margin:0 0 7px;font-size:18px;font-weight:600}.explanation p{margin:0;color:var(--canvas-muted);font-size:13px;line-height:1.8}.foot{border-top:1px solid var(--canvas-line);padding-top:12px;font-size:11px;letter-spacing:0}@media(max-width:420px){.eyebrow{font-size:9px}.stage{margin:13px 0}.stage-note{font-size:8px;bottom:5px}.explanation{padding-top:18px}.explanation h2{font-size:16px}.partnav{gap:5px}.partnav button{padding:5px 9px}.foot{flex-wrap:wrap}}",
|
|
80
|
+
"script": "const parts={all:['全部','五个相互连接的系统','车架承载骑手,车轮负责滚动,传动把踩踏转为后轮扭矩。选择一个系统,观察它如何与整车配合。'],frame:['车架','车架:让各系统成为整车','三角形结构连接车轮、坐垫和转向部件,承受并传递骑手与路面的载荷。图中的位移只是拆解展示。'],wheels:['车轮','车轮:支撑与滚动','轮胎接触地面,轮圈与辐条连接轮毂。前轮随车把转向,后轮接受传动扭矩。'],drive:['传动','传动:把踩踏变为前进','曲柄通过链条驱动后轮。七个可选齿比改变踩踏阻力与每圈前进距离;本示意不精确绘制七片飞轮。'],brakes:['刹车','刹车:用摩擦控制速度','刹把经拉线控制制动机构。这里用简化的轮圈刹车表示,实际走线与装配位置因车型而异。'],cockpit:['操控','操控:把意图传给车辆','车把、把立和前叉组成转向链路,骑手通过车把和刹把控制方向与速度。']};\nconst nav=document.querySelector('.partnav');for(const [key,p]of Object.entries(parts)){const b=document.createElement('button');b.type='button';b.textContent=p[0];b.dataset.focus=key;b.onclick=()=>DSHUI.setState({focus:key});nav.append(b)}\nfor(const [key,x]of [['rear',180],['front',540]]){const g=document.querySelector('[data-wheel='+key+']');for(let i=0;i<16;i++){const a=i*Math.PI/8,l=document.createElementNS('http://www.w3.org/2000/svg','line');for(const [k,v]of Object.entries({x1:x,y1:250,x2:x+60*Math.cos(a),y2:250+60*Math.sin(a)}))l.setAttribute(k,v);g.append(l)}}\nlet current=DSHUI.snapshot,angle=0;\nDSHUI.subscribe(s=>{current=s;const e=s.state.explode/100,f=s.state.focus;for(const g of document.querySelectorAll('[data-part]')){const p=g.dataset.part;g.style.opacity=f==='all'||f===p?'1':'.16';if(p==='wheels'){document.getElementById('rearWheel').setAttribute('transform','translate('+(-48*e)+' '+(15*e)+')');document.getElementById('frontWheel').setAttribute('transform','translate('+(48*e)+' '+(15*e)+')')}else{const v={frame:[0,-18],drive:[0,52],brakes:[18,-45],cockpit:[22,-55]}[p];g.setAttribute('transform','translate('+(v[0]*e)+' '+(v[1]*e)+')')}}for(const b of nav.children){b.setAttribute('aria-pressed',String(b.dataset.focus===f));b.disabled=s.disabled}document.getElementById('partTitle').textContent=parts[f][1];document.getElementById('partText').textContent=parts[f][2];document.getElementById('phase').textContent=s.derived.phase;document.getElementById('play').textContent=s.state.playing?'暂停轮转':'播放轮转';document.getElementById('play').disabled=s.disabled});\ndocument.getElementById('play').onclick=()=>DSHUI.setState({playing:!current.state.playing});\nDSHUI.animate(({delta})=>{if(current.state.playing&&!current.disabled){angle+=delta*90;for(const [key,x]of [['rear',180],['front',540]])document.querySelector('[data-wheel='+key+']').setAttribute('transform','rotate('+angle+' '+x+' 250)')}});"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "explodeControl",
|
|
84
|
+
"type": "slider",
|
|
85
|
+
"label": "拆解程度 %",
|
|
86
|
+
"bind": "state.explode"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "focusControl",
|
|
90
|
+
"type": "select",
|
|
91
|
+
"label": "聚焦系统(与图内按钮同步)",
|
|
92
|
+
"bind": "state.focus"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "rotation",
|
|
96
|
+
"type": "toggle",
|
|
97
|
+
"label": "播放示意轮转(非物理仿真)",
|
|
98
|
+
"bind": "state.playing"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "phaseText",
|
|
102
|
+
"type": "text",
|
|
103
|
+
"text": {
|
|
104
|
+
"ref": "derived.phase"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"title": "理论权重体积计算器",
|
|
4
|
+
"fallback": "27B 参数、4 bit 时纯权重理论体积约 12.57 GiB。这是理论估算,不是实测文件大小或运行显存;不含量化元数据、混合精度层、KV cache 和运行缓冲区。",
|
|
5
|
+
"state": {
|
|
6
|
+
"parametersB": {
|
|
7
|
+
"type": "number",
|
|
8
|
+
"default": 27,
|
|
9
|
+
"min": 1,
|
|
10
|
+
"max": 200,
|
|
11
|
+
"step": 1
|
|
12
|
+
},
|
|
13
|
+
"bits": {
|
|
14
|
+
"type": "number",
|
|
15
|
+
"default": 4,
|
|
16
|
+
"min": 2,
|
|
17
|
+
"max": 16,
|
|
18
|
+
"step": 1
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"data": {},
|
|
22
|
+
"derived": {
|
|
23
|
+
"weightGiB": {
|
|
24
|
+
"op": "div",
|
|
25
|
+
"args": [
|
|
26
|
+
{
|
|
27
|
+
"op": "mul",
|
|
28
|
+
"args": [
|
|
29
|
+
{
|
|
30
|
+
"ref": "state.parametersB"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"const": 1000000000
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"ref": "state.bits"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"const": 8589934592
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"nodes": [
|
|
47
|
+
{
|
|
48
|
+
"id": "parameters",
|
|
49
|
+
"type": "input",
|
|
50
|
+
"label": "参数量 B(十亿)",
|
|
51
|
+
"bind": "state.parametersB"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "bits",
|
|
55
|
+
"type": "slider",
|
|
56
|
+
"label": "假设有效位宽 bit",
|
|
57
|
+
"bind": "state.bits"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "weight",
|
|
61
|
+
"type": "metric",
|
|
62
|
+
"label": "纯权重理论体积",
|
|
63
|
+
"value": {
|
|
64
|
+
"ref": "derived.weightGiB"
|
|
65
|
+
},
|
|
66
|
+
"unit": "GiB",
|
|
67
|
+
"decimals": 2,
|
|
68
|
+
"icon": "database",
|
|
69
|
+
"tone": "accent"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "note",
|
|
73
|
+
"type": "text",
|
|
74
|
+
"text": "理论估算,不是实际 GGUF 大小或推理显存。",
|
|
75
|
+
"tone": "warning"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "followup",
|
|
79
|
+
"type": "button",
|
|
80
|
+
"text": "按当前参数继续分析",
|
|
81
|
+
"action": "analyze"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"actions": {
|
|
85
|
+
"analyze": {
|
|
86
|
+
"type": "agent.followup",
|
|
87
|
+
"intent": "分析当前参数下的量化选择,区分理论权重体积与真实运行开销;缺少信息时说明不确定性。",
|
|
88
|
+
"stateKeys": [
|
|
89
|
+
"parametersB",
|
|
90
|
+
"bits"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"title": "示例数据比较",
|
|
4
|
+
"fallback": "仅用于演示:A 为 12,B 为 18,C 为 15;不是实测性能。",
|
|
5
|
+
"data": {
|
|
6
|
+
"results": [
|
|
7
|
+
{
|
|
8
|
+
"name": "A",
|
|
9
|
+
"value": 12
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "B",
|
|
13
|
+
"value": 18
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "C",
|
|
17
|
+
"value": 15
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"nodes": [
|
|
22
|
+
{
|
|
23
|
+
"id": "note",
|
|
24
|
+
"type": "text",
|
|
25
|
+
"text": "以下为演示数据,不是实测性能。",
|
|
26
|
+
"tone": "warning"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "chart",
|
|
30
|
+
"type": "chart",
|
|
31
|
+
"kind": "bar",
|
|
32
|
+
"rows": {
|
|
33
|
+
"ref": "data.results"
|
|
34
|
+
},
|
|
35
|
+
"labelKey": "name",
|
|
36
|
+
"valueKey": "value",
|
|
37
|
+
"label": "示例分数",
|
|
38
|
+
"unit": "分"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "table",
|
|
42
|
+
"type": "table",
|
|
43
|
+
"rows": {
|
|
44
|
+
"ref": "data.results"
|
|
45
|
+
},
|
|
46
|
+
"columns": [
|
|
47
|
+
{
|
|
48
|
+
"key": "name",
|
|
49
|
+
"label": "方案"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"key": "value",
|
|
53
|
+
"label": "示例分数",
|
|
54
|
+
"unit": "分"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"title": "理论权重预算比较",
|
|
4
|
+
"fallback": "这是纯权重理论预算比较,不包含实际推理运行开销。默认 27B、4 bit、20 GiB 理论预算,权重约 12.57 GiB。",
|
|
5
|
+
"state": {
|
|
6
|
+
"parametersB": {
|
|
7
|
+
"type": "number",
|
|
8
|
+
"default": 27,
|
|
9
|
+
"min": 1,
|
|
10
|
+
"max": 200,
|
|
11
|
+
"step": 1
|
|
12
|
+
},
|
|
13
|
+
"bits": {
|
|
14
|
+
"type": "number",
|
|
15
|
+
"default": 4,
|
|
16
|
+
"min": 2,
|
|
17
|
+
"max": 16,
|
|
18
|
+
"step": 1
|
|
19
|
+
},
|
|
20
|
+
"budgetGiB": {
|
|
21
|
+
"type": "number",
|
|
22
|
+
"default": 20,
|
|
23
|
+
"min": 1,
|
|
24
|
+
"max": 96,
|
|
25
|
+
"step": 1
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"data": {},
|
|
29
|
+
"derived": {
|
|
30
|
+
"weightGiB": {
|
|
31
|
+
"op": "div",
|
|
32
|
+
"args": [
|
|
33
|
+
{
|
|
34
|
+
"op": "mul",
|
|
35
|
+
"args": [
|
|
36
|
+
{
|
|
37
|
+
"ref": "state.parametersB"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"const": 1000000000
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"ref": "state.bits"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"const": 8589934592
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"verdict": {
|
|
53
|
+
"op": "if",
|
|
54
|
+
"args": [
|
|
55
|
+
{
|
|
56
|
+
"op": "gt",
|
|
57
|
+
"args": [
|
|
58
|
+
{
|
|
59
|
+
"ref": "derived.weightGiB"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"ref": "state.budgetGiB"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"const": "超过纯权重理论预算;请降低位宽或提高预算。"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"const": "在纯权重理论预算内;仍需另计运行开销。"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"nodes": [
|
|
76
|
+
{
|
|
77
|
+
"id": "assumptions",
|
|
78
|
+
"type": "text",
|
|
79
|
+
"tone": "warning",
|
|
80
|
+
"text": "以下均为理论估算,不能直接据此判断模型能否在显卡上运行。"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "settings",
|
|
84
|
+
"type": "card",
|
|
85
|
+
"title": "调整参数",
|
|
86
|
+
"icon": "sliders",
|
|
87
|
+
"children": [
|
|
88
|
+
{
|
|
89
|
+
"id": "parameters",
|
|
90
|
+
"type": "input",
|
|
91
|
+
"label": "参数量 B(十亿)",
|
|
92
|
+
"bind": "state.parametersB"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "bits",
|
|
96
|
+
"type": "slider",
|
|
97
|
+
"label": "假设有效位宽 bit",
|
|
98
|
+
"bind": "state.bits"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "budget",
|
|
102
|
+
"type": "slider",
|
|
103
|
+
"label": "纯权重理论预算 GiB",
|
|
104
|
+
"bind": "state.budgetGiB"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "results",
|
|
110
|
+
"type": "row",
|
|
111
|
+
"children": [
|
|
112
|
+
{
|
|
113
|
+
"id": "weight",
|
|
114
|
+
"type": "metric",
|
|
115
|
+
"label": "纯权重理论体积",
|
|
116
|
+
"value": {
|
|
117
|
+
"ref": "derived.weightGiB"
|
|
118
|
+
},
|
|
119
|
+
"unit": "GiB",
|
|
120
|
+
"decimals": 2,
|
|
121
|
+
"icon": "database",
|
|
122
|
+
"tone": "accent"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "budgetMetric",
|
|
126
|
+
"type": "metric",
|
|
127
|
+
"label": "理论预算",
|
|
128
|
+
"icon": "target",
|
|
129
|
+
"tone": "neutral",
|
|
130
|
+
"value": {
|
|
131
|
+
"ref": "state.budgetGiB"
|
|
132
|
+
},
|
|
133
|
+
"unit": "GiB",
|
|
134
|
+
"decimals": 0
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "verdictText",
|
|
140
|
+
"type": "text",
|
|
141
|
+
"icon": "info",
|
|
142
|
+
"text": {
|
|
143
|
+
"ref": "derived.verdict"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"actions": {}
|
|
148
|
+
}
|