@assistant-ui/react 0.12.8 → 0.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js +1 -1
- package/dist/context/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts +3 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +4 -6
- package/dist/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
- package/dist/primitives/message/MessageParts.d.ts +140 -133
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/package.json +7 -7
- package/src/context/providers/ChainOfThoughtByIndicesProvider.tsx +3 -2
- package/src/primitives/chainOfThought/ChainOfThoughtParts.tsx +18 -8
- package/src/primitives/message/MessageParts.tsx +149 -141
- package/src/primitives/chainOfThought/CHAIN_OF_THOUGHT.spec.md +0 -68
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainOfThoughtByIndicesProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/ChainOfThoughtByIndicesProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKxD,eAAO,MAAM,+BAA+B,EAAE,EAAE,CAC9C,iBAAiB,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,
|
|
1
|
+
{"version":3,"file":"ChainOfThoughtByIndicesProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/ChainOfThoughtByIndicesProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKxD,eAAO,MAAM,+BAA+B,EAAE,EAAE,CAC9C,iBAAiB,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAwBH,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useAui, useAuiState, AuiProvider } from "@assistant-ui/store";
|
|
4
4
|
import { ChainOfThoughtClient } from "../../client/ChainOfThoughtClient.js";
|
|
5
5
|
export const ChainOfThoughtByIndicesProvider = ({ startIndex, endIndex, children }) => {
|
|
6
|
-
const parts = useAuiState(({ message }) => message.parts.slice(startIndex, endIndex + 1)
|
|
6
|
+
const parts = useAuiState(({ message }) => message.parts).slice(startIndex, endIndex + 1);
|
|
7
7
|
const parentAui = useAui();
|
|
8
8
|
const aui = useAui({
|
|
9
9
|
chainOfThought: ChainOfThoughtClient({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainOfThoughtByIndicesProvider.js","sourceRoot":"","sources":["../../../src/context/providers/ChainOfThoughtByIndicesProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,6CAA0C;AAGzE,MAAM,CAAC,MAAM,+BAA+B,GAKxC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzC,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ChainOfThoughtByIndicesProvider.js","sourceRoot":"","sources":["../../../src/context/providers/ChainOfThoughtByIndicesProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,6CAA0C;AAGzE,MAAM,CAAC,MAAM,+BAA+B,GAKxC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzC,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAC7D,UAAU,EACV,QAAQ,GAAG,CAAC,CACW,CAAC;IAE1B,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;IAE3B,MAAM,GAAG,GAAG,MAAM,CAAC;QACjB,cAAc,EAAE,oBAAoB,CAAC;YACnC,KAAK;YACL,cAAc,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;gBAC5B,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBACvC,MAAM,IAAI,KAAK,CACb,6BAA6B,KAAK,yBAAyB,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,CAC/E,CAAC;gBACJ,CAAC;gBACD,OAAO,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,KAAK,EAAE,CAAC,CAAC;YACjE,CAAC;SACF,CAAC;KACH,CAAC,CAAC;IAEH,OAAO,KAAC,WAAW,IAAC,KAAK,EAAE,GAAG,YAAG,QAAQ,GAAe,CAAC;AAC3D,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FC } from "react";
|
|
1
|
+
import { type ComponentType, type FC, type PropsWithChildren } from "react";
|
|
2
2
|
import type { ReasoningMessagePartComponent, ToolCallMessagePartComponent } from "../../types/MessagePartComponentTypes.js";
|
|
3
3
|
export declare namespace ChainOfThoughtPrimitiveParts {
|
|
4
4
|
type Props = {
|
|
@@ -12,6 +12,8 @@ export declare namespace ChainOfThoughtPrimitiveParts {
|
|
|
12
12
|
tools?: {
|
|
13
13
|
Fallback?: ToolCallMessagePartComponent | undefined;
|
|
14
14
|
};
|
|
15
|
+
/** Layout component to wrap the rendered parts when expanded */
|
|
16
|
+
Layout?: ComponentType<PropsWithChildren> | undefined;
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainOfThoughtParts.d.ts","sourceRoot":"","sources":["../../../src/primitives/chainOfThought/ChainOfThoughtParts.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"ChainOfThoughtParts.d.ts","sourceRoot":"","sources":["../../../src/primitives/chainOfThought/ChainOfThoughtParts.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,EAAE,EACP,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC7B,iDAA8C;AAE/C,yBAAiB,4BAA4B,CAAC;IAC5C,KAAY,KAAK,GAAG;QAClB;;WAEG;QACH,UAAU,CAAC,EAAE;YACX,8CAA8C;YAC9C,SAAS,CAAC,EAAE,6BAA6B,GAAG,SAAS,CAAC;YACtD,6CAA6C;YAC7C,KAAK,CAAC,EAAE;gBACN,QAAQ,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;aACrD,CAAC;YACF,gEAAgE;YAChE,MAAM,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;SACvD,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,4BAA4B,CAAC,KAAK,CAiCnC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from "react";
|
|
3
|
+
import { useMemo, } from "react";
|
|
4
4
|
import { useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { ChainOfThoughtPartByIndexProvider } from "../../context/providers/ChainOfThoughtPartByIndexProvider.js";
|
|
6
6
|
import { MessagePartComponent } from "../message/MessageParts.js";
|
|
@@ -23,7 +23,6 @@ import { MessagePartComponent } from "../message/MessageParts.js";
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export const ChainOfThoughtPrimitiveParts = ({ components }) => {
|
|
26
|
-
const collapsed = useAuiState(({ chainOfThought }) => chainOfThought.collapsed);
|
|
27
26
|
const partsLength = useAuiState(({ chainOfThought }) => chainOfThought.parts.length);
|
|
28
27
|
const messageComponents = useMemo(() => ({
|
|
29
28
|
Reasoning: components?.Reasoning,
|
|
@@ -31,11 +30,10 @@ export const ChainOfThoughtPrimitiveParts = ({ components }) => {
|
|
|
31
30
|
Fallback: components?.tools?.Fallback,
|
|
32
31
|
},
|
|
33
32
|
}), [components?.Reasoning, components?.tools?.Fallback]);
|
|
33
|
+
const Layout = components?.Layout;
|
|
34
34
|
const elements = useMemo(() => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return Array.from({ length: partsLength }, (_, index) => (_jsx(ChainOfThoughtPartByIndexProvider, { index: index, children: _jsx(MessagePartComponent, { components: messageComponents }) }, index)));
|
|
38
|
-
}, [collapsed, partsLength, messageComponents]);
|
|
35
|
+
return Array.from({ length: partsLength }, (_, index) => (_jsx(ChainOfThoughtPartByIndexProvider, { index: index, children: Layout ? (_jsx(Layout, { children: _jsx(MessagePartComponent, { components: messageComponents }) })) : (_jsx(MessagePartComponent, { components: messageComponents })) }, index)));
|
|
36
|
+
}, [partsLength, messageComponents, Layout]);
|
|
39
37
|
return _jsx(_Fragment, { children: elements });
|
|
40
38
|
};
|
|
41
39
|
ChainOfThoughtPrimitiveParts.displayName = "ChainOfThoughtPrimitive.Parts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChainOfThoughtParts.js","sourceRoot":"","sources":["../../../src/primitives/chainOfThought/ChainOfThoughtParts.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,
|
|
1
|
+
{"version":3,"file":"ChainOfThoughtParts.js","sourceRoot":"","sources":["../../../src/primitives/chainOfThought/ChainOfThoughtParts.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAIL,OAAO,GACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,iCAAiC,EAAE,qEAAkE;AAC9G,OAAO,EAAE,oBAAoB,EAAE,mCAAgC;AAwB/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAErC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;IACrB,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CACpD,CAAC;IAEF,MAAM,iBAAiB,GAAG,OAAO,CAC/B,GAAG,EAAE,CAAC,CAAC;QACL,SAAS,EAAE,UAAU,EAAE,SAAS;QAChC,KAAK,EAAE;YACL,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ;SACtC;KACF,CAAC,EACF,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CACrD,CAAC;IAEF,MAAM,MAAM,GAAG,UAAU,EAAE,MAAM,CAAC;IAElC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CACvD,KAAC,iCAAiC,IAAa,KAAK,EAAE,KAAK,YACxD,MAAM,CAAC,CAAC,CAAC,CACR,KAAC,MAAM,cACL,KAAC,oBAAoB,IAAC,UAAU,EAAE,iBAAiB,GAAI,GAChD,CACV,CAAC,CAAC,CAAC,CACF,KAAC,oBAAoB,IAAC,UAAU,EAAE,iBAAiB,GAAI,CACxD,IAPqC,KAAK,CAQT,CACrC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAE7C,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC,CAAC;AAEF,4BAA4B,CAAC,WAAW,GAAG,+BAA+B,CAAC"}
|
|
@@ -1,145 +1,151 @@
|
|
|
1
1
|
import { type ComponentType, type FC, PropsWithChildren } from "react";
|
|
2
2
|
import type { Unstable_AudioMessagePartComponent, EmptyMessagePartComponent, TextMessagePartComponent, ImageMessagePartComponent, SourceMessagePartComponent, ToolCallMessagePartComponent, ToolCallMessagePartProps, FileMessagePartComponent, ReasoningMessagePartComponent, ReasoningGroupComponent } from "../../types/MessagePartComponentTypes.js";
|
|
3
3
|
export declare namespace MessagePrimitiveParts {
|
|
4
|
-
type
|
|
4
|
+
type BaseComponents = {
|
|
5
|
+
/** Component for rendering empty messages */
|
|
6
|
+
Empty?: EmptyMessagePartComponent | undefined;
|
|
7
|
+
/** Component for rendering text content */
|
|
8
|
+
Text?: TextMessagePartComponent | undefined;
|
|
9
|
+
/** Component for rendering source content */
|
|
10
|
+
Source?: SourceMessagePartComponent | undefined;
|
|
11
|
+
/** Component for rendering image content */
|
|
12
|
+
Image?: ImageMessagePartComponent | undefined;
|
|
13
|
+
/** Component for rendering file content */
|
|
14
|
+
File?: FileMessagePartComponent | undefined;
|
|
15
|
+
/** Component for rendering audio content (experimental) */
|
|
16
|
+
Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;
|
|
17
|
+
};
|
|
18
|
+
type ToolsConfig = {
|
|
19
|
+
/** Map of tool names to their specific components */
|
|
20
|
+
by_name?: Record<string, ToolCallMessagePartComponent | undefined> | undefined;
|
|
21
|
+
/** Fallback component for unregistered tools */
|
|
22
|
+
Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;
|
|
23
|
+
} | {
|
|
24
|
+
/** Override component that handles all tool calls */
|
|
25
|
+
Override: ComponentType<ToolCallMessagePartProps>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Standard component configuration for rendering reasoning and tool-call parts
|
|
29
|
+
* individually (with optional grouping).
|
|
30
|
+
*
|
|
31
|
+
* Cannot be combined with `ChainOfThought`.
|
|
32
|
+
*/
|
|
33
|
+
type StandardComponents = BaseComponents & {
|
|
34
|
+
/** Component for rendering reasoning content (typically hidden) */
|
|
35
|
+
Reasoning?: ReasoningMessagePartComponent | undefined;
|
|
36
|
+
/** Configuration for tool call rendering */
|
|
37
|
+
tools?: ToolsConfig | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Component for rendering grouped consecutive tool calls.
|
|
40
|
+
*
|
|
41
|
+
* When provided, this component will automatically wrap consecutive tool-call
|
|
42
|
+
* message parts, allowing you to create collapsible sections, custom styling,
|
|
43
|
+
* or other grouped presentations for multiple tool calls.
|
|
44
|
+
*
|
|
45
|
+
* The component receives:
|
|
46
|
+
* - `startIndex`: The index of the first tool call in the group
|
|
47
|
+
* - `endIndex`: The index of the last tool call in the group
|
|
48
|
+
* - `children`: The rendered tool call components
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Collapsible tool group
|
|
53
|
+
* ToolGroup: ({ startIndex, endIndex, children }) => (
|
|
54
|
+
* <details className="tool-group">
|
|
55
|
+
* <summary>
|
|
56
|
+
* {endIndex - startIndex + 1} tool calls
|
|
57
|
+
* </summary>
|
|
58
|
+
* <div className="tool-group-content">
|
|
59
|
+
* {children}
|
|
60
|
+
* </div>
|
|
61
|
+
* </details>
|
|
62
|
+
* )
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @param startIndex - Index of the first tool call in the group
|
|
66
|
+
* @param endIndex - Index of the last tool call in the group
|
|
67
|
+
* @param children - Rendered tool call components to display within the group
|
|
68
|
+
*
|
|
69
|
+
* @deprecated This feature is still experimental and subject to change.
|
|
70
|
+
*/
|
|
71
|
+
ToolGroup?: ComponentType<PropsWithChildren<{
|
|
72
|
+
startIndex: number;
|
|
73
|
+
endIndex: number;
|
|
74
|
+
}>>;
|
|
75
|
+
/**
|
|
76
|
+
* Component for rendering grouped reasoning parts.
|
|
77
|
+
*
|
|
78
|
+
* When provided, this component will automatically wrap reasoning message parts
|
|
79
|
+
* (one or more consecutive) in a group container. Each reasoning part inside
|
|
80
|
+
* renders its own text independently - no text merging occurs.
|
|
81
|
+
*
|
|
82
|
+
* The component receives:
|
|
83
|
+
* - `startIndex`: The index of the first reasoning part in the group
|
|
84
|
+
* - `endIndex`: The index of the last reasoning part in the group
|
|
85
|
+
* - `children`: The rendered Reasoning components (one per part)
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* // Collapsible reasoning group
|
|
90
|
+
* ReasoningGroup: ({ children }) => (
|
|
91
|
+
* <details className="reasoning-group">
|
|
92
|
+
* <summary>Reasoning</summary>
|
|
93
|
+
* <div className="reasoning-content">
|
|
94
|
+
* {children}
|
|
95
|
+
* </div>
|
|
96
|
+
* </details>
|
|
97
|
+
* )
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @param startIndex - Index of the first reasoning part in the group
|
|
101
|
+
* @param endIndex - Index of the last reasoning part in the group
|
|
102
|
+
* @param children - Rendered reasoning part components
|
|
103
|
+
*/
|
|
104
|
+
ReasoningGroup?: ReasoningGroupComponent;
|
|
105
|
+
ChainOfThought?: never;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Chain of thought component configuration.
|
|
109
|
+
*
|
|
110
|
+
* When `ChainOfThought` is set, it takes control of rendering ALL reasoning and
|
|
111
|
+
* tool-call parts in the message. The `Reasoning`, `tools`, `ReasoningGroup`, and
|
|
112
|
+
* `ToolGroup` components cannot be used alongside it.
|
|
113
|
+
*
|
|
114
|
+
* The component is automatically wrapped in a ChainOfThoughtByIndicesProvider
|
|
115
|
+
* that sets up the chainOfThought client scope with the correct parts.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* // Chain of thought with accordion
|
|
120
|
+
* ChainOfThought: () => (
|
|
121
|
+
* <ChainOfThoughtPrimitive.Root>
|
|
122
|
+
* <ChainOfThoughtPrimitive.AccordionTrigger>
|
|
123
|
+
* Toggle reasoning
|
|
124
|
+
* </ChainOfThoughtPrimitive.AccordionTrigger>
|
|
125
|
+
* <ChainOfThoughtPrimitive.Parts />
|
|
126
|
+
* </ChainOfThoughtPrimitive.Root>
|
|
127
|
+
* )
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
type ChainOfThoughtComponents = BaseComponents & {
|
|
131
|
+
ChainOfThought: ComponentType;
|
|
132
|
+
Reasoning?: never;
|
|
133
|
+
tools?: never;
|
|
134
|
+
ToolGroup?: never;
|
|
135
|
+
ReasoningGroup?: never;
|
|
136
|
+
};
|
|
137
|
+
export type Props = {
|
|
5
138
|
/**
|
|
6
139
|
* Component configuration for rendering different types of message content.
|
|
7
140
|
*
|
|
8
141
|
* You can provide custom components for each content type (text, image, file, etc.)
|
|
9
142
|
* and configure tool rendering behavior. If not provided, default components will be used.
|
|
143
|
+
*
|
|
144
|
+
* Use either `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup` for standard rendering,
|
|
145
|
+
* or `ChainOfThought` to group all reasoning and tool-call parts into a single
|
|
146
|
+
* collapsible component. These two modes are mutually exclusive.
|
|
10
147
|
*/
|
|
11
|
-
components?:
|
|
12
|
-
/** Component for rendering empty messages */
|
|
13
|
-
Empty?: EmptyMessagePartComponent | undefined;
|
|
14
|
-
/** Component for rendering text content */
|
|
15
|
-
Text?: TextMessagePartComponent | undefined;
|
|
16
|
-
/** Component for rendering reasoning content (typically hidden) */
|
|
17
|
-
Reasoning?: ReasoningMessagePartComponent | undefined;
|
|
18
|
-
/** Component for rendering source content */
|
|
19
|
-
Source?: SourceMessagePartComponent | undefined;
|
|
20
|
-
/** Component for rendering image content */
|
|
21
|
-
Image?: ImageMessagePartComponent | undefined;
|
|
22
|
-
/** Component for rendering file content */
|
|
23
|
-
File?: FileMessagePartComponent | undefined;
|
|
24
|
-
/** Component for rendering audio content (experimental) */
|
|
25
|
-
Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;
|
|
26
|
-
/** Configuration for tool call rendering */
|
|
27
|
-
tools?: {
|
|
28
|
-
/** Map of tool names to their specific components */
|
|
29
|
-
by_name?: Record<string, ToolCallMessagePartComponent | undefined> | undefined;
|
|
30
|
-
/** Fallback component for unregistered tools */
|
|
31
|
-
Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;
|
|
32
|
-
} | {
|
|
33
|
-
/** Override component that handles all tool calls */
|
|
34
|
-
Override: ComponentType<ToolCallMessagePartProps>;
|
|
35
|
-
} | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Component for rendering grouped consecutive tool calls.
|
|
38
|
-
*
|
|
39
|
-
* When provided, this component will automatically wrap consecutive tool-call
|
|
40
|
-
* message parts, allowing you to create collapsible sections, custom styling,
|
|
41
|
-
* or other grouped presentations for multiple tool calls.
|
|
42
|
-
*
|
|
43
|
-
* The component receives:
|
|
44
|
-
* - `startIndex`: The index of the first tool call in the group
|
|
45
|
-
* - `endIndex`: The index of the last tool call in the group
|
|
46
|
-
* - `children`: The rendered tool call components
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```tsx
|
|
50
|
-
* // Collapsible tool group
|
|
51
|
-
* ToolGroup: ({ startIndex, endIndex, children }) => (
|
|
52
|
-
* <details className="tool-group">
|
|
53
|
-
* <summary>
|
|
54
|
-
* {endIndex - startIndex + 1} tool calls
|
|
55
|
-
* </summary>
|
|
56
|
-
* <div className="tool-group-content">
|
|
57
|
-
* {children}
|
|
58
|
-
* </div>
|
|
59
|
-
* </details>
|
|
60
|
-
* )
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* // Custom styled tool group with header
|
|
66
|
-
* ToolGroup: ({ startIndex, endIndex, children }) => (
|
|
67
|
-
* <div className="border rounded-lg p-4 my-2">
|
|
68
|
-
* <div className="text-sm text-gray-600 mb-2">
|
|
69
|
-
* Tool execution #{startIndex + 1}-{endIndex + 1}
|
|
70
|
-
* </div>
|
|
71
|
-
* <div className="space-y-2">
|
|
72
|
-
* {children}
|
|
73
|
-
* </div>
|
|
74
|
-
* </div>
|
|
75
|
-
* )
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @param startIndex - Index of the first tool call in the group
|
|
79
|
-
* @param endIndex - Index of the last tool call in the group
|
|
80
|
-
* @param children - Rendered tool call components to display within the group
|
|
81
|
-
*
|
|
82
|
-
* @deprecated This feature is still experimental and subject to change.
|
|
83
|
-
*/
|
|
84
|
-
ToolGroup?: ComponentType<PropsWithChildren<{
|
|
85
|
-
startIndex: number;
|
|
86
|
-
endIndex: number;
|
|
87
|
-
}>>;
|
|
88
|
-
/**
|
|
89
|
-
* Component for rendering grouped reasoning parts.
|
|
90
|
-
*
|
|
91
|
-
* When provided, this component will automatically wrap reasoning message parts
|
|
92
|
-
* (one or more consecutive) in a group container. Each reasoning part inside
|
|
93
|
-
* renders its own text independently - no text merging occurs.
|
|
94
|
-
*
|
|
95
|
-
* The component receives:
|
|
96
|
-
* - `startIndex`: The index of the first reasoning part in the group
|
|
97
|
-
* - `endIndex`: The index of the last reasoning part in the group
|
|
98
|
-
* - `children`: The rendered Reasoning components (one per part)
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```tsx
|
|
102
|
-
* // Collapsible reasoning group
|
|
103
|
-
* ReasoningGroup: ({ children }) => (
|
|
104
|
-
* <details className="reasoning-group">
|
|
105
|
-
* <summary>Reasoning</summary>
|
|
106
|
-
* <div className="reasoning-content">
|
|
107
|
-
* {children}
|
|
108
|
-
* </div>
|
|
109
|
-
* </details>
|
|
110
|
-
* )
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* @param startIndex - Index of the first reasoning part in the group
|
|
114
|
-
* @param endIndex - Index of the last reasoning part in the group
|
|
115
|
-
* @param children - Rendered reasoning part components
|
|
116
|
-
*/
|
|
117
|
-
ReasoningGroup?: ReasoningGroupComponent;
|
|
118
|
-
/**
|
|
119
|
-
* Component for rendering chain of thought (reasoning + tool-call) parts.
|
|
120
|
-
*
|
|
121
|
-
* When provided, this component takes control of rendering ALL reasoning and
|
|
122
|
-
* tool-call parts in the message. The Reasoning, tools, ReasoningGroup, and
|
|
123
|
-
* ToolGroup components are completely ignored when ChainOfThought is set.
|
|
124
|
-
*
|
|
125
|
-
* The component is automatically wrapped in a ChainOfThoughtByIndicesProvider
|
|
126
|
-
* that sets up the chainOfThought client scope with the correct parts.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```tsx
|
|
130
|
-
* // Chain of thought with accordion
|
|
131
|
-
* ChainOfThought: () => (
|
|
132
|
-
* <ChainOfThoughtPrimitive.Root>
|
|
133
|
-
* <ChainOfThoughtPrimitive.AccordionTrigger>
|
|
134
|
-
* Toggle reasoning
|
|
135
|
-
* </ChainOfThoughtPrimitive.AccordionTrigger>
|
|
136
|
-
* <ChainOfThoughtPrimitive.Parts />
|
|
137
|
-
* </ChainOfThoughtPrimitive.Root>
|
|
138
|
-
* )
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
ChainOfThought?: ComponentType;
|
|
142
|
-
} | undefined;
|
|
148
|
+
components?: StandardComponents | ChainOfThoughtComponents | undefined;
|
|
143
149
|
/**
|
|
144
150
|
* When enabled, shows the Empty component if the last part in the message
|
|
145
151
|
* is anything other than Text or Reasoning.
|
|
@@ -152,6 +158,7 @@ export declare namespace MessagePrimitiveParts {
|
|
|
152
158
|
*/
|
|
153
159
|
unstable_showEmptyOnNonTextEnd?: boolean | undefined;
|
|
154
160
|
};
|
|
161
|
+
export {};
|
|
155
162
|
}
|
|
156
163
|
type MessagePartComponentProps = {
|
|
157
164
|
components: MessagePrimitiveParts.Props["components"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageParts.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageParts.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,EAAE,EAEP,iBAAiB,EAElB,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EACV,kCAAkC,EAClC,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,uBAAuB,EACxB,iDAA8C;AAsH/C,yBAAiB,qBAAqB,CAAC;IACrC,
|
|
1
|
+
{"version":3,"file":"MessageParts.d.ts","sourceRoot":"","sources":["../../../src/primitives/message/MessageParts.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,EAAE,EAEP,iBAAiB,EAElB,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EACV,kCAAkC,EAClC,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,uBAAuB,EACxB,iDAA8C;AAsH/C,yBAAiB,qBAAqB,CAAC;IACrC,KAAK,cAAc,GAAG;QACpB,6CAA6C;QAC7C,KAAK,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;QAC9C,2CAA2C;QAC3C,IAAI,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;QAC5C,6CAA6C;QAC7C,MAAM,CAAC,EAAE,0BAA0B,GAAG,SAAS,CAAC;QAChD,4CAA4C;QAC5C,KAAK,CAAC,EAAE,yBAAyB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": "0.12.9",
|
|
4
4
|
"description": "TypeScript/React library for AI Chat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"radix-ui",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
],
|
|
50
50
|
"sideEffects": false,
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"assistant-cloud": "^0.1.
|
|
53
|
-
"@assistant-ui/tap": "^0.4.
|
|
54
|
-
"@assistant-ui/store": "^0.1.
|
|
52
|
+
"assistant-cloud": "^0.1.17",
|
|
53
|
+
"@assistant-ui/tap": "^0.4.5",
|
|
54
|
+
"@assistant-ui/store": "^0.1.6",
|
|
55
55
|
"@radix-ui/primitive": "^1.1.3",
|
|
56
56
|
"@radix-ui/react-compose-refs": "^1.1.2",
|
|
57
57
|
"@radix-ui/react-context": "^1.1.3",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@radix-ui/react-slot": "^1.2.4",
|
|
62
62
|
"@radix-ui/react-use-callback-ref": "^1.1.1",
|
|
63
63
|
"@radix-ui/react-use-escape-keydown": "^1.1.1",
|
|
64
|
-
"assistant-stream": "^0.3.
|
|
64
|
+
"assistant-stream": "^0.3.2",
|
|
65
65
|
"nanoid": "^5.1.6",
|
|
66
66
|
"react-textarea-autosize": "^8.5.9",
|
|
67
67
|
"zod": "^4.3.6",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/json-schema": "^7.0.15",
|
|
86
|
-
"@types/node": "^25.2.
|
|
87
|
-
"@types/react": "^19.2.
|
|
86
|
+
"@types/node": "^25.2.1",
|
|
87
|
+
"@types/react": "^19.2.13",
|
|
88
88
|
"@types/react-dom": "^19.2.3",
|
|
89
89
|
"react": "^19.2.4",
|
|
90
90
|
"react-dom": "^19.2.4",
|
|
@@ -11,8 +11,9 @@ export const ChainOfThoughtByIndicesProvider: FC<
|
|
|
11
11
|
endIndex: number;
|
|
12
12
|
}>
|
|
13
13
|
> = ({ startIndex, endIndex, children }) => {
|
|
14
|
-
const parts = useAuiState(({ message }) =>
|
|
15
|
-
|
|
14
|
+
const parts = useAuiState(({ message }) => message.parts).slice(
|
|
15
|
+
startIndex,
|
|
16
|
+
endIndex + 1,
|
|
16
17
|
) as ChainOfThoughtPart[];
|
|
17
18
|
|
|
18
19
|
const parentAui = useAui();
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type ComponentType,
|
|
5
|
+
type FC,
|
|
6
|
+
type PropsWithChildren,
|
|
7
|
+
useMemo,
|
|
8
|
+
} from "react";
|
|
4
9
|
import { useAuiState } from "@assistant-ui/store";
|
|
5
10
|
import { ChainOfThoughtPartByIndexProvider } from "../../context/providers/ChainOfThoughtPartByIndexProvider";
|
|
6
11
|
import { MessagePartComponent } from "../message/MessageParts";
|
|
@@ -21,6 +26,8 @@ export namespace ChainOfThoughtPrimitiveParts {
|
|
|
21
26
|
tools?: {
|
|
22
27
|
Fallback?: ToolCallMessagePartComponent | undefined;
|
|
23
28
|
};
|
|
29
|
+
/** Layout component to wrap the rendered parts when expanded */
|
|
30
|
+
Layout?: ComponentType<PropsWithChildren> | undefined;
|
|
24
31
|
};
|
|
25
32
|
};
|
|
26
33
|
}
|
|
@@ -46,9 +53,6 @@ export namespace ChainOfThoughtPrimitiveParts {
|
|
|
46
53
|
export const ChainOfThoughtPrimitiveParts: FC<
|
|
47
54
|
ChainOfThoughtPrimitiveParts.Props
|
|
48
55
|
> = ({ components }) => {
|
|
49
|
-
const collapsed = useAuiState(
|
|
50
|
-
({ chainOfThought }) => chainOfThought.collapsed,
|
|
51
|
-
);
|
|
52
56
|
const partsLength = useAuiState(
|
|
53
57
|
({ chainOfThought }) => chainOfThought.parts.length,
|
|
54
58
|
);
|
|
@@ -63,15 +67,21 @@ export const ChainOfThoughtPrimitiveParts: FC<
|
|
|
63
67
|
[components?.Reasoning, components?.tools?.Fallback],
|
|
64
68
|
);
|
|
65
69
|
|
|
66
|
-
const
|
|
67
|
-
if (collapsed) return null;
|
|
70
|
+
const Layout = components?.Layout;
|
|
68
71
|
|
|
72
|
+
const elements = useMemo(() => {
|
|
69
73
|
return Array.from({ length: partsLength }, (_, index) => (
|
|
70
74
|
<ChainOfThoughtPartByIndexProvider key={index} index={index}>
|
|
71
|
-
|
|
75
|
+
{Layout ? (
|
|
76
|
+
<Layout>
|
|
77
|
+
<MessagePartComponent components={messageComponents} />
|
|
78
|
+
</Layout>
|
|
79
|
+
) : (
|
|
80
|
+
<MessagePartComponent components={messageComponents} />
|
|
81
|
+
)}
|
|
72
82
|
</ChainOfThoughtPartByIndexProvider>
|
|
73
83
|
));
|
|
74
|
-
}, [
|
|
84
|
+
}, [partsLength, messageComponents, Layout]);
|
|
75
85
|
|
|
76
86
|
return <>{elements}</>;
|
|
77
87
|
};
|
|
@@ -145,154 +145,162 @@ const useMessagePartsGroups = (
|
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
export namespace MessagePrimitiveParts {
|
|
148
|
+
type BaseComponents = {
|
|
149
|
+
/** Component for rendering empty messages */
|
|
150
|
+
Empty?: EmptyMessagePartComponent | undefined;
|
|
151
|
+
/** Component for rendering text content */
|
|
152
|
+
Text?: TextMessagePartComponent | undefined;
|
|
153
|
+
/** Component for rendering source content */
|
|
154
|
+
Source?: SourceMessagePartComponent | undefined;
|
|
155
|
+
/** Component for rendering image content */
|
|
156
|
+
Image?: ImageMessagePartComponent | undefined;
|
|
157
|
+
/** Component for rendering file content */
|
|
158
|
+
File?: FileMessagePartComponent | undefined;
|
|
159
|
+
/** Component for rendering audio content (experimental) */
|
|
160
|
+
Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
type ToolsConfig =
|
|
164
|
+
| {
|
|
165
|
+
/** Map of tool names to their specific components */
|
|
166
|
+
by_name?:
|
|
167
|
+
| Record<string, ToolCallMessagePartComponent | undefined>
|
|
168
|
+
| undefined;
|
|
169
|
+
/** Fallback component for unregistered tools */
|
|
170
|
+
Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;
|
|
171
|
+
}
|
|
172
|
+
| {
|
|
173
|
+
/** Override component that handles all tool calls */
|
|
174
|
+
Override: ComponentType<ToolCallMessagePartProps>;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Standard component configuration for rendering reasoning and tool-call parts
|
|
179
|
+
* individually (with optional grouping).
|
|
180
|
+
*
|
|
181
|
+
* Cannot be combined with `ChainOfThought`.
|
|
182
|
+
*/
|
|
183
|
+
type StandardComponents = BaseComponents & {
|
|
184
|
+
/** Component for rendering reasoning content (typically hidden) */
|
|
185
|
+
Reasoning?: ReasoningMessagePartComponent | undefined;
|
|
186
|
+
/** Configuration for tool call rendering */
|
|
187
|
+
tools?: ToolsConfig | undefined;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Component for rendering grouped consecutive tool calls.
|
|
191
|
+
*
|
|
192
|
+
* When provided, this component will automatically wrap consecutive tool-call
|
|
193
|
+
* message parts, allowing you to create collapsible sections, custom styling,
|
|
194
|
+
* or other grouped presentations for multiple tool calls.
|
|
195
|
+
*
|
|
196
|
+
* The component receives:
|
|
197
|
+
* - `startIndex`: The index of the first tool call in the group
|
|
198
|
+
* - `endIndex`: The index of the last tool call in the group
|
|
199
|
+
* - `children`: The rendered tool call components
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* // Collapsible tool group
|
|
204
|
+
* ToolGroup: ({ startIndex, endIndex, children }) => (
|
|
205
|
+
* <details className="tool-group">
|
|
206
|
+
* <summary>
|
|
207
|
+
* {endIndex - startIndex + 1} tool calls
|
|
208
|
+
* </summary>
|
|
209
|
+
* <div className="tool-group-content">
|
|
210
|
+
* {children}
|
|
211
|
+
* </div>
|
|
212
|
+
* </details>
|
|
213
|
+
* )
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* @param startIndex - Index of the first tool call in the group
|
|
217
|
+
* @param endIndex - Index of the last tool call in the group
|
|
218
|
+
* @param children - Rendered tool call components to display within the group
|
|
219
|
+
*
|
|
220
|
+
* @deprecated This feature is still experimental and subject to change.
|
|
221
|
+
*/
|
|
222
|
+
ToolGroup?: ComponentType<
|
|
223
|
+
PropsWithChildren<{ startIndex: number; endIndex: number }>
|
|
224
|
+
>;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Component for rendering grouped reasoning parts.
|
|
228
|
+
*
|
|
229
|
+
* When provided, this component will automatically wrap reasoning message parts
|
|
230
|
+
* (one or more consecutive) in a group container. Each reasoning part inside
|
|
231
|
+
* renders its own text independently - no text merging occurs.
|
|
232
|
+
*
|
|
233
|
+
* The component receives:
|
|
234
|
+
* - `startIndex`: The index of the first reasoning part in the group
|
|
235
|
+
* - `endIndex`: The index of the last reasoning part in the group
|
|
236
|
+
* - `children`: The rendered Reasoning components (one per part)
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```tsx
|
|
240
|
+
* // Collapsible reasoning group
|
|
241
|
+
* ReasoningGroup: ({ children }) => (
|
|
242
|
+
* <details className="reasoning-group">
|
|
243
|
+
* <summary>Reasoning</summary>
|
|
244
|
+
* <div className="reasoning-content">
|
|
245
|
+
* {children}
|
|
246
|
+
* </div>
|
|
247
|
+
* </details>
|
|
248
|
+
* )
|
|
249
|
+
* ```
|
|
250
|
+
*
|
|
251
|
+
* @param startIndex - Index of the first reasoning part in the group
|
|
252
|
+
* @param endIndex - Index of the last reasoning part in the group
|
|
253
|
+
* @param children - Rendered reasoning part components
|
|
254
|
+
*/
|
|
255
|
+
ReasoningGroup?: ReasoningGroupComponent;
|
|
256
|
+
|
|
257
|
+
ChainOfThought?: never;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Chain of thought component configuration.
|
|
262
|
+
*
|
|
263
|
+
* When `ChainOfThought` is set, it takes control of rendering ALL reasoning and
|
|
264
|
+
* tool-call parts in the message. The `Reasoning`, `tools`, `ReasoningGroup`, and
|
|
265
|
+
* `ToolGroup` components cannot be used alongside it.
|
|
266
|
+
*
|
|
267
|
+
* The component is automatically wrapped in a ChainOfThoughtByIndicesProvider
|
|
268
|
+
* that sets up the chainOfThought client scope with the correct parts.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```tsx
|
|
272
|
+
* // Chain of thought with accordion
|
|
273
|
+
* ChainOfThought: () => (
|
|
274
|
+
* <ChainOfThoughtPrimitive.Root>
|
|
275
|
+
* <ChainOfThoughtPrimitive.AccordionTrigger>
|
|
276
|
+
* Toggle reasoning
|
|
277
|
+
* </ChainOfThoughtPrimitive.AccordionTrigger>
|
|
278
|
+
* <ChainOfThoughtPrimitive.Parts />
|
|
279
|
+
* </ChainOfThoughtPrimitive.Root>
|
|
280
|
+
* )
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
type ChainOfThoughtComponents = BaseComponents & {
|
|
284
|
+
ChainOfThought: ComponentType;
|
|
285
|
+
|
|
286
|
+
Reasoning?: never;
|
|
287
|
+
tools?: never;
|
|
288
|
+
ToolGroup?: never;
|
|
289
|
+
ReasoningGroup?: never;
|
|
290
|
+
};
|
|
291
|
+
|
|
148
292
|
export type Props = {
|
|
149
293
|
/**
|
|
150
294
|
* Component configuration for rendering different types of message content.
|
|
151
295
|
*
|
|
152
296
|
* You can provide custom components for each content type (text, image, file, etc.)
|
|
153
297
|
* and configure tool rendering behavior. If not provided, default components will be used.
|
|
298
|
+
*
|
|
299
|
+
* Use either `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup` for standard rendering,
|
|
300
|
+
* or `ChainOfThought` to group all reasoning and tool-call parts into a single
|
|
301
|
+
* collapsible component. These two modes are mutually exclusive.
|
|
154
302
|
*/
|
|
155
|
-
components?:
|
|
156
|
-
| {
|
|
157
|
-
/** Component for rendering empty messages */
|
|
158
|
-
Empty?: EmptyMessagePartComponent | undefined;
|
|
159
|
-
/** Component for rendering text content */
|
|
160
|
-
Text?: TextMessagePartComponent | undefined;
|
|
161
|
-
/** Component for rendering reasoning content (typically hidden) */
|
|
162
|
-
Reasoning?: ReasoningMessagePartComponent | undefined;
|
|
163
|
-
/** Component for rendering source content */
|
|
164
|
-
Source?: SourceMessagePartComponent | undefined;
|
|
165
|
-
/** Component for rendering image content */
|
|
166
|
-
Image?: ImageMessagePartComponent | undefined;
|
|
167
|
-
/** Component for rendering file content */
|
|
168
|
-
File?: FileMessagePartComponent | undefined;
|
|
169
|
-
/** Component for rendering audio content (experimental) */
|
|
170
|
-
Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;
|
|
171
|
-
/** Configuration for tool call rendering */
|
|
172
|
-
tools?:
|
|
173
|
-
| {
|
|
174
|
-
/** Map of tool names to their specific components */
|
|
175
|
-
by_name?:
|
|
176
|
-
| Record<string, ToolCallMessagePartComponent | undefined>
|
|
177
|
-
| undefined;
|
|
178
|
-
/** Fallback component for unregistered tools */
|
|
179
|
-
Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;
|
|
180
|
-
}
|
|
181
|
-
| {
|
|
182
|
-
/** Override component that handles all tool calls */
|
|
183
|
-
Override: ComponentType<ToolCallMessagePartProps>;
|
|
184
|
-
}
|
|
185
|
-
| undefined;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Component for rendering grouped consecutive tool calls.
|
|
189
|
-
*
|
|
190
|
-
* When provided, this component will automatically wrap consecutive tool-call
|
|
191
|
-
* message parts, allowing you to create collapsible sections, custom styling,
|
|
192
|
-
* or other grouped presentations for multiple tool calls.
|
|
193
|
-
*
|
|
194
|
-
* The component receives:
|
|
195
|
-
* - `startIndex`: The index of the first tool call in the group
|
|
196
|
-
* - `endIndex`: The index of the last tool call in the group
|
|
197
|
-
* - `children`: The rendered tool call components
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* ```tsx
|
|
201
|
-
* // Collapsible tool group
|
|
202
|
-
* ToolGroup: ({ startIndex, endIndex, children }) => (
|
|
203
|
-
* <details className="tool-group">
|
|
204
|
-
* <summary>
|
|
205
|
-
* {endIndex - startIndex + 1} tool calls
|
|
206
|
-
* </summary>
|
|
207
|
-
* <div className="tool-group-content">
|
|
208
|
-
* {children}
|
|
209
|
-
* </div>
|
|
210
|
-
* </details>
|
|
211
|
-
* )
|
|
212
|
-
* ```
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* ```tsx
|
|
216
|
-
* // Custom styled tool group with header
|
|
217
|
-
* ToolGroup: ({ startIndex, endIndex, children }) => (
|
|
218
|
-
* <div className="border rounded-lg p-4 my-2">
|
|
219
|
-
* <div className="text-sm text-gray-600 mb-2">
|
|
220
|
-
* Tool execution #{startIndex + 1}-{endIndex + 1}
|
|
221
|
-
* </div>
|
|
222
|
-
* <div className="space-y-2">
|
|
223
|
-
* {children}
|
|
224
|
-
* </div>
|
|
225
|
-
* </div>
|
|
226
|
-
* )
|
|
227
|
-
* ```
|
|
228
|
-
*
|
|
229
|
-
* @param startIndex - Index of the first tool call in the group
|
|
230
|
-
* @param endIndex - Index of the last tool call in the group
|
|
231
|
-
* @param children - Rendered tool call components to display within the group
|
|
232
|
-
*
|
|
233
|
-
* @deprecated This feature is still experimental and subject to change.
|
|
234
|
-
*/
|
|
235
|
-
ToolGroup?: ComponentType<
|
|
236
|
-
PropsWithChildren<{ startIndex: number; endIndex: number }>
|
|
237
|
-
>;
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Component for rendering grouped reasoning parts.
|
|
241
|
-
*
|
|
242
|
-
* When provided, this component will automatically wrap reasoning message parts
|
|
243
|
-
* (one or more consecutive) in a group container. Each reasoning part inside
|
|
244
|
-
* renders its own text independently - no text merging occurs.
|
|
245
|
-
*
|
|
246
|
-
* The component receives:
|
|
247
|
-
* - `startIndex`: The index of the first reasoning part in the group
|
|
248
|
-
* - `endIndex`: The index of the last reasoning part in the group
|
|
249
|
-
* - `children`: The rendered Reasoning components (one per part)
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* ```tsx
|
|
253
|
-
* // Collapsible reasoning group
|
|
254
|
-
* ReasoningGroup: ({ children }) => (
|
|
255
|
-
* <details className="reasoning-group">
|
|
256
|
-
* <summary>Reasoning</summary>
|
|
257
|
-
* <div className="reasoning-content">
|
|
258
|
-
* {children}
|
|
259
|
-
* </div>
|
|
260
|
-
* </details>
|
|
261
|
-
* )
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* @param startIndex - Index of the first reasoning part in the group
|
|
265
|
-
* @param endIndex - Index of the last reasoning part in the group
|
|
266
|
-
* @param children - Rendered reasoning part components
|
|
267
|
-
*/
|
|
268
|
-
ReasoningGroup?: ReasoningGroupComponent;
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Component for rendering chain of thought (reasoning + tool-call) parts.
|
|
272
|
-
*
|
|
273
|
-
* When provided, this component takes control of rendering ALL reasoning and
|
|
274
|
-
* tool-call parts in the message. The Reasoning, tools, ReasoningGroup, and
|
|
275
|
-
* ToolGroup components are completely ignored when ChainOfThought is set.
|
|
276
|
-
*
|
|
277
|
-
* The component is automatically wrapped in a ChainOfThoughtByIndicesProvider
|
|
278
|
-
* that sets up the chainOfThought client scope with the correct parts.
|
|
279
|
-
*
|
|
280
|
-
* @example
|
|
281
|
-
* ```tsx
|
|
282
|
-
* // Chain of thought with accordion
|
|
283
|
-
* ChainOfThought: () => (
|
|
284
|
-
* <ChainOfThoughtPrimitive.Root>
|
|
285
|
-
* <ChainOfThoughtPrimitive.AccordionTrigger>
|
|
286
|
-
* Toggle reasoning
|
|
287
|
-
* </ChainOfThoughtPrimitive.AccordionTrigger>
|
|
288
|
-
* <ChainOfThoughtPrimitive.Parts />
|
|
289
|
-
* </ChainOfThoughtPrimitive.Root>
|
|
290
|
-
* )
|
|
291
|
-
* ```
|
|
292
|
-
*/
|
|
293
|
-
ChainOfThought?: ComponentType;
|
|
294
|
-
}
|
|
295
|
-
| undefined;
|
|
303
|
+
components?: StandardComponents | ChainOfThoughtComponents | undefined;
|
|
296
304
|
/**
|
|
297
305
|
* When enabled, shows the Empty component if the last part in the message
|
|
298
306
|
* is anything other than Text or Reasoning.
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
ChainOfThought Primitive
|
|
2
|
-
|
|
3
|
-
Overview
|
|
4
|
-
|
|
5
|
-
- Groups consecutive reasoning and tool-call message parts into a collapsible "chain of thought" section.
|
|
6
|
-
- Built on the part-scope mechanism shared with `MessagePrimitiveParts`, using `Derived` for part resolution.
|
|
7
|
-
- Each part within the chain of thought gets its own part scope via `ChainOfThoughtPartByIndexProvider`.
|
|
8
|
-
- Rendering is delegated to the shared `MessagePartComponent`, supporting the same component configuration as `MessagePrimitiveParts`.
|
|
9
|
-
|
|
10
|
-
Architecture
|
|
11
|
-
|
|
12
|
-
ChainOfThoughtState
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
type ChainOfThoughtState = {
|
|
16
|
-
readonly startIndex: number; // index of the first CoT part in the parent message
|
|
17
|
-
readonly parts: readonly ChainOfThoughtPart[];
|
|
18
|
-
readonly collapsed: boolean;
|
|
19
|
-
readonly status: MessagePartStatus | ToolCallMessagePartStatus;
|
|
20
|
-
};
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
ChainOfThoughtMethods
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
type ChainOfThoughtMethods = {
|
|
27
|
-
getState(): ChainOfThoughtState;
|
|
28
|
-
setCollapsed(collapsed: boolean): void;
|
|
29
|
-
part(selector: { index: number }): PartMethods;
|
|
30
|
-
};
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
- `part({ index })` delegates to the parent message's `part()` at offset `startIndex + index`.
|
|
34
|
-
|
|
35
|
-
ChainOfThoughtClient
|
|
36
|
-
|
|
37
|
-
- Resource params: `{ startIndex, parts, getMessagePart }`.
|
|
38
|
-
- `getMessagePart` is a callback that resolves to the parent message's `part()` method.
|
|
39
|
-
- The `part` method implementation: `({ index }) => getMessagePart({ index: startIndex + index })`.
|
|
40
|
-
|
|
41
|
-
Providers
|
|
42
|
-
|
|
43
|
-
ChainOfThoughtByIndicesProvider
|
|
44
|
-
|
|
45
|
-
- Wraps a range of message parts (startIndex..endIndex) into a chain of thought scope.
|
|
46
|
-
- Reads parts from the parent message state, passes `startIndex` and `getMessagePart` to `ChainOfThoughtClient`.
|
|
47
|
-
- Used internally by `MessagePrimitiveParts` when `ChainOfThought` component is configured.
|
|
48
|
-
|
|
49
|
-
ChainOfThoughtPartByIndexProvider
|
|
50
|
-
|
|
51
|
-
- Follows the same pattern as `PartByIndexProvider`.
|
|
52
|
-
- Reads `startIndex` from chain of thought state.
|
|
53
|
-
- Creates a `Derived` part scope: `source: "message"`, `query: { type: "index", index: startIndex + index }`.
|
|
54
|
-
- Delegates `get` to `aui.chainOfThought().part({ index })`.
|
|
55
|
-
|
|
56
|
-
Rendering (ChainOfThoughtPrimitiveParts)
|
|
57
|
-
|
|
58
|
-
- Accepts `components` prop with the same type as `MessagePrimitiveParts.Props["components"]`.
|
|
59
|
-
- Reads `collapsed` and `parts.length` from chain of thought state.
|
|
60
|
-
- When collapsed, renders nothing.
|
|
61
|
-
- When expanded, renders each part via `ChainOfThoughtPartByIndexProvider` + `MessagePartComponent`.
|
|
62
|
-
- `MessagePartComponent` is the shared rendering component exported from `MessageParts.tsx`.
|
|
63
|
-
|
|
64
|
-
Integration with MessagePrimitiveParts
|
|
65
|
-
|
|
66
|
-
- When `components.ChainOfThought` is set, `MessagePrimitiveParts` groups consecutive tool-call and reasoning parts into `chainOfThoughtGroup` ranges.
|
|
67
|
-
- Each group is wrapped in `ChainOfThoughtByIndicesProvider`, which sets up the chain of thought scope.
|
|
68
|
-
- The user's `ChainOfThought` component renders inside that scope and can use `ChainOfThoughtPrimitive.Parts` to render individual parts through the part-scope mechanism.
|