inline-chat-kit 0.54.2 → 0.55.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 +102 -0
- package/dist/ChatExperience/ChatExperience.d.ts +115 -0
- package/dist/ChatExperience-CRtVStGQ.js +5839 -0
- package/dist/ChatExperience-CRtVStGQ.js.map +1 -0
- package/dist/demo/ChatExperienceDemo.d.ts +27 -0
- package/dist/demo/InlineChatBanner.d.ts +6 -0
- package/dist/demo/IntroLanding.d.ts +43 -0
- package/dist/demo/featureStatus.d.ts +18 -0
- package/dist/demo/index.d.ts +8 -0
- package/dist/demo/scriptedApi.d.ts +49 -0
- package/dist/demo.js +691 -0
- package/dist/demo.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/inline-chat-kit.css +1 -1
- package/dist/inline-chat-kit.js +8 -5540
- package/dist/inline-chat-kit.js.map +1 -1
- package/getting-started.md +33 -69
- package/package.json +7 -3
package/dist/demo.js
ADDED
|
@@ -0,0 +1,691 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Z as e, t } from "./ChatExperience-CRtVStGQ.js";
|
|
3
|
+
import { useCallback as n, useRef as r, useState as i } from "react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
import { AnimatePresence as s, motion as c } from "motion/react";
|
|
6
|
+
var l = {
|
|
7
|
+
banner: "ick-banner-qe2q",
|
|
8
|
+
header: "ick-header-v41q",
|
|
9
|
+
headerIcon: "ick-headerIcon-hWUJ",
|
|
10
|
+
headerText: "ick-headerText-r1fK",
|
|
11
|
+
title: "ick-title-hqo4",
|
|
12
|
+
body: "ick-body--6nK",
|
|
13
|
+
columns: "ick-columns-IGXM",
|
|
14
|
+
divider: "ick-divider-Fs1E",
|
|
15
|
+
column: "ick-column-DhdN",
|
|
16
|
+
items: "ick-items-Z-x5",
|
|
17
|
+
item: "ick-item-j--c",
|
|
18
|
+
columnLabel: "ick-columnLabel--SUu"
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/demo/InlineChatBanner.tsx
|
|
22
|
+
function u({ status: e }) {
|
|
23
|
+
return /* @__PURE__ */ o("div", {
|
|
24
|
+
className: l.banner,
|
|
25
|
+
children: [/* @__PURE__ */ o("div", {
|
|
26
|
+
className: l.header,
|
|
27
|
+
children: [/* @__PURE__ */ o("svg", {
|
|
28
|
+
width: "16",
|
|
29
|
+
height: "16",
|
|
30
|
+
viewBox: "0 0 16 16",
|
|
31
|
+
fill: "none",
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
className: l.headerIcon,
|
|
34
|
+
"aria-hidden": !0,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ a("circle", {
|
|
37
|
+
cx: "8",
|
|
38
|
+
cy: "8",
|
|
39
|
+
r: "7",
|
|
40
|
+
stroke: "currentColor",
|
|
41
|
+
strokeWidth: "1.2"
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ a("path", {
|
|
44
|
+
d: "M8 7v4",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
strokeWidth: "1.2",
|
|
47
|
+
strokeLinecap: "round"
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ a("circle", {
|
|
50
|
+
cx: "8",
|
|
51
|
+
cy: "5",
|
|
52
|
+
r: "0.8",
|
|
53
|
+
fill: "currentColor"
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
}), /* @__PURE__ */ o("div", {
|
|
57
|
+
className: l.headerText,
|
|
58
|
+
children: [/* @__PURE__ */ a("span", {
|
|
59
|
+
className: l.title,
|
|
60
|
+
children: "Quick heads up"
|
|
61
|
+
}), /* @__PURE__ */ a("span", {
|
|
62
|
+
className: l.body,
|
|
63
|
+
children: "The answers are scripted — there is no model behind this page. Everything else is the real component, so the list below is what you can actually try."
|
|
64
|
+
})]
|
|
65
|
+
})]
|
|
66
|
+
}), /* @__PURE__ */ o("div", {
|
|
67
|
+
className: l.columns,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ a(d, {
|
|
70
|
+
label: "Works",
|
|
71
|
+
items: e.works
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ a(d, {
|
|
74
|
+
label: "Not working",
|
|
75
|
+
items: e.notWorking
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ a(d, {
|
|
78
|
+
label: "Soon",
|
|
79
|
+
items: e.soon
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function d({ label: e, items: t }) {
|
|
86
|
+
return /* @__PURE__ */ o("div", {
|
|
87
|
+
className: l.column,
|
|
88
|
+
children: [/* @__PURE__ */ a("span", {
|
|
89
|
+
className: l.columnLabel,
|
|
90
|
+
children: e
|
|
91
|
+
}), /* @__PURE__ */ a("div", {
|
|
92
|
+
className: l.items,
|
|
93
|
+
children: t.map((e) => /* @__PURE__ */ a("span", {
|
|
94
|
+
className: l.item,
|
|
95
|
+
children: e
|
|
96
|
+
}, e))
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/demo/featureStatus.ts
|
|
102
|
+
var f = {
|
|
103
|
+
works: [
|
|
104
|
+
"Send, stop, edit",
|
|
105
|
+
"Multiline input",
|
|
106
|
+
"Attach an image",
|
|
107
|
+
"Dictate a message",
|
|
108
|
+
"Copy an answer",
|
|
109
|
+
"Rate an answer",
|
|
110
|
+
"Regenerate and compare",
|
|
111
|
+
"Highlight a passage",
|
|
112
|
+
"Reply in a thread",
|
|
113
|
+
"Answer questions inline",
|
|
114
|
+
"Approve a tool call",
|
|
115
|
+
"Open a plan in a pane",
|
|
116
|
+
"Reasoning and tools",
|
|
117
|
+
"Sources and citations",
|
|
118
|
+
"Light and dark"
|
|
119
|
+
],
|
|
120
|
+
notWorking: ["Real model answers", "Real speech to text"],
|
|
121
|
+
soon: [
|
|
122
|
+
"Mobile",
|
|
123
|
+
"A fixed composer",
|
|
124
|
+
"Queue a message",
|
|
125
|
+
"Saved conversations"
|
|
126
|
+
]
|
|
127
|
+
}, p = {
|
|
128
|
+
page: "ick-page-FfCm",
|
|
129
|
+
container: "ick-container-o-mL",
|
|
130
|
+
infoContainer: "ick-infoContainer-6g-x",
|
|
131
|
+
content: "ick-content-ThcU",
|
|
132
|
+
introContent: "ick-introContent-51vD",
|
|
133
|
+
nameContent: "ick-nameContent-WLHx",
|
|
134
|
+
welcome: "ick-welcome-nSyR",
|
|
135
|
+
title: "ick-title-q3J8",
|
|
136
|
+
version: "ick-version-VmaR",
|
|
137
|
+
description: "ick-description-Zv0R",
|
|
138
|
+
inputSection: "ick-inputSection-O64A",
|
|
139
|
+
bannerWrapper: "ick-bannerWrapper-URah",
|
|
140
|
+
buttonWrapper: "ick-buttonWrapper-3eYt",
|
|
141
|
+
fyi: "ick-fyi-9rqo"
|
|
142
|
+
}, m = {
|
|
143
|
+
staggerIn: .07,
|
|
144
|
+
stiffness: 100,
|
|
145
|
+
damping: 36,
|
|
146
|
+
offsetIn: -10,
|
|
147
|
+
blurIn: 10,
|
|
148
|
+
staggerOut: .07,
|
|
149
|
+
durationOut: .28,
|
|
150
|
+
offsetOut: -10,
|
|
151
|
+
blurOut: 10
|
|
152
|
+
};
|
|
153
|
+
function h({ logo: t, back: n, onStart: r, welcome: i = "Welcome", title: s = "This is inline chat experience", version: l = "v1.0.0", description: d = "Exploration of having the input be the same as response. Or better said input morphing into chat bubble and maintains the continuous experience.", status: h = f, motionConfig: g }) {
|
|
154
|
+
let _ = {
|
|
155
|
+
...m,
|
|
156
|
+
...g
|
|
157
|
+
}, v = {
|
|
158
|
+
hidden: {},
|
|
159
|
+
visible: { transition: { staggerChildren: _.staggerIn } },
|
|
160
|
+
exit: { transition: {
|
|
161
|
+
staggerChildren: _.staggerOut,
|
|
162
|
+
staggerDirection: -1
|
|
163
|
+
} }
|
|
164
|
+
}, y = {
|
|
165
|
+
hidden: {
|
|
166
|
+
opacity: 0,
|
|
167
|
+
filter: `blur(${_.blurIn}px)`,
|
|
168
|
+
y: _.offsetIn
|
|
169
|
+
},
|
|
170
|
+
visible: {
|
|
171
|
+
opacity: 1,
|
|
172
|
+
filter: "blur(0px)",
|
|
173
|
+
y: 0,
|
|
174
|
+
transition: {
|
|
175
|
+
type: "spring",
|
|
176
|
+
stiffness: _.stiffness,
|
|
177
|
+
damping: _.damping
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
exit: {
|
|
181
|
+
opacity: 0,
|
|
182
|
+
filter: `blur(${_.blurOut}px)`,
|
|
183
|
+
y: _.offsetOut,
|
|
184
|
+
transition: {
|
|
185
|
+
duration: _.durationOut,
|
|
186
|
+
ease: [
|
|
187
|
+
.4,
|
|
188
|
+
0,
|
|
189
|
+
1,
|
|
190
|
+
1
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
return /* @__PURE__ */ a(c.div, {
|
|
196
|
+
className: p.page,
|
|
197
|
+
variants: v,
|
|
198
|
+
initial: "hidden",
|
|
199
|
+
animate: "visible",
|
|
200
|
+
exit: "exit",
|
|
201
|
+
children: /* @__PURE__ */ o("div", {
|
|
202
|
+
className: p.container,
|
|
203
|
+
children: [
|
|
204
|
+
/* @__PURE__ */ o("div", {
|
|
205
|
+
className: p.infoContainer,
|
|
206
|
+
children: [t && /* @__PURE__ */ a(c.div, {
|
|
207
|
+
variants: y,
|
|
208
|
+
children: t
|
|
209
|
+
}), /* @__PURE__ */ o("div", {
|
|
210
|
+
className: p.content,
|
|
211
|
+
children: [/* @__PURE__ */ o("div", {
|
|
212
|
+
className: p.introContent,
|
|
213
|
+
children: [/* @__PURE__ */ o(c.div, {
|
|
214
|
+
className: p.nameContent,
|
|
215
|
+
variants: y,
|
|
216
|
+
children: [/* @__PURE__ */ a("span", {
|
|
217
|
+
className: p.welcome,
|
|
218
|
+
children: i
|
|
219
|
+
}), /* @__PURE__ */ a("span", {
|
|
220
|
+
className: p.title,
|
|
221
|
+
children: s
|
|
222
|
+
})]
|
|
223
|
+
}), /* @__PURE__ */ a(c.span, {
|
|
224
|
+
className: p.version,
|
|
225
|
+
variants: y,
|
|
226
|
+
children: l
|
|
227
|
+
})]
|
|
228
|
+
}), /* @__PURE__ */ a(c.p, {
|
|
229
|
+
className: p.description,
|
|
230
|
+
variants: y,
|
|
231
|
+
children: d
|
|
232
|
+
})]
|
|
233
|
+
})]
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ a(c.div, {
|
|
236
|
+
variants: y,
|
|
237
|
+
className: p.bannerWrapper,
|
|
238
|
+
children: /* @__PURE__ */ a(u, { status: h })
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ a(c.div, {
|
|
241
|
+
variants: y,
|
|
242
|
+
style: { display: "none" }
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ a(c.div, {
|
|
245
|
+
variants: y,
|
|
246
|
+
style: { display: "none" }
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ a(c.div, {
|
|
249
|
+
variants: y,
|
|
250
|
+
style: { display: "none" }
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ o(c.div, {
|
|
253
|
+
variants: y,
|
|
254
|
+
className: p.buttonWrapper,
|
|
255
|
+
children: [/* @__PURE__ */ a(e, {
|
|
256
|
+
variant: "glass",
|
|
257
|
+
size: "m",
|
|
258
|
+
onClick: r,
|
|
259
|
+
children: "Start experience"
|
|
260
|
+
}), n]
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
})
|
|
264
|
+
}, "intro");
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/demo/scriptedApi.ts
|
|
268
|
+
var g = /* @__PURE__ */ new Map(), _ = [
|
|
269
|
+
"Particle physics studies the most fundamental constituents of matter and the forces that act between them.",
|
|
270
|
+
"The **Standard Model** organises them into three families:",
|
|
271
|
+
"- twelve fermions — six quarks and six leptons\n- the force-carrying bosons\n- the Higgs, which gives the rest their mass",
|
|
272
|
+
"The Higgs boson, found at CERN in 2012, completes the picture by giving elementary particles their mass through interaction with the Higgs field."
|
|
273
|
+
], v = [
|
|
274
|
+
"The Higgs boson is a *point particle* — it has no measurable spatial extent at any scale we can currently probe.",
|
|
275
|
+
"| property | value |\n| --- | --- |\n| mass | ~125 GeV/c² |\n| charge | 0 |\n| spin | 0 |",
|
|
276
|
+
"So 'how big is it' has only one honest answer: it has no size, only `mass` and quantum numbers."
|
|
277
|
+
], y = ["Here is what I would do, in order. The first two are cheap and tell us whether the rest is worth doing."], b = [
|
|
278
|
+
"The current combined figure is **125.25 GeV/c²**[^1], from ATLAS and CMS together — separately, neither experiment gets there.",
|
|
279
|
+
"It is known to about a fifth of a percent[^2], which for a particle discovered in 2012 is a remarkably tight number.",
|
|
280
|
+
"The uncertainty is now dominated by systematics rather than statistics[^3] — more collisions alone will not sharpen it much further."
|
|
281
|
+
], x = [
|
|
282
|
+
{
|
|
283
|
+
id: "atlas-cms",
|
|
284
|
+
title: "Combined measurement of the Higgs boson mass",
|
|
285
|
+
origin: "atlas.cern",
|
|
286
|
+
url: "https://example.com/atlas-cms",
|
|
287
|
+
quote: "125.25 ± 0.17 GeV, from the combination of the ATLAS and CMS datasets."
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: "pdg",
|
|
291
|
+
title: "Particle Data Group — Higgs boson listings",
|
|
292
|
+
origin: "pdg.lbl.gov",
|
|
293
|
+
url: "https://example.com/pdg"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: "systematics",
|
|
297
|
+
title: "Systematic uncertainties in the mass measurement",
|
|
298
|
+
origin: "cms.cern",
|
|
299
|
+
url: "https://example.com/systematics"
|
|
300
|
+
}
|
|
301
|
+
], S = [
|
|
302
|
+
{
|
|
303
|
+
id: "read",
|
|
304
|
+
label: "Read what is being asked",
|
|
305
|
+
body: "Not the mass itself — how well it is known, and by whom."
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: "split",
|
|
309
|
+
label: "Separate the two numbers",
|
|
310
|
+
body: "The value and its uncertainty come from different arguments; giving one without the other answers half."
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
id: "check",
|
|
314
|
+
label: "Check which is the limiting one now",
|
|
315
|
+
body: "Statistics used to dominate. It is systematics now, and that changes what more data would buy."
|
|
316
|
+
}
|
|
317
|
+
], C = [
|
|
318
|
+
{
|
|
319
|
+
id: "setup",
|
|
320
|
+
type: "inputs",
|
|
321
|
+
title: "What are we running?",
|
|
322
|
+
subtitle: "Enough to set the geometry up — the rest I can assume",
|
|
323
|
+
shortTitle: "The setup",
|
|
324
|
+
fields: [{
|
|
325
|
+
id: "particle",
|
|
326
|
+
label: "Particle",
|
|
327
|
+
placeholder: "Electron"
|
|
328
|
+
}, {
|
|
329
|
+
id: "separation",
|
|
330
|
+
label: "Slit separation",
|
|
331
|
+
placeholder: "100 nm"
|
|
332
|
+
}]
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
id: "detector",
|
|
336
|
+
type: "single",
|
|
337
|
+
title: "Where do you put the detector?",
|
|
338
|
+
subtitle: "This is the experiment, really — the rest is apparatus",
|
|
339
|
+
shortTitle: "Detector",
|
|
340
|
+
options: [
|
|
341
|
+
{
|
|
342
|
+
id: "slits",
|
|
343
|
+
title: "At the slits",
|
|
344
|
+
description: "Learn which path each particle took",
|
|
345
|
+
short: "At the slits"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: "screen",
|
|
349
|
+
title: "At the screen",
|
|
350
|
+
description: "Learn only where each one landed",
|
|
351
|
+
short: "At the screen"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: "nowhere",
|
|
355
|
+
title: "Nowhere",
|
|
356
|
+
description: "Let it run unobserved and see what arrives",
|
|
357
|
+
short: "Nowhere"
|
|
358
|
+
}
|
|
359
|
+
]
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
id: "plots",
|
|
363
|
+
type: "multi",
|
|
364
|
+
title: "What should I plot?",
|
|
365
|
+
subtitle: "Pick everything worth looking at",
|
|
366
|
+
shortTitle: "Plots",
|
|
367
|
+
allowOther: !0,
|
|
368
|
+
allowEmpty: !0,
|
|
369
|
+
options: [
|
|
370
|
+
{
|
|
371
|
+
id: "fringes",
|
|
372
|
+
title: "Interference pattern",
|
|
373
|
+
description: "Counts across the screen",
|
|
374
|
+
short: "Fringes"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
id: "psi",
|
|
378
|
+
title: "Wavefunction",
|
|
379
|
+
description: "|ψ|² as it evolves",
|
|
380
|
+
short: "|ψ|²"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
id: "path",
|
|
384
|
+
title: "Which-path record",
|
|
385
|
+
description: "Only meaningful with a detector at the slits",
|
|
386
|
+
short: "Which-path"
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
}
|
|
390
|
+
], w = (e) => new Promise((t) => setTimeout(t, e));
|
|
391
|
+
async function* T(e) {
|
|
392
|
+
for (let t of e.join("\n\n").split(/(\s+)/)) await w(24), yield t;
|
|
393
|
+
}
|
|
394
|
+
async function* E(e, t) {
|
|
395
|
+
let n = "";
|
|
396
|
+
for (let r of t) n += (n ? "\n\n" : "") + r, yield {
|
|
397
|
+
kind: "reasoning",
|
|
398
|
+
id: e,
|
|
399
|
+
text: n,
|
|
400
|
+
state: "thinking"
|
|
401
|
+
}, await w(420);
|
|
402
|
+
yield {
|
|
403
|
+
kind: "reasoning",
|
|
404
|
+
id: e,
|
|
405
|
+
state: "done"
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
var D = {
|
|
409
|
+
query: "higgs boson mass measurement",
|
|
410
|
+
limit: 3
|
|
411
|
+
}, O = {
|
|
412
|
+
results: [{
|
|
413
|
+
title: "ATLAS and CMS combined measurement",
|
|
414
|
+
url: "https://example.com/atlas-cms",
|
|
415
|
+
rank: 1
|
|
416
|
+
}, {
|
|
417
|
+
title: "Particle Data Group — Higgs boson",
|
|
418
|
+
url: "https://example.com/pdg",
|
|
419
|
+
rank: 2
|
|
420
|
+
}],
|
|
421
|
+
took_ms: 412
|
|
422
|
+
};
|
|
423
|
+
async function* k(e) {
|
|
424
|
+
yield {
|
|
425
|
+
kind: "tool",
|
|
426
|
+
id: e,
|
|
427
|
+
name: "search_web",
|
|
428
|
+
state: "running",
|
|
429
|
+
summary: "Searching the web",
|
|
430
|
+
input: D
|
|
431
|
+
}, await w(900), yield {
|
|
432
|
+
kind: "tool",
|
|
433
|
+
id: e,
|
|
434
|
+
name: "search_web",
|
|
435
|
+
state: "done",
|
|
436
|
+
summary: "2 results",
|
|
437
|
+
output: O,
|
|
438
|
+
duration: 412
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
var A = [
|
|
442
|
+
{
|
|
443
|
+
id: "read",
|
|
444
|
+
label: "Read the care plan"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
id: "meds",
|
|
448
|
+
label: "Check the medication list against the prescription"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
id: "gaps",
|
|
452
|
+
label: "Find the gaps in the weekly cover"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
id: "draft",
|
|
456
|
+
label: "Draft the questions for the family"
|
|
457
|
+
}
|
|
458
|
+
];
|
|
459
|
+
async function* j(e) {
|
|
460
|
+
for (let t = 0; t <= A.length; t++) yield {
|
|
461
|
+
kind: "tasks",
|
|
462
|
+
id: e,
|
|
463
|
+
title: "Plan",
|
|
464
|
+
collapsible: !0,
|
|
465
|
+
tasks: A.map((e, n) => ({
|
|
466
|
+
...e,
|
|
467
|
+
state: n < t ? "done" : n === t ? "running" : "pending"
|
|
468
|
+
}))
|
|
469
|
+
}, await w(800);
|
|
470
|
+
}
|
|
471
|
+
async function* M(e) {
|
|
472
|
+
for (let t = 0; t < S.length; t++) yield {
|
|
473
|
+
kind: "chain",
|
|
474
|
+
id: e,
|
|
475
|
+
state: "thinking",
|
|
476
|
+
steps: S.slice(0, t + 1).map((e, n) => ({
|
|
477
|
+
...e,
|
|
478
|
+
state: n < t ? "done" : "running"
|
|
479
|
+
}))
|
|
480
|
+
}, await w(700);
|
|
481
|
+
yield {
|
|
482
|
+
kind: "chain",
|
|
483
|
+
id: e,
|
|
484
|
+
state: "done",
|
|
485
|
+
steps: S.map((e) => ({
|
|
486
|
+
...e,
|
|
487
|
+
state: "done"
|
|
488
|
+
}))
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
var N = (e, ...t) => {
|
|
492
|
+
let n = e.toLowerCase();
|
|
493
|
+
return t.some((e) => n.includes(e));
|
|
494
|
+
}, P = ["I can see it. Whatever you send along with a message arrives here the same way the text does — one `attachments` array on the turn, and the composer that held it is the same one that shows it afterwards.", "This demo does not read the picture; there is no model behind it. A real one would get the file and the sentence in the same request."], F = [[
|
|
495
|
+
"Another way to put it: particle physics is the study of what is left when you stop dividing.",
|
|
496
|
+
"Everything in the Standard Model is there because dividing it further stopped producing anything smaller — twelve fermions, the bosons that carry the forces between them, and the Higgs.",
|
|
497
|
+
"The interesting part is not the list. It is that the list is *short*, and that nothing found since 1973 has needed adding to it."
|
|
498
|
+
], [
|
|
499
|
+
"Once more, from the other end. Start with the four forces and ask what carries each one.",
|
|
500
|
+
"Electromagnetism has the photon. The strong force has gluons. The weak force has the W and Z. Gravity has no entry here at all — which is the honest shape of the field's biggest open problem.",
|
|
501
|
+
"Matter is what those forces act on: quarks, which feel the strong force, and leptons, which do not."
|
|
502
|
+
]], I = "Week 1 — base\nMon rest\nTue 4 km easy, conversational pace\nWed cross-train, 30 min\nThu 5 × 400 m at 5k effort, 90 s jog between\nFri rest\nSat 6 km easy\nSun 20 min walk\n\nWeek 2 — base\nMon rest\nTue 5 km easy\nWed cross-train, 35 min\nThu 6 × 400 m, 90 s jog between\nFri rest\nSat 7 km easy, last kilometre at pace\nSun 20 min walk\n\nWeek 3 — build\nMon rest\nTue 5 km easy\nWed cross-train, 35 min\nThu 4 × 800 m at 5k effort, 2 min jog between\nFri rest\nSat 8 km easy\nSun 20 min walk\n\nWeek 4 — cut back\nMon rest\nTue 4 km easy\nWed cross-train, 30 min\nThu 5 × 400 m, 90 s jog between\nFri rest\nSat 5 km easy\nSun rest\n\nWeek 5 — build\nMon rest\nTue 6 km easy\nWed cross-train, 40 min\nThu 5 × 800 m, 2 min jog between\nFri rest\nSat 9 km easy\nSun 20 min walk\n\nWeek 6 — sharpen\nMon rest\nTue 6 km with 3 km at target pace\nWed cross-train, 30 min\nThu 8 × 400 m, 60 s jog between\nFri rest\nSat 8 km easy\nSun 20 min walk\n\nWeek 7 — sharpen\nMon rest\nTue 5 km with 4 km at target pace\nWed cross-train, 30 min\nThu 6 × 400 m, 60 s jog between\nFri rest\nSat 6 km easy\nSun rest\n\nWeek 8 — taper and race\nMon rest\nTue 4 km easy with 4 × 100 m strides\nWed rest\nThu 3 km easy\nFri rest\nSat race, 5 km\nSun 20 min walk\n\nNotes\nEasy means you can hold a conversation. If you cannot, it is not easy.\nEvery hard day is followed by a rest day; that is where the fitness is made.\nMiss a week and repeat it rather than skipping ahead to catch up.";
|
|
503
|
+
async function* L(e, { attachments: t, turnId: n }) {
|
|
504
|
+
if (t.length > 0) {
|
|
505
|
+
yield* E("r", [`${t.length === 1 ? "A file" : `${t.length} files`} came with this.`, "Say what arrived, and be honest that nothing here is looking at it."]), yield* T(P);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
if (N(e, "plan", "training", "5k", "run ", "running", "trening", "trčanj", "trcanj")) {
|
|
509
|
+
yield* E("r", ["Eight weeks is the shortest honest 5k build for somebody starting from a base.", "The plan is long. Put it behind a card rather than into the answer — an answer nobody can read past is not an answer."]), yield {
|
|
510
|
+
kind: "artifact",
|
|
511
|
+
id: "plan",
|
|
512
|
+
title: "5k training plan",
|
|
513
|
+
state: "writing"
|
|
514
|
+
}, yield "Here is an eight-week plan. Four sessions a week, one of them hard, and a cut-back week in the middle so the fourth week does not become the one you quit in.", await w(900), yield {
|
|
515
|
+
kind: "artifact",
|
|
516
|
+
id: "plan",
|
|
517
|
+
meta: "8 weeks · 4 sessions a week",
|
|
518
|
+
preview: "text",
|
|
519
|
+
content: I,
|
|
520
|
+
state: "done"
|
|
521
|
+
}, yield " Open it to see the weeks.";
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
if (N(e, "question", "ask me", "set up", "double-slit", "experiment", "pitanj")) {
|
|
525
|
+
yield* E("r", ["They want to be asked rather than to specify the whole thing up front.", "Three is the most anybody answers in one sitting: the geometry, then where the detector goes — which is the only choice that changes the physics — then what to plot."]), yield {
|
|
526
|
+
kind: "question",
|
|
527
|
+
id: "q",
|
|
528
|
+
title: "Setting up the run",
|
|
529
|
+
questions: C,
|
|
530
|
+
answers: {},
|
|
531
|
+
activeIndex: 0
|
|
532
|
+
};
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (N(e, "delete", "run ", "send an email", "permission", "approve")) {
|
|
536
|
+
yield* E("r", ["This one changes something outside the conversation, so it is not mine to decide.", "Show what it would run, and wait."]), yield {
|
|
537
|
+
kind: "approval",
|
|
538
|
+
id: "ask",
|
|
539
|
+
title: "Run a command in your shell",
|
|
540
|
+
description: "It removes the generated screenshots. Nothing else is touched.",
|
|
541
|
+
tool: {
|
|
542
|
+
name: "bash",
|
|
543
|
+
input: {
|
|
544
|
+
command: "rm -rf Shots/",
|
|
545
|
+
cwd: "~/Projects/chat"
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (N(e, "plan", "todo", "steps", "what would you do")) {
|
|
552
|
+
yield* E("r", ["This is a sequence, not a single answer, so the plan is the answer.", "Order it so the cheap checks come first — if the medication list already matches, the rest is much smaller."]), yield* j("p"), yield* T(y);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (N(e, "sources", "cite", "how do you know", "izvor")) {
|
|
556
|
+
yield* M("c"), yield {
|
|
557
|
+
kind: "sources",
|
|
558
|
+
id: "s",
|
|
559
|
+
sources: x,
|
|
560
|
+
title: "Sources",
|
|
561
|
+
collapsible: !0
|
|
562
|
+
}, yield* T(b);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (N(e, "how big", "mass", "size", "weigh")) {
|
|
566
|
+
yield* E("r", ["The question is about the Higgs boson's size, and the honest answer is that it does not have one.", "Better to give the mass instead, and say why size is the wrong question — but check the current figure first."]), yield* k("t"), yield* T(v);
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
let r = (g.get(n) ?? 0) % (F.length + 1);
|
|
570
|
+
if (g.set(n, r + 1), r > 0) {
|
|
571
|
+
yield* E("r", ["Asked again, so the first answer did not land.", "Same physics, different way in — repeating it in other words is not answering it again."]), yield* T(F[r - 1]);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
yield* E("r", ["A general question, so the answer should start from what the field is for rather than from a definition.", "Three families is the useful shape: fermions, bosons, and the Higgs."]), yield* T(_);
|
|
575
|
+
}
|
|
576
|
+
async function* R() {
|
|
577
|
+
yield* T(["Marking a passage and asking about it keeps the question attached to what it is about — so the answer can be short.", "That is the whole of the thread: the quote, one question, one answer."]);
|
|
578
|
+
}
|
|
579
|
+
async function* z(e, { signal: t }) {
|
|
580
|
+
let n = `this is a scripted transcript standing in for about ${Math.max(1, Math.round(e.size / 12e3))} seconds of speech`.split(" ");
|
|
581
|
+
for (let e of n) {
|
|
582
|
+
if (await new Promise((e) => setTimeout(e, 90)), t.aborted) return;
|
|
583
|
+
yield `${e} `;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
var B = { plan: "ick-plan-nXLe" }, V = 8e3, H = 900;
|
|
587
|
+
function U({ logo: e, back: o, backHref: c = "/", backLabel: l = "Back to home", skipIntro: u = !1, theme: d, onThemeChange: f, cursor: p = !1, animationConfig: m, foldMotion: g, feedDelay: _, introMotion: v }) {
|
|
588
|
+
let [y, b] = i(u), x = r({}), S = n((e, t, n, r, i) => {
|
|
589
|
+
let a = {
|
|
590
|
+
...x.current[n] ?? {},
|
|
591
|
+
[r]: i
|
|
592
|
+
};
|
|
593
|
+
x.current[n] = a;
|
|
594
|
+
let o = C.findIndex((e) => e.id === r) + 1, s = o >= C.length;
|
|
595
|
+
e(t, {
|
|
596
|
+
kind: "question",
|
|
597
|
+
id: n,
|
|
598
|
+
title: "Setting up the run",
|
|
599
|
+
questions: C,
|
|
600
|
+
answers: a,
|
|
601
|
+
activeIndex: s ? null : o,
|
|
602
|
+
collapsible: s
|
|
603
|
+
});
|
|
604
|
+
}, []), w = n((e, t, n, r) => {
|
|
605
|
+
e(t, {
|
|
606
|
+
kind: "question",
|
|
607
|
+
id: n,
|
|
608
|
+
questions: C,
|
|
609
|
+
answers: x.current[n] ?? {},
|
|
610
|
+
activeIndex: r,
|
|
611
|
+
collapsible: !1
|
|
612
|
+
});
|
|
613
|
+
}, []), T = n((e, t, n, r) => {
|
|
614
|
+
e(t, {
|
|
615
|
+
kind: "approval",
|
|
616
|
+
id: n,
|
|
617
|
+
decision: r
|
|
618
|
+
}), r !== "denied" && (e(t, {
|
|
619
|
+
kind: "tool",
|
|
620
|
+
id: `${n}-ran`,
|
|
621
|
+
name: "bash",
|
|
622
|
+
state: "running",
|
|
623
|
+
summary: "Removing Shots/",
|
|
624
|
+
input: { command: "rm -rf Shots/" }
|
|
625
|
+
}), window.setTimeout(() => {
|
|
626
|
+
e(t, {
|
|
627
|
+
kind: "tool",
|
|
628
|
+
id: `${n}-ran`,
|
|
629
|
+
name: "bash",
|
|
630
|
+
state: "done",
|
|
631
|
+
summary: "42 files removed",
|
|
632
|
+
duration: 380,
|
|
633
|
+
output: "removed 42 files, 3 directories"
|
|
634
|
+
});
|
|
635
|
+
}, 1100));
|
|
636
|
+
}, []);
|
|
637
|
+
return /* @__PURE__ */ a(s, {
|
|
638
|
+
mode: "wait",
|
|
639
|
+
children: y ? /* @__PURE__ */ a(t, {
|
|
640
|
+
onSend: L,
|
|
641
|
+
onTranscribe: z,
|
|
642
|
+
onThreadReply: R,
|
|
643
|
+
title: "inline chat experience",
|
|
644
|
+
backHref: c,
|
|
645
|
+
backLabel: l,
|
|
646
|
+
placeholder: "Ask me about particle physics…",
|
|
647
|
+
empty: {
|
|
648
|
+
title: "Ask me about particle physics",
|
|
649
|
+
description: "The Standard Model, the Higgs, and what a boson actually is.",
|
|
650
|
+
suggestions: [
|
|
651
|
+
"What does particle physics actually study?",
|
|
652
|
+
"How big is the Higgs boson?",
|
|
653
|
+
"Write me a plan for running a 5k",
|
|
654
|
+
"How do you know — show me your sources",
|
|
655
|
+
"What would you do first — give me a plan",
|
|
656
|
+
"Set up a double-slit experiment",
|
|
657
|
+
"Delete the screenshots"
|
|
658
|
+
]
|
|
659
|
+
},
|
|
660
|
+
contextTotal: V,
|
|
661
|
+
contextBase: H,
|
|
662
|
+
artifact: () => ({
|
|
663
|
+
title: "5k training plan",
|
|
664
|
+
meta: "8 weeks · 4 sessions a week",
|
|
665
|
+
children: /* @__PURE__ */ a("pre", {
|
|
666
|
+
className: B.plan,
|
|
667
|
+
children: I
|
|
668
|
+
})
|
|
669
|
+
}),
|
|
670
|
+
theme: d,
|
|
671
|
+
onThemeChange: f,
|
|
672
|
+
cursor: p,
|
|
673
|
+
selectionToggle: !0,
|
|
674
|
+
animationConfig: m,
|
|
675
|
+
foldMotion: g,
|
|
676
|
+
feedDelay: _,
|
|
677
|
+
onAnswerQuestion: S,
|
|
678
|
+
onEditQuestion: w,
|
|
679
|
+
onDecideApproval: T
|
|
680
|
+
}, "chat") : /* @__PURE__ */ a(h, {
|
|
681
|
+
logo: e,
|
|
682
|
+
back: o,
|
|
683
|
+
onStart: () => b(!0),
|
|
684
|
+
motionConfig: v
|
|
685
|
+
}, "intro")
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
//#endregion
|
|
689
|
+
export { U as ChatExperienceDemo, f as INLINE_CHAT_FEATURE_STATUS, u as InlineChatBanner, h as IntroLanding, C as QUESTIONS, I as RUNNING_PLAN, L as scriptedApi, z as scriptedTranscript, R as threadReply };
|
|
690
|
+
|
|
691
|
+
//# sourceMappingURL=demo.js.map
|