2.10.0
中文
Skip to content

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 ​

1
Knowledge Query
Query knowledge base
2
Web Search Tool Invoked
Tool invocation
3
Model Invocation Complete
Invoke model for response
4
Task completed
Basic

Basic usage.

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:
ThoughtChain.Item

ThoughtChain.Item is an independent compact component that supports three variants: solid, outlined, and text, as well as four states: loading, success, error, and abort.

Node status ​

Thought Chain Item - 1
status: success
Thought Chain Item - 2
status: error
Node status

Thought chain nodes support configuring the status property to clearly indicate the current execution status of the node.

Collapsible ​

Create Task: Write New Component
Execute files needed for creating new component
Creating folder for new component
Executing command
mkdir -p component
Creating files needed for new component
Creating file
component/index.tsx
Creating Chinese description file for new component
Creating file
component/index.zh-CN.md
Creating English description file for new component
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
Collapsible

Configuring the collapsible and defaultExpandedKeys of an item enables the folding functionality of the content area of a thought chain node.

Controlled mode ​

Create Task: Develop New Component
Execute files needed for new component creation
Creating folder for new component
Executing command
mkdir -p component
Creating files needed for new component
Creating file
component/index.tsx
Creating Chinese documentation fileCreating English description file for new component
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
Controlled mode

Controlled mode is achieved through expandedKeys and onExpand.

Destroy on collapse ​

1
Collapsible Task
Content will be removed from DOM when collapsed
Task detail content.
2
Normal Task
Task2 content.
Destroy on collapse

Whether to destroy content when collapsed.

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
Creating folder for new component
Executing command
mkdir -p component
Creating files needed for new component
Creating file
component/index.tsx
Creating Chinese documentation file for new component
Continue creating file
component/index.zh-CN.md
Creating English description file for new component
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
Customization

The items property supports flexible customization, including custom icons, footnotes, nested Think components, etc. Supports line="dashed" for dashed line style.

Nested usage ​

1
1 - Thought Chain Item
description
1
1-1 Thought Chain Item
description
2
1-2 Thought Chain Item
description
2
2 - Thought Chain Item
description
1
2-1 Thought Chain Item
description
2
2-2 Thought Chain Item
description
3
2-3 Thought Chain Item
description
Nested usage

ThoughtChain supports nesting.

Single-line collapse ​

Create Task: Write New Component
Creating folder for new component
Executing command
mkdir -p component
Creating files needed for new component
Creating file
component/index.tsx
Creating Chinese description file for new component
Creating file
component/index.zh-CN.md
Creating English description file for new component
Creating file
component/index.en-US.md
Single-line collapse

Hide icons with icon: false and use custom styles.itemContent to achieve a single-line folding effect.

API ​

ThoughtChainProps ​

PropDescriptionTypeDefaultVersion
itemsCollection of thought nodesThoughtChainItemType[]--
defaultExpandedKeysInitially expanded nodesstring[]--
expandedKeysCurrently expanded nodesstring[]--
onExpandCallback for node expansion change(expandedKeys: string[]) => void--
lineLine styleboolean'solid''dashed'
classNamesClass names for semantic structureRecord<SemanticType, string>--
stylesStyles for semantic structureRecord<SemanticType, CSSProperties>--
prefixClsCustom prefixstring--
rootClassNameCustom root class namestring--

ThoughtChainItemType ​

PropDescriptionTypeDefaultVersion
keyUnique identifier for mind nodestring--
iconIcon for mind node, set to false to hideVNodestringnumber
titleMind node titleVNodestring-
descriptionMind node descriptionVNodestring-
contentMind node contentVNodestring-
footerMind node footer noteVNodestring-
statusMind node status'loading''success''error'
collapsibleWhether it is collapsibleboolean--
blinkBlink animationboolean--
destroyOnHiddenWhether to destroy content node when hiddenbooleantrue-

ThoughtChain.Item Props ​

PropDescriptionTypeDefaultVersion
variantVariant'solid''outlined''text'
iconIconVNodestring-
titleTitleVNodestring-
descriptionDescriptionVNodestring-
statusStatus'loading''success''error'
blinkBlink animationboolean--
disabledWhether disabledbooleanfalse-
onClickClick event() => void--
classNamesSemantic structure class namesRecord<'root''icon''title'
stylesSemantic structure stylesRecord<'root''icon''title'

SemanticType ​

NameDescription
rootRoot node
itemNode item
itemHeaderNode header
itemIconNode icon
itemContentNode content
itemFooterNode 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 ​

PropDescriptionTypeDefault
itemSolidBgThoughtChain.Item solid background colorstringcolorFillTertiary
itemSolidHoverBgThoughtChain.Item solid hover background colorstringcolorBgTextHover
itemOutlinedBgThoughtChain.Item outlined background colorstringcolorBgContainer
itemOutlinedHoverBgThoughtChain.Item outlined hover background colorstringcolorBgTextHover
itemBorderRadiusThoughtChain.Item border radiusnumberborderRadius
iconSizeIcon container sizenumberfontSize
colorTextBlinkDefaultDefault typing animation colorstringcolorTextDescription
colorTextBlinkTyping animation colorstringcolorTextBase
itemMotionDescriptionEffect description text color (semi-transparent)stringrgba(colorTextDescription, 0.25)