Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(rich-answer): choose diagram formats for readability

zqchris45c095f3da74
diff --git a/docs/rich-answers.md b/docs/rich-answers.md
index 27142cffb2..266c149606 100644
--- a/docs/rich-answers.md
+++ b/docs/rich-answers.md
@@ -36,6 +36,10 @@ Desktop 使用原生 React 组件;Mobile 使用原生 View/Text 与既有媒
公共交付说明以表达目标、阅读层次和视觉组织为框架,明确要求优雅、美观、易读;模型根据内容自行决定组件、布局和强调方式,不使用场景白名单或固定组件组合。图文、图标、图表与控件是可组合能力,不要求用户点名后才使用。协议例子只说明语法,验收场景不构成输出模板。简短内容仍可简短表达,用户指定格式优先。
+流程图按阅读效果与用户指定格式选择表达方式:`diagram` 是 Mermaid 自动布局的入口,不是所有流程图的必选组件;需要控制几何与连线路径时可以用 `svg`,也可以把小图与文字、分栏、折叠区或页签组合。两种格式都不能保证天然易读。用户要求画图或看样稿时应实际展示图,而不是只描述布局方案。
+
+复杂图应保留判断、分支、汇合和回路,通过路径分组、结果标注及对应清楚的连接点减少交叉线;分段展示时必须交代段间关系并保留完整逻辑。按实际显示宽度检查文字,不把整张 Mermaid 或 SVG 缩小当成可读性方案。`svg` 没有内建缩放、平移或节点点击能力;需要小屏可读时用现有组件分段组织,不虚构渲染器交互。此选择指引复用上述公共入口,不改 Harness 原生指令、组件协议或历史消息渲染。
+
当前图表外观仍由组件固定,仅支持单系列折线/条形与数据标签。用户已否决其视觉效果;下述数据正确性和展示检查不代表视觉设计通过。更新后的通用交付说明已完成三 Harness 真实生成复测(见末节),图表设计空间与默认样式仍待优化。当前版本按用户要求进入 PR 评审,送审不代表视觉优化或全部验收已经完成。
## 验收状态
diff --git a/packages/maker-shared/src/richAnswerGuide.ts b/packages/maker-shared/src/richAnswerGuide.ts
index 9f8e9d33e0..c3581e94a4 100644
--- a/packages/maker-shared/src/richAnswerGuide.ts
+++ b/packages/maker-shared/src/richAnswerGuide.ts
@@ -3,6 +3,10 @@ export const RICH_ANSWER_GUIDE = `Cindy can render a streaming component documen
Your canvas is an inline, progressively rendered part of the conversation, on Cindy's own surface. Layout, hierarchy, typography and spacing are yours; colors and backgrounds belong to Cindy so every answer stays calm and consistent with the application.
+Choose a diagram's format for readability and the user's requested output. Mermaid is an option, not a requirement for flowcharts or technical explanations. Use diagram for Mermaid's automatic layout; use svg when custom geometry and routing improve clarity, or compose smaller diagrams with text, rows, details or tabs. Neither format is inherently more readable. When asked to draw or preview, show the diagram rather than only describing a proposed layout.
+
+For complex diagrams, preserve the decisions, branches, joins and loops. Organize related paths, label outcomes, and use clearly matched connectors or linked sections to reduce crossing lines. If you split a diagram, make the connections explicit and retain the full logic across the sections. Check text size at the displayed width: shrinking one large Mermaid or SVG to fit is not a readability solution. Use readable sections when needed, without assuming svg has built-in zoom, pan or clickable nodes.
+
Every answer must work across devices and modes. The same stored answer is shown in a desktop message column (about 560–900 px wide) and on phones (about 320–430 px wide), and is often generated on one device and read later on another. It is shown in light and dark mode, and the user can switch modes at any time after generation. Do not design for the device or mode you assume the user has now.
- Layout: keep the answer readable at 320 px without horizontal scrolling. Prefer unset or percentage widths; use fixed pixel sizes only for small elements. Below 600 px, rows and grids become one column unless mobileColumns sets more; decide what should stay side by side on a phone. Cindy keeps nodes within the available width, so oversized fixed widths shrink rather than overflow.
- Color: answers have no backgrounds or custom color values; Cindy draws every color from its theme, so both modes follow automatically. Where color carries meaning, name a role: "primary", "secondary" or "tertiary" for text emphasis, and "success", "warning" or "danger" only for results, cautions and problems. Other color values are ignored. When asked for a colorful or themed look, build it from layout, typography, icons and spacing instead of colors.
@@ -22,7 +26,7 @@ Components and props (no arbitrary HTML, CSS, scripts or tool access):
- stack/group: vertical children. row/grid: columns?, mobileColumns?, weights? (relative column widths); layout:"aside" for side-by-side content.
- divider.
- image/video/audio: src (existing managed reference, URL or task file), alt, caption. Reuse actual media; never invent asset URLs or embed base64 data. Video src accepts a playable media file URL or a YouTube watch/share/shorts URL (the host uses the site player). Other website pages are links, not video files; link to those pages instead of treating them as media bytes.
-- code: text, language. math: text (LaTeX). diagram: text (Mermaid).
+- code: text, language. math: text (LaTeX). diagram: text (Mermaid; svg and composed components can also express diagrams).
- stat: label, value, prefix?, suffix?.
- chart: label, variant:"bar"|"line", data:[{label,value}], color? (role), colors? (bar roles), height?, yMin?, yMax?, includeZero?, ticks?, decimals?, showValues?, showLabels?, showPoints?, pointRadius?, strokeWidth?, showGrid?, left?, right?, top?, bottom?. Line domains fit the data unless specified. Chart options are optional; use svg for other chart types or custom composition.
- svg: label/alt, viewBox:[x,y,width,height], shapes:[{type,...attributes}]. Shape types: path, rect, circle, ellipse, line, polyline, polygon, text. Attributes: x,y,x1,y1,x2,y2,width,height,rx,ry,cx,cy,r,d,points,fill and stroke (a color role or "none"),strokeWidth,strokeDasharray,strokeLinecap,strokeLinejoin,opacity,fillOpacity,strokeOpacity,fontSize,fontWeight,letterSpacing,textAnchor,transform. text shapes use text. Coordinates and paths are model-designed; the viewBox scales to the available width. No script, events, HTML, external references or URL paints.