ThoughtChain
The Thought Chain component is used to visualize and track the call chain of an Agent to Actions and Tools.
When to use
- Debug and track call chains in complex Agent Systems
- Used in similar chain-like scenarios
Examples
Basic
Knowledge Query
Query knowledge base
Web Search Tool Invoked
Tool invocation
Model Invocation Complete
Invoke model for response
Response Complete
Task completed
ThoughtChain.Item
loading status:
Tool Calling
Tool Calling
Tool Calling
success status:
Tool Call Finished
Tool Call Finished
Tool Call Finished
error status:
Tool Call Error
Tool Call Error
Tool Call Error
abort status:
Agent Response Aborted
Agent Response Aborted
Agent Response Aborted
custom icon:
Task Completed
Task Completed
Task Completed
description & click:
Opening Webpage
https://x.ant.design/docs/playground/copilot
Creating
todo.md
Searching
Route Information
blink:
Task Completed
Task Completed
Task Completed
Route Information
Node status
Thought Chain Item - 1
status: success
Thought Chain Item - 2
status: error
Collapsible
Create Task: Write New Component
Execute files needed for creating new component
Creating folder for new componentCreating files needed for new componentCreating Chinese description file for new componentCreating English description file for new component
Executing command
mkdir -p component
Creating file
component/index.tsx
Creating file
component/index.zh-CN.md
Creating file
component/index.en-US.md
Checking Task Execution Steps
Verify overall task execution logic and feasibility
Folder created
component
File created
component/index.tsx
File created
component/index.zh-CN.md
File created
component/index.en-US.md
Controlled mode
Create Task: Develop New Component
Execute files needed for new component creation
Creating folder for new componentCreating files needed for new componentCreating Chinese documentation fileCreating English description file for new component
Executing command
mkdir -p component
Creating file
component/index.tsx
Continue creating file
component/index.en-US.md
Check Task Execution Steps Completion
Verify the overall task execution logic and feasibility
Using the New Component
Using the generated component to complete the task
File created
component
Destroy on collapse
Collapsible Task
Content will be removed from DOM when collapsed
Task detail content.
Normal Task
Task2 content.
Customization
Create Task
description
Thinking Process
1. Analyze task, understand task workflow
2. Task creation, files needed for task
3. Task execution, using new component
Executing command
mkdir -p component
Creating file
component/index.tsx
Continue creating file
component/index.zh-CN.md
Continue creating file
component/index.en-US.md
Check Task Execution Steps Completion
Verify the overall task execution logic and feasibility
Checking Task Execution Steps
Verify the overall task execution logic and feasibility
Folder creation completed
component
File creation completed
component/index.tsx
File creation completed
component/index.zh-CN.md
File creation completed
component/index.en-US.md
Nested usage
1 - Thought Chain Item
description
1-1 Thought Chain Item
description
1-2 Thought Chain Item
description
2 - Thought Chain Item
description
2-1 Thought Chain Item
description
2-2 Thought Chain Item
description
2-3 Thought Chain Item
description
Single-line collapse
Create Task: Write New Component
Creating folder for new componentCreating files needed for new componentCreating Chinese description file for new componentCreating English description file for new component
Executing command
mkdir -p component
Creating file
component/index.tsx
Creating file
component/index.zh-CN.md
Creating file
component/index.en-US.md
API
ThoughtChainProps
| Prop | Description | Type | Default | Version |
|---|---|---|---|---|
| items | Collection of thought nodes | ThoughtChainItemType[] | - | - |
| defaultExpandedKeys | Initially expanded nodes | string[] | - | - |
| expandedKeys | Currently expanded nodes | string[] | - | - |
| onExpand | Callback for node expansion change | (expandedKeys: string[]) => void | - | - |
| line | Line style | boolean | 'solid' | 'dashed' |
| classNames | Class names for semantic structure | Record<SemanticType, string> | - | - |
| styles | Styles for semantic structure | Record<SemanticType, CSSProperties> | - | - |
| prefixCls | Custom prefix | string | - | - |
| rootClassName | Custom root class name | string | - | - |
ThoughtChainItemType
| Prop | Description | Type | Default | Version |
|---|---|---|---|---|
| key | Unique identifier for mind node | string | - | - |
| icon | Icon for mind node, set to false to hide | VNode | string | number |
| title | Mind node title | VNode | string | - |
| description | Mind node description | VNode | string | - |
| content | Mind node content | VNode | string | - |
| footer | Mind node footer note | VNode | string | - |
| status | Mind node status | 'loading' | 'success' | 'error' |
| collapsible | Whether it is collapsible | boolean | - | - |
| blink | Blink animation | boolean | - | - |
| destroyOnHidden | Whether to destroy content node when hidden | boolean | true | - |
ThoughtChain.Item Props
| Prop | Description | Type | Default | Version |
|---|---|---|---|---|
| variant | Variant | 'solid' | 'outlined' | 'text' |
| icon | Icon | VNode | string | - |
| title | Title | VNode | string | - |
| description | Description | VNode | string | - |
| status | Status | 'loading' | 'success' | 'error' |
| blink | Blink animation | boolean | - | - |
| disabled | Whether disabled | boolean | false | - |
| onClick | Click event | () => void | - | - |
| classNames | Semantic structure class names | Record<'root' | 'icon' | 'title' |
| styles | Semantic structure styles | Record<'root' | 'icon' | 'title' |
SemanticType
| Name | Description |
|---|---|
| root | Root node |
| item | Node item |
| itemHeader | Node header |
| itemIcon | Node icon |
| itemContent | Node content |
| itemFooter | Node footer |
Semantic DOM
The preview sequentially displays the semantic structure of ThoughtChain and ThoughtChain.Item.
Thought Chain Item Title
description
Thought Chain Item Content
root
根节点item
思维链节点itemIcon
思维链图标itemHeader
思维链节点头部itemContent
思维链节点内容itemFooter
思维链节点页脚
Opening Webpage
https://x.ant.design/docs/playground/copilot
root
根节点icon
思维链图标title
思维链标题description
思维链节点描述
Design Token
| Prop | Description | Type | Default |
|---|---|---|---|
| itemSolidBg | ThoughtChain.Item solid background color | string | colorFillTertiary |
| itemSolidHoverBg | ThoughtChain.Item solid hover background color | string | colorBgTextHover |
| itemOutlinedBg | ThoughtChain.Item outlined background color | string | colorBgContainer |
| itemOutlinedHoverBg | ThoughtChain.Item outlined hover background color | string | colorBgTextHover |
| itemBorderRadius | ThoughtChain.Item border radius | number | borderRadius |
| iconSize | Icon container size | number | fontSize |
| colorTextBlinkDefault | Default typing animation color | string | colorTextDescription |
| colorTextBlink | Typing animation color | string | colorTextBase |
| itemMotionDescription | Effect description text color (semi-transparent) | string | rgba(colorTextDescription, 0.25) |