Files
cc-web/.trellis/spec/frontend/component-guidelines.md

1.6 KiB

Component Guidelines

How components are built in this project.


Overview

(To be filled by the team)


Component Structure

(To be filled by the team)


Props Conventions

(To be filled by the team)


Styling Patterns

(To be filled by the team)


Accessibility

(To be filled by the team)


Common Mistakes

(To be filled by the team)

MCP 结果组件

  • 渲染 MCP 工具结果前,先区分直接业务对象和 CallToolResult 包装;包装结果优先 读取 structuredContent,缺失或无效时再解析 content 中的文本业务 JSON。 不应直接用包装对象的 ok 判断业务失败。
  • isError: true 表示工具调用失败,不能被内部 ok: true 覆盖;保留明确错误消息、 未完成时的等待状态和畸形结果的兜底提示。解包限定标准层级,避免循环或递归嵌套。
  • 行为回归必须使用真实 MCP 包装形状,同时覆盖对象与 JSON 字符串、成功附件与 直链图片、业务失败与 MCP 错误;历史回放和实时更新应共用相同的解析及渲染入口。