@swisper.ai/web-chat-ui 0.2.15 → 0.3.1
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/README.md +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +10 -10
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +5 -2
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/index.d.ts +1 -1
- package/dist/components/chat-thinking-process/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +272 -276
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chat-thinking-process/chat-thinking-process.json +17 -11
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +50 -26
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +54 -60
- package/src/components/chat-thinking-process/index.ts +1 -0
- package/src/docs/agent.stories.tsx +1 -1
package/README.md
CHANGED
|
@@ -179,7 +179,7 @@ Everything is exported from the package root. Each row names a component family:
|
|
|
179
179
|
| `ChatMessage`, `ChatMessageContent`, `ChatMessageActions` | One question (an end-aligned bubble, `isQuestion`) or one answer (full width), with a row of actions that fades in on hover. |
|
|
180
180
|
| `ChatMessageResponse` | An assistant answer: Markdown through `MarkdownViewer`, already configured for a message. |
|
|
181
181
|
| `MarkdownViewer` | Renders model Markdown (GitHub-flavoured, sanitised inline HTML) through Streamdown, repairs half-received syntax while it streams, and renders `<swi-*>` tags with your components. |
|
|
182
|
-
| `ChatThinkingProcess` and its parts | A collapsible
|
|
182
|
+
| `ChatThinkingProcess` and its parts | A collapsible list of the model's reasoning or tool steps above its answer, with a live preview while it thinks. |
|
|
183
183
|
| `ChatMessageToolbar` and its parts | The row under a message: timestamp plus small icon actions (copy, edit, feedback), each with an optional tooltip. |
|
|
184
184
|
| `ChatMessageAttachmentCard` and its parts, `getAttachmentIcon` | A compact chip for a file attached to a prompt or message: file-type icon or image thumbnail, truncated name, remove button. |
|
|
185
185
|
| `ChatSuggestions`, `ChatSuggestion` and its parts, `useChatSuggestionContext` | Numbered follow-up questions or quick replies above the composer, keyboard-navigable; picking one (`onSelect`) sends it. |
|
|
@@ -41,22 +41,16 @@ export interface ChatThinkingProcessContentProps extends ComponentProps<'div'> {
|
|
|
41
41
|
className?: string;
|
|
42
42
|
/** Classes for the expanded list of steps. */
|
|
43
43
|
itemsClassName?: string;
|
|
44
|
-
/** Classes for each timeline row: the marker column and the step beside it. */
|
|
45
|
-
rowClassName?: string;
|
|
46
|
-
/** Classes for the dot that marks each step. */
|
|
47
|
-
markerClassName?: string;
|
|
48
|
-
/** Classes for the line that joins a step's dot to the next one. */
|
|
49
|
-
connectorClassName?: string;
|
|
50
44
|
/** Classes for the faded preview of the last step. */
|
|
51
45
|
previewClassName?: string;
|
|
52
46
|
/** Previews the last step while the root is streaming and collapsed. */
|
|
53
47
|
hasLastMessagePreview?: boolean;
|
|
54
48
|
}
|
|
55
49
|
/**
|
|
56
|
-
* The steps
|
|
57
|
-
*
|
|
50
|
+
* The steps, listed under the label once expanded. The last one is previewed while the root is
|
|
51
|
+
* streaming and collapsed.
|
|
58
52
|
*/
|
|
59
|
-
export declare function ChatThinkingProcessContent({ children, className, itemsClassName,
|
|
53
|
+
export declare function ChatThinkingProcessContent({ children, className, itemsClassName, previewClassName, hasLastMessagePreview, ...rest }: ChatThinkingProcessContentProps): React.JSX.Element;
|
|
60
54
|
export interface ChatThinkingProcessContentPreviewProps {
|
|
61
55
|
children: ReactNode;
|
|
62
56
|
className?: string;
|
|
@@ -67,6 +61,12 @@ export interface ChatThinkingProcessContentItemProps extends ComponentProps<'div
|
|
|
67
61
|
children: ReactNode;
|
|
68
62
|
className?: string;
|
|
69
63
|
}
|
|
70
|
-
/** One step of the process: text, or any node such as streamed Markdown. */
|
|
64
|
+
/** One step of the process: text, or any node such as streamed Markdown, after an optional icon. */
|
|
71
65
|
export declare function ChatThinkingProcessContentItem({ children, className, ...rest }: ChatThinkingProcessContentItemProps): React.JSX.Element;
|
|
66
|
+
export interface ChatThinkingProcessContentItemIconProps extends ComponentProps<'span'> {
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
/** The logo or icon before a step's text: which tool the step used. The height is fixed; a logo's width follows its image. */
|
|
71
|
+
export declare function ChatThinkingProcessContentItemIcon({ children, className, ...rest }: ChatThinkingProcessContentItemIconProps): React.JSX.Element;
|
|
72
72
|
//# sourceMappingURL=chat-thinking-process.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-thinking-process.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAExF,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,iGAmB/B,CAAC;AAIF,MAAM,WAAW,+BAAgC,SAAQ,cAAc,CAAC,QAAQ,CAAC;IAC/E,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,gGAAgG;AAChG,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,+BAA+B,qBAqBjC;AAED,MAAM,WAAW,mCAAoC,SAAQ,cAAc,CAAC,MAAM,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mEAAmE;AACnE,wBAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,mCAAmC,
|
|
1
|
+
{"version":3,"file":"chat-thinking-process.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAExF,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,iGAmB/B,CAAC;AAIF,MAAM,WAAW,+BAAgC,SAAQ,cAAc,CAAC,QAAQ,CAAC;IAC/E,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,gGAAgG;AAChG,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,+BAA+B,qBAqBjC;AAED,MAAM,WAAW,mCAAoC,SAAQ,cAAc,CAAC,MAAM,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mEAAmE;AACnE,wBAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,mCAAmC,qBAgBrC;AAED,MAAM,WAAW,oC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oGAAoG;AACpG,wBAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,mCAAmC,qBAYrC;AAED,MAAM,WAAW,uCAAwC,SAAQ,cAAc,CAAC,MAAM,CAAC;IACrF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8HAA8H;AAC9H,wBAAgB,kCAAkC,CAAC,EACjD,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,uCAAuC,qBAgBzC"}
|
|
@@ -6,6 +6,8 @@ export default meta;
|
|
|
6
6
|
type Story = StoryObj<typeof ChatThinkingProcess>;
|
|
7
7
|
/** A finished process above an answer: collapsed, with a label that sums up what was done. */
|
|
8
8
|
export declare const Default: Story;
|
|
9
|
+
/** Expanded steps that each open with the logo of the tool they used. Logos keep their own width. */
|
|
10
|
+
export declare const WithItemIcons: Story;
|
|
9
11
|
/** Still thinking with the preview switched off: the label shimmers, and the steps show only once expanded. */
|
|
10
12
|
export declare const WithoutPreview: Story;
|
|
11
13
|
/** Still thinking: the label shimmers and the latest step is previewed under the collapsed trigger. */
|
|
@@ -22,13 +24,14 @@ export declare const StreamingPreview: Story;
|
|
|
22
24
|
export declare const WithoutPreviewHidesSteps: Story;
|
|
23
25
|
/** The process in each place it's allowed: in a chat message while thinking, and above the answer in a thread. */
|
|
24
26
|
export declare const Examples: Story;
|
|
25
|
-
interface ChatThinkingProcessPlaygroundProps extends Omit<ChatThinkingProcessProps, 'children'>, Pick<ChatThinkingProcessContentProps, 'itemsClassName' | '
|
|
27
|
+
interface ChatThinkingProcessPlaygroundProps extends Omit<ChatThinkingProcessProps, 'children'>, Pick<ChatThinkingProcessContentProps, 'itemsClassName' | 'previewClassName' | 'hasLastMessagePreview'> {
|
|
26
28
|
label: string;
|
|
27
29
|
icon: ReactNode;
|
|
28
30
|
stepCount: number;
|
|
29
31
|
hasArrow: boolean;
|
|
32
|
+
hasItemIcons: boolean;
|
|
30
33
|
}
|
|
31
|
-
declare function ChatThinkingProcessPlayground({ label, icon, stepCount, itemsClassName,
|
|
34
|
+
declare function ChatThinkingProcessPlayground({ label, icon, stepCount, itemsClassName, previewClassName, defaultOpen, hasArrow, hasLastMessagePreview, hasItemIcons, ...rest }: ChatThinkingProcessPlaygroundProps): import('react').JSX.Element;
|
|
32
35
|
/** Every part at once, with each part and prop of the root and the content on the Controls panel. */
|
|
33
36
|
export declare const Playground: StoryObj<typeof ChatThinkingProcessPlayground>;
|
|
34
37
|
//# sourceMappingURL=chat-thinking-process.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-thinking-process.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-thinking-process.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBvC,OAAO,EACL,mBAAmB,EAQnB,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC9B,MAAM,yBAAyB,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,mBAAmB,CAwD1C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAElD,8FAA8F;AAC9F,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF,qGAAqG;AACrG,eAAO,MAAM,aAAa,EAAE,KA4B3B,CAAC;AAEF,+GAA+G;AAC/G,eAAO,MAAM,cAAc,EAAE,KAmB5B,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,SAAS,EAAE,KAmBvB,CAAC;AAEF,qGAAqG;AACrG,eAAO,MAAM,oBAAoB,EAAE,KAyBlC,CAAC;AAEF,wGAAwG;AACxG,eAAO,MAAM,mBAAmB,EAAE,KAiCjC,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,eAAe,EAAE,KA2B7B,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,gBAAgB,EAAE,KA+B9B,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,wBAAwB,EAAE,KAmBtC,CAAC;AAEF,kHAAkH;AAClH,eAAO,MAAM,QAAQ,EAAE,KA+CtB,CAAC;AAEF,UAAU,kCACR,SACE,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,EAC1C,IAAI,CACF,+BAA+B,EAC/B,gBAAgB,GAAG,kBAAkB,GAAG,uBAAuB,CAChE;IACH,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,iBAAS,6BAA6B,CAAC,EACrC,KAAK,EACL,IAAI,EACJ,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,qBAAqB,EACrB,YAAY,EACZ,GAAG,IAAI,EACR,EAAE,kCAAkC,+BA4BpC;AAED,qGAAqG;AACrG,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,6BAA6B,CAuDrE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ChatThinkingProcess, ChatThinkingProcessTrigger, ChatThinkingProcessTriggerIcon, ChatThinkingProcessTriggerLabel, ChatThinkingProcessTriggerArrow, ChatThinkingProcessContent, ChatThinkingProcessContentItem, } from './chat-thinking-process';
|
|
1
|
+
export { ChatThinkingProcess, ChatThinkingProcessTrigger, ChatThinkingProcessTriggerIcon, ChatThinkingProcessTriggerLabel, ChatThinkingProcessTriggerArrow, ChatThinkingProcessContent, ChatThinkingProcessContentItem, ChatThinkingProcessContentItemIcon, } from './chat-thinking-process';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,8BAA8B,EAC9B,kCAAkC,GACnC,MAAM,yBAAyB,CAAC"}
|