@webority/chat-react 0.128.0 → 0.133.0
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/chat-react.js +14 -11
- package/dist/types/ChatAgentTyping.d.ts +4 -0
- package/dist/types/ChatAuthorBadge.d.ts +4 -0
- package/dist/types/ChatComposer.d.ts +10 -0
- package/dist/types/ChatConversationActions.d.ts +7 -0
- package/dist/types/ChatEmbed.d.ts +5 -0
- package/dist/types/ChatExplain.d.ts +16 -0
- package/dist/types/ChatFooter.d.ts +8 -0
- package/dist/types/ChatFrame.d.ts +26 -0
- package/dist/types/ChatHistory.d.ts +9 -0
- package/dist/types/ChatLauncher.d.ts +5 -0
- package/dist/types/ChatLiveStatus.d.ts +4 -0
- package/dist/types/ChatMessageActions.d.ts +10 -0
- package/dist/types/ChatNudge.d.ts +10 -0
- package/dist/types/ChatOpenTickets.d.ts +9 -0
- package/dist/types/ChatPage.d.ts +49 -0
- package/dist/types/ChatPanel.d.ts +9 -0
- package/dist/types/ChatPastChats.d.ts +9 -0
- package/dist/types/ChatReadAloudButton.d.ts +8 -0
- package/dist/types/ChatShell.d.ts +32 -0
- package/dist/types/ChatStarters.d.ts +8 -0
- package/dist/types/ChatThread.d.ts +15 -0
- package/dist/types/chatLive.d.ts +5 -0
- package/dist/types/chatPrint.d.ts +5 -0
- package/dist/types/chatShared.d.ts +10 -0
- package/dist/types/dictationText.d.ts +31 -0
- package/dist/types/index.d.ts +20 -14
- package/dist/types/loaders/ChatLoader.d.ts +21 -0
- package/dist/types/loaders/OrbLoader.d.ts +11 -0
- package/dist/types/loaders/PhrasesLoader.d.ts +14 -0
- package/dist/types/loaders/SkeletonLoader.d.ts +11 -0
- package/dist/types/loaders/StepsLoader.d.ts +12 -0
- package/dist/types/loaders/TypingPill.d.ts +12 -0
- package/dist/types/renderers/ActionPart.d.ts +4 -0
- package/dist/types/renderers/ChartPart.d.ts +4 -0
- package/dist/types/renderers/ChatLinkContext.d.ts +8 -0
- package/dist/types/renderers/FigureText.d.ts +5 -0
- package/dist/types/renderers/FiguresPart.d.ts +4 -0
- package/dist/types/renderers/FilePart.d.ts +4 -0
- package/dist/types/renderers/HandoffPart.d.ts +4 -0
- package/dist/types/renderers/ImagePart.d.ts +4 -0
- package/dist/types/renderers/InputRequestPart.d.ts +5 -0
- package/dist/types/renderers/NoticePart.d.ts +3 -0
- package/dist/types/renderers/QuickRepliesPart.d.ts +4 -0
- package/dist/types/renderers/RecordCardPart.d.ts +4 -0
- package/dist/types/renderers/SourcesPart.d.ts +4 -0
- package/dist/types/renderers/TablePart.d.ts +4 -0
- package/dist/types/renderers/TextPart.d.ts +5 -0
- package/dist/types/renderers/TicketPart.d.ts +4 -0
- package/dist/types/renderers/VoiceClipPart.d.ts +7 -0
- package/dist/types/renderers/index.d.ts +32 -0
- package/dist/types/useAutoOpen.d.ts +11 -0
- package/dist/types/useChat.d.ts +34 -76
- package/dist/types/useChatDictation.d.ts +24 -0
- package/dist/types/useChatExplain.d.ts +57 -0
- package/dist/types/useChatHandoff.d.ts +19 -0
- package/dist/types/useChatReadAloud.d.ts +16 -0
- package/dist/types/useChatSound.d.ts +5 -0
- package/dist/types/useChatSpeech.d.ts +7 -0
- package/dist/types/useLauncherAvoid.d.ts +1 -0
- package/dist/types/useReducedMotion.d.ts +1 -0
- package/dist/types/useTranscriptActions.d.ts +12 -0
- package/package.json +18 -20
- package/README.md +0 -320
- package/dist/guidance.json +0 -216
- package/dist/types/ChatMarkdown.meta.d.ts +0 -31
- package/dist/types/components/ActionCard.d.ts +0 -27
- package/dist/types/components/ActionCard.meta.d.ts +0 -89
- package/dist/types/components/ChatComposer.d.ts +0 -38
- package/dist/types/components/ChatComposer.meta.d.ts +0 -56
- package/dist/types/components/ChatConversationList.d.ts +0 -20
- package/dist/types/components/ChatConversationList.meta.d.ts +0 -37
- package/dist/types/components/ChatLauncher.d.ts +0 -31
- package/dist/types/components/ChatLauncher.meta.d.ts +0 -50
- package/dist/types/components/ChatMessage.d.ts +0 -61
- package/dist/types/components/ChatMessage.meta.d.ts +0 -173
- package/dist/types/components/ChatPanel.d.ts +0 -74
- package/dist/types/components/ChatPanel.meta.d.ts +0 -228
- package/dist/types/components/ChatThread.d.ts +0 -54
- package/dist/types/components/ChatThread.meta.d.ts +0 -151
- package/dist/types/components/CitationChip.d.ts +0 -15
- package/dist/types/components/CitationChip.meta.d.ts +0 -48
- package/dist/types/components/ComposerAttachments.d.ts +0 -14
- package/dist/types/components/ConfirmCard.d.ts +0 -24
- package/dist/types/components/ConfirmCard.meta.d.ts +0 -43
- package/dist/types/components/ReplyRating.d.ts +0 -16
- package/dist/types/components/ReplyRating.meta.d.ts +0 -34
- package/dist/types/markdown.d.ts +0 -22
- /package/{LICENSE → LICENSE.txt} +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The assistant's drawer: about 440px from the right, the full screen on a phone. The header
|
|
3
|
-
* carries the title, New chat and Close; the body the conversation; the footer the question box,
|
|
4
|
-
* the questions left today (once 10 or fewer remain) and the AI footnote. Focus stays inside
|
|
5
|
-
* while it is open, Escape closes it, and the question box takes focus when it opens.
|
|
6
|
-
*
|
|
7
|
-
* With `conversations`, a history icon shows the person's past chats in place of the body and
|
|
8
|
-
* the footer; a back icon returns to the chat. Closing the drawer returns to the chat.
|
|
9
|
-
*
|
|
10
|
-
* @param {object} props
|
|
11
|
-
* @param {ReturnType<typeof import('../useChat.js').useChat>} props.chat
|
|
12
|
-
* @param {boolean} props.open
|
|
13
|
-
* @param {() => void} props.onClose
|
|
14
|
-
* @param {import('react').ReactNode} [props.title]
|
|
15
|
-
* @param {string} [props.titleIcon="sparkles"]
|
|
16
|
-
* @param {import('react').ReactNode} [props.headerActions]
|
|
17
|
-
* @param {import('react').ReactNode} [props.empty]
|
|
18
|
-
* @param {import('react').ReactNode} [props.disclaimer]
|
|
19
|
-
* @param {number} [props.maxLength=4000]
|
|
20
|
-
* @param {number} [props.allowanceThreshold=10]
|
|
21
|
-
* @param {string} [props.width="440px"]
|
|
22
|
-
* @param {(href: string) => string|null|undefined} [props.resolveLink] See `ChatMarkdown`.
|
|
23
|
-
* @param {import('react').ElementType} [props.linkComponent] A router link (it receives `to`).
|
|
24
|
-
* @param {(token: string) => Promise<{ id: string, number: string }>} [props.confirmAction] Shows
|
|
25
|
-
* support action cards, e.g. `supportClient.confirmAction`.
|
|
26
|
-
* @param {(ticket: { id: string, number: string }) => void} [props.onViewTicket]
|
|
27
|
-
* @param {boolean} [props.rating=true]
|
|
28
|
-
* @param {(turn: import('../useChat.js').ChatTurn, state: { streaming: boolean }) => import('react').ReactNode} [props.renderReply]
|
|
29
|
-
* Draws each assistant answer instead of `ChatMarkdown`; see `ChatMessage`.
|
|
30
|
-
* @param {(attachment: { publicId: string, fileName: string, contentType: string, length: number }) => void} [props.openAttachment]
|
|
31
|
-
* Opens a file on a question; the session has no open action, so the app supplies one (for example
|
|
32
|
-
* with `client.getAttachment` and a blob URL).
|
|
33
|
-
* @param {boolean} [props.conversations=false] Offers the person's past chats from a header icon.
|
|
34
|
-
* @param {(inner: string) => boolean} [props.isCitation] Passed to `ChatThread`; see `ChatMarkdown`.
|
|
35
|
-
* @param {(citation: string) => void} [props.onOpenCitation] Passed to `ChatThread`; see `ChatMarkdown`.
|
|
36
|
-
* @param {Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>} [props.labels]
|
|
37
|
-
*/
|
|
38
|
-
export default function ChatPanel({ chat, open, onClose, title, titleIcon, headerActions, empty, disclaimer, maxLength, allowanceThreshold, width, resolveLink, linkComponent, confirmAction, onViewTicket, rating, renderReply, openAttachment, conversations, isCitation, onOpenCitation, labels: labelOverrides, }: {
|
|
39
|
-
chat: ReturnType<typeof import('../useChat.js').useChat>;
|
|
40
|
-
open: boolean;
|
|
41
|
-
onClose: () => void;
|
|
42
|
-
title?: import('react').ReactNode;
|
|
43
|
-
titleIcon?: string;
|
|
44
|
-
headerActions?: import('react').ReactNode;
|
|
45
|
-
empty?: import('react').ReactNode;
|
|
46
|
-
disclaimer?: import('react').ReactNode;
|
|
47
|
-
maxLength?: number;
|
|
48
|
-
allowanceThreshold?: number;
|
|
49
|
-
width?: string;
|
|
50
|
-
resolveLink?: (href: string) => string | null | undefined;
|
|
51
|
-
linkComponent?: import('react').ElementType;
|
|
52
|
-
confirmAction?: (token: string) => Promise<{
|
|
53
|
-
id: string;
|
|
54
|
-
number: string;
|
|
55
|
-
}>;
|
|
56
|
-
onViewTicket?: (ticket: {
|
|
57
|
-
id: string;
|
|
58
|
-
number: string;
|
|
59
|
-
}) => void;
|
|
60
|
-
rating?: boolean;
|
|
61
|
-
renderReply?: (turn: import('../useChat.js').ChatTurn, state: {
|
|
62
|
-
streaming: boolean;
|
|
63
|
-
}) => import('react').ReactNode;
|
|
64
|
-
openAttachment?: (attachment: {
|
|
65
|
-
publicId: string;
|
|
66
|
-
fileName: string;
|
|
67
|
-
contentType: string;
|
|
68
|
-
length: number;
|
|
69
|
-
}) => void;
|
|
70
|
-
conversations?: boolean;
|
|
71
|
-
isCitation?: (inner: string) => boolean;
|
|
72
|
-
onOpenCitation?: (citation: string) => void;
|
|
73
|
-
labels?: Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>;
|
|
74
|
-
}): import("react").JSX.Element;
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ChatPanel";
|
|
3
|
-
readonly marker: "ChatPanel";
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly chat: {
|
|
8
|
-
readonly type: "object";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The chat state the panel shows; the app takes it from useChat. The kit draws a stand-in with these fields.";
|
|
11
|
-
readonly fields: {
|
|
12
|
-
readonly turns: {
|
|
13
|
-
readonly type: "array";
|
|
14
|
-
readonly required: true;
|
|
15
|
-
readonly description: "The conversation, oldest turn first.";
|
|
16
|
-
readonly itemFields: {
|
|
17
|
-
readonly id: {
|
|
18
|
-
readonly type: "string";
|
|
19
|
-
readonly required: true;
|
|
20
|
-
readonly description: "Local key for the turn.";
|
|
21
|
-
};
|
|
22
|
-
readonly question: {
|
|
23
|
-
readonly type: "string";
|
|
24
|
-
readonly required: true;
|
|
25
|
-
readonly description: "What the person asked.";
|
|
26
|
-
};
|
|
27
|
-
readonly answer: {
|
|
28
|
-
readonly type: "string";
|
|
29
|
-
readonly required: true;
|
|
30
|
-
readonly description: "The answer shown.";
|
|
31
|
-
};
|
|
32
|
-
readonly streaming: {
|
|
33
|
-
readonly type: "boolean";
|
|
34
|
-
readonly required: true;
|
|
35
|
-
readonly description: "True while the answer is still arriving.";
|
|
36
|
-
};
|
|
37
|
-
readonly step: {
|
|
38
|
-
readonly type: "string";
|
|
39
|
-
readonly required: false;
|
|
40
|
-
readonly description: "The tool the assistant is running.";
|
|
41
|
-
};
|
|
42
|
-
readonly error: {
|
|
43
|
-
readonly type: "object";
|
|
44
|
-
readonly required: false;
|
|
45
|
-
readonly description: "Set when the turn failed.";
|
|
46
|
-
readonly fields: {
|
|
47
|
-
readonly code: {
|
|
48
|
-
readonly type: "string";
|
|
49
|
-
readonly required: true;
|
|
50
|
-
readonly description: "A short code for the failure.";
|
|
51
|
-
};
|
|
52
|
-
readonly message: {
|
|
53
|
-
readonly type: "string";
|
|
54
|
-
readonly required: true;
|
|
55
|
-
readonly description: "Written for the person.";
|
|
56
|
-
};
|
|
57
|
-
readonly resetsAtUtc: {
|
|
58
|
-
readonly type: "string";
|
|
59
|
-
readonly required: false;
|
|
60
|
-
readonly description: "When a limit resets, as an ISO time.";
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
readonly actions: {
|
|
65
|
-
readonly type: "array";
|
|
66
|
-
readonly required: true;
|
|
67
|
-
readonly description: "Support actions prepared for the turn.";
|
|
68
|
-
};
|
|
69
|
-
readonly messageId: {
|
|
70
|
-
readonly type: "string";
|
|
71
|
-
readonly required: false;
|
|
72
|
-
readonly description: "The stored reply's id.";
|
|
73
|
-
};
|
|
74
|
-
readonly questionId: {
|
|
75
|
-
readonly type: "string";
|
|
76
|
-
readonly required: false;
|
|
77
|
-
readonly description: "The stored question's id.";
|
|
78
|
-
};
|
|
79
|
-
readonly stopped: {
|
|
80
|
-
readonly type: "boolean";
|
|
81
|
-
readonly required: false;
|
|
82
|
-
readonly description: "True when the person stopped the answer.";
|
|
83
|
-
};
|
|
84
|
-
readonly attachments: {
|
|
85
|
-
readonly type: "array";
|
|
86
|
-
readonly required: false;
|
|
87
|
-
readonly description: "The files sent with the question.";
|
|
88
|
-
};
|
|
89
|
-
readonly rating: {
|
|
90
|
-
readonly type: "enum";
|
|
91
|
-
readonly values: readonly ["Up", "Down"];
|
|
92
|
-
readonly required: false;
|
|
93
|
-
readonly description: "The rating given.";
|
|
94
|
-
};
|
|
95
|
-
readonly ratingNote: {
|
|
96
|
-
readonly type: "string";
|
|
97
|
-
readonly required: false;
|
|
98
|
-
readonly description: "The note saved with the rating.";
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
readonly messagesLeftToday: {
|
|
103
|
-
readonly type: "number";
|
|
104
|
-
readonly required: false;
|
|
105
|
-
readonly description: "Questions left today. Unset when not known.";
|
|
106
|
-
};
|
|
107
|
-
readonly loading: {
|
|
108
|
-
readonly type: "boolean";
|
|
109
|
-
readonly required: true;
|
|
110
|
-
readonly description: "True while a saved conversation loads.";
|
|
111
|
-
};
|
|
112
|
-
readonly streaming: {
|
|
113
|
-
readonly type: "boolean";
|
|
114
|
-
readonly required: true;
|
|
115
|
-
readonly description: "True while an answer is arriving.";
|
|
116
|
-
};
|
|
117
|
-
readonly loadError: {
|
|
118
|
-
readonly type: "object";
|
|
119
|
-
readonly required: false;
|
|
120
|
-
readonly description: "Set when a saved conversation failed to load.";
|
|
121
|
-
readonly fields: {
|
|
122
|
-
readonly message: {
|
|
123
|
-
readonly type: "string";
|
|
124
|
-
readonly required: true;
|
|
125
|
-
readonly description: "Written for the person.";
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
readonly open: {
|
|
132
|
-
readonly type: "boolean";
|
|
133
|
-
readonly required: true;
|
|
134
|
-
readonly description: "Whether the drawer is shown.";
|
|
135
|
-
};
|
|
136
|
-
readonly title: {
|
|
137
|
-
readonly type: "node";
|
|
138
|
-
readonly description: "The drawer title. Defaults to the panel title label.";
|
|
139
|
-
};
|
|
140
|
-
readonly titleIcon: {
|
|
141
|
-
readonly type: "string";
|
|
142
|
-
readonly default: "sparkles";
|
|
143
|
-
readonly description: "A library icon name shown before the title.";
|
|
144
|
-
};
|
|
145
|
-
readonly headerActions: {
|
|
146
|
-
readonly type: "node";
|
|
147
|
-
readonly description: "Extra header controls placed before New chat.";
|
|
148
|
-
};
|
|
149
|
-
readonly empty: {
|
|
150
|
-
readonly type: "node";
|
|
151
|
-
readonly description: "Shown before the first question.";
|
|
152
|
-
};
|
|
153
|
-
readonly disclaimer: {
|
|
154
|
-
readonly type: "node";
|
|
155
|
-
readonly description: "The footnote under the question box. Defaults to the disclaimer label.";
|
|
156
|
-
};
|
|
157
|
-
readonly maxLength: {
|
|
158
|
-
readonly type: "number";
|
|
159
|
-
readonly default: 4000;
|
|
160
|
-
readonly description: "The most characters a question may have.";
|
|
161
|
-
};
|
|
162
|
-
readonly allowanceThreshold: {
|
|
163
|
-
readonly type: "number";
|
|
164
|
-
readonly default: 10;
|
|
165
|
-
readonly description: "The questions left note shows once this many or fewer remain.";
|
|
166
|
-
};
|
|
167
|
-
readonly width: {
|
|
168
|
-
readonly type: "string";
|
|
169
|
-
readonly default: "440px";
|
|
170
|
-
readonly description: "The drawer width on wide screens.";
|
|
171
|
-
};
|
|
172
|
-
readonly rating: {
|
|
173
|
-
readonly type: "boolean";
|
|
174
|
-
readonly default: true;
|
|
175
|
-
readonly description: "Offer thumbs under stored replies.";
|
|
176
|
-
};
|
|
177
|
-
readonly conversations: {
|
|
178
|
-
readonly type: "boolean";
|
|
179
|
-
readonly default: false;
|
|
180
|
-
readonly description: "Offers the person's past chats from a header icon; the list replaces the conversation until a chat is opened.";
|
|
181
|
-
};
|
|
182
|
-
readonly labels: {
|
|
183
|
-
readonly type: "object";
|
|
184
|
-
readonly description: "Replacements for the built-in wording.";
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
readonly examples: readonly [{
|
|
188
|
-
readonly id: "ChatPanel";
|
|
189
|
-
readonly title: "Default";
|
|
190
|
-
readonly props: {
|
|
191
|
-
readonly chat: {
|
|
192
|
-
readonly turns: readonly [];
|
|
193
|
-
readonly messagesLeftToday: 8;
|
|
194
|
-
readonly loading: false;
|
|
195
|
-
readonly streaming: false;
|
|
196
|
-
};
|
|
197
|
-
readonly open: false;
|
|
198
|
-
};
|
|
199
|
-
}, {
|
|
200
|
-
readonly id: "ChatPanel.conversation";
|
|
201
|
-
readonly title: "With a conversation";
|
|
202
|
-
readonly props: {
|
|
203
|
-
readonly chat: {
|
|
204
|
-
readonly turns: readonly [{
|
|
205
|
-
readonly id: "demo-question";
|
|
206
|
-
readonly question: "How do I turn on two-step sign-in?";
|
|
207
|
-
readonly answer: "Open the security settings and choose two-step sign-in.";
|
|
208
|
-
readonly streaming: false;
|
|
209
|
-
readonly actions: readonly [];
|
|
210
|
-
}];
|
|
211
|
-
readonly messagesLeftToday: 8;
|
|
212
|
-
readonly loading: false;
|
|
213
|
-
readonly streaming: false;
|
|
214
|
-
};
|
|
215
|
-
readonly open: false;
|
|
216
|
-
};
|
|
217
|
-
}];
|
|
218
|
-
readonly usage: {
|
|
219
|
-
readonly when: readonly ["Offer the assistant as a drawer that opens from a launcher.", "Show the conversation, the question box, the questions left today and the footnote in one place."];
|
|
220
|
-
readonly whenNot: readonly [{
|
|
221
|
-
readonly text: "Showing only the conversation inside a page.";
|
|
222
|
-
readonly instead: "ChatThread";
|
|
223
|
-
}];
|
|
224
|
-
readonly do: readonly [];
|
|
225
|
-
readonly dont: readonly [];
|
|
226
|
-
readonly a11y: readonly ["Focus stays inside the drawer while it is open, Escape closes it, and the question box takes focus when it opens.", "The drawer is named by its title.", "The questions left note is a status region."];
|
|
227
|
-
};
|
|
228
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The conversation, oldest turn first. It keeps the newest text in view as an answer streams.
|
|
3
|
-
* With no turns it shows `empty`, or a default "How can I help?" state.
|
|
4
|
-
*
|
|
5
|
-
* @param {object} props
|
|
6
|
-
* @param {import('../useChat.js').ChatTurn[]} props.turns
|
|
7
|
-
* @param {import('react').ReactNode} [props.empty]
|
|
8
|
-
* @param {(turnId: string, rating: "Up"|"Down", note?: string) => Promise<unknown>} [props.onRate]
|
|
9
|
-
* @param {(href: string) => string|null|undefined} [props.resolveLink]
|
|
10
|
-
* @param {import('react').ElementType} [props.linkComponent]
|
|
11
|
-
* @param {(token: string) => Promise<{ id: string, number: string }>} [props.confirmAction]
|
|
12
|
-
* @param {(ticket: { id: string, number: string }) => void} [props.onViewTicket]
|
|
13
|
-
* @param {(turn: import('../useChat.js').ChatTurn, state: { streaming: boolean }) => import('react').ReactNode} [props.renderReply]
|
|
14
|
-
* Draws each assistant answer instead of `ChatMarkdown`; see `ChatMessage`.
|
|
15
|
-
* @param {(turnId: string) => void} [props.onRetry]
|
|
16
|
-
* @param {(turnId: string) => void} [props.onRegenerate] Offered on the last turn only.
|
|
17
|
-
* @param {(text: string) => void} [props.onAskSuggestion] Sends a suggested follow-up; offered on the last turn only.
|
|
18
|
-
* @param {(inner: string) => boolean} [props.isCitation] Passed to `ChatMessage`; see `ChatMarkdown`.
|
|
19
|
-
* @param {(citation: string) => void} [props.onOpenCitation] Passed to `ChatMessage`; see `ChatMarkdown`.
|
|
20
|
-
* @param {(turnId: string) => void} [props.onEdit]
|
|
21
|
-
* @param {(attachment: { publicId: string, fileName: string, contentType: string, length: number }) => void} [props.onOpenAttachment]
|
|
22
|
-
* @param {Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>} [props.labels]
|
|
23
|
-
*/
|
|
24
|
-
export default function ChatThread({ turns, empty, onRate, resolveLink, linkComponent, confirmAction, onViewTicket, renderReply, onRetry, onRegenerate, onAskSuggestion, isCitation, onOpenCitation, onEdit, onOpenAttachment, labels: labelOverrides, }: {
|
|
25
|
-
turns: import('../useChat.js').ChatTurn[];
|
|
26
|
-
empty?: import('react').ReactNode;
|
|
27
|
-
onRate?: (turnId: string, rating: "Up" | "Down", note?: string) => Promise<unknown>;
|
|
28
|
-
resolveLink?: (href: string) => string | null | undefined;
|
|
29
|
-
linkComponent?: import('react').ElementType;
|
|
30
|
-
confirmAction?: (token: string) => Promise<{
|
|
31
|
-
id: string;
|
|
32
|
-
number: string;
|
|
33
|
-
}>;
|
|
34
|
-
onViewTicket?: (ticket: {
|
|
35
|
-
id: string;
|
|
36
|
-
number: string;
|
|
37
|
-
}) => void;
|
|
38
|
-
renderReply?: (turn: import('../useChat.js').ChatTurn, state: {
|
|
39
|
-
streaming: boolean;
|
|
40
|
-
}) => import('react').ReactNode;
|
|
41
|
-
onRetry?: (turnId: string) => void;
|
|
42
|
-
onRegenerate?: (turnId: string) => void;
|
|
43
|
-
onAskSuggestion?: (text: string) => void;
|
|
44
|
-
isCitation?: (inner: string) => boolean;
|
|
45
|
-
onOpenCitation?: (citation: string) => void;
|
|
46
|
-
onEdit?: (turnId: string) => void;
|
|
47
|
-
onOpenAttachment?: (attachment: {
|
|
48
|
-
publicId: string;
|
|
49
|
-
fileName: string;
|
|
50
|
-
contentType: string;
|
|
51
|
-
length: number;
|
|
52
|
-
}) => void;
|
|
53
|
-
labels?: Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>;
|
|
54
|
-
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined>;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ChatThread";
|
|
3
|
-
readonly marker: "ChatThread";
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly turns: {
|
|
8
|
-
readonly type: "array";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The conversation, oldest turn first. With none, the empty state shows.";
|
|
11
|
-
readonly itemFields: {
|
|
12
|
-
readonly id: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
readonly required: true;
|
|
15
|
-
readonly description: "Local key for the turn.";
|
|
16
|
-
};
|
|
17
|
-
readonly question: {
|
|
18
|
-
readonly type: "string";
|
|
19
|
-
readonly required: true;
|
|
20
|
-
readonly description: "What the person asked.";
|
|
21
|
-
};
|
|
22
|
-
readonly answer: {
|
|
23
|
-
readonly type: "string";
|
|
24
|
-
readonly required: true;
|
|
25
|
-
readonly description: "The answer shown: the streamed text so far, then the reply of record.";
|
|
26
|
-
};
|
|
27
|
-
readonly streaming: {
|
|
28
|
-
readonly type: "boolean";
|
|
29
|
-
readonly required: true;
|
|
30
|
-
readonly description: "True while the answer is still arriving.";
|
|
31
|
-
};
|
|
32
|
-
readonly step: {
|
|
33
|
-
readonly type: "string";
|
|
34
|
-
readonly required: false;
|
|
35
|
-
readonly description: "The name of the tool the assistant is running. Unset when none is.";
|
|
36
|
-
};
|
|
37
|
-
readonly error: {
|
|
38
|
-
readonly type: "object";
|
|
39
|
-
readonly required: false;
|
|
40
|
-
readonly description: "Set when the turn failed.";
|
|
41
|
-
readonly fields: {
|
|
42
|
-
readonly code: {
|
|
43
|
-
readonly type: "string";
|
|
44
|
-
readonly required: true;
|
|
45
|
-
readonly description: "A short code for the failure.";
|
|
46
|
-
};
|
|
47
|
-
readonly message: {
|
|
48
|
-
readonly type: "string";
|
|
49
|
-
readonly required: true;
|
|
50
|
-
readonly description: "Written for the person.";
|
|
51
|
-
};
|
|
52
|
-
readonly resetsAtUtc: {
|
|
53
|
-
readonly type: "string";
|
|
54
|
-
readonly required: false;
|
|
55
|
-
readonly description: "When a limit resets, as an ISO time.";
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
readonly actions: {
|
|
60
|
-
readonly type: "array";
|
|
61
|
-
readonly required: true;
|
|
62
|
-
readonly description: "Support actions the assistant prepared for this turn.";
|
|
63
|
-
};
|
|
64
|
-
readonly messageId: {
|
|
65
|
-
readonly type: "string";
|
|
66
|
-
readonly required: false;
|
|
67
|
-
readonly description: "The stored reply's id. The rating needs it.";
|
|
68
|
-
};
|
|
69
|
-
readonly questionId: {
|
|
70
|
-
readonly type: "string";
|
|
71
|
-
readonly required: false;
|
|
72
|
-
readonly description: "The stored question's id. Editing the question needs it.";
|
|
73
|
-
};
|
|
74
|
-
readonly stopped: {
|
|
75
|
-
readonly type: "boolean";
|
|
76
|
-
readonly required: false;
|
|
77
|
-
readonly description: "True when the person stopped the answer before it finished.";
|
|
78
|
-
};
|
|
79
|
-
readonly attachments: {
|
|
80
|
-
readonly type: "array";
|
|
81
|
-
readonly required: false;
|
|
82
|
-
readonly description: "The files sent with the question.";
|
|
83
|
-
};
|
|
84
|
-
readonly rating: {
|
|
85
|
-
readonly type: "enum";
|
|
86
|
-
readonly values: readonly ["Up", "Down"];
|
|
87
|
-
readonly required: false;
|
|
88
|
-
readonly description: "The rating already given to the reply.";
|
|
89
|
-
};
|
|
90
|
-
readonly ratingNote: {
|
|
91
|
-
readonly type: "string";
|
|
92
|
-
readonly required: false;
|
|
93
|
-
readonly description: "The note saved with the rating.";
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
readonly empty: {
|
|
98
|
-
readonly type: "node";
|
|
99
|
-
readonly required: false;
|
|
100
|
-
readonly description: "Shown when there are no turns; defaults to a short How can I help state.";
|
|
101
|
-
};
|
|
102
|
-
readonly linkComponent: {
|
|
103
|
-
readonly type: "node";
|
|
104
|
-
readonly required: false;
|
|
105
|
-
readonly description: "A router link component for in-app links in answers; it receives to.";
|
|
106
|
-
};
|
|
107
|
-
readonly labels: {
|
|
108
|
-
readonly type: "object";
|
|
109
|
-
readonly required: false;
|
|
110
|
-
readonly description: "Replacements for the built-in wording, such as the thread name and the empty-state text.";
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
readonly examples: readonly [{
|
|
114
|
-
readonly id: "ChatThread";
|
|
115
|
-
readonly title: "Default";
|
|
116
|
-
readonly props: {
|
|
117
|
-
readonly turns: readonly [{
|
|
118
|
-
readonly id: "t-1";
|
|
119
|
-
readonly question: "What is due?";
|
|
120
|
-
readonly answer: "Two invoices.";
|
|
121
|
-
readonly streaming: false;
|
|
122
|
-
readonly actions: readonly [];
|
|
123
|
-
}, {
|
|
124
|
-
readonly id: "t-2";
|
|
125
|
-
readonly question: "And next?";
|
|
126
|
-
readonly answer: "One more.";
|
|
127
|
-
readonly streaming: false;
|
|
128
|
-
readonly actions: readonly [];
|
|
129
|
-
}];
|
|
130
|
-
};
|
|
131
|
-
}, {
|
|
132
|
-
readonly id: "ChatThread.empty";
|
|
133
|
-
readonly title: "No turns yet";
|
|
134
|
-
readonly props: {
|
|
135
|
-
readonly turns: readonly [];
|
|
136
|
-
};
|
|
137
|
-
}];
|
|
138
|
-
readonly usage: {
|
|
139
|
-
readonly when: readonly ["Show a whole conversation, oldest turn first, in a panel or a page.", "Let the thread follow the newest text as an answer streams."];
|
|
140
|
-
readonly whenNot: readonly [{
|
|
141
|
-
readonly text: "Showing one turn on its own.";
|
|
142
|
-
readonly instead: "ChatMessage";
|
|
143
|
-
}, {
|
|
144
|
-
readonly text: "Showing the full assistant drawer with its header and question box.";
|
|
145
|
-
readonly instead: "ChatPanel";
|
|
146
|
-
}];
|
|
147
|
-
readonly do: readonly [];
|
|
148
|
-
readonly dont: readonly [];
|
|
149
|
-
readonly a11y: readonly ["The turns are an ordered list named by the thread label.", "Each answer is a polite live region; see ChatMessage.", "Only the nearest box that scrolls on its own follows the newest text, so the page itself never jumps."];
|
|
150
|
-
};
|
|
151
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A citation the assistant wrote as `[inner]`: a chip that opens the source it names.
|
|
3
|
-
*
|
|
4
|
-
* @param {object} props
|
|
5
|
-
* @param {string} props.citation
|
|
6
|
-
* @param {string} [props.label]
|
|
7
|
-
* @param {string} [props.ariaLabel]
|
|
8
|
-
* @param {(citation: string) => void} props.onOpen
|
|
9
|
-
*/
|
|
10
|
-
export default function CitationChip({ citation, label, ariaLabel, onOpen }: {
|
|
11
|
-
citation: string;
|
|
12
|
-
label?: string;
|
|
13
|
-
ariaLabel?: string;
|
|
14
|
-
onOpen: (citation: string) => void;
|
|
15
|
-
}): import("react").JSX.Element;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "CitationChip";
|
|
3
|
-
readonly marker: null;
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly citation: {
|
|
8
|
-
readonly type: "string";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The source the assistant named in its reply, written as [inner] in the text. It is the chip's text and its accessible name unless label or ariaLabel replace them.";
|
|
11
|
-
};
|
|
12
|
-
readonly label: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
readonly required: false;
|
|
15
|
-
readonly description: "Text on the chip. Defaults to the citation.";
|
|
16
|
-
};
|
|
17
|
-
readonly ariaLabel: {
|
|
18
|
-
readonly type: "string";
|
|
19
|
-
readonly required: false;
|
|
20
|
-
readonly description: "Accessible label for the chip. Defaults to the citation.";
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
readonly examples: readonly [{
|
|
24
|
-
readonly id: "CitationChip";
|
|
25
|
-
readonly title: "Default";
|
|
26
|
-
readonly props: {
|
|
27
|
-
readonly citation: "Clause 4.2";
|
|
28
|
-
};
|
|
29
|
-
}, {
|
|
30
|
-
readonly id: "CitationChip.label";
|
|
31
|
-
readonly title: "With a label";
|
|
32
|
-
readonly props: {
|
|
33
|
-
readonly citation: "Table 1";
|
|
34
|
-
readonly label: "Table 1, page 3";
|
|
35
|
-
readonly ariaLabel: "Open Table 1";
|
|
36
|
-
};
|
|
37
|
-
}];
|
|
38
|
-
readonly usage: {
|
|
39
|
-
readonly when: readonly ["Show a source the assistant named in a reply as a small chip the person can select to open it.", "Pair it with splitCitations from @webority/markdown-core (re-exported by @webority/chat-react) to turn [source] runs in reply text into chips."];
|
|
40
|
-
readonly whenNot: readonly [{
|
|
41
|
-
readonly text: "Showing a general label or removable token that is not a source.";
|
|
42
|
-
readonly instead: "AppChip";
|
|
43
|
-
}];
|
|
44
|
-
readonly do: readonly [];
|
|
45
|
-
readonly dont: readonly [];
|
|
46
|
-
readonly a11y: readonly ["The chip is a button named by ariaLabel, or by the citation when none is given.", "Selecting it by pointer or keyboard calls onOpen with the citation."];
|
|
47
|
-
};
|
|
48
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The files attached to the question being written. A failed upload stays listed with its
|
|
3
|
-
* error, so the person can remove it.
|
|
4
|
-
*
|
|
5
|
-
* @param {object} props
|
|
6
|
-
* @param {import('@webority/markdown-core/chat').ComposerAttachment[]} props.attachments
|
|
7
|
-
* @param {(key: string) => unknown} props.onRemove Called with the attachment key.
|
|
8
|
-
* @param {import('@webority/markdown-core/chat').ChatLabels} props.labels The merged labels.
|
|
9
|
-
*/
|
|
10
|
-
export default function ComposerAttachments({ attachments, onRemove, labels }: {
|
|
11
|
-
attachments: import('@webority/markdown-core/chat').ComposerAttachment[];
|
|
12
|
-
onRemove: (key: string) => unknown;
|
|
13
|
-
labels: import('@webority/markdown-core/chat').ChatLabels;
|
|
14
|
-
}): import("react").JSX.Element | null;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One general card for an action the assistant prepared. Nothing happens until the person confirms.
|
|
3
|
-
* The card moves from ready to sending to done, or to dismissed when the person says not now. A
|
|
4
|
-
* failed confirm shows its message and returns to ready, so the person can try again.
|
|
5
|
-
*
|
|
6
|
-
* @param {object} props
|
|
7
|
-
* @param {string} props.title
|
|
8
|
-
* @param {string} [props.subtitle]
|
|
9
|
-
* @param {string[]} [props.lines]
|
|
10
|
-
* @param {string} [props.note]
|
|
11
|
-
* @param {() => Promise<{ message?: string } | void>} props.onConfirm Sends the person's yes; resolves to
|
|
12
|
-
* an optional message for the done state. A rejection's `message` is shown when present.
|
|
13
|
-
* @param {Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>} [props.labels]
|
|
14
|
-
*/
|
|
15
|
-
export default function ConfirmCard({ title, subtitle, lines, note, onConfirm, labels: labelsProp }: {
|
|
16
|
-
title: string;
|
|
17
|
-
subtitle?: string;
|
|
18
|
-
lines?: string[];
|
|
19
|
-
note?: string;
|
|
20
|
-
onConfirm: () => Promise<{
|
|
21
|
-
message?: string;
|
|
22
|
-
} | void>;
|
|
23
|
-
labels?: Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>;
|
|
24
|
-
}): import("react").JSX.Element;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ConfirmCard";
|
|
3
|
-
readonly marker: null;
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly title: {
|
|
8
|
-
readonly type: "string";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The action the assistant prepared, written as what happens when the person confirms.";
|
|
11
|
-
};
|
|
12
|
-
readonly subtitle: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
readonly description: "A line under the title that says more about the action.";
|
|
15
|
-
};
|
|
16
|
-
readonly lines: {
|
|
17
|
-
readonly type: "array";
|
|
18
|
-
readonly description: "One paragraph per entry, shown above the note.";
|
|
19
|
-
};
|
|
20
|
-
readonly note: {
|
|
21
|
-
readonly type: "string";
|
|
22
|
-
readonly description: "Replaces the default line saying nothing is sent until the person confirms.";
|
|
23
|
-
};
|
|
24
|
-
readonly labels: {
|
|
25
|
-
readonly type: "object";
|
|
26
|
-
readonly description: "Replaces any of the chat texts the card shows, such as the confirm and not now button texts and the done message.";
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
readonly examples: readonly [{
|
|
30
|
-
readonly id: "ConfirmCard";
|
|
31
|
-
readonly title: "Default";
|
|
32
|
-
readonly props: {
|
|
33
|
-
readonly title: "Copy assessment";
|
|
34
|
-
};
|
|
35
|
-
}];
|
|
36
|
-
readonly usage: {
|
|
37
|
-
readonly when: readonly ["The assistant has prepared an action and nothing should happen until the person says yes.", "The action is one step the person can send now or decline."];
|
|
38
|
-
readonly whenNot: readonly [];
|
|
39
|
-
readonly do: readonly [];
|
|
40
|
-
readonly dont: readonly [];
|
|
41
|
-
readonly a11y: readonly ["Confirm and Not now are native buttons, and Confirm shows its loading state while the action is sent.", "The done message is a status message.", "A failed confirm shows its message in an alert above the buttons and returns the card to ready."];
|
|
42
|
-
};
|
|
43
|
-
};
|