@galaxycore/ai-chat 0.7.0 → 0.9.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/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/dist/appearance-CCOHF5L-.d.ts +19 -0
- package/dist/appearance.d.ts +2 -1
- package/dist/appearance.js +1 -1
- package/dist/branches-Dvdv5ug7.d.ts +398 -0
- package/dist/branches-M2XjURF5.js +539 -0
- package/dist/branches-M2XjURF5.js.map +1 -0
- package/dist/context.js +1 -1
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +2 -2
- package/dist/icons-CZZENm5N.d.ts +20 -0
- package/dist/index.d.ts +55 -3
- package/dist/index.js +874 -293
- package/dist/index.js.map +1 -1
- package/dist/styles.css +33 -0
- package/dist/{ui-primitives-BCbe9Ds8.js → ui-primitives-BzbdVU2_.js} +12 -2
- package/dist/ui-primitives-BzbdVU2_.js.map +1 -0
- package/docs/publishing.md +5 -5
- package/package.json +1 -1
- package/dist/appearance-BUtKwRL5.d.ts +0 -34
- package/dist/labels-BM5o9a9K.js +0 -116
- package/dist/labels-BM5o9a9K.js.map +0 -1
- package/dist/labels-a_-_yLBi.d.ts +0 -195
- package/dist/ui-primitives-BCbe9Ds8.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,344 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { i as
|
|
4
|
-
import { n as ChatAppearanceProvider, r as Icon, t as ChatIconButton } from "./ui-primitives-
|
|
3
|
+
import { a as filterSkills, c as slugifySkillName, d as resolveLabels, f as zhCN, i as filterMentions, l as useComposerTrigger, n as useChatBranches, o as parseSkillMarkdown, p as useAiChat, r as detectComposerTrigger, s as replaceComposerTrigger, t as projectChatBranches, u as enUS } from "./branches-M2XjURF5.js";
|
|
4
|
+
import { n as ChatAppearanceProvider, r as Icon, t as ChatIconButton } from "./ui-primitives-BzbdVU2_.js";
|
|
5
5
|
import { i as safeUrl, n as asError, r as getMessageText, t as acceptsFile } from "./utils-DqBGBYA1.js";
|
|
6
6
|
import { SpeechInputError, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
|
|
7
7
|
import { MarkdownResponse } from "./markdown.js";
|
|
8
8
|
import { ContextTray, createTextSelectionAdapter, useChatContext } from "./context.js";
|
|
9
9
|
import "./appearance.js";
|
|
10
10
|
import { ChatTargetingOverlay, enUSTargetingLabels, toChatContextItem, useChatTargeting, zhCNTargetingLabels } from "./targeting.js";
|
|
11
|
-
import { useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
11
|
+
import { useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { isToolUIPart } from "ai";
|
|
14
|
+
//#region src/composer-popovers.tsx
|
|
15
|
+
function ChatSlashMenu({ skills, activeIndex, onHighlight, onSelect, onAddSkill, onBrowseSkills, labels: overrides, className = "" }) {
|
|
16
|
+
const labels = resolveLabels(overrides);
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: `gc-chat__popover gc-chat__slash-menu ${className}`.trim(),
|
|
19
|
+
role: "listbox",
|
|
20
|
+
"aria-label": labels.skillsMenu,
|
|
21
|
+
children: [skills.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "gc-chat__popover-list",
|
|
23
|
+
children: skills.map((skill, index) => {
|
|
24
|
+
const active = index === activeIndex;
|
|
25
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
26
|
+
type: "button",
|
|
27
|
+
role: "option",
|
|
28
|
+
"aria-selected": active,
|
|
29
|
+
className: "gc-chat__popover-item",
|
|
30
|
+
"data-active": active || void 0,
|
|
31
|
+
onMouseEnter: () => onHighlight?.(index),
|
|
32
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
33
|
+
onClick: () => onSelect(skill),
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: "gc-chat__popover-icon",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
children: skill.icon ? /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "gc-chat__popover-emoji",
|
|
40
|
+
children: skill.icon
|
|
41
|
+
}) : /* @__PURE__ */ jsx(Icon, {
|
|
42
|
+
name: "sparkle",
|
|
43
|
+
width: 15,
|
|
44
|
+
height: 15
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsxs("span", {
|
|
48
|
+
className: "gc-chat__popover-copy",
|
|
49
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: "gc-chat__popover-label",
|
|
51
|
+
children: skill.name
|
|
52
|
+
}), skill.description ? /* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: "gc-chat__popover-desc",
|
|
54
|
+
children: skill.description
|
|
55
|
+
}) : null]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx("span", {
|
|
58
|
+
className: "gc-chat__popover-trailing",
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
61
|
+
name: "plus",
|
|
62
|
+
width: 14,
|
|
63
|
+
height: 14
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
}, skill.id);
|
|
68
|
+
})
|
|
69
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
70
|
+
className: "gc-chat__popover-empty",
|
|
71
|
+
children: labels.noMatchingSkills
|
|
72
|
+
}), onAddSkill || onBrowseSkills ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: "gc-chat__popover-divider",
|
|
74
|
+
role: "separator"
|
|
75
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
76
|
+
className: "gc-chat__popover-footer",
|
|
77
|
+
children: [onAddSkill ? /* @__PURE__ */ jsxs("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
className: "gc-chat__popover-item",
|
|
80
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
81
|
+
onClick: onAddSkill,
|
|
82
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: "gc-chat__popover-icon",
|
|
84
|
+
"aria-hidden": "true",
|
|
85
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
86
|
+
name: "plus",
|
|
87
|
+
width: 15,
|
|
88
|
+
height: 15
|
|
89
|
+
})
|
|
90
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
91
|
+
className: "gc-chat__popover-label",
|
|
92
|
+
children: labels.addSkill
|
|
93
|
+
})]
|
|
94
|
+
}) : null, onBrowseSkills ? /* @__PURE__ */ jsxs("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
className: "gc-chat__popover-item",
|
|
97
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
98
|
+
onClick: onBrowseSkills,
|
|
99
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
100
|
+
className: "gc-chat__popover-icon",
|
|
101
|
+
"aria-hidden": "true",
|
|
102
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
103
|
+
name: "compass",
|
|
104
|
+
width: 15,
|
|
105
|
+
height: 15
|
|
106
|
+
})
|
|
107
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
108
|
+
className: "gc-chat__popover-label",
|
|
109
|
+
children: labels.browseSkills
|
|
110
|
+
})]
|
|
111
|
+
}) : null]
|
|
112
|
+
})] }) : null]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function mentionIcon(kind) {
|
|
116
|
+
if (kind === "tab" || kind === "page") return "page";
|
|
117
|
+
if (kind === "image" || kind === "drawing" || kind === "region") return "scan";
|
|
118
|
+
if (kind === "table" || kind === "clause" || kind === "scope") return "layers";
|
|
119
|
+
if (kind === "query" || kind === "search") return "search";
|
|
120
|
+
if (kind === "patent" || kind === "document") return "file";
|
|
121
|
+
return "text";
|
|
122
|
+
}
|
|
123
|
+
function ChatMentionMenu({ items, activeIndex, onHighlight, onSelect, labels: overrides, className = "" }) {
|
|
124
|
+
const labels = resolveLabels(overrides);
|
|
125
|
+
const groups = [];
|
|
126
|
+
items.forEach((item, index) => {
|
|
127
|
+
const last = groups.at(-1);
|
|
128
|
+
if (last && last.name === item.group) last.entries.push({
|
|
129
|
+
item,
|
|
130
|
+
index
|
|
131
|
+
});
|
|
132
|
+
else groups.push({
|
|
133
|
+
name: item.group,
|
|
134
|
+
entries: [{
|
|
135
|
+
item,
|
|
136
|
+
index
|
|
137
|
+
}]
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
return /* @__PURE__ */ jsx("div", {
|
|
141
|
+
className: `gc-chat__popover gc-chat__mention-menu ${className}`.trim(),
|
|
142
|
+
role: "listbox",
|
|
143
|
+
"aria-label": labels.mentionMenu,
|
|
144
|
+
children: items.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
145
|
+
className: "gc-chat__popover-list",
|
|
146
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs("div", {
|
|
147
|
+
className: "gc-chat__popover-group",
|
|
148
|
+
children: [group.name ? /* @__PURE__ */ jsx("div", {
|
|
149
|
+
className: "gc-chat__popover-group-label",
|
|
150
|
+
children: group.name
|
|
151
|
+
}) : null, group.entries.map(({ item, index }) => {
|
|
152
|
+
const active = index === activeIndex;
|
|
153
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
154
|
+
type: "button",
|
|
155
|
+
role: "option",
|
|
156
|
+
"aria-selected": active,
|
|
157
|
+
disabled: item.disabled,
|
|
158
|
+
className: "gc-chat__popover-item",
|
|
159
|
+
"data-active": active || void 0,
|
|
160
|
+
onMouseEnter: () => onHighlight?.(index),
|
|
161
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
162
|
+
onClick: () => {
|
|
163
|
+
if (!item.disabled) onSelect(item);
|
|
164
|
+
},
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx("span", {
|
|
167
|
+
className: "gc-chat__popover-icon",
|
|
168
|
+
"aria-hidden": "true",
|
|
169
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
170
|
+
name: mentionIcon(item.kind),
|
|
171
|
+
width: 15,
|
|
172
|
+
height: 15
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsxs("span", {
|
|
176
|
+
className: "gc-chat__popover-copy",
|
|
177
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
178
|
+
className: "gc-chat__popover-label",
|
|
179
|
+
children: item.label
|
|
180
|
+
}), item.description ? /* @__PURE__ */ jsx("span", {
|
|
181
|
+
className: "gc-chat__popover-desc",
|
|
182
|
+
children: item.description
|
|
183
|
+
}) : null]
|
|
184
|
+
}),
|
|
185
|
+
item.badge ? /* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: "gc-chat__popover-badge",
|
|
187
|
+
children: item.badge
|
|
188
|
+
}) : null
|
|
189
|
+
]
|
|
190
|
+
}, item.id);
|
|
191
|
+
})]
|
|
192
|
+
}, group.name ?? `group-${groupIndex}`))
|
|
193
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
194
|
+
className: "gc-chat__popover-empty",
|
|
195
|
+
children: labels.noMatchingMentions
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function ChatPlusMenu({ open, onClose, actions, labels: overrides, className = "" }) {
|
|
200
|
+
const labels = resolveLabels(overrides);
|
|
201
|
+
const menuRef = useRef(null);
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (!open) return;
|
|
204
|
+
const onPointerDown = (event) => {
|
|
205
|
+
if (!menuRef.current?.contains(event.target)) onClose();
|
|
206
|
+
};
|
|
207
|
+
const onKeyDown = (event) => {
|
|
208
|
+
if (event.key === "Escape") {
|
|
209
|
+
event.preventDefault();
|
|
210
|
+
onClose();
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
214
|
+
document.addEventListener("keydown", onKeyDown);
|
|
215
|
+
return () => {
|
|
216
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
217
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
218
|
+
};
|
|
219
|
+
}, [open, onClose]);
|
|
220
|
+
if (!open || !actions.length) return null;
|
|
221
|
+
const sections = [];
|
|
222
|
+
for (const action of actions) {
|
|
223
|
+
const last = sections.at(-1);
|
|
224
|
+
if (last && last.name === action.section) last.items.push(action);
|
|
225
|
+
else sections.push({
|
|
226
|
+
name: action.section,
|
|
227
|
+
items: [action]
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return /* @__PURE__ */ jsx("div", {
|
|
231
|
+
ref: menuRef,
|
|
232
|
+
className: `gc-chat__popover gc-chat__plus-menu ${className}`.trim(),
|
|
233
|
+
role: "menu",
|
|
234
|
+
"aria-label": labels.plusMenu,
|
|
235
|
+
children: sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", {
|
|
236
|
+
className: "gc-chat__popover-group",
|
|
237
|
+
children: [sectionIndex > 0 ? /* @__PURE__ */ jsx("div", {
|
|
238
|
+
className: "gc-chat__popover-divider",
|
|
239
|
+
role: "separator"
|
|
240
|
+
}) : null, section.items.map((action) => {
|
|
241
|
+
if (action.trailing === "toggle") return /* @__PURE__ */ jsxs("button", {
|
|
242
|
+
type: "button",
|
|
243
|
+
role: "menuitemcheckbox",
|
|
244
|
+
"aria-checked": Boolean(action.checked),
|
|
245
|
+
disabled: action.disabled,
|
|
246
|
+
className: "gc-chat__popover-item",
|
|
247
|
+
onClick: () => action.onToggle?.(!action.checked),
|
|
248
|
+
children: [
|
|
249
|
+
action.icon ? /* @__PURE__ */ jsx("span", {
|
|
250
|
+
className: "gc-chat__popover-icon",
|
|
251
|
+
"aria-hidden": "true",
|
|
252
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
253
|
+
name: action.icon,
|
|
254
|
+
width: 15,
|
|
255
|
+
height: 15
|
|
256
|
+
})
|
|
257
|
+
}) : null,
|
|
258
|
+
/* @__PURE__ */ jsxs("span", {
|
|
259
|
+
className: "gc-chat__popover-copy",
|
|
260
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
261
|
+
className: "gc-chat__popover-label",
|
|
262
|
+
children: action.label
|
|
263
|
+
}), action.description ? /* @__PURE__ */ jsx("span", {
|
|
264
|
+
className: "gc-chat__popover-desc",
|
|
265
|
+
children: action.description
|
|
266
|
+
}) : null]
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ jsx("span", {
|
|
269
|
+
className: "gc-chat__toggle-track",
|
|
270
|
+
"data-checked": Boolean(action.checked) || void 0,
|
|
271
|
+
"aria-hidden": "true",
|
|
272
|
+
children: /* @__PURE__ */ jsx("span", { className: "gc-chat__toggle-thumb" })
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
}, action.id);
|
|
276
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
277
|
+
type: "button",
|
|
278
|
+
role: "menuitem",
|
|
279
|
+
disabled: action.disabled,
|
|
280
|
+
className: "gc-chat__popover-item",
|
|
281
|
+
onClick: () => {
|
|
282
|
+
action.onSelect?.();
|
|
283
|
+
onClose();
|
|
284
|
+
},
|
|
285
|
+
children: [
|
|
286
|
+
action.icon ? /* @__PURE__ */ jsx("span", {
|
|
287
|
+
className: "gc-chat__popover-icon",
|
|
288
|
+
"aria-hidden": "true",
|
|
289
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
290
|
+
name: action.icon,
|
|
291
|
+
width: 15,
|
|
292
|
+
height: 15
|
|
293
|
+
})
|
|
294
|
+
}) : null,
|
|
295
|
+
/* @__PURE__ */ jsxs("span", {
|
|
296
|
+
className: "gc-chat__popover-copy",
|
|
297
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
298
|
+
className: "gc-chat__popover-label",
|
|
299
|
+
children: [action.label, action.badge ? /* @__PURE__ */ jsx("span", {
|
|
300
|
+
className: "gc-chat__popover-badge",
|
|
301
|
+
children: action.badge
|
|
302
|
+
}) : null]
|
|
303
|
+
}), action.description ? /* @__PURE__ */ jsx("span", {
|
|
304
|
+
className: "gc-chat__popover-desc",
|
|
305
|
+
children: action.description
|
|
306
|
+
}) : null]
|
|
307
|
+
}),
|
|
308
|
+
action.trailing === "chevron" ? /* @__PURE__ */ jsx("span", {
|
|
309
|
+
className: "gc-chat__popover-trailing",
|
|
310
|
+
"aria-hidden": "true",
|
|
311
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
312
|
+
name: "chevron",
|
|
313
|
+
width: 14,
|
|
314
|
+
height: 14
|
|
315
|
+
})
|
|
316
|
+
}) : action.trailing === "check" && action.checked ? /* @__PURE__ */ jsx("span", {
|
|
317
|
+
className: "gc-chat__popover-trailing",
|
|
318
|
+
"aria-hidden": "true",
|
|
319
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
320
|
+
name: "check",
|
|
321
|
+
width: 14,
|
|
322
|
+
height: 14
|
|
323
|
+
})
|
|
324
|
+
}) : null
|
|
325
|
+
]
|
|
326
|
+
}, action.id);
|
|
327
|
+
})]
|
|
328
|
+
}, section.name ?? `sec-${sectionIndex}`))
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
14
332
|
//#region src/chat-composer.tsx
|
|
15
333
|
/** Drafts and upload requests are isolated by conversation id. */
|
|
16
334
|
function ChatComposer(props) {
|
|
17
335
|
return /* @__PURE__ */ jsx(Composer, { ...props }, props.chat.id);
|
|
18
336
|
}
|
|
19
|
-
function Composer({ chat, labels: overrides, attachments, speech, toolbar, context, requestOptions, disabled, className = "", onActionError }) {
|
|
337
|
+
function Composer({ chat, labels: overrides, attachments, speech, skills, onSelectSkill, onAddSkill, onBrowseSkills, mentions, onSelectMention, plusMenuActions, toolbar, context, requestOptions, disabled, className = "", onActionError }) {
|
|
20
338
|
const labels = resolveLabels(overrides);
|
|
21
339
|
const [text, setText] = useState("");
|
|
340
|
+
const [cursor, setCursor] = useState(0);
|
|
341
|
+
const [plusOpen, setPlusOpen] = useState(false);
|
|
22
342
|
const [files, setFiles] = useState([]);
|
|
23
343
|
const [error, setError] = useState();
|
|
24
344
|
const uploads = useRef(/* @__PURE__ */ new Map());
|
|
@@ -122,6 +442,61 @@ function Composer({ chat, labels: overrides, attachments, speech, toolbar, conte
|
|
|
122
442
|
}
|
|
123
443
|
const uploading = files.some((file) => !file.part);
|
|
124
444
|
const canSend = !disabled && !chat.isBusy && !voice.isActive && !uploading && files.length <= (attachments?.maxFiles ?? 5) && (text.trim().length > 0 || files.length > 0);
|
|
445
|
+
const enabledTriggers = useMemo(() => {
|
|
446
|
+
const list = [];
|
|
447
|
+
if (skills !== void 0 || onAddSkill || onBrowseSkills) list.push("/");
|
|
448
|
+
if (mentions !== void 0) list.push("@");
|
|
449
|
+
return list;
|
|
450
|
+
}, [
|
|
451
|
+
skills,
|
|
452
|
+
onAddSkill,
|
|
453
|
+
onBrowseSkills,
|
|
454
|
+
mentions
|
|
455
|
+
]);
|
|
456
|
+
const preliminary = useComposerTrigger({
|
|
457
|
+
value: text,
|
|
458
|
+
cursor,
|
|
459
|
+
triggers: enabledTriggers,
|
|
460
|
+
enabled: !disabled && !voice.isActive && enabledTriggers.length > 0,
|
|
461
|
+
itemCount: 0
|
|
462
|
+
});
|
|
463
|
+
const filteredSkills = useMemo(() => preliminary.match?.trigger === "/" ? filterSkills(skills ?? [], preliminary.match.query) : [], [preliminary.match, skills]);
|
|
464
|
+
const filteredMentions = useMemo(() => preliminary.match?.trigger === "@" ? filterMentions(mentions ?? [], preliminary.match.query) : [], [preliminary.match, mentions]);
|
|
465
|
+
function applyReplacement(match, replacement) {
|
|
466
|
+
const next = replaceComposerTrigger(text, match, replacement);
|
|
467
|
+
setText(next.value);
|
|
468
|
+
setCursor(next.cursor);
|
|
469
|
+
draft.current = next.value;
|
|
470
|
+
requestAnimationFrame(() => {
|
|
471
|
+
textarea.current?.focus();
|
|
472
|
+
textarea.current?.setSelectionRange(next.cursor, next.cursor);
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function commitSkill(skill, match) {
|
|
476
|
+
if (match) applyReplacement(match, onSelectSkill ? "" : `${skill.prompt}\n`);
|
|
477
|
+
onSelectSkill?.(skill);
|
|
478
|
+
}
|
|
479
|
+
function commitMention(item, match) {
|
|
480
|
+
if (match) applyReplacement(match, onSelectMention ? "" : `@${item.label} `);
|
|
481
|
+
onSelectMention?.(item);
|
|
482
|
+
}
|
|
483
|
+
const activeItemsCount = preliminary.match?.trigger === "/" ? filteredSkills.length : preliminary.match?.trigger === "@" ? filteredMentions.length : 0;
|
|
484
|
+
const trigger = useComposerTrigger({
|
|
485
|
+
value: text,
|
|
486
|
+
cursor,
|
|
487
|
+
triggers: enabledTriggers,
|
|
488
|
+
enabled: !disabled && !voice.isActive && enabledTriggers.length > 0,
|
|
489
|
+
itemCount: activeItemsCount,
|
|
490
|
+
onCommit: (index, match) => {
|
|
491
|
+
if (match.trigger === "/") {
|
|
492
|
+
const chosen = filteredSkills[index];
|
|
493
|
+
if (chosen) commitSkill(chosen, match);
|
|
494
|
+
} else {
|
|
495
|
+
const chosen = filteredMentions[index];
|
|
496
|
+
if (chosen && !chosen.disabled) commitMention(chosen, match);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
});
|
|
125
500
|
async function send() {
|
|
126
501
|
if (!canSend || sending.current) return;
|
|
127
502
|
sending.current = true;
|
|
@@ -149,225 +524,274 @@ function Composer({ chat, labels: overrides, attachments, speech, toolbar, conte
|
|
|
149
524
|
}
|
|
150
525
|
return /* @__PURE__ */ jsxs("div", {
|
|
151
526
|
className: "gc-chat__composer-wrap",
|
|
152
|
-
children: [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
527
|
+
children: [
|
|
528
|
+
trigger.open && trigger.match?.trigger === "/" ? /* @__PURE__ */ jsx(ChatSlashMenu, {
|
|
529
|
+
skills: filteredSkills,
|
|
530
|
+
activeIndex: trigger.activeIndex,
|
|
531
|
+
onHighlight: trigger.setActiveIndex,
|
|
532
|
+
onSelect: (skill) => commitSkill(skill, trigger.match),
|
|
533
|
+
onAddSkill: onAddSkill ? () => {
|
|
534
|
+
trigger.dismiss();
|
|
535
|
+
onAddSkill();
|
|
536
|
+
} : void 0,
|
|
537
|
+
onBrowseSkills: onBrowseSkills ? () => {
|
|
538
|
+
trigger.dismiss();
|
|
539
|
+
onBrowseSkills();
|
|
540
|
+
} : void 0,
|
|
541
|
+
labels: overrides
|
|
542
|
+
}) : null,
|
|
543
|
+
trigger.open && trigger.match?.trigger === "@" ? /* @__PURE__ */ jsx(ChatMentionMenu, {
|
|
544
|
+
items: filteredMentions,
|
|
545
|
+
activeIndex: trigger.activeIndex,
|
|
546
|
+
onHighlight: trigger.setActiveIndex,
|
|
547
|
+
onSelect: (item) => commitMention(item, trigger.match),
|
|
548
|
+
labels: overrides
|
|
549
|
+
}) : null,
|
|
550
|
+
plusMenuActions?.length ? /* @__PURE__ */ jsx(ChatPlusMenu, {
|
|
551
|
+
open: plusOpen,
|
|
552
|
+
onClose: () => setPlusOpen(false),
|
|
553
|
+
actions: plusMenuActions,
|
|
554
|
+
labels: overrides
|
|
555
|
+
}) : null,
|
|
556
|
+
context != null ? /* @__PURE__ */ jsx("div", {
|
|
557
|
+
className: "gc-chat__context",
|
|
558
|
+
children: context
|
|
559
|
+
}) : null,
|
|
560
|
+
/* @__PURE__ */ jsxs("form", {
|
|
561
|
+
className: `gc-chat__composer ${className}`,
|
|
562
|
+
onSubmit: (event) => {
|
|
166
563
|
event.preventDefault();
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
564
|
+
send();
|
|
565
|
+
},
|
|
566
|
+
onDragOver: (event) => {
|
|
567
|
+
if (attachments && !disabled) event.preventDefault();
|
|
568
|
+
},
|
|
569
|
+
onDrop: (event) => {
|
|
570
|
+
if (attachments && !disabled) {
|
|
571
|
+
event.preventDefault();
|
|
572
|
+
addFiles(Array.from(event.dataTransfer.files));
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
children: [
|
|
576
|
+
files.length ? /* @__PURE__ */ jsx("ul", {
|
|
577
|
+
className: "gc-chat__attachments",
|
|
578
|
+
"aria-label": labels.attach,
|
|
579
|
+
children: files.map((file) => /* @__PURE__ */ jsxs("li", {
|
|
580
|
+
className: "gc-chat__attachment",
|
|
581
|
+
children: [
|
|
582
|
+
/* @__PURE__ */ jsx(Icon, { name: "file" }),
|
|
583
|
+
/* @__PURE__ */ jsx("span", { children: file.name }),
|
|
584
|
+
!file.part ? /* @__PURE__ */ jsx("span", {
|
|
585
|
+
role: "status",
|
|
586
|
+
children: labels.uploading
|
|
587
|
+
}) : null,
|
|
588
|
+
/* @__PURE__ */ jsx(ChatIconButton, {
|
|
589
|
+
label: `${labels.removeAttachment}: ${file.name}`,
|
|
590
|
+
icon: "close",
|
|
591
|
+
onClick: () => removeFile(file.id)
|
|
592
|
+
})
|
|
593
|
+
]
|
|
594
|
+
}, file.id))
|
|
595
|
+
}) : null,
|
|
596
|
+
speech && voice.state === "consent" && /* @__PURE__ */ jsxs("div", {
|
|
597
|
+
className: "gc-chat__voice-consent",
|
|
598
|
+
role: "group",
|
|
599
|
+
"aria-label": voiceLabels.consentTitle,
|
|
176
600
|
children: [
|
|
177
|
-
/* @__PURE__ */ jsx(
|
|
178
|
-
/* @__PURE__ */ jsx("
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
601
|
+
/* @__PURE__ */ jsx("strong", { children: voiceLabels.consentTitle }),
|
|
602
|
+
/* @__PURE__ */ jsx("p", {
|
|
603
|
+
className: "gc-chat__voice-disclosure",
|
|
604
|
+
children: voice.disclosure
|
|
605
|
+
}),
|
|
606
|
+
/* @__PURE__ */ jsxs("label", {
|
|
607
|
+
className: "gc-chat__voice-remember",
|
|
608
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
609
|
+
type: "checkbox",
|
|
610
|
+
checked: rememberSpeech,
|
|
611
|
+
onChange: (event) => setRememberSpeech(event.target.checked)
|
|
612
|
+
}), voiceLabels.remember]
|
|
613
|
+
}),
|
|
614
|
+
/* @__PURE__ */ jsxs("div", {
|
|
615
|
+
className: "gc-chat__voice-actions",
|
|
616
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
617
|
+
type: "button",
|
|
618
|
+
className: "gc-chat__button",
|
|
619
|
+
disabled: disabled || chat.isBusy,
|
|
620
|
+
onClick: () => voice.confirm(rememberSpeech),
|
|
621
|
+
children: voiceLabels.confirm
|
|
622
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
623
|
+
type: "button",
|
|
624
|
+
className: "gc-chat__button",
|
|
625
|
+
onClick: voice.cancel,
|
|
626
|
+
children: voiceLabels.cancel
|
|
627
|
+
})]
|
|
187
628
|
})
|
|
188
629
|
]
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
role: "group",
|
|
194
|
-
"aria-label": voiceLabels.consentTitle,
|
|
195
|
-
children: [
|
|
196
|
-
/* @__PURE__ */ jsx("strong", { children: voiceLabels.consentTitle }),
|
|
197
|
-
/* @__PURE__ */ jsx("p", {
|
|
198
|
-
className: "gc-chat__voice-disclosure",
|
|
199
|
-
children: voice.disclosure
|
|
200
|
-
}),
|
|
201
|
-
/* @__PURE__ */ jsxs("label", {
|
|
202
|
-
className: "gc-chat__voice-remember",
|
|
203
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
204
|
-
type: "checkbox",
|
|
205
|
-
checked: rememberSpeech,
|
|
206
|
-
onChange: (event) => setRememberSpeech(event.target.checked)
|
|
207
|
-
}), voiceLabels.remember]
|
|
208
|
-
}),
|
|
209
|
-
/* @__PURE__ */ jsxs("div", {
|
|
210
|
-
className: "gc-chat__voice-actions",
|
|
211
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
212
|
-
type: "button",
|
|
213
|
-
className: "gc-chat__button",
|
|
214
|
-
disabled: disabled || chat.isBusy,
|
|
215
|
-
onClick: () => voice.confirm(rememberSpeech),
|
|
216
|
-
children: voiceLabels.confirm
|
|
217
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
218
|
-
type: "button",
|
|
219
|
-
className: "gc-chat__button",
|
|
220
|
-
onClick: voice.cancel,
|
|
221
|
-
children: voiceLabels.cancel
|
|
222
|
-
})]
|
|
223
|
-
})
|
|
224
|
-
]
|
|
225
|
-
}),
|
|
226
|
-
speech && voice.isActive && /* @__PURE__ */ jsxs("div", {
|
|
227
|
-
className: "gc-chat__voice",
|
|
228
|
-
"data-state": voice.state,
|
|
229
|
-
children: [
|
|
230
|
-
/* @__PURE__ */ jsxs("span", {
|
|
231
|
-
className: "gc-chat__voice-wave",
|
|
232
|
-
"aria-hidden": "true",
|
|
233
|
-
children: [
|
|
234
|
-
/* @__PURE__ */ jsx("i", {}),
|
|
235
|
-
/* @__PURE__ */ jsx("i", {}),
|
|
236
|
-
/* @__PURE__ */ jsx("i", {}),
|
|
237
|
-
/* @__PURE__ */ jsx("i", {}),
|
|
238
|
-
/* @__PURE__ */ jsx("i", {})
|
|
239
|
-
]
|
|
240
|
-
}),
|
|
241
|
-
/* @__PURE__ */ jsx("span", {
|
|
242
|
-
className: "gc-chat__voice-status",
|
|
243
|
-
role: "status",
|
|
244
|
-
children: voice.state === "starting" ? voiceLabels.starting : voice.state === "stopping" ? voiceLabels.stopping : voiceLabels.listening
|
|
245
|
-
}),
|
|
246
|
-
/* @__PURE__ */ jsxs("div", {
|
|
247
|
-
className: "gc-chat__voice-actions",
|
|
248
|
-
children: [/* @__PURE__ */ jsx(ChatIconButton, {
|
|
249
|
-
disabled: voice.state === "stopping",
|
|
250
|
-
label: voiceLabels.finish,
|
|
251
|
-
icon: "check",
|
|
252
|
-
onClick: voice.stop
|
|
253
|
-
}), /* @__PURE__ */ jsx(ChatIconButton, {
|
|
254
|
-
label: voiceLabels.cancel,
|
|
255
|
-
icon: "close",
|
|
256
|
-
onClick: voice.cancel
|
|
257
|
-
})]
|
|
258
|
-
}),
|
|
259
|
-
/* @__PURE__ */ jsxs("p", {
|
|
260
|
-
className: "gc-chat__voice-transcript",
|
|
261
|
-
children: [
|
|
262
|
-
voice.result.finalText,
|
|
263
|
-
/* @__PURE__ */ jsx("span", { children: voice.result.interimText }),
|
|
264
|
-
!voice.result.finalText && !voice.result.interimText ? voiceLabels.empty : null
|
|
265
|
-
]
|
|
266
|
-
})
|
|
267
|
-
]
|
|
268
|
-
}),
|
|
269
|
-
speech && !voice.support.supported && /* @__PURE__ */ jsx("p", {
|
|
270
|
-
id: `${inputId}-voice-support`,
|
|
271
|
-
className: "gc-chat__voice-unsupported",
|
|
272
|
-
children: voice.support.reason
|
|
273
|
-
}),
|
|
274
|
-
speech && voice.error && /* @__PURE__ */ jsx("p", {
|
|
275
|
-
className: "gc-chat__voice-error",
|
|
276
|
-
role: "alert",
|
|
277
|
-
children: voice.error.message
|
|
278
|
-
}),
|
|
279
|
-
/* @__PURE__ */ jsx("textarea", {
|
|
280
|
-
ref: textarea,
|
|
281
|
-
className: "gc-chat__input",
|
|
282
|
-
"aria-label": labels.placeholder,
|
|
283
|
-
placeholder: labels.placeholder,
|
|
284
|
-
value: text,
|
|
285
|
-
rows: 2,
|
|
286
|
-
disabled,
|
|
287
|
-
onChange: (event) => setText(event.target.value),
|
|
288
|
-
onPaste: (event) => {
|
|
289
|
-
if (attachments && event.clipboardData.files.length) {
|
|
290
|
-
event.preventDefault();
|
|
291
|
-
addFiles(Array.from(event.clipboardData.files));
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
onKeyDown: (event) => {
|
|
295
|
-
if (event.key === "Escape" && !event.nativeEvent.isComposing && event.keyCode !== 229) {
|
|
296
|
-
event.currentTarget.blur();
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing && event.keyCode !== 229) {
|
|
300
|
-
event.preventDefault();
|
|
301
|
-
send();
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}),
|
|
305
|
-
/* @__PURE__ */ jsxs("div", {
|
|
306
|
-
className: "gc-chat__composer-bottom",
|
|
307
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
308
|
-
className: "gc-chat__toolbar",
|
|
630
|
+
}),
|
|
631
|
+
speech && voice.isActive && /* @__PURE__ */ jsxs("div", {
|
|
632
|
+
className: "gc-chat__voice",
|
|
633
|
+
"data-state": voice.state,
|
|
309
634
|
children: [
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
635
|
+
/* @__PURE__ */ jsxs("span", {
|
|
636
|
+
className: "gc-chat__voice-wave",
|
|
637
|
+
"aria-hidden": "true",
|
|
638
|
+
children: [
|
|
639
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
640
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
641
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
642
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
643
|
+
/* @__PURE__ */ jsx("i", {})
|
|
644
|
+
]
|
|
645
|
+
}),
|
|
646
|
+
/* @__PURE__ */ jsx("span", {
|
|
647
|
+
className: "gc-chat__voice-status",
|
|
648
|
+
role: "status",
|
|
649
|
+
children: voice.state === "starting" ? voiceLabels.starting : voice.state === "stopping" ? voiceLabels.stopping : voiceLabels.listening
|
|
650
|
+
}),
|
|
651
|
+
/* @__PURE__ */ jsxs("div", {
|
|
652
|
+
className: "gc-chat__voice-actions",
|
|
653
|
+
children: [/* @__PURE__ */ jsx(ChatIconButton, {
|
|
654
|
+
disabled: voice.state === "stopping",
|
|
655
|
+
label: voiceLabels.finish,
|
|
656
|
+
icon: "check",
|
|
657
|
+
onClick: voice.stop
|
|
658
|
+
}), /* @__PURE__ */ jsx(ChatIconButton, {
|
|
659
|
+
label: voiceLabels.cancel,
|
|
660
|
+
icon: "close",
|
|
661
|
+
onClick: voice.cancel
|
|
662
|
+
})]
|
|
663
|
+
}),
|
|
664
|
+
/* @__PURE__ */ jsxs("p", {
|
|
665
|
+
className: "gc-chat__voice-transcript",
|
|
666
|
+
children: [
|
|
667
|
+
voice.result.finalText,
|
|
668
|
+
/* @__PURE__ */ jsx("span", { children: voice.result.interimText }),
|
|
669
|
+
!voice.result.finalText && !voice.result.interimText ? voiceLabels.empty : null
|
|
670
|
+
]
|
|
332
671
|
})
|
|
333
672
|
]
|
|
334
|
-
}),
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
673
|
+
}),
|
|
674
|
+
speech && !voice.support.supported && /* @__PURE__ */ jsx("p", {
|
|
675
|
+
id: `${inputId}-voice-support`,
|
|
676
|
+
className: "gc-chat__voice-unsupported",
|
|
677
|
+
children: voice.support.reason
|
|
678
|
+
}),
|
|
679
|
+
speech && voice.error && /* @__PURE__ */ jsx("p", {
|
|
680
|
+
className: "gc-chat__voice-error",
|
|
681
|
+
role: "alert",
|
|
682
|
+
children: voice.error.message
|
|
683
|
+
}),
|
|
684
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
685
|
+
ref: textarea,
|
|
686
|
+
className: "gc-chat__input",
|
|
687
|
+
"aria-label": labels.placeholder,
|
|
688
|
+
placeholder: labels.placeholder,
|
|
689
|
+
value: text,
|
|
690
|
+
rows: 2,
|
|
691
|
+
disabled,
|
|
692
|
+
onChange: (event) => {
|
|
693
|
+
setText(event.target.value);
|
|
694
|
+
setCursor(event.target.selectionStart ?? event.target.value.length);
|
|
695
|
+
},
|
|
696
|
+
onSelect: (event) => setCursor(event.currentTarget.selectionStart ?? text.length),
|
|
697
|
+
onClick: (event) => setCursor(event.currentTarget.selectionStart ?? text.length),
|
|
698
|
+
onPaste: (event) => {
|
|
699
|
+
if (attachments && event.clipboardData.files.length) {
|
|
700
|
+
event.preventDefault();
|
|
701
|
+
addFiles(Array.from(event.clipboardData.files));
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
onKeyDown: (event) => {
|
|
705
|
+
if (trigger.handleKeyDown(event)) return;
|
|
706
|
+
if (event.key === "Escape" && !event.nativeEvent.isComposing && event.keyCode !== 229) {
|
|
707
|
+
if (plusOpen) {
|
|
708
|
+
setPlusOpen(false);
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
event.currentTarget.blur();
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing && event.keyCode !== 229) {
|
|
348
715
|
event.preventDefault();
|
|
349
|
-
|
|
716
|
+
send();
|
|
350
717
|
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
718
|
+
}
|
|
719
|
+
}),
|
|
720
|
+
/* @__PURE__ */ jsxs("div", {
|
|
721
|
+
className: "gc-chat__composer-bottom",
|
|
722
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
723
|
+
className: "gc-chat__toolbar",
|
|
724
|
+
children: [
|
|
725
|
+
attachments ? /* @__PURE__ */ jsx("input", {
|
|
726
|
+
ref: fileInput,
|
|
727
|
+
id: inputId,
|
|
728
|
+
type: "file",
|
|
729
|
+
hidden: true,
|
|
730
|
+
multiple: true,
|
|
731
|
+
accept: attachments.accept,
|
|
732
|
+
disabled,
|
|
733
|
+
onChange: (event) => {
|
|
734
|
+
addFiles(Array.from(event.target.files ?? []));
|
|
735
|
+
event.target.value = "";
|
|
736
|
+
}
|
|
737
|
+
}) : null,
|
|
738
|
+
plusMenuActions?.length ? /* @__PURE__ */ jsx(ChatIconButton, {
|
|
739
|
+
disabled,
|
|
740
|
+
label: labels.plusMenu,
|
|
741
|
+
icon: plusOpen ? "close" : "plus",
|
|
742
|
+
"aria-expanded": plusOpen,
|
|
743
|
+
"aria-haspopup": "menu",
|
|
744
|
+
onClick: () => setPlusOpen((current) => !current)
|
|
745
|
+
}) : attachments ? /* @__PURE__ */ jsx(ChatIconButton, {
|
|
746
|
+
disabled,
|
|
747
|
+
label: labels.attach,
|
|
748
|
+
icon: "plus",
|
|
749
|
+
onClick: () => fileInput.current?.click()
|
|
750
|
+
}) : null,
|
|
751
|
+
toolbar,
|
|
752
|
+
!attachments && !speech && toolbar == null && /* @__PURE__ */ jsx("span", {
|
|
753
|
+
className: "gc-chat__input-hint",
|
|
754
|
+
children: labels.composerHint
|
|
755
|
+
})
|
|
756
|
+
]
|
|
757
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
758
|
+
className: "gc-chat__composer-actions",
|
|
759
|
+
children: [speech && /* @__PURE__ */ jsx(ChatIconButton, {
|
|
760
|
+
label: voiceLabels.start,
|
|
761
|
+
icon: "mic",
|
|
762
|
+
tooltip: voice.support.reason ?? voiceLabels.start,
|
|
763
|
+
"aria-describedby": !voice.support.supported ? `${inputId}-voice-support` : void 0,
|
|
764
|
+
disabled: disabled || chat.isBusy || voice.isActive || voice.state === "consent" || !voice.support.supported,
|
|
765
|
+
onClick: voice.start
|
|
766
|
+
}), chat.isBusy ? /* @__PURE__ */ jsx(ChatIconButton, {
|
|
767
|
+
className: "gc-chat__send",
|
|
768
|
+
label: labels.stop,
|
|
769
|
+
icon: "stop",
|
|
770
|
+
onClick: (event) => {
|
|
771
|
+
event.preventDefault();
|
|
772
|
+
chat.stop().catch(report);
|
|
773
|
+
}
|
|
774
|
+
}) : /* @__PURE__ */ jsx(ChatIconButton, {
|
|
775
|
+
className: "gc-chat__send",
|
|
776
|
+
type: "submit",
|
|
777
|
+
disabled: !canSend,
|
|
778
|
+
label: labels.send,
|
|
779
|
+
icon: "send"
|
|
780
|
+
})]
|
|
357
781
|
})]
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
782
|
+
}),
|
|
783
|
+
error ? /* @__PURE__ */ jsxs("div", {
|
|
784
|
+
className: "gc-chat__error",
|
|
785
|
+
role: "alert",
|
|
786
|
+
children: [error, /* @__PURE__ */ jsx(ChatIconButton, {
|
|
787
|
+
label: labels.dismiss,
|
|
788
|
+
icon: "close",
|
|
789
|
+
onClick: () => setError(void 0)
|
|
790
|
+
})]
|
|
791
|
+
}) : null
|
|
792
|
+
]
|
|
793
|
+
})
|
|
794
|
+
]
|
|
371
795
|
});
|
|
372
796
|
}
|
|
373
797
|
function fitTextarea(element) {
|
|
@@ -375,6 +799,76 @@ function fitTextarea(element) {
|
|
|
375
799
|
element.style.height = `${Math.min(Math.max(element.getBoundingClientRect().height, element.scrollHeight), 180)}px`;
|
|
376
800
|
}
|
|
377
801
|
//#endregion
|
|
802
|
+
//#region src/branch-switcher.tsx
|
|
803
|
+
function formatPosition(template, index, count) {
|
|
804
|
+
return template.replace("{current}", String(index)).replace("{total}", String(count));
|
|
805
|
+
}
|
|
806
|
+
/** Compact `< 2 / 3 >` sibling-branch navigation control. */
|
|
807
|
+
function ChatBranchSwitcher({ branch, onSelect, disabled = false, labels: overrides, className }) {
|
|
808
|
+
if (branch.count <= 1) return null;
|
|
809
|
+
const labels = resolveLabels(overrides);
|
|
810
|
+
const status = formatPosition(labels.branchPosition, branch.index, branch.count);
|
|
811
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
812
|
+
className: ["gc-chat__branch-switcher", className].filter(Boolean).join(" "),
|
|
813
|
+
role: "group",
|
|
814
|
+
"aria-label": status,
|
|
815
|
+
children: [
|
|
816
|
+
/* @__PURE__ */ jsx(ChatIconButton, {
|
|
817
|
+
size: "sm",
|
|
818
|
+
icon: "chevronLeft",
|
|
819
|
+
label: labels.previousBranch,
|
|
820
|
+
disabled: disabled || !branch.prevId,
|
|
821
|
+
onClick: () => {
|
|
822
|
+
if (branch.prevId) onSelect(branch.prevId);
|
|
823
|
+
}
|
|
824
|
+
}),
|
|
825
|
+
/* @__PURE__ */ jsxs("span", {
|
|
826
|
+
className: "gc-chat__branch-count",
|
|
827
|
+
"aria-live": "polite",
|
|
828
|
+
children: [
|
|
829
|
+
branch.index,
|
|
830
|
+
"/",
|
|
831
|
+
branch.count
|
|
832
|
+
]
|
|
833
|
+
}),
|
|
834
|
+
/* @__PURE__ */ jsx(ChatIconButton, {
|
|
835
|
+
size: "sm",
|
|
836
|
+
icon: "chevron",
|
|
837
|
+
label: labels.nextBranch,
|
|
838
|
+
disabled: disabled || !branch.nextId,
|
|
839
|
+
onClick: () => {
|
|
840
|
+
if (branch.nextId) onSelect(branch.nextId);
|
|
841
|
+
}
|
|
842
|
+
})
|
|
843
|
+
]
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
/** Cursor-style checkpoint status bar shown when reverted before a message, with one-click Restore. */
|
|
847
|
+
function ChatCheckpointBanner({ message, onRestore, restoreLabel, disabled = false, labels: overrides, className }) {
|
|
848
|
+
const labels = resolveLabels(overrides);
|
|
849
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
850
|
+
className: ["gc-chat__checkpoint-banner", className].filter(Boolean).join(" "),
|
|
851
|
+
role: "status",
|
|
852
|
+
children: [
|
|
853
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
854
|
+
name: "undo",
|
|
855
|
+
className: "gc-chat__checkpoint-icon"
|
|
856
|
+
}),
|
|
857
|
+
/* @__PURE__ */ jsx("span", {
|
|
858
|
+
className: "gc-chat__checkpoint-text",
|
|
859
|
+
children: message ?? labels.revertedBanner
|
|
860
|
+
}),
|
|
861
|
+
onRestore && /* @__PURE__ */ jsx("button", {
|
|
862
|
+
type: "button",
|
|
863
|
+
className: "gc-chat__checkpoint-restore",
|
|
864
|
+
disabled,
|
|
865
|
+
onClick: onRestore,
|
|
866
|
+
children: restoreLabel ?? labels.restoreBranch
|
|
867
|
+
})
|
|
868
|
+
]
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
//#endregion
|
|
378
872
|
//#region src/tool-activity.tsx
|
|
379
873
|
function readableValue(value) {
|
|
380
874
|
if (typeof value === "string") return value;
|
|
@@ -839,7 +1333,7 @@ function StreamingText({ text, isStreaming, enabled = true, renderText }) {
|
|
|
839
1333
|
function ChatMessages(props) {
|
|
840
1334
|
return /* @__PURE__ */ jsx(Messages, { ...props }, props.chat.id);
|
|
841
1335
|
}
|
|
842
|
-
function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming = true, scrollRef, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, className, requestOptions, onActionError, capabilities }) {
|
|
1336
|
+
function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming = true, scrollRef, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderUserMessageFooter, branches, onSelectBranch, onRevertMessage, onBranchMessage, renderMessageHeader, empty, className, requestOptions, onActionError, capabilities }) {
|
|
843
1337
|
const labels = resolveLabels(labelOverrides);
|
|
844
1338
|
const { scroller, content, awayFromBottom, scrollToLatest, reveal, scrollEvents } = useMessageScroll(chat.messages);
|
|
845
1339
|
useImperativeHandle(scrollRef, () => ({ reveal }), [reveal]);
|
|
@@ -883,6 +1377,44 @@ function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming =
|
|
|
883
1377
|
setActionPending(false);
|
|
884
1378
|
}
|
|
885
1379
|
}
|
|
1380
|
+
async function revertMessage(message) {
|
|
1381
|
+
if (chat.isBusy || actionInFlight.current || !onRevertMessage) return;
|
|
1382
|
+
setActionError(void 0);
|
|
1383
|
+
try {
|
|
1384
|
+
const pending = onRevertMessage(message);
|
|
1385
|
+
if (pending && typeof pending === "object" && "then" in pending) {
|
|
1386
|
+
actionInFlight.current = true;
|
|
1387
|
+
setActionPending(true);
|
|
1388
|
+
await pending;
|
|
1389
|
+
}
|
|
1390
|
+
} catch (cause) {
|
|
1391
|
+
reportError(cause);
|
|
1392
|
+
} finally {
|
|
1393
|
+
if (actionInFlight.current) {
|
|
1394
|
+
actionInFlight.current = false;
|
|
1395
|
+
setActionPending(false);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
async function branchMessage(message) {
|
|
1400
|
+
if (chat.isBusy || actionInFlight.current || !onBranchMessage) return;
|
|
1401
|
+
setActionError(void 0);
|
|
1402
|
+
try {
|
|
1403
|
+
const pending = onBranchMessage(message);
|
|
1404
|
+
if (pending && typeof pending === "object" && "then" in pending) {
|
|
1405
|
+
actionInFlight.current = true;
|
|
1406
|
+
setActionPending(true);
|
|
1407
|
+
await pending;
|
|
1408
|
+
}
|
|
1409
|
+
} catch (cause) {
|
|
1410
|
+
reportError(cause);
|
|
1411
|
+
} finally {
|
|
1412
|
+
if (actionInFlight.current) {
|
|
1413
|
+
actionInFlight.current = false;
|
|
1414
|
+
setActionPending(false);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
886
1418
|
function focusComposer() {
|
|
887
1419
|
content.current?.closest(".gc-chat")?.querySelector(".gc-chat__input")?.focus();
|
|
888
1420
|
}
|
|
@@ -1057,87 +1589,131 @@ function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming =
|
|
|
1057
1589
|
/* @__PURE__ */ jsx("p", { children: labels.emptyDescription })
|
|
1058
1590
|
]
|
|
1059
1591
|
})),
|
|
1060
|
-
visibleMessages.map((message) =>
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
message.role
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
children:
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
"
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1592
|
+
visibleMessages.map((message) => {
|
|
1593
|
+
const branch = branches?.[message.id];
|
|
1594
|
+
const hasBranchSwitcher = Boolean(branch && branch.count > 1 && onSelectBranch);
|
|
1595
|
+
return /* @__PURE__ */ jsxs("article", {
|
|
1596
|
+
className: `gc-chat__message gc-chat__message--${message.role}`,
|
|
1597
|
+
"aria-label": message.role === "user" ? labels.user : labels.assistant,
|
|
1598
|
+
children: [
|
|
1599
|
+
message.role === "assistant" && (renderMessageHeader ? renderMessageHeader({
|
|
1600
|
+
message,
|
|
1601
|
+
isStreaming: chat.status === "streaming" && message === last,
|
|
1602
|
+
chat
|
|
1603
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
1604
|
+
className: "gc-chat__message-heading",
|
|
1605
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1606
|
+
className: "gc-chat__assistant-mark",
|
|
1607
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "sparkle" })
|
|
1608
|
+
}), /* @__PURE__ */ jsx("strong", {
|
|
1609
|
+
className: "gc-chat__assistant-name",
|
|
1610
|
+
children: labels.assistant
|
|
1611
|
+
})]
|
|
1612
|
+
})),
|
|
1613
|
+
/* @__PURE__ */ jsx("div", {
|
|
1614
|
+
className: "gc-chat__message-body",
|
|
1615
|
+
children: message.parts.map((part, partIndex) => /* @__PURE__ */ jsx("div", {
|
|
1616
|
+
className: "gc-chat__part",
|
|
1617
|
+
"data-part": isToolUIPart(part) ? "tool" : part.type,
|
|
1618
|
+
children: renderPart(part, message, chat.status === "streaming" && message === last)
|
|
1619
|
+
}, isToolUIPart(part) ? `tool-${part.toolCallId}` : `${part.type}-${partIndex}`))
|
|
1620
|
+
}),
|
|
1621
|
+
message.role === "user" && (renderUserMessageFooter ? renderUserMessageFooter({
|
|
1622
|
+
message,
|
|
1623
|
+
chat,
|
|
1624
|
+
focusComposer
|
|
1625
|
+
}) : (hasBranchSwitcher || onRevertMessage) && /* @__PURE__ */ jsx("div", {
|
|
1626
|
+
className: "gc-chat__message-footer gc-chat__message-footer--user",
|
|
1627
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1628
|
+
className: "gc-chat__message-actions",
|
|
1629
|
+
role: "group",
|
|
1630
|
+
"aria-label": labels.user,
|
|
1631
|
+
children: [hasBranchSwitcher && /* @__PURE__ */ jsx(ChatBranchSwitcher, {
|
|
1632
|
+
branch,
|
|
1633
|
+
onSelect: onSelectBranch,
|
|
1634
|
+
disabled: chat.isBusy || actionPending,
|
|
1635
|
+
labels: labelOverrides
|
|
1636
|
+
}), onRevertMessage && /* @__PURE__ */ jsx(ChatIconButton, {
|
|
1637
|
+
size: "sm",
|
|
1638
|
+
label: labels.revert,
|
|
1639
|
+
icon: "undo",
|
|
1640
|
+
disabled: chat.isBusy || actionPending,
|
|
1641
|
+
onClick: () => void revertMessage(message)
|
|
1642
|
+
})]
|
|
1643
|
+
})
|
|
1644
|
+
})),
|
|
1645
|
+
message === last && message.role === "assistant" && !chat.isBusy && /* @__PURE__ */ jsxs(Fragment, { children: [actions.length > 0 && /* @__PURE__ */ jsxs("section", {
|
|
1646
|
+
className: "gc-chat__suggestions",
|
|
1647
|
+
"aria-label": labels.suggestions ?? "Suggested next steps",
|
|
1648
|
+
"aria-busy": pendingSuggestion !== void 0,
|
|
1649
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1650
|
+
className: "gc-chat__suggestions-heading",
|
|
1651
|
+
children: [/* @__PURE__ */ jsx("h3", { children: suggestionsTitle ?? labels.suggestions ?? "Suggested next steps" }), suggestionsDescription != null && /* @__PURE__ */ jsx("span", {
|
|
1652
|
+
className: "gc-chat__suggestions-reason",
|
|
1653
|
+
children: suggestionsDescription
|
|
1654
|
+
})]
|
|
1655
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1656
|
+
className: "gc-chat__suggestions-actions",
|
|
1657
|
+
children: actions.map((action, index) => /* @__PURE__ */ jsxs("button", {
|
|
1658
|
+
type: "button",
|
|
1659
|
+
className: "gc-chat__suggestion",
|
|
1660
|
+
"data-emphasis": action.emphasis === "recommended" && index !== recommendedIndex ? "secondary" : action.emphasis ?? "secondary",
|
|
1661
|
+
"data-pending": pendingSuggestion === action.id || void 0,
|
|
1662
|
+
disabled: actionPending || action.disabled,
|
|
1663
|
+
onClick: () => void selectSuggestion(action, message),
|
|
1664
|
+
children: [
|
|
1665
|
+
action.icon,
|
|
1666
|
+
pendingSuggestion === action.id ? action.pendingLabel ?? action.label : action.label,
|
|
1667
|
+
action.trailingIcon
|
|
1668
|
+
]
|
|
1669
|
+
}, action.id))
|
|
1095
1670
|
})]
|
|
1096
|
-
}),
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1671
|
+
}), renderMessageActions?.({
|
|
1672
|
+
message,
|
|
1673
|
+
chat,
|
|
1674
|
+
focusComposer
|
|
1675
|
+
})] }),
|
|
1676
|
+
message.role === "assistant" && /* @__PURE__ */ jsx("div", {
|
|
1677
|
+
className: "gc-chat__message-footer",
|
|
1678
|
+
children: showThinking && message === last ? thinking : /* @__PURE__ */ jsxs("div", {
|
|
1679
|
+
className: "gc-chat__message-actions",
|
|
1680
|
+
role: "group",
|
|
1681
|
+
"aria-label": labels.assistant,
|
|
1105
1682
|
children: [
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1683
|
+
hasBranchSwitcher && /* @__PURE__ */ jsx(ChatBranchSwitcher, {
|
|
1684
|
+
branch,
|
|
1685
|
+
onSelect: onSelectBranch,
|
|
1686
|
+
disabled: chat.isBusy || actionPending,
|
|
1687
|
+
labels: labelOverrides
|
|
1688
|
+
}),
|
|
1689
|
+
getMessageText(message) && /* @__PURE__ */ jsx(ChatIconButton, {
|
|
1690
|
+
size: "sm",
|
|
1691
|
+
label: copiedId === message.id ? labels.copied : labels.copy,
|
|
1692
|
+
icon: copiedId === message.id ? "check" : "copy",
|
|
1693
|
+
"data-copied": copiedId === message.id || void 0,
|
|
1694
|
+
disabled: chat.isBusy && message === last,
|
|
1695
|
+
onClick: () => void copy(message)
|
|
1696
|
+
}),
|
|
1697
|
+
onBranchMessage && /* @__PURE__ */ jsx(ChatIconButton, {
|
|
1698
|
+
size: "sm",
|
|
1699
|
+
label: labels.branch,
|
|
1700
|
+
icon: "branch",
|
|
1701
|
+
disabled: chat.isBusy || actionPending,
|
|
1702
|
+
onClick: () => void branchMessage(message)
|
|
1703
|
+
}),
|
|
1704
|
+
message === last && capabilities?.regenerate !== false && /* @__PURE__ */ jsx(ChatIconButton, {
|
|
1705
|
+
size: "sm",
|
|
1706
|
+
label: labels.regenerate,
|
|
1707
|
+
icon: "refresh",
|
|
1708
|
+
disabled: chat.isBusy || actionPending,
|
|
1709
|
+
onClick: () => void regenerate(message)
|
|
1710
|
+
})
|
|
1109
1711
|
]
|
|
1110
|
-
}
|
|
1111
|
-
})]
|
|
1112
|
-
}), renderMessageActions?.({
|
|
1113
|
-
message,
|
|
1114
|
-
chat,
|
|
1115
|
-
focusComposer
|
|
1116
|
-
})] }),
|
|
1117
|
-
message.role === "assistant" && /* @__PURE__ */ jsx("div", {
|
|
1118
|
-
className: "gc-chat__message-footer",
|
|
1119
|
-
children: showThinking && message === last ? thinking : /* @__PURE__ */ jsxs("div", {
|
|
1120
|
-
className: "gc-chat__message-actions",
|
|
1121
|
-
role: "group",
|
|
1122
|
-
"aria-label": labels.assistant,
|
|
1123
|
-
children: [getMessageText(message) && /* @__PURE__ */ jsx(ChatIconButton, {
|
|
1124
|
-
size: "sm",
|
|
1125
|
-
label: copiedId === message.id ? labels.copied : labels.copy,
|
|
1126
|
-
icon: copiedId === message.id ? "check" : "copy",
|
|
1127
|
-
"data-copied": copiedId === message.id || void 0,
|
|
1128
|
-
disabled: chat.isBusy && message === last,
|
|
1129
|
-
onClick: () => void copy(message)
|
|
1130
|
-
}), message === last && capabilities?.regenerate !== false && /* @__PURE__ */ jsx(ChatIconButton, {
|
|
1131
|
-
size: "sm",
|
|
1132
|
-
label: labels.regenerate,
|
|
1133
|
-
icon: "refresh",
|
|
1134
|
-
disabled: chat.isBusy || actionPending,
|
|
1135
|
-
onClick: () => void regenerate(message)
|
|
1136
|
-
})]
|
|
1712
|
+
})
|
|
1137
1713
|
})
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
}
|
|
1714
|
+
]
|
|
1715
|
+
}, message.id);
|
|
1716
|
+
}),
|
|
1141
1717
|
showThinking && last?.role !== "assistant" && /* @__PURE__ */ jsx("article", {
|
|
1142
1718
|
className: "gc-chat__message gc-chat__message--assistant",
|
|
1143
1719
|
"aria-label": labels.assistant,
|
|
@@ -1178,7 +1754,7 @@ function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming =
|
|
|
1178
1754
|
function ChatPanel(props) {
|
|
1179
1755
|
return /* @__PURE__ */ jsx(Panel, { ...props }, props.chat.id);
|
|
1180
1756
|
}
|
|
1181
|
-
function Panel({ chat, labels: labelOverrides, title, subtitle, headerIcon, header, headerActions, footer, composer, composerProps, theme = "auto", variant = "panel", density = "comfortable", capabilities, className, renderText, smoothStreaming, scrollRef, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, requestOptions, onActionError, ...elementProps }) {
|
|
1757
|
+
function Panel({ chat, labels: labelOverrides, title, subtitle, headerIcon, header, headerActions, footer, composer, composerProps, theme = "auto", variant = "panel", density = "comfortable", capabilities, className, renderText, smoothStreaming, scrollRef, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderUserMessageFooter, branches, onSelectBranch, onRevertMessage, onBranchMessage, renderMessageHeader, empty, requestOptions, onActionError, ...elementProps }) {
|
|
1182
1758
|
const labels = resolveLabels(labelOverrides);
|
|
1183
1759
|
const [retrying, setRetrying] = useState(false);
|
|
1184
1760
|
const [retryError, setRetryError] = useState();
|
|
@@ -1249,6 +1825,11 @@ function Panel({ chat, labels: labelOverrides, title, subtitle, headerIcon, head
|
|
|
1249
1825
|
suggestionsTitle,
|
|
1250
1826
|
suggestionsDescription,
|
|
1251
1827
|
renderMessageActions,
|
|
1828
|
+
renderUserMessageFooter,
|
|
1829
|
+
branches,
|
|
1830
|
+
onSelectBranch,
|
|
1831
|
+
onRevertMessage,
|
|
1832
|
+
onBranchMessage,
|
|
1252
1833
|
renderMessageHeader,
|
|
1253
1834
|
empty,
|
|
1254
1835
|
requestOptions,
|
|
@@ -1477,6 +2058,6 @@ function ChatHistoryMenu({ conversations, currentId, onSelect, onNewChat, disabl
|
|
|
1477
2058
|
});
|
|
1478
2059
|
}
|
|
1479
2060
|
//#endregion
|
|
1480
|
-
export { AiChat, ChatAppearanceProvider, ChatComposer, ChatHistoryMenu, Icon as ChatIcon, ChatIconButton, ChatMessages, ChatPanel, ChatTargetingOverlay, ContextTray, SpeechInputError, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, enUSTargetingLabels, getMessageText, toChatContextItem, useAiChat, useChatContext, useChatTargeting, useSpeechInput, zhCN, zhCNTargetingLabels };
|
|
2061
|
+
export { AiChat, ChatAppearanceProvider, ChatBranchSwitcher, ChatCheckpointBanner, ChatComposer, ChatHistoryMenu, Icon as ChatIcon, ChatIconButton, ChatMentionMenu, ChatMessages, ChatPanel, ChatPlusMenu, ChatSlashMenu, ChatTargetingOverlay, ContextTray, SpeechInputError, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, detectComposerTrigger, enUS, enUSTargetingLabels, filterMentions, filterSkills, getMessageText, parseSkillMarkdown, projectChatBranches, replaceComposerTrigger, slugifySkillName, toChatContextItem, useAiChat, useChatBranches, useChatContext, useChatTargeting, useComposerTrigger, useSpeechInput, zhCN, zhCNTargetingLabels };
|
|
1481
2062
|
|
|
1482
2063
|
//# sourceMappingURL=index.js.map
|