70 lines
1.6 KiB
Markdown
70 lines
1.6 KiB
Markdown
# Component Guidelines
|
|
|
|
> How components are built in this project.
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
<!--
|
|
Document your project's component conventions here.
|
|
|
|
Questions to answer:
|
|
- What component patterns do you use?
|
|
- How are props defined?
|
|
- How do you handle composition?
|
|
- What accessibility standards apply?
|
|
-->
|
|
|
|
(To be filled by the team)
|
|
|
|
---
|
|
|
|
## Component Structure
|
|
|
|
<!-- Standard structure of a component file -->
|
|
|
|
(To be filled by the team)
|
|
|
|
---
|
|
|
|
## Props Conventions
|
|
|
|
<!-- How props should be defined and typed -->
|
|
|
|
(To be filled by the team)
|
|
|
|
---
|
|
|
|
## Styling Patterns
|
|
|
|
<!-- How styles are applied (CSS modules, styled-components, Tailwind, etc.) -->
|
|
|
|
(To be filled by the team)
|
|
|
|
---
|
|
|
|
## Accessibility
|
|
|
|
<!-- A11y requirements and patterns -->
|
|
|
|
(To be filled by the team)
|
|
|
|
---
|
|
|
|
## Common Mistakes
|
|
|
|
<!-- Component-related mistakes your team has made -->
|
|
|
|
(To be filled by the team)
|
|
|
|
### MCP 结果组件
|
|
|
|
- 渲染 MCP 工具结果前,先区分直接业务对象和 `CallToolResult` 包装;包装结果优先
|
|
读取 `structuredContent`,缺失或无效时再解析 `content` 中的文本业务 JSON。
|
|
不应直接用包装对象的 `ok` 判断业务失败。
|
|
- `isError: true` 表示工具调用失败,不能被内部 `ok: true` 覆盖;保留明确错误消息、
|
|
未完成时的等待状态和畸形结果的兜底提示。解包限定标准层级,避免循环或递归嵌套。
|
|
- 行为回归必须使用真实 MCP 包装形状,同时覆盖对象与 JSON 字符串、成功附件与
|
|
直链图片、业务失败与 MCP 错误;历史回放和实时更新应共用相同的解析及渲染入口。
|