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(chat): guide readable rich layouts and stack narrow chart columns

Chrisaa4c80c8117f
diff --git a/apps/desktop/src/renderer/components/chat/rich-answer.css b/apps/desktop/src/renderer/components/chat/rich-answer.css
index 02977559a6..1edcd7a892 100644
--- a/apps/desktop/src/renderer/components/chat/rich-answer.css
+++ b/apps/desktop/src/renderer/components/chat/rich-answer.css
@@ -139,7 +139,11 @@
height: 100%;
background: var(--text-secondary);
}
-@container (max-width:360px) {
+/* Two readable chart columns need more room than a phone-sized answer. */
+@container (max-width:600px) {
+ .rich-answer-row {
+ flex-direction: column;
+ }
.rich-answer-grid {
grid-template-columns: 1fr;
}
diff --git a/apps/mobile/src/session/RichAnswer.tsx b/apps/mobile/src/session/RichAnswer.tsx
index e151168750..3437d0afee 100644
--- a/apps/mobile/src/session/RichAnswer.tsx
+++ b/apps/mobile/src/session/RichAnswer.tsx
@@ -218,7 +218,7 @@ function RichDocumentView({
case "grid": {
const aside = richString(node, "layout") === "aside";
const columns =
- width < 360 && !aside
+ width <= 600 && !aside
? 1
: Math.round(
Math.max(1, Math.min(3, richNumber(node, "columns", 2))),
diff --git a/docs/rich-answers.md b/docs/rich-answers.md
index b48b27792d..31a529a199 100644
--- a/docs/rich-answers.md
+++ b/docs/rich-answers.md
@@ -26,6 +26,10 @@ Desktop 使用原生 React 组件;Mobile 使用原生 View/Text 与既有媒
模型自由组合布局;简单回答、代码和显式要求的格式保持简洁。组件仅适用于 Cindy 正文,外部渠道沿用其格式。控件只改变本地查看状态,不执行工具、不提交用户输入。原有执行、停止、上下文压缩及工作过程折叠流程不变。计算可引用输入与其它计算节点;缺失、循环或非法计算显示局部不可用,不伪造零值。流式尚未到达的引用先等待。
+公共交付说明以表达目标、阅读层次和视觉组织为框架,明确要求优雅、美观、易读;模型根据内容自行决定组件、布局和强调方式,不使用场景白名单或固定组件组合。图文、图标、图表与控件是可组合能力,不要求用户点名后才使用。协议例子只说明语法,验收场景不构成输出模板。简短内容仍可简短表达,用户指定格式优先。
+
+当前图表外观仍由组件固定,仅支持单系列折线/条形与数据标签。用户已否决其视觉效果;下述数据正确性和展示检查不代表视觉设计通过。更新后的通用交付说明已完成三 Harness 真实生成复测(见末节),图表设计空间与默认样式仍待优化。当前版本按用户要求进入 PR 评审,送审不代表视觉优化或全部验收已经完成。
+
## 验收状态
本地实现与定向测试已完成。通过隔离 Cindy 的实际 maker 入口运行 18 次:5 个自然请求(费用比较、图文、简短算术、代码、勾选清单)× Codex / Claude Code / Pi,加上三种 Harness 各一个测试伙伴。12 份组件正文均无解析错误和不可用计算,6 份简单/代码回答使用普通正文。三个费用比较在 12 个月并开启服务时均显示 300 / 240、省 60;清单勾选两项后均为 2 / 4。伙伴沿用用户档案的“清单在前、完成数量在后”偏好。单次样本不代表稳定成功率;Claude Code 的代码回答多了一句说明,费用回答有空代码围栏,已在报告保留。
@@ -65,3 +69,13 @@ iPhone 原生测试版回放真实结果,已检查任务、伙伴、流式到
| iOS 图文 | iOS 原生图标(深色) | iOS 数据图 |
| --- | --- | --- |
| ![图文](images/rich-answers/mobile-illustrated-light.png) | ![图标](images/rich-answers/mobile-icons-dark.png) | ![图表](images/rich-answers/mobile-charts-light.png) |
+
+## 通用设计框架复测(2026-10-18)
+
+使用更新后的公共说明,经隔离 Desktop 的 maker 入口新建 12 个真实任务:照片行程、团队数据简报、新同事说明、简单算术 × Codex / Claude Code / Pi。请求只提供内容与阅读目标,没有指定组件协议、图表类型或布局。模型分别为 gpt-6.1-sol、claude-sonnet-5-5、chatgpt/gpt-6.1-sol,使用原订阅,每个样本一次生成,无额外答案优化调用。
+
+9 份主要答案均自行采用组件,并在模型结束前观察到组件显示;生产解析器没有错误或不可用计算。三份数据简报的 30 个输入数值全部一致,三份图文各保留三张真实照片,三份新同事说明各自行选择四个原生图标。三个算术答案均正确回答 391 且不使用组件。结构确有差异:Codex 并排双图、Claude Code 指标概览加分段图表、Pi 指标概览加并排双图。实际四个 Pi RPC 进程的 `--append-system-prompt` 均包含新版说明,桥接未移除该段;不据此声称已启动的旧进程也自动获得新版说明。
+
+实测发现手机两列图表挤压月份和数值,修复为正文可用宽度不超过 600 时将普通 row/grid 改为单列;旁置图片保持其专用布局,宽屏仍保留模型选择。桌面生产组件在 393 像素容器验证两图上下排列、标签和数值保留、无横向溢出。手机原生回放九份实际答案,修复后重看浅深色和答案不同段落;照片仅在测试 fixture 中映射到本机 HTTP,不代替 Device Link 全链路。测试滚动调用列表接口及拖动处理,不宣称完成手势验收。桌面组件 5 项(1.14s)、Mobile 类型检查通过;未新增仅检查 CSS 字面量的测试。
+
+视觉仍未通过:图表默认灰色样式及设计空间未改善;Claude Code 的数据简报附带重复表格,新同事说明也偏长。不能用解析与数值通过代替视觉质量。单次样本不是稳定成功率;本轮未重新测伙伴身份和远程执行。原始结果、截图、实际 Pi 注入检查与窄屏测量保存在作者的“日常正文验收”目录,汇总为自包含“自由排版实测.html”。本轮 12 个及上轮 15 个测试任务已通过应用生命周期关闭执行、标记删除并回读,保留独立证据和登录态。
diff --git a/packages/maker-shared/src/richAnswerGuide.ts b/packages/maker-shared/src/richAnswerGuide.ts
index 3cfa61e7ed..11cf8e9e59 100644
--- a/packages/maker-shared/src/richAnswerGuide.ts
+++ b/packages/maker-shared/src/richAnswerGuide.ts
@@ -26,7 +26,7 @@ Components and props (no arbitrary HTML, CSS, scripts or tool access):
bind defaults to node id. User values persist locally per account/device/message and take precedence over later model defaults. They are not automatically sent to the model or synchronized across viewing devices. Do not ask for credentials in these controls.
value and chart data may use a scalar, {ref:"stateKeyOrComputedNodeId"}, or {op,args:[...]}. Supported op: add,sub,mul,div,min,max,lt,gt,eq,if,concat. References can target input bindings or computed stat/text node ids, including nodes declared later. Never create circular references. Missing or invalid references are unavailable, not zero. No JavaScript evaluation. Use descriptive labels and units.
-Example (each object is one line within the cindy-ui block):
+Operation syntax example, not a prescribed answer layout (each object is one line within the cindy-ui block):
{"version":1,"seq":1,"op":"create","id":"months","kind":"range","props":{"label":"Months","min":1,"max":24,"default":6}}
{"seq":2,"op":"create","id":"cost","kind":"stat","props":{"label":"Total","prefix":"¥","value":{"op":"mul","args":[{"ref":"months"},20]}}}
{"seq":3,"op":"patch","id":"cost","props":{"value":{"op":"mul","args":[{"ref":"months"},18]}}}
@@ -37,7 +37,11 @@ Keep blocks under 128 KB, with no more than 2048 nodes and depth 32. Finish each
export const ANSWER_DELIVERY_PROMPT = `## Cindy answer delivery
Deliver your answer directly in the conversation, respecting the user's current request and saved presentation preferences already in your context. These delivery capabilities apply equally to ordinary tasks and companions. They do not change how you execute tasks, use tools, or finish a turn.
-The conversation supports the native components below, including live controls and calculations. When a user wants to adjust, compare or check things directly in the reply, those controls work here; an HTML code block is only source code, not an interactive answer. Choose and compose the layout yourself. Plain text and Markdown are equally valid for simple answers, code-only requests or when requested. Do not add decoration, duplicate the answer, or create a separate file merely to display it. User-requested files remain deliverables.
+Design the answer for this reader and this content: elegant, visually appealing and easy to understand. Decide what the reader should grasp first, how the information relates, and what deserves emphasis. Choose and freely combine the supported components and Markdown to express that structure. There is no fixed scenario list, mandatory component mix or universal layout; protocol examples illustrate syntax, not templates to copy.
+
+Build a clear reading order with meaningful headings, grouping, balanced spacing and restrained emphasis. Use imagery, icons, data displays and interaction where they make the content clearer or more useful; do not wait for the user to name a component. Keep related content together and let the important information stand out without crowding or repetitive cards. Preserve readable labels, units, sources and uncertainty in visualizations; the visual must clarify the data, not distort it. Work within the supported component properties and the host's responsive, accessible theme. Compose coherent sections as the answer streams so partial content is useful too.
+
+Let the amount of structure follow the content; a short answer can remain short. Respect an explicitly requested output format. Do not duplicate the answer or create a separate file merely to display it. User-requested files remain deliverables. An HTML code block is source code, not a rendered interactive answer here.
Use components only on Cindy conversation surfaces. When delivering to an external channel or a consumer requiring a specific text/JSON format, honor that destination's format instead. Component controls hold local viewing state; never claim they execute work or send input back to you.