@marimo-team/islands 0.23.1-dev7 → 0.23.1-dev9
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-ui-D0rOcl77.js → chat-ui-Bs4egzxg.js} +128 -128
- package/dist/main.js +4419 -1343
- package/dist/{process-output-C1_DucTc.js → process-output-BK6F4vqt.js} +2198 -2182
- package/dist/slides-component-_3tukGh-.js +3065 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +50 -44
- package/src/components/slides/__tests__/minimap.test.ts +402 -0
- package/src/components/slides/minimap.tsx +534 -0
- package/src/components/slides/slide.tsx +29 -0
- package/src/components/slides/slides-component.tsx +16 -1
- package/src/core/cells/__tests__/cells.test.ts +105 -1
- package/src/core/cells/cells.ts +43 -0
- package/src/core/cells/document-changes.ts +2 -1
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +38 -14
- package/dist/slides-component-CutG23yD.js +0 -3057
|
@@ -5,7 +5,7 @@ import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
|
|
|
5
5
|
import { t as require_react } from "./react-Bs6Z0kvn.js";
|
|
6
6
|
import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
|
|
7
7
|
import { r as toast } from "./copy-DzOz_Au7.js";
|
|
8
|
-
import {
|
|
8
|
+
import { A as MarimoIncomingMessageEvent, An as Trash2, Bt as variablesAtom, C as contextToXml, Cn as Anchor2, D as AccordionContent, E as Accordion, Hn as CircleX, I as ChatBubbleIcon, In as Info, Jt as getTableType, Kt as allTablesAtom, Ln as File$1, Mt as moveToEndOfEditor, O as AccordionItem, Pn as LoaderCircle, Q as cellErrorsAtom, S as Sections, St as displayCellName, T as AIContextRegistry, U as deserializeBlob, Vt as PluralWord, W as base64ToDataURL, Xt as getRequestClient, Z as renderHTML, a as toPng, an as ZodLocalStorage, d as Spinner, en as singleFacet, f as Popover, g as isOutputEmpty, h as PopoverTrigger, k as AccordionTrigger, kn as Wrench, kt as createVariableInfoElement, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, qt as dataSourceConnectionsAtom, t as processOutput, un as CellOutputId, w as AIContextProvider, x as Boosts, xn as atomWithStorage, y as DatasourceContextProvider, zt as jotaiJsonStorage } from "./process-output-BK6F4vqt.js";
|
|
9
9
|
import "./chunk-5FQGJX7Z-C428iZBW.js";
|
|
10
10
|
import { u as createLucideIcon } from "./dist-CjLQ79mo.js";
|
|
11
11
|
import { C as logNever, I as X, n as Strings, t as Label } from "./label-J1N4mVcg.js";
|
|
@@ -6355,21 +6355,21 @@ var import_compiler_runtime$3 = require_compiler_runtime();
|
|
|
6355
6355
|
const ReasoningAccordion = (e18) => {
|
|
6356
6356
|
let _ = (0, import_compiler_runtime$3.c)(13), { reasoning: v, index: y, isStreaming: b } = e18, x = y === void 0 ? 0 : y, S = b === void 0 ? false : b, C = S ? "reasoning" : void 0, w;
|
|
6357
6357
|
_[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), _[0] = w) : w = _[0];
|
|
6358
|
-
let
|
|
6359
|
-
_[1] !== v.length || _[2] !==
|
|
6358
|
+
let T = S ? "Thinking" : "View reasoning", O;
|
|
6359
|
+
_[1] !== v.length || _[2] !== T ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
|
|
6360
6360
|
className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
|
|
6361
6361
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
6362
6362
|
className: "flex items-center gap-2",
|
|
6363
6363
|
children: [
|
|
6364
6364
|
w,
|
|
6365
|
-
|
|
6365
|
+
T,
|
|
6366
6366
|
" (",
|
|
6367
6367
|
v.length,
|
|
6368
6368
|
" ",
|
|
6369
6369
|
"chars)"
|
|
6370
6370
|
]
|
|
6371
6371
|
})
|
|
6372
|
-
}), _[1] = v.length, _[2] =
|
|
6372
|
+
}), _[1] = v.length, _[2] = T, _[3] = O) : O = _[3];
|
|
6373
6373
|
let k;
|
|
6374
6374
|
_[4] === v ? k = _[5] : (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
|
|
6375
6375
|
className: "pb-2 px-2",
|
|
@@ -6411,24 +6411,24 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
|
|
|
6411
6411
|
className: "text-xs font-semibold text-muted-foreground",
|
|
6412
6412
|
children: "Tool Result"
|
|
6413
6413
|
}), _[2] = E) : E = _[2];
|
|
6414
|
-
let
|
|
6415
|
-
_[3] === e19 ?
|
|
6414
|
+
let D;
|
|
6415
|
+
_[3] === e19 ? D = _[4] : (D = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
6416
6416
|
className: "text-xs px-2 py-0.5 bg-[var(--grass-2)] text-[var(--grass-11)] rounded-full font-medium capitalize",
|
|
6417
6417
|
children: e19
|
|
6418
|
-
}), _[3] = e19, _[4] =
|
|
6419
|
-
let
|
|
6420
|
-
_[5] === b ?
|
|
6418
|
+
}), _[3] = e19, _[4] = D);
|
|
6419
|
+
let O;
|
|
6420
|
+
_[5] === b ? O = _[6] : (O = b && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
6421
6421
|
className: "text-xs px-2 py-0.5 bg-[var(--amber-2)] text-[var(--amber-11)] rounded-full",
|
|
6422
6422
|
children: "Auth Required"
|
|
6423
|
-
}), _[5] = b, _[6] =
|
|
6424
|
-
let
|
|
6425
|
-
_[7] !==
|
|
6423
|
+
}), _[5] = b, _[6] = O);
|
|
6424
|
+
let k;
|
|
6425
|
+
_[7] !== D || _[8] !== O ? (k = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6426
6426
|
className: "flex items-center justify-between",
|
|
6427
6427
|
children: [E, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6428
6428
|
className: "flex items-center gap-2",
|
|
6429
|
-
children: [
|
|
6429
|
+
children: [D, O]
|
|
6430
6430
|
})]
|
|
6431
|
-
}), _[7] =
|
|
6431
|
+
}), _[7] = D, _[8] = O, _[9] = k) : k = _[9];
|
|
6432
6432
|
let j;
|
|
6433
6433
|
_[10] === w ? j = _[11] : (j = w && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6434
6434
|
className: "flex items-start gap-2",
|
|
@@ -6439,7 +6439,7 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
|
|
|
6439
6439
|
}), _[10] = w, _[11] = j), y = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6440
6440
|
className: "flex flex-col gap-1.5",
|
|
6441
6441
|
children: [
|
|
6442
|
-
|
|
6442
|
+
k,
|
|
6443
6443
|
j,
|
|
6444
6444
|
T && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6445
6445
|
className: "space-y-3",
|
|
@@ -6486,9 +6486,9 @@ var import_compiler_runtime$2 = require_compiler_runtime(), SuccessResultSchema
|
|
|
6486
6486
|
}), _[7] = C, _[8] = w), w;
|
|
6487
6487
|
};
|
|
6488
6488
|
const ToolCallAccordion = (e18) => {
|
|
6489
|
-
let _ = (0, import_compiler_runtime$2.c)(38), { toolName: v, result: y, error: b, index: x, state: S, className: C, input: w } = e18,
|
|
6490
|
-
_[0] ===
|
|
6491
|
-
switch (
|
|
6489
|
+
let _ = (0, import_compiler_runtime$2.c)(38), { toolName: v, result: y, error: b, index: x, state: S, className: C, input: w } = e18, T = x === void 0 ? 0 : x, k = S === "output-available" && (y || b), A = b ? "error" : k ? "success" : "loading", j;
|
|
6490
|
+
_[0] === A ? j = _[1] : (j = () => {
|
|
6491
|
+
switch (A) {
|
|
6492
6492
|
case "loading":
|
|
6493
6493
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "h-3 w-3 animate-spin" });
|
|
6494
6494
|
case "error":
|
|
@@ -6498,39 +6498,39 @@ const ToolCallAccordion = (e18) => {
|
|
|
6498
6498
|
default:
|
|
6499
6499
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Wrench, { className: "h-3 w-3" });
|
|
6500
6500
|
}
|
|
6501
|
-
}, _[0] =
|
|
6502
|
-
let
|
|
6503
|
-
_[2] !== b || _[3] !==
|
|
6504
|
-
let
|
|
6501
|
+
}, _[0] = A, _[1] = j);
|
|
6502
|
+
let M = j, N;
|
|
6503
|
+
_[2] !== b || _[3] !== k || _[4] !== A ? (N = () => A === "loading" ? "Running" : b ? "Failed" : k ? "Done" : "Tool call", _[2] = b, _[3] = k, _[4] = A, _[5] = N) : N = _[5];
|
|
6504
|
+
let P = N, L = `tool-${T}`, R;
|
|
6505
6505
|
_[6] === C ? R = _[7] : (R = cn("w-full", C), _[6] = C, _[7] = R);
|
|
6506
|
-
let z =
|
|
6506
|
+
let z = A === "error" && "text-[var(--red-11)]/80", B = A === "success" && "text-[var(--grass-11)]/80", V;
|
|
6507
6507
|
_[8] !== z || _[9] !== B ? (V = cn("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline", z, B), _[8] = z, _[9] = B, _[10] = V) : V = _[10];
|
|
6508
|
-
let
|
|
6509
|
-
_[11] ===
|
|
6510
|
-
let
|
|
6511
|
-
_[13] === v ?
|
|
6512
|
-
let
|
|
6513
|
-
_[15] ===
|
|
6508
|
+
let H;
|
|
6509
|
+
_[11] === M ? H = _[12] : (H = M(), _[11] = M, _[12] = H);
|
|
6510
|
+
let U = P(), W;
|
|
6511
|
+
_[13] === v ? W = _[14] : (W = formatToolName(v), _[13] = v, _[14] = W);
|
|
6512
|
+
let G;
|
|
6513
|
+
_[15] === W ? G = _[16] : (G = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
|
|
6514
6514
|
className: "font-mono text-xs",
|
|
6515
|
-
children:
|
|
6516
|
-
}), _[15] =
|
|
6517
|
-
let
|
|
6518
|
-
_[17] !==
|
|
6515
|
+
children: W
|
|
6516
|
+
}), _[15] = W, _[16] = G);
|
|
6517
|
+
let K;
|
|
6518
|
+
_[17] !== U || _[18] !== G || _[19] !== H ? (K = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
6519
6519
|
className: "flex items-center gap-1",
|
|
6520
6520
|
children: [
|
|
6521
|
+
H,
|
|
6521
6522
|
U,
|
|
6522
|
-
W,
|
|
6523
6523
|
":",
|
|
6524
|
-
|
|
6524
|
+
G
|
|
6525
6525
|
]
|
|
6526
|
-
}), _[17] =
|
|
6527
|
-
let
|
|
6528
|
-
_[21] !==
|
|
6526
|
+
}), _[17] = U, _[18] = G, _[19] = H, _[20] = K) : K = _[20];
|
|
6527
|
+
let q;
|
|
6528
|
+
_[21] !== K || _[22] !== V ? (q = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
|
|
6529
6529
|
className: V,
|
|
6530
|
-
children:
|
|
6531
|
-
}), _[21] =
|
|
6532
|
-
let
|
|
6533
|
-
_[24] !== b || _[25] !==
|
|
6530
|
+
children: K
|
|
6531
|
+
}), _[21] = K, _[22] = V, _[23] = q) : q = _[23];
|
|
6532
|
+
let J;
|
|
6533
|
+
_[24] !== b || _[25] !== k || _[26] !== w || _[27] !== y ? (J = k && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6534
6534
|
className: "space-y-3",
|
|
6535
6535
|
children: [
|
|
6536
6536
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: w }),
|
|
@@ -6546,25 +6546,25 @@ const ToolCallAccordion = (e18) => {
|
|
|
6546
6546
|
})]
|
|
6547
6547
|
})
|
|
6548
6548
|
]
|
|
6549
|
-
}), _[24] = b, _[25] =
|
|
6550
|
-
let
|
|
6551
|
-
_[29] ===
|
|
6549
|
+
}), _[24] = b, _[25] = k, _[26] = w, _[27] = y, _[28] = J) : J = _[28];
|
|
6550
|
+
let Y;
|
|
6551
|
+
_[29] === J ? Y = _[30] : (Y = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
|
|
6552
6552
|
className: "py-2 px-2",
|
|
6553
|
-
children:
|
|
6554
|
-
}), _[29] =
|
|
6555
|
-
let
|
|
6556
|
-
_[31] !==
|
|
6553
|
+
children: J
|
|
6554
|
+
}), _[29] = J, _[30] = Y);
|
|
6555
|
+
let Z;
|
|
6556
|
+
_[31] !== q || _[32] !== Y ? (Z = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
|
|
6557
6557
|
value: "tool-call",
|
|
6558
6558
|
className: "border-0",
|
|
6559
|
-
children: [
|
|
6560
|
-
}), _[31] =
|
|
6561
|
-
let
|
|
6562
|
-
return _[34] !==
|
|
6559
|
+
children: [q, Y]
|
|
6560
|
+
}), _[31] = q, _[32] = Y, _[33] = Z) : Z = _[33];
|
|
6561
|
+
let Q;
|
|
6562
|
+
return _[34] !== Z || _[35] !== L || _[36] !== R ? (Q = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
|
|
6563
6563
|
type: "single",
|
|
6564
6564
|
collapsible: true,
|
|
6565
6565
|
className: R,
|
|
6566
|
-
children:
|
|
6567
|
-
}, L), _[34] =
|
|
6566
|
+
children: Z
|
|
6567
|
+
}, L), _[34] = Z, _[35] = L, _[36] = R, _[37] = Q) : Q = _[37], Q;
|
|
6568
6568
|
};
|
|
6569
6569
|
function formatToolName(e18) {
|
|
6570
6570
|
return e18.replace("tool-", "");
|
|
@@ -7161,24 +7161,24 @@ var import_compiler_runtime = require_compiler_runtime(), PopoverAnchor = Anchor
|
|
|
7161
7161
|
});
|
|
7162
7162
|
const Chatbot = (e18) => {
|
|
7163
7163
|
var _a;
|
|
7164
|
-
let [_, v] = (0, import_react.useState)(""), [y, b] = (0, import_react.useState)(e18.config), [
|
|
7165
|
-
Object.keys(e18.config).some((_2) => e18.config[_2] !==
|
|
7166
|
-
let
|
|
7167
|
-
|
|
7168
|
-
let
|
|
7164
|
+
let [_, v] = (0, import_react.useState)(""), [y, b] = (0, import_react.useState)(e18.config), [C, w] = (0, import_react.useState)(e18.config), [T, E] = (0, import_react.useState)(void 0), D = (0, import_react.useRef)(null), O = (0, import_react.useRef)(null), k = (0, import_react.useRef)(null), A = (0, import_react.useRef)(null);
|
|
7165
|
+
Object.keys(e18.config).some((_2) => e18.config[_2] !== C[_2]) && (b(e18.config), w(e18.config));
|
|
7166
|
+
let j = (0, import_react.useRef)(y);
|
|
7167
|
+
j.current = y;
|
|
7168
|
+
let M = (0, import_react.useRef)({
|
|
7169
7169
|
backendMessageId: null,
|
|
7170
7170
|
frontendMessageIndex: null
|
|
7171
|
-
}),
|
|
7171
|
+
}), N = (0, import_react.useRef)(null), { data: F } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), I = e18.value.length > 0 ? e18.value : F, { messages: L, sendMessage: R, setMessages: z, status: B, stop: V, error: H, regenerate: U, clearError: W } = useChat({
|
|
7172
7172
|
transport: new DefaultChatTransport({ fetch: async (_2, v2) => {
|
|
7173
7173
|
var _a2;
|
|
7174
7174
|
if (v2 === void 0) return fetch(_2);
|
|
7175
|
-
let y2 = JSON.parse(v2.body), b2 = v2.signal,
|
|
7176
|
-
max_tokens:
|
|
7177
|
-
temperature:
|
|
7178
|
-
top_p:
|
|
7179
|
-
top_k:
|
|
7180
|
-
frequency_penalty:
|
|
7181
|
-
presence_penalty:
|
|
7175
|
+
let y2 = JSON.parse(v2.body), b2 = v2.signal, x = {
|
|
7176
|
+
max_tokens: j.current.max_tokens,
|
|
7177
|
+
temperature: j.current.temperature,
|
|
7178
|
+
top_p: j.current.top_p,
|
|
7179
|
+
top_k: j.current.top_k,
|
|
7180
|
+
frequency_penalty: j.current.frequency_penalty,
|
|
7181
|
+
presence_penalty: j.current.presence_penalty
|
|
7182
7182
|
};
|
|
7183
7183
|
try {
|
|
7184
7184
|
let _3 = y2.messages.map((e19) => {
|
|
@@ -7189,32 +7189,32 @@ const Chatbot = (e18) => {
|
|
|
7189
7189
|
};
|
|
7190
7190
|
}), v3 = new ReadableStream({
|
|
7191
7191
|
start(e19) {
|
|
7192
|
-
|
|
7192
|
+
N.current = e19;
|
|
7193
7193
|
let _4 = () => {
|
|
7194
7194
|
try {
|
|
7195
7195
|
e19.close();
|
|
7196
7196
|
} catch (e20) {
|
|
7197
7197
|
Logger.debug("Controller may already be closed", { error: e20 });
|
|
7198
7198
|
}
|
|
7199
|
-
|
|
7199
|
+
N.current = null;
|
|
7200
7200
|
};
|
|
7201
7201
|
return b2 == null ? void 0 : b2.addEventListener("abort", _4), () => {
|
|
7202
7202
|
b2 == null ? void 0 : b2.removeEventListener("abort", _4);
|
|
7203
7203
|
};
|
|
7204
7204
|
},
|
|
7205
7205
|
cancel() {
|
|
7206
|
-
|
|
7206
|
+
N.current = null;
|
|
7207
7207
|
}
|
|
7208
7208
|
});
|
|
7209
7209
|
return e18.send_prompt({
|
|
7210
7210
|
messages: _3,
|
|
7211
|
-
config:
|
|
7211
|
+
config: x
|
|
7212
7212
|
}).catch((e19) => {
|
|
7213
7213
|
var _a3;
|
|
7214
|
-
(_a3 =
|
|
7214
|
+
(_a3 = N.current) == null ? void 0 : _a3.error(e19), N.current = null;
|
|
7215
7215
|
}), createUIMessageStreamResponse({ stream: v3 });
|
|
7216
7216
|
} catch (e19) {
|
|
7217
|
-
if (
|
|
7217
|
+
if (M.current = {
|
|
7218
7218
|
backendMessageId: null,
|
|
7219
7219
|
frontendMessageIndex: null
|
|
7220
7220
|
}, e19 instanceof Error && e19.name === "AbortError") return new Response("Aborted", { status: 499 });
|
|
@@ -7222,15 +7222,15 @@ const Chatbot = (e18) => {
|
|
|
7222
7222
|
return new Response(_3, { status: 400 });
|
|
7223
7223
|
}
|
|
7224
7224
|
} }),
|
|
7225
|
-
messages:
|
|
7225
|
+
messages: I,
|
|
7226
7226
|
onFinish: (_2) => {
|
|
7227
|
-
|
|
7227
|
+
E(void 0), D.current && (D.current.value = ""), Logger.debug("Finished streaming message:", _2), M.current = {
|
|
7228
7228
|
backendMessageId: null,
|
|
7229
7229
|
frontendMessageIndex: null
|
|
7230
7230
|
}, e18.setValue(_2.messages);
|
|
7231
7231
|
},
|
|
7232
7232
|
onError: (e19) => {
|
|
7233
|
-
Logger.error("An error occurred:", e19),
|
|
7233
|
+
Logger.error("An error occurred:", e19), M.current = {
|
|
7234
7234
|
backendMessageId: null,
|
|
7235
7235
|
frontendMessageIndex: null
|
|
7236
7236
|
};
|
|
@@ -7239,34 +7239,34 @@ const Chatbot = (e18) => {
|
|
|
7239
7239
|
useEventListener(e18.host, MarimoIncomingMessageEvent.TYPE, (e19) => {
|
|
7240
7240
|
let _2 = ChatMessageIncomingSchema.safeParse(e19.detail.message);
|
|
7241
7241
|
if (!_2.success) return;
|
|
7242
|
-
let v2 = _2.data, y2 =
|
|
7243
|
-
y2 && (v2.content && y2.enqueue(v2.content), v2.is_final && (y2.close(),
|
|
7242
|
+
let v2 = _2.data, y2 = N.current;
|
|
7243
|
+
y2 && (v2.content && y2.enqueue(v2.content), v2.is_final && (y2.close(), N.current = null));
|
|
7244
7244
|
});
|
|
7245
|
-
let
|
|
7246
|
-
let v2 =
|
|
7245
|
+
let G = B === "submitted" || B === "streaming", K = (_2) => {
|
|
7246
|
+
let v2 = L.findIndex((e19) => e19.id === _2);
|
|
7247
7247
|
if (v2 !== -1) {
|
|
7248
|
-
let y2 =
|
|
7249
|
-
e18.delete_chat_message({ index: v2 }),
|
|
7248
|
+
let y2 = L.filter((e19) => e19.id !== _2);
|
|
7249
|
+
e18.delete_chat_message({ index: v2 }), z(y2), e18.setValue(y2);
|
|
7250
7250
|
}
|
|
7251
|
-
},
|
|
7251
|
+
}, q = Array.isArray(e18.allowAttachments) && e18.allowAttachments.length > 0 || e18.allowAttachments === true, Y = {
|
|
7252
7252
|
triggerCompletionRegex: /^\/(\w+)?/,
|
|
7253
7253
|
completions: e18.prompts.map((e19) => ({
|
|
7254
7254
|
label: `/${e19}`,
|
|
7255
7255
|
displayLabel: e19,
|
|
7256
7256
|
apply: e19
|
|
7257
7257
|
}))
|
|
7258
|
-
},
|
|
7258
|
+
}, Z = e18.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
|
|
7259
7259
|
(0, import_react.useEffect)(() => {
|
|
7260
7260
|
var _a2;
|
|
7261
|
-
(_a2 =
|
|
7262
|
-
top:
|
|
7261
|
+
(_a2 = A.current) == null ? void 0 : _a2.scrollTo({
|
|
7262
|
+
top: A.current.scrollHeight,
|
|
7263
7263
|
behavior: "smooth"
|
|
7264
7264
|
});
|
|
7265
|
-
}, [
|
|
7266
|
-
let
|
|
7267
|
-
if (
|
|
7268
|
-
let e19 =
|
|
7269
|
-
|
|
7265
|
+
}, [L.length, A]);
|
|
7266
|
+
let Q = (_a = k.current) == null ? void 0 : _a.view, $ = () => {
|
|
7267
|
+
if (Q) {
|
|
7268
|
+
let e19 = Q.state.doc.length;
|
|
7269
|
+
Q.dispatch({ changes: {
|
|
7270
7270
|
from: 0,
|
|
7271
7271
|
to: e19,
|
|
7272
7272
|
insert: ""
|
|
@@ -7283,18 +7283,18 @@ const Chatbot = (e18) => {
|
|
|
7283
7283
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7284
7284
|
variant: "text",
|
|
7285
7285
|
size: "icon",
|
|
7286
|
-
disabled:
|
|
7286
|
+
disabled: L.length === 0,
|
|
7287
7287
|
onClick: () => {
|
|
7288
|
-
|
|
7288
|
+
z([]), e18.setValue([]), e18.delete_chat_history({}), W();
|
|
7289
7289
|
},
|
|
7290
7290
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RotateCw, { className: "h-3 w-3" })
|
|
7291
7291
|
})
|
|
7292
7292
|
}),
|
|
7293
7293
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7294
7294
|
className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
|
|
7295
|
-
ref:
|
|
7295
|
+
ref: A,
|
|
7296
7296
|
children: [
|
|
7297
|
-
|
|
7297
|
+
L.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7298
7298
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
7299
7299
|
children: [
|
|
7300
7300
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-12 w-12 mb-4" }),
|
|
@@ -7308,16 +7308,16 @@ const Chatbot = (e18) => {
|
|
|
7308
7308
|
})
|
|
7309
7309
|
]
|
|
7310
7310
|
}),
|
|
7311
|
-
|
|
7311
|
+
L.map((e19, _2) => {
|
|
7312
7312
|
var _a2;
|
|
7313
|
-
let v2 = (_a2 = e19.parts) == null ? void 0 : _a2.filter((e20) => e20.type === "text").map((e20) => e20.text).join("\n"), y2 = _2 ===
|
|
7313
|
+
let v2 = (_a2 = e19.parts) == null ? void 0 : _a2.filter((e20) => e20.type === "text").map((e20) => e20.text).join("\n"), y2 = _2 === L.length - 1;
|
|
7314
7314
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7315
7315
|
className: cn("flex flex-col group gap-2", e19.role === "user" ? "items-end" : "items-start"),
|
|
7316
7316
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
7317
7317
|
className: `max-w-[80%] p-3 rounded-lg ${e19.role === "user" ? "bg-(--sky-11) text-(--slate-1) whitespace-pre-wrap" : "bg-(--slate-4) text-(--slate-12)"}`,
|
|
7318
7318
|
children: renderUIMessage({
|
|
7319
7319
|
message: e19,
|
|
7320
|
-
isStreamingReasoning:
|
|
7320
|
+
isStreamingReasoning: B === "streaming",
|
|
7321
7321
|
isLast: y2
|
|
7322
7322
|
})
|
|
7323
7323
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
@@ -7328,29 +7328,29 @@ const Chatbot = (e18) => {
|
|
|
7328
7328
|
buttonClassName: "text-xs text-(--slate-9) hover:text-(--slate-11)"
|
|
7329
7329
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
7330
7330
|
type: "button",
|
|
7331
|
-
onClick: () =>
|
|
7331
|
+
onClick: () => K(e19.id),
|
|
7332
7332
|
className: "text-xs text-(--slate-9) hover:text-(--slate-11)",
|
|
7333
7333
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "h-3 w-3 text-(--red-9)" })
|
|
7334
7334
|
})]
|
|
7335
7335
|
})]
|
|
7336
7336
|
}, `${e19.id}-${_2}`);
|
|
7337
7337
|
}),
|
|
7338
|
-
|
|
7338
|
+
G && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7339
7339
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
7340
7340
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: "small" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7341
7341
|
variant: "link",
|
|
7342
7342
|
size: "sm",
|
|
7343
|
-
onClick: () =>
|
|
7343
|
+
onClick: () => V(),
|
|
7344
7344
|
className: "text-(--red-9) hover:text-(--red-11)",
|
|
7345
7345
|
children: "Stop"
|
|
7346
7346
|
})]
|
|
7347
7347
|
}),
|
|
7348
|
-
|
|
7348
|
+
H && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7349
7349
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
7350
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, { error:
|
|
7350
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, { error: H }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7351
7351
|
variant: "outline",
|
|
7352
7352
|
size: "sm",
|
|
7353
|
-
onClick: () =>
|
|
7353
|
+
onClick: () => U(),
|
|
7354
7354
|
children: "Retry"
|
|
7355
7355
|
})]
|
|
7356
7356
|
})
|
|
@@ -7359,16 +7359,16 @@ const Chatbot = (e18) => {
|
|
|
7359
7359
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
7360
7360
|
onSubmit: async (v2) => {
|
|
7361
7361
|
if (v2.preventDefault(), e18.disabled) return;
|
|
7362
|
-
let y2 =
|
|
7363
|
-
|
|
7362
|
+
let y2 = T ? await convertToFileUIPart(T) : void 0;
|
|
7363
|
+
R({
|
|
7364
7364
|
role: "user",
|
|
7365
7365
|
parts: [{
|
|
7366
7366
|
type: "text",
|
|
7367
7367
|
text: _
|
|
7368
7368
|
}, ...y2 ?? []]
|
|
7369
|
-
}),
|
|
7369
|
+
}), $();
|
|
7370
7370
|
},
|
|
7371
|
-
ref:
|
|
7371
|
+
ref: O,
|
|
7372
7372
|
inert: e18.disabled || void 0,
|
|
7373
7373
|
className: cn("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", e18.disabled && "opacity-50 cursor-not-allowed"),
|
|
7374
7374
|
children: [
|
|
@@ -7380,66 +7380,66 @@ const Chatbot = (e18) => {
|
|
|
7380
7380
|
prompts: e18.prompts,
|
|
7381
7381
|
onSelect: (e19) => {
|
|
7382
7382
|
v(e19), requestAnimationFrame(() => {
|
|
7383
|
-
|
|
7383
|
+
Q == null ? void 0 : Q.focus(), moveToEndOfEditor(Q);
|
|
7384
7384
|
});
|
|
7385
7385
|
}
|
|
7386
7386
|
}),
|
|
7387
7387
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PromptInput, {
|
|
7388
7388
|
className: "rounded-sm mr-2",
|
|
7389
|
-
placeholder:
|
|
7389
|
+
placeholder: Z,
|
|
7390
7390
|
value: _,
|
|
7391
|
-
inputRef:
|
|
7391
|
+
inputRef: k,
|
|
7392
7392
|
maxHeight: e18.maxHeight ? `${e18.maxHeight / 2}px` : void 0,
|
|
7393
7393
|
onChange: v,
|
|
7394
7394
|
onSubmit: (e19, _2) => {
|
|
7395
7395
|
var _a2;
|
|
7396
|
-
_2.trim() && ((_a2 =
|
|
7396
|
+
_2.trim() && ((_a2 = O.current) == null ? void 0 : _a2.requestSubmit());
|
|
7397
7397
|
},
|
|
7398
7398
|
onClose: () => {
|
|
7399
7399
|
},
|
|
7400
|
-
additionalCompletions:
|
|
7400
|
+
additionalCompletions: Y
|
|
7401
7401
|
}),
|
|
7402
|
-
|
|
7403
|
-
title:
|
|
7402
|
+
T && T.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
7403
|
+
title: T[0].name,
|
|
7404
7404
|
className: "text-sm text-(--slate-11) truncate shrink-0 w-fit max-w-24",
|
|
7405
|
-
children:
|
|
7405
|
+
children: T[0].name
|
|
7406
7406
|
}),
|
|
7407
|
-
|
|
7408
|
-
title: [...
|
|
7407
|
+
T && T.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
7408
|
+
title: [...T].map((e19) => e19.name).join("\n"),
|
|
7409
7409
|
className: "text-sm text-(--slate-11) truncate shrink-0",
|
|
7410
|
-
children: [
|
|
7410
|
+
children: [T.length, " files"]
|
|
7411
7411
|
}),
|
|
7412
|
-
|
|
7412
|
+
T && T.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7413
7413
|
type: "button",
|
|
7414
7414
|
variant: "text",
|
|
7415
7415
|
size: "sm",
|
|
7416
7416
|
onClick: () => {
|
|
7417
|
-
|
|
7417
|
+
E(void 0), D.current && (D.current.value = "");
|
|
7418
7418
|
},
|
|
7419
7419
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-3" })
|
|
7420
7420
|
}),
|
|
7421
|
-
|
|
7421
|
+
q && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7422
7422
|
type: "button",
|
|
7423
7423
|
variant: "text",
|
|
7424
7424
|
size: "sm",
|
|
7425
7425
|
onClick: () => {
|
|
7426
7426
|
var _a2;
|
|
7427
|
-
return (_a2 =
|
|
7427
|
+
return (_a2 = D.current) == null ? void 0 : _a2.click();
|
|
7428
7428
|
},
|
|
7429
7429
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Paperclip, { className: "h-4" })
|
|
7430
7430
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
7431
7431
|
type: "file",
|
|
7432
|
-
ref:
|
|
7432
|
+
ref: D,
|
|
7433
7433
|
className: "hidden",
|
|
7434
7434
|
multiple: true,
|
|
7435
7435
|
accept: Array.isArray(e18.allowAttachments) ? e18.allowAttachments.join(",") : void 0,
|
|
7436
7436
|
onChange: (e19) => {
|
|
7437
|
-
e19.target.files &&
|
|
7437
|
+
e19.target.files && E([...e19.target.files]);
|
|
7438
7438
|
}
|
|
7439
7439
|
})] }),
|
|
7440
7440
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7441
7441
|
type: "submit",
|
|
7442
|
-
disabled:
|
|
7442
|
+
disabled: G || !_,
|
|
7443
7443
|
variant: "outline",
|
|
7444
7444
|
size: "xs",
|
|
7445
7445
|
className: "text-(--slate-11)",
|