@marimo-team/islands 0.22.5-dev6 → 0.22.5-dev8
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-DfR3sT9K.js → chat-ui-X5KPeHrU.js} +123 -123
- package/dist/main.js +243 -243
- package/dist/{process-output-BvkX_OeE.js → process-output-C0tmJosY.js} +85 -84
- package/package.json +1 -1
- package/src/components/editor/errors/traceback-modal.tsx +6 -5
- package/src/components/editor/output/MarimoErrorOutput.tsx +7 -14
- package/src/components/editor/output/MarimoTracebackOutput.tsx +4 -3
|
@@ -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-BRF7ryOP.js";
|
|
8
|
-
import {
|
|
8
|
+
import { $t as singleFacet, A as MarimoIncomingMessageEvent, Bt as PluralWord, C as contextToXml, D as AccordionContent, E as Accordion, Fn as Info, Gt as allTablesAtom, I as ChatBubbleIcon, In as File$1, Kt as dataSourceConnectionsAtom, Nn as LoaderCircle, O as AccordionItem, On as Wrench, Ot as createVariableInfoElement, Q as cellErrorsAtom, Rt as jotaiJsonStorage, S as Sections, Sn as Anchor2, T as AIContextRegistry, U as deserializeBlob, Vn as CircleX, W as base64ToDataURL, Yt as getRequestClient, Z as renderHTML, a as toPng, bn as atomWithStorage, d as Spinner, f as Popover, g as isOutputEmpty, h as PopoverTrigger, in as ZodLocalStorage, jt as moveToEndOfEditor, k as AccordionTrigger, kn as Trash2, ln as CellOutputId, m as PopoverContent, n as blobToString, nt as notebookAtom, o as MarkdownRenderer, qt as getTableType, t as processOutput, w as AIContextProvider, x as Boosts, xt as displayCellName, y as DatasourceContextProvider, zt as variablesAtom } from "./process-output-C0tmJosY.js";
|
|
9
9
|
import "./chunk-5FQGJX7Z-C428iZBW.js";
|
|
10
10
|
import { u as createLucideIcon } from "./dist-D56NKWim.js";
|
|
11
11
|
import { C as logNever, I as X, n as Strings, t as Label } from "./label-CIR53v8V.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 D = S ? "Thinking" : "View reasoning", O;
|
|
6359
|
+
_[1] !== v.length || _[2] !== D ? (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
|
+
D,
|
|
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] = D, _[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",
|
|
@@ -6382,11 +6382,11 @@ const ReasoningAccordion = (e18) => {
|
|
|
6382
6382
|
})
|
|
6383
6383
|
}), _[4] = v, _[5] = k);
|
|
6384
6384
|
let A;
|
|
6385
|
-
_[6] !==
|
|
6385
|
+
_[6] !== O || _[7] !== k ? (A = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AccordionItem, {
|
|
6386
6386
|
value: "reasoning",
|
|
6387
6387
|
className: "border-0",
|
|
6388
|
-
children: [
|
|
6389
|
-
}), _[6] =
|
|
6388
|
+
children: [O, k]
|
|
6389
|
+
}), _[6] = O, _[7] = k, _[8] = A) : A = _[8];
|
|
6390
6390
|
let j;
|
|
6391
6391
|
return _[9] !== x || _[10] !== C || _[11] !== A ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
|
|
6392
6392
|
type: "single",
|
|
@@ -6411,36 +6411,36 @@ 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 O;
|
|
6415
|
+
_[3] === e19 ? O = _[4] : (O = /* @__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] = O);
|
|
6419
|
+
let k;
|
|
6420
|
+
_[5] === b ? k = _[6] : (k = 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] = k);
|
|
6424
|
+
let A;
|
|
6425
|
+
_[7] !== O || _[8] !== k ? (A = /* @__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: [O, k]
|
|
6430
6430
|
})]
|
|
6431
|
-
}), _[7] =
|
|
6432
|
-
let
|
|
6433
|
-
_[10] === w ?
|
|
6431
|
+
}), _[7] = O, _[8] = k, _[9] = A) : A = _[9];
|
|
6432
|
+
let j;
|
|
6433
|
+
_[10] === w ? j = _[11] : (j = w && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6434
6434
|
className: "flex items-start gap-2",
|
|
6435
6435
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "h-3 w-3 text-[var(--blue-11)] mt-0.5 flex-shrink-0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6436
6436
|
className: "text-xs text-foreground",
|
|
6437
6437
|
children: w
|
|
6438
6438
|
})]
|
|
6439
|
-
}), _[10] = w, _[11] =
|
|
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
|
-
k,
|
|
6443
6442
|
A,
|
|
6443
|
+
j,
|
|
6444
6444
|
T && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6445
6445
|
className: "space-y-3",
|
|
6446
6446
|
children: Object.entries(T).map(_temp$1)
|
|
@@ -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:
|
|
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, D = x === void 0 ? 0 : x, O = S === "output-available" && (y || b), k = b ? "error" : O ? "success" : "loading", A;
|
|
6490
|
+
_[0] === k ? A = _[1] : (A = () => {
|
|
6491
|
+
switch (k) {
|
|
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,16 +6498,16 @@ 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
|
|
6505
|
-
_[6] ===
|
|
6506
|
-
let
|
|
6507
|
-
_[8] !==
|
|
6501
|
+
}, _[0] = k, _[1] = A);
|
|
6502
|
+
let j = A, F;
|
|
6503
|
+
_[2] !== b || _[3] !== O || _[4] !== k ? (F = () => k === "loading" ? "Running" : b ? "Failed" : O ? "Done" : "Tool call", _[2] = b, _[3] = O, _[4] = k, _[5] = F) : F = _[5];
|
|
6504
|
+
let I = F, L = `tool-${D}`, R;
|
|
6505
|
+
_[6] === C ? R = _[7] : (R = cn("w-full", C), _[6] = C, _[7] = R);
|
|
6506
|
+
let z = k === "error" && "text-[var(--red-11)]/80", B = k === "success" && "text-[var(--grass-11)]/80", V;
|
|
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
6508
|
let U;
|
|
6509
|
-
_[11] ===
|
|
6510
|
-
let W =
|
|
6509
|
+
_[11] === j ? U = _[12] : (U = j(), _[11] = j, _[12] = U);
|
|
6510
|
+
let W = I(), G;
|
|
6511
6511
|
_[13] === v ? G = _[14] : (G = formatToolName(v), _[13] = v, _[14] = G);
|
|
6512
6512
|
let K;
|
|
6513
6513
|
_[15] === G ? K = _[16] : (K = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
|
|
@@ -6525,15 +6525,15 @@ const ToolCallAccordion = (e18) => {
|
|
|
6525
6525
|
]
|
|
6526
6526
|
}), _[17] = W, _[18] = K, _[19] = U, _[20] = q) : q = _[20];
|
|
6527
6527
|
let J;
|
|
6528
|
-
_[21] !== q || _[22] !==
|
|
6529
|
-
className:
|
|
6528
|
+
_[21] !== q || _[22] !== V ? (J = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
|
|
6529
|
+
className: V,
|
|
6530
6530
|
children: q
|
|
6531
|
-
}), _[21] = q, _[22] =
|
|
6531
|
+
}), _[21] = q, _[22] = V, _[23] = J) : J = _[23];
|
|
6532
6532
|
let Y;
|
|
6533
|
-
_[24] !== b || _[25] !==
|
|
6533
|
+
_[24] !== b || _[25] !== O || _[26] !== w || _[27] !== y ? (Y = O && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6534
6534
|
className: "space-y-3",
|
|
6535
6535
|
children: [
|
|
6536
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input:
|
|
6536
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: w }),
|
|
6537
6537
|
y != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultRenderer, { result: y }),
|
|
6538
6538
|
b && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6539
6539
|
className: "bg-[var(--red-2)] border border-[var(--red-6)] rounded-lg p-3",
|
|
@@ -6546,7 +6546,7 @@ const ToolCallAccordion = (e18) => {
|
|
|
6546
6546
|
})]
|
|
6547
6547
|
})
|
|
6548
6548
|
]
|
|
6549
|
-
}), _[24] = b, _[25] =
|
|
6549
|
+
}), _[24] = b, _[25] = O, _[26] = w, _[27] = y, _[28] = Y) : Y = _[28];
|
|
6550
6550
|
let Z;
|
|
6551
6551
|
_[29] === Y ? Z = _[30] : (Z = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
|
|
6552
6552
|
className: "py-2 px-2",
|
|
@@ -6559,12 +6559,12 @@ const ToolCallAccordion = (e18) => {
|
|
|
6559
6559
|
children: [J, Z]
|
|
6560
6560
|
}), _[31] = J, _[32] = Z, _[33] = Q) : Q = _[33];
|
|
6561
6561
|
let $;
|
|
6562
|
-
return _[34] !== Q || _[35] !==
|
|
6562
|
+
return _[34] !== Q || _[35] !== L || _[36] !== R ? ($ = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Accordion, {
|
|
6563
6563
|
type: "single",
|
|
6564
6564
|
collapsible: true,
|
|
6565
|
-
className:
|
|
6565
|
+
className: R,
|
|
6566
6566
|
children: Q
|
|
6567
|
-
},
|
|
6567
|
+
}, L), _[34] = Q, _[35] = L, _[36] = R, _[37] = $) : $ = _[37], $;
|
|
6568
6568
|
};
|
|
6569
6569
|
function formatToolName(e18) {
|
|
6570
6570
|
return e18.replace("tool-", "");
|
|
@@ -7160,24 +7160,24 @@ var import_compiler_runtime = require_compiler_runtime(), PopoverAnchor = Anchor
|
|
|
7160
7160
|
});
|
|
7161
7161
|
const Chatbot = (e18) => {
|
|
7162
7162
|
var _a;
|
|
7163
|
-
let [_, v] = (0, import_react.useState)(""), [y, b] = (0, import_react.useState)(e18.config), [
|
|
7164
|
-
Object.keys(e18.config).some((_2) => e18.config[_2] !==
|
|
7165
|
-
let
|
|
7166
|
-
|
|
7167
|
-
let
|
|
7163
|
+
let [_, v] = (0, import_react.useState)(""), [y, b] = (0, import_react.useState)(e18.config), [x, C] = (0, import_react.useState)(e18.config), [w, T] = (0, import_react.useState)(void 0), E = (0, import_react.useRef)(null), D = (0, import_react.useRef)(null), O = (0, import_react.useRef)(null), k = (0, import_react.useRef)(null);
|
|
7164
|
+
Object.keys(e18.config).some((_2) => e18.config[_2] !== x[_2]) && (b(e18.config), C(e18.config));
|
|
7165
|
+
let A = (0, import_react.useRef)(y);
|
|
7166
|
+
A.current = y;
|
|
7167
|
+
let j = (0, import_react.useRef)({
|
|
7168
7168
|
backendMessageId: null,
|
|
7169
7169
|
frontendMessageIndex: null
|
|
7170
|
-
}),
|
|
7170
|
+
}), M = (0, import_react.useRef)(null), { data: N } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), P = e18.value.length > 0 ? e18.value : N, { messages: F, sendMessage: I, setMessages: L, status: R, stop: z, error: B, regenerate: V, clearError: H } = useChat({
|
|
7171
7171
|
transport: new DefaultChatTransport({ fetch: async (_2, v2) => {
|
|
7172
7172
|
var _a2;
|
|
7173
7173
|
if (v2 === void 0) return fetch(_2);
|
|
7174
|
-
let y2 = JSON.parse(v2.body), b2 = v2.signal,
|
|
7175
|
-
max_tokens:
|
|
7176
|
-
temperature:
|
|
7177
|
-
top_p:
|
|
7178
|
-
top_k:
|
|
7179
|
-
frequency_penalty:
|
|
7180
|
-
presence_penalty:
|
|
7174
|
+
let y2 = JSON.parse(v2.body), b2 = v2.signal, x2 = {
|
|
7175
|
+
max_tokens: A.current.max_tokens,
|
|
7176
|
+
temperature: A.current.temperature,
|
|
7177
|
+
top_p: A.current.top_p,
|
|
7178
|
+
top_k: A.current.top_k,
|
|
7179
|
+
frequency_penalty: A.current.frequency_penalty,
|
|
7180
|
+
presence_penalty: A.current.presence_penalty
|
|
7181
7181
|
};
|
|
7182
7182
|
try {
|
|
7183
7183
|
let _3 = y2.messages.map((e19) => {
|
|
@@ -7188,32 +7188,32 @@ const Chatbot = (e18) => {
|
|
|
7188
7188
|
};
|
|
7189
7189
|
}), v3 = new ReadableStream({
|
|
7190
7190
|
start(e19) {
|
|
7191
|
-
|
|
7191
|
+
M.current = e19;
|
|
7192
7192
|
let _4 = () => {
|
|
7193
7193
|
try {
|
|
7194
7194
|
e19.close();
|
|
7195
7195
|
} catch (e20) {
|
|
7196
7196
|
Logger.debug("Controller may already be closed", { error: e20 });
|
|
7197
7197
|
}
|
|
7198
|
-
|
|
7198
|
+
M.current = null;
|
|
7199
7199
|
};
|
|
7200
7200
|
return b2 == null ? void 0 : b2.addEventListener("abort", _4), () => {
|
|
7201
7201
|
b2 == null ? void 0 : b2.removeEventListener("abort", _4);
|
|
7202
7202
|
};
|
|
7203
7203
|
},
|
|
7204
7204
|
cancel() {
|
|
7205
|
-
|
|
7205
|
+
M.current = null;
|
|
7206
7206
|
}
|
|
7207
7207
|
});
|
|
7208
7208
|
return e18.send_prompt({
|
|
7209
7209
|
messages: _3,
|
|
7210
|
-
config:
|
|
7210
|
+
config: x2
|
|
7211
7211
|
}).catch((e19) => {
|
|
7212
7212
|
var _a3;
|
|
7213
|
-
(_a3 =
|
|
7213
|
+
(_a3 = M.current) == null ? void 0 : _a3.error(e19), M.current = null;
|
|
7214
7214
|
}), createUIMessageStreamResponse({ stream: v3 });
|
|
7215
7215
|
} catch (e19) {
|
|
7216
|
-
if (
|
|
7216
|
+
if (j.current = {
|
|
7217
7217
|
backendMessageId: null,
|
|
7218
7218
|
frontendMessageIndex: null
|
|
7219
7219
|
}, e19 instanceof Error && e19.name === "AbortError") return new Response("Aborted", { status: 499 });
|
|
@@ -7221,15 +7221,15 @@ const Chatbot = (e18) => {
|
|
|
7221
7221
|
return new Response(_3, { status: 400 });
|
|
7222
7222
|
}
|
|
7223
7223
|
} }),
|
|
7224
|
-
messages:
|
|
7224
|
+
messages: P,
|
|
7225
7225
|
onFinish: (_2) => {
|
|
7226
|
-
|
|
7226
|
+
T(void 0), E.current && (E.current.value = ""), Logger.debug("Finished streaming message:", _2), j.current = {
|
|
7227
7227
|
backendMessageId: null,
|
|
7228
7228
|
frontendMessageIndex: null
|
|
7229
7229
|
}, e18.setValue(_2.messages);
|
|
7230
7230
|
},
|
|
7231
7231
|
onError: (e19) => {
|
|
7232
|
-
Logger.error("An error occurred:", e19),
|
|
7232
|
+
Logger.error("An error occurred:", e19), j.current = {
|
|
7233
7233
|
backendMessageId: null,
|
|
7234
7234
|
frontendMessageIndex: null
|
|
7235
7235
|
};
|
|
@@ -7238,34 +7238,34 @@ const Chatbot = (e18) => {
|
|
|
7238
7238
|
useEventListener(e18.host, MarimoIncomingMessageEvent.TYPE, (e19) => {
|
|
7239
7239
|
let _2 = ChatMessageIncomingSchema.safeParse(e19.detail.message);
|
|
7240
7240
|
if (!_2.success) return;
|
|
7241
|
-
let v2 = _2.data, y2 =
|
|
7242
|
-
y2 && (v2.content && y2.enqueue(v2.content), v2.is_final && (y2.close(),
|
|
7241
|
+
let v2 = _2.data, y2 = M.current;
|
|
7242
|
+
y2 && (v2.content && y2.enqueue(v2.content), v2.is_final && (y2.close(), M.current = null));
|
|
7243
7243
|
});
|
|
7244
|
-
let
|
|
7245
|
-
let v2 =
|
|
7244
|
+
let U = R === "submitted" || R === "streaming", W = (_2) => {
|
|
7245
|
+
let v2 = F.findIndex((e19) => e19.id === _2);
|
|
7246
7246
|
if (v2 !== -1) {
|
|
7247
|
-
let y2 =
|
|
7248
|
-
e18.delete_chat_message({ index: v2 }),
|
|
7247
|
+
let y2 = F.filter((e19) => e19.id !== _2);
|
|
7248
|
+
e18.delete_chat_message({ index: v2 }), L(y2), e18.setValue(y2);
|
|
7249
7249
|
}
|
|
7250
|
-
},
|
|
7250
|
+
}, G = Array.isArray(e18.allowAttachments) && e18.allowAttachments.length > 0 || e18.allowAttachments === true, K = {
|
|
7251
7251
|
triggerCompletionRegex: /^\/(\w+)?/,
|
|
7252
7252
|
completions: e18.prompts.map((e19) => ({
|
|
7253
7253
|
label: `/${e19}`,
|
|
7254
7254
|
displayLabel: e19,
|
|
7255
7255
|
apply: e19
|
|
7256
7256
|
}))
|
|
7257
|
-
},
|
|
7257
|
+
}, q = e18.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
|
|
7258
7258
|
(0, import_react.useEffect)(() => {
|
|
7259
7259
|
var _a2;
|
|
7260
|
-
(_a2 =
|
|
7261
|
-
top:
|
|
7260
|
+
(_a2 = k.current) == null ? void 0 : _a2.scrollTo({
|
|
7261
|
+
top: k.current.scrollHeight,
|
|
7262
7262
|
behavior: "smooth"
|
|
7263
7263
|
});
|
|
7264
|
-
}, [
|
|
7265
|
-
let
|
|
7266
|
-
if (
|
|
7267
|
-
let e19 =
|
|
7268
|
-
|
|
7264
|
+
}, [F.length, k]);
|
|
7265
|
+
let Y = (_a = O.current) == null ? void 0 : _a.view, Z = () => {
|
|
7266
|
+
if (Y) {
|
|
7267
|
+
let e19 = Y.state.doc.length;
|
|
7268
|
+
Y.dispatch({ changes: {
|
|
7269
7269
|
from: 0,
|
|
7270
7270
|
to: e19,
|
|
7271
7271
|
insert: ""
|
|
@@ -7282,18 +7282,18 @@ const Chatbot = (e18) => {
|
|
|
7282
7282
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7283
7283
|
variant: "text",
|
|
7284
7284
|
size: "icon",
|
|
7285
|
-
disabled:
|
|
7285
|
+
disabled: F.length === 0,
|
|
7286
7286
|
onClick: () => {
|
|
7287
|
-
|
|
7287
|
+
L([]), e18.setValue([]), e18.delete_chat_history({}), H();
|
|
7288
7288
|
},
|
|
7289
7289
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RotateCw, { className: "h-3 w-3" })
|
|
7290
7290
|
})
|
|
7291
7291
|
}),
|
|
7292
7292
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7293
7293
|
className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
|
|
7294
|
-
ref:
|
|
7294
|
+
ref: k,
|
|
7295
7295
|
children: [
|
|
7296
|
-
|
|
7296
|
+
F.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7297
7297
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
7298
7298
|
children: [
|
|
7299
7299
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-12 w-12 mb-4" }),
|
|
@@ -7307,16 +7307,16 @@ const Chatbot = (e18) => {
|
|
|
7307
7307
|
})
|
|
7308
7308
|
]
|
|
7309
7309
|
}),
|
|
7310
|
-
|
|
7310
|
+
F.map((e19, _2) => {
|
|
7311
7311
|
var _a2;
|
|
7312
|
-
let v2 = (_a2 = e19.parts) == null ? void 0 : _a2.filter((e20) => e20.type === "text").map((e20) => e20.text).join("\n"), y2 = _2 ===
|
|
7312
|
+
let v2 = (_a2 = e19.parts) == null ? void 0 : _a2.filter((e20) => e20.type === "text").map((e20) => e20.text).join("\n"), y2 = _2 === F.length - 1;
|
|
7313
7313
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7314
7314
|
className: cn("flex flex-col group gap-2", e19.role === "user" ? "items-end" : "items-start"),
|
|
7315
7315
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
7316
7316
|
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)"}`,
|
|
7317
7317
|
children: renderUIMessage({
|
|
7318
7318
|
message: e19,
|
|
7319
|
-
isStreamingReasoning:
|
|
7319
|
+
isStreamingReasoning: R === "streaming",
|
|
7320
7320
|
isLast: y2
|
|
7321
7321
|
})
|
|
7322
7322
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
@@ -7327,29 +7327,29 @@ const Chatbot = (e18) => {
|
|
|
7327
7327
|
buttonClassName: "text-xs text-(--slate-9) hover:text-(--slate-11)"
|
|
7328
7328
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
7329
7329
|
type: "button",
|
|
7330
|
-
onClick: () =>
|
|
7330
|
+
onClick: () => W(e19.id),
|
|
7331
7331
|
className: "text-xs text-(--slate-9) hover:text-(--slate-11)",
|
|
7332
7332
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "h-3 w-3 text-(--red-9)" })
|
|
7333
7333
|
})]
|
|
7334
7334
|
})]
|
|
7335
7335
|
}, `${e19.id}-${_2}`);
|
|
7336
7336
|
}),
|
|
7337
|
-
|
|
7337
|
+
U && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7338
7338
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
7339
7339
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: "small" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7340
7340
|
variant: "link",
|
|
7341
7341
|
size: "sm",
|
|
7342
|
-
onClick: () =>
|
|
7342
|
+
onClick: () => z(),
|
|
7343
7343
|
className: "text-(--red-9) hover:text-(--red-11)",
|
|
7344
7344
|
children: "Stop"
|
|
7345
7345
|
})]
|
|
7346
7346
|
}),
|
|
7347
|
-
|
|
7347
|
+
B && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7348
7348
|
className: "flex items-center justify-center space-x-2 mb-4",
|
|
7349
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, { error:
|
|
7349
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, { error: B }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7350
7350
|
variant: "outline",
|
|
7351
7351
|
size: "sm",
|
|
7352
|
-
onClick: () =>
|
|
7352
|
+
onClick: () => V(),
|
|
7353
7353
|
children: "Retry"
|
|
7354
7354
|
})]
|
|
7355
7355
|
})
|
|
@@ -7358,16 +7358,16 @@ const Chatbot = (e18) => {
|
|
|
7358
7358
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
7359
7359
|
onSubmit: async (v2) => {
|
|
7360
7360
|
if (v2.preventDefault(), e18.disabled) return;
|
|
7361
|
-
let y2 =
|
|
7362
|
-
|
|
7361
|
+
let y2 = w ? await convertToFileUIPart(w) : void 0;
|
|
7362
|
+
I({
|
|
7363
7363
|
role: "user",
|
|
7364
7364
|
parts: [{
|
|
7365
7365
|
type: "text",
|
|
7366
7366
|
text: _
|
|
7367
7367
|
}, ...y2 ?? []]
|
|
7368
|
-
}),
|
|
7368
|
+
}), Z();
|
|
7369
7369
|
},
|
|
7370
|
-
ref:
|
|
7370
|
+
ref: D,
|
|
7371
7371
|
inert: e18.disabled || void 0,
|
|
7372
7372
|
className: cn("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", e18.disabled && "opacity-50 cursor-not-allowed"),
|
|
7373
7373
|
children: [
|
|
@@ -7379,66 +7379,66 @@ const Chatbot = (e18) => {
|
|
|
7379
7379
|
prompts: e18.prompts,
|
|
7380
7380
|
onSelect: (e19) => {
|
|
7381
7381
|
v(e19), requestAnimationFrame(() => {
|
|
7382
|
-
|
|
7382
|
+
Y == null ? void 0 : Y.focus(), moveToEndOfEditor(Y);
|
|
7383
7383
|
});
|
|
7384
7384
|
}
|
|
7385
7385
|
}),
|
|
7386
7386
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PromptInput, {
|
|
7387
7387
|
className: "rounded-sm mr-2",
|
|
7388
|
-
placeholder:
|
|
7388
|
+
placeholder: q,
|
|
7389
7389
|
value: _,
|
|
7390
|
-
inputRef:
|
|
7390
|
+
inputRef: O,
|
|
7391
7391
|
maxHeight: e18.maxHeight ? `${e18.maxHeight / 2}px` : void 0,
|
|
7392
7392
|
onChange: v,
|
|
7393
7393
|
onSubmit: (e19, _2) => {
|
|
7394
7394
|
var _a2;
|
|
7395
|
-
_2.trim() && ((_a2 =
|
|
7395
|
+
_2.trim() && ((_a2 = D.current) == null ? void 0 : _a2.requestSubmit());
|
|
7396
7396
|
},
|
|
7397
7397
|
onClose: () => {
|
|
7398
7398
|
},
|
|
7399
|
-
additionalCompletions:
|
|
7399
|
+
additionalCompletions: K
|
|
7400
7400
|
}),
|
|
7401
|
-
|
|
7402
|
-
title:
|
|
7401
|
+
w && w.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
7402
|
+
title: w[0].name,
|
|
7403
7403
|
className: "text-sm text-(--slate-11) truncate shrink-0 w-fit max-w-24",
|
|
7404
|
-
children:
|
|
7404
|
+
children: w[0].name
|
|
7405
7405
|
}),
|
|
7406
|
-
|
|
7407
|
-
title: [...
|
|
7406
|
+
w && w.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
7407
|
+
title: [...w].map((e19) => e19.name).join("\n"),
|
|
7408
7408
|
className: "text-sm text-(--slate-11) truncate shrink-0",
|
|
7409
|
-
children: [
|
|
7409
|
+
children: [w.length, " files"]
|
|
7410
7410
|
}),
|
|
7411
|
-
|
|
7411
|
+
w && w.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7412
7412
|
type: "button",
|
|
7413
7413
|
variant: "text",
|
|
7414
7414
|
size: "sm",
|
|
7415
7415
|
onClick: () => {
|
|
7416
|
-
|
|
7416
|
+
T(void 0), E.current && (E.current.value = "");
|
|
7417
7417
|
},
|
|
7418
7418
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-3" })
|
|
7419
7419
|
}),
|
|
7420
|
-
|
|
7420
|
+
G && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7421
7421
|
type: "button",
|
|
7422
7422
|
variant: "text",
|
|
7423
7423
|
size: "sm",
|
|
7424
7424
|
onClick: () => {
|
|
7425
7425
|
var _a2;
|
|
7426
|
-
return (_a2 =
|
|
7426
|
+
return (_a2 = E.current) == null ? void 0 : _a2.click();
|
|
7427
7427
|
},
|
|
7428
7428
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Paperclip, { className: "h-4" })
|
|
7429
7429
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
7430
7430
|
type: "file",
|
|
7431
|
-
ref:
|
|
7431
|
+
ref: E,
|
|
7432
7432
|
className: "hidden",
|
|
7433
7433
|
multiple: true,
|
|
7434
7434
|
accept: Array.isArray(e18.allowAttachments) ? e18.allowAttachments.join(",") : void 0,
|
|
7435
7435
|
onChange: (e19) => {
|
|
7436
|
-
e19.target.files &&
|
|
7436
|
+
e19.target.files && T([...e19.target.files]);
|
|
7437
7437
|
}
|
|
7438
7438
|
})] }),
|
|
7439
7439
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
7440
7440
|
type: "submit",
|
|
7441
|
-
disabled:
|
|
7441
|
+
disabled: U || !_,
|
|
7442
7442
|
variant: "outline",
|
|
7443
7443
|
size: "xs",
|
|
7444
7444
|
className: "text-(--slate-11)",
|
|
@@ -7600,25 +7600,25 @@ var configDescriptions = {
|
|
|
7600
7600
|
className: "w-64 max-h-96 overflow-y-auto",
|
|
7601
7601
|
children: D
|
|
7602
7602
|
})] }) }), _[8] = D, _[9] = O);
|
|
7603
|
-
let k;
|
|
7604
|
-
_[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = () => x(false), _[10] = k) : k = _[10];
|
|
7605
7603
|
let A;
|
|
7606
|
-
_[
|
|
7604
|
+
_[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = () => x(false), _[10] = A) : A = _[10];
|
|
7605
|
+
let j;
|
|
7606
|
+
_[11] !== y || _[12] !== S ? (j = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContent, {
|
|
7607
7607
|
side: "right",
|
|
7608
7608
|
align: "end",
|
|
7609
7609
|
className: "min-w-80 px-2",
|
|
7610
7610
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PromptVariablesForm, {
|
|
7611
7611
|
prompt: S,
|
|
7612
|
-
onClose:
|
|
7612
|
+
onClose: A,
|
|
7613
7613
|
onSelect: y
|
|
7614
7614
|
})
|
|
7615
|
-
}), _[11] = y, _[12] = S, _[13] =
|
|
7615
|
+
}), _[11] = y, _[12] = S, _[13] = j) : j = _[13];
|
|
7616
7616
|
let M;
|
|
7617
|
-
return _[14] !== b || _[15] !== O || _[16] !==
|
|
7617
|
+
return _[14] !== b || _[15] !== O || _[16] !== j ? (M = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, {
|
|
7618
7618
|
open: b,
|
|
7619
7619
|
onOpenChange: x,
|
|
7620
|
-
children: [O,
|
|
7621
|
-
}), _[14] = b, _[15] = O, _[16] =
|
|
7620
|
+
children: [O, j]
|
|
7621
|
+
}), _[14] = b, _[15] = O, _[16] = j, _[17] = M) : M = _[17], M;
|
|
7622
7622
|
}, PromptVariablesForm = (e18) => {
|
|
7623
7623
|
let _ = (0, import_compiler_runtime.c)(32), { prompt: v, onClose: y, onSelect: b } = e18, x;
|
|
7624
7624
|
_[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = {}, _[0] = x) : x = _[0];
|