@marimo-team/islands 0.23.16-dev34 → 0.23.16-dev36
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-DuPGKU9z.js → chat-ui-DAPduOBU.js} +77 -77
- package/dist/{common-CZKqr-N4.js → common-Bj3GHNDa.js} +701 -709
- package/dist/{html-to-image-Bza3T2dl.js → html-to-image-CRnU7G8x.js} +5069 -5540
- package/dist/main.js +113 -113
- package/dist/{process-output-pCEXvnhG.js → process-output-CK1nZFgq.js} +1 -1
- package/dist/{reveal-component-CJHfXZXF.js → reveal-component-s04jmX79.js} +11 -11
- package/package.json +2 -3
- package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +25 -0
- package/src/components/editor/chrome/panels/logs-panel.tsx +12 -2
- package/src/core/cells/__tests__/cells.test.ts +12 -2
- package/src/core/cells/__tests__/logs.test.ts +5 -5
- package/src/core/cells/cells.ts +13 -0
- package/src/core/cells/document-changes.ts +1 -0
- package/src/core/cells/logs.ts +14 -4
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +396 -100
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +128 -540
- package/src/core/codemirror/copilot/language-server.ts +182 -70
- package/src/core/codemirror/copilot/transport.ts +15 -207
- package/src/core/codemirror/copilot/types.ts +9 -2
- package/src/core/codemirror/language/languages/python.ts +23 -11
- package/src/core/codemirror/lsp/__tests__/federated-lsp.test.ts +161 -0
- package/src/core/codemirror/lsp/__tests__/log-messages.test.ts +53 -0
- package/src/core/codemirror/lsp/__tests__/normalize-markdown-math.test.ts +25 -0
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +598 -156
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +112 -0
- package/src/core/codemirror/lsp/federated-lsp.ts +76 -23
- package/src/core/codemirror/lsp/log-messages.ts +37 -0
- package/src/core/codemirror/lsp/normalize-markdown-math.ts +8 -4
- package/src/core/codemirror/lsp/notebook-lsp.ts +220 -56
- package/src/core/codemirror/lsp/transports.ts +8 -1
- package/src/core/codemirror/lsp/types.ts +68 -8
- package/src/core/codemirror/lsp/utils.ts +14 -0
- package/src/core/lsp/__tests__/transport.test.ts +509 -337
- package/src/core/lsp/transport.ts +304 -132
- package/src/css/app/codemirror.css +16 -2
- package/src/stories/log-viewer.stories.tsx +12 -6
|
@@ -6,13 +6,13 @@ import { c as useEventListener, g as Logger, h as cn, t as Button } from "./butt
|
|
|
6
6
|
import { t as require_react } from "./react-DA-nE2FX.js";
|
|
7
7
|
import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
8
8
|
import { r as toast } from "./copy-DNq8q3zw.js";
|
|
9
|
-
import {
|
|
9
|
+
import { Bn as Info, Bt as PluralWord, C as Accordion, E as AccordionTrigger, En as Anchor2, F as base64ToDataURL, Ft as variablesAtom, Gt as allTablesAtom, H as renderHTML, Kn as CircleX, Kt as dataSourceConnectionsAtom, Mn as Wrench, Nn as Trash2, O as ChatBubbleIcon, Pt as jotaiJsonStorage, Q as notebookAtom, Rn as LoaderCircle, S as AIContextRegistry, T as AccordionItem, Un as ExternalLink, Vn as FileText, Yt as getRequestClient, b as contextToXml, c as Popover, d as PopoverTrigger, f as isOutputEmpty, g as formatDatasourceContextForCell, h as DatasourceContextProvider, ht as displayCellName, in as singleFacet, jt as generateUUID, kt as moveToEndOfEditor, ln as ZodLocalStorage, mn as CellOutputId, n as Spinner, nn as isMarimoErrorsMime, qt as getTableType, r as MarkdownRenderer, rn as isTracebackMime, st as parseHtmlContent, t as toPng, tn as isErrorMime, u as PopoverContent, v as Boosts, w as AccordionContent, wn as atomWithStorage, wt as createVariableInfoElement, x as AIContextProvider, y as Sections } from "./html-to-image-CRnU7G8x.js";
|
|
10
10
|
import "./chunk-5FQGJX7Z-B9WoXK1R.js";
|
|
11
11
|
import { u as createLucideIcon } from "./dist-DIlxLFXG.js";
|
|
12
12
|
import { C as logNever, I as X, R as ChevronDown, t as Strings } from "./strings-DIy9NAmg.js";
|
|
13
13
|
import { C as DropdownMenuTrigger, a as NumberField, f as DropdownMenu, h as DropdownMenuItem, p as DropdownMenuContent, r as Input } from "./input-C5K4VBvB.js";
|
|
14
14
|
import { p as isUrl, w as CircleQuestionMark } from "./toDate-CqhBWjvO.js";
|
|
15
|
-
import { a as MarimoIncomingMessageEvent, d as Square, f as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-
|
|
15
|
+
import { a as MarimoIncomingMessageEvent, d as Square, f as File$1, n as blobToString, t as processOutput, u as deserializeBlob } from "./process-output-CK1nZFgq.js";
|
|
16
16
|
import "./react-dom-BTJzcVJ9.js";
|
|
17
17
|
import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
|
|
18
18
|
import { A as looseObject, B as union, C as any, D as discriminatedUnion, E as custom, H as safeParseAsync, I as record, L as strictObject, M as never, N as number, O as lazy, P as object$1, R as string, S as _null, T as boolean, V as unknown, W as toJSONSchema, b as _enum, k as literal, w as array$1, x as _instanceof } from "./zod-BUcyXSdR.js";
|
|
@@ -6081,11 +6081,11 @@ function getCellErrorEntries(e18) {
|
|
|
6081
6081
|
if (!b || !isErrorMime(b.mimetype)) continue;
|
|
6082
6082
|
let x = parseCellErrorOutput(b);
|
|
6083
6083
|
if (!x) continue;
|
|
6084
|
-
let S = displayCellName(_[y].name, e19),
|
|
6084
|
+
let S = displayCellName(_[y].name, e19), C = _[y].lastCodeRun ?? _[y].code;
|
|
6085
6085
|
v.push({
|
|
6086
6086
|
cellId: y,
|
|
6087
6087
|
cellName: S,
|
|
6088
|
-
cellCode:
|
|
6088
|
+
cellCode: C,
|
|
6089
6089
|
errorData: x.errorData,
|
|
6090
6090
|
tracebackHtml: resolveTracebackHtml(x, h2.consoleOutputs)
|
|
6091
6091
|
});
|
|
@@ -6613,18 +6613,18 @@ const ReasoningAccordion = (e18) => {
|
|
|
6613
6613
|
if (!g && !b) return null;
|
|
6614
6614
|
let C = b ? "reasoning" : x, w;
|
|
6615
6615
|
h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BotMessageSquare, { className: "h-3 w-3" }), h[0] = w) : w = h[0];
|
|
6616
|
-
let
|
|
6617
|
-
h[1] !==
|
|
6616
|
+
let D = b ? "Thinking" : "View reasoning", O = g.length > 0 && ` (${g.length} chars)`, k;
|
|
6617
|
+
h[1] !== D || h[2] !== O ? (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionTrigger, {
|
|
6618
6618
|
className: "text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",
|
|
6619
6619
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
6620
6620
|
className: "flex items-center gap-2",
|
|
6621
6621
|
children: [
|
|
6622
6622
|
w,
|
|
6623
|
-
|
|
6623
|
+
D,
|
|
6624
6624
|
O
|
|
6625
6625
|
]
|
|
6626
6626
|
})
|
|
6627
|
-
}), h[1] =
|
|
6627
|
+
}), h[1] = D, h[2] = O, h[3] = k) : k = h[3];
|
|
6628
6628
|
let A;
|
|
6629
6629
|
h[4] === g ? A = h[5] : (A = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionContent, {
|
|
6630
6630
|
className: "pb-2 px-2",
|
|
@@ -6762,8 +6762,8 @@ const ToolErrorCard = (e18) => {
|
|
|
6762
6762
|
}), h[7] = A) : A = h[7];
|
|
6763
6763
|
let j;
|
|
6764
6764
|
h[8] === g ? j = h[9] : (j = formatToolName(g), h[8] = g, h[9] = j);
|
|
6765
|
-
let
|
|
6766
|
-
h[10] === j ?
|
|
6765
|
+
let N;
|
|
6766
|
+
h[10] === j ? N = h[11] : (N = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
6767
6767
|
className: "flex-1 text-left",
|
|
6768
6768
|
children: [
|
|
6769
6769
|
A,
|
|
@@ -6773,25 +6773,25 @@ const ToolErrorCard = (e18) => {
|
|
|
6773
6773
|
children: j
|
|
6774
6774
|
})
|
|
6775
6775
|
]
|
|
6776
|
-
}), h[10] = j, h[11] =
|
|
6777
|
-
let
|
|
6778
|
-
h[12] ===
|
|
6779
|
-
let F;
|
|
6780
|
-
h[14] === P ? F = h[15] : (F = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: P }), h[14] = P, h[15] = F);
|
|
6776
|
+
}), h[10] = j, h[11] = N);
|
|
6777
|
+
let P = S && "rotate-180", F;
|
|
6778
|
+
h[12] === P ? F = h[13] : (F = cn("h-3.5 w-3.5 shrink-0 transition-transform", P), h[12] = P, h[13] = F);
|
|
6781
6779
|
let I;
|
|
6782
|
-
h[
|
|
6780
|
+
h[14] === F ? I = h[15] : (I = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: F }), h[14] = F, h[15] = I);
|
|
6781
|
+
let L;
|
|
6782
|
+
h[16] !== S || h[17] !== I || h[18] !== N ? (L = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
6783
6783
|
type: "button",
|
|
6784
6784
|
onClick: O,
|
|
6785
6785
|
className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-(--red-11) hover:bg-(--red-3) rounded-md transition-colors",
|
|
6786
6786
|
"aria-expanded": S,
|
|
6787
6787
|
children: [
|
|
6788
6788
|
k,
|
|
6789
|
-
|
|
6790
|
-
|
|
6789
|
+
N,
|
|
6790
|
+
I
|
|
6791
6791
|
]
|
|
6792
|
-
}), h[16] = S, h[17] =
|
|
6793
|
-
let
|
|
6794
|
-
h[20] !== y || h[21] !== _ || h[22] !== S ? (
|
|
6792
|
+
}), h[16] = S, h[17] = I, h[18] = N, h[19] = L) : L = h[19];
|
|
6793
|
+
let R;
|
|
6794
|
+
h[20] !== y || h[21] !== _ || h[22] !== S ? (R = S && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6795
6795
|
className: "px-3 pb-3 space-y-3 border-t border-(--red-6)/40 pt-3",
|
|
6796
6796
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolArgsRenderer, { input: _ }), y && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
6797
6797
|
className: "text-xs font-semibold text-(--red-11) mb-1",
|
|
@@ -6800,12 +6800,12 @@ const ToolErrorCard = (e18) => {
|
|
|
6800
6800
|
className: "bg-(--red-2) border border-(--red-6) rounded p-2 text-xs text-(--red-11) leading-relaxed overflow-auto scrollbar-thin max-h-64 whitespace-pre-wrap",
|
|
6801
6801
|
children: y
|
|
6802
6802
|
})] })]
|
|
6803
|
-
}), h[20] = y, h[21] = _, h[22] = S, h[23] =
|
|
6804
|
-
let
|
|
6805
|
-
return h[24] !==
|
|
6803
|
+
}), h[20] = y, h[21] = _, h[22] = S, h[23] = R) : R = h[23];
|
|
6804
|
+
let z;
|
|
6805
|
+
return h[24] !== L || h[25] !== R || h[26] !== D ? (z = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6806
6806
|
className: D,
|
|
6807
|
-
children: [
|
|
6808
|
-
}), h[24] =
|
|
6807
|
+
children: [L, R]
|
|
6808
|
+
}), h[24] = L, h[25] = R, h[26] = D, h[27] = z) : z = h[27], z;
|
|
6809
6809
|
};
|
|
6810
6810
|
function _temp$3(e18) {
|
|
6811
6811
|
return !e18;
|
|
@@ -6824,44 +6824,44 @@ var SuccessResultSchema = looseObject({
|
|
|
6824
6824
|
}), PrettySuccessResult = (e18) => {
|
|
6825
6825
|
let h = (0, import_compiler_runtime$4.c)(12), { data: g } = e18, _;
|
|
6826
6826
|
if (h[0] !== g) {
|
|
6827
|
-
let { status: e19, auth_required: v, action_url: y, meta: b, next_steps: x, message: S, ...
|
|
6828
|
-
h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
6827
|
+
let { status: e19, auth_required: v, action_url: y, meta: b, next_steps: x, message: S, ...w } = g, T;
|
|
6828
|
+
h[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
6829
6829
|
className: "text-xs font-semibold text-muted-foreground",
|
|
6830
6830
|
children: "Tool Result"
|
|
6831
|
-
}), h[2] =
|
|
6832
|
-
let
|
|
6833
|
-
h[3] === e19 ?
|
|
6831
|
+
}), h[2] = T) : T = h[2];
|
|
6832
|
+
let E;
|
|
6833
|
+
h[3] === e19 ? E = h[4] : (E = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
6834
6834
|
className: "text-xs px-2 py-0.5 bg-(--grass-2) text-(--grass-11) rounded-full font-medium capitalize",
|
|
6835
6835
|
children: e19
|
|
6836
|
-
}), h[3] = e19, h[4] =
|
|
6837
|
-
let
|
|
6838
|
-
h[5] === v ?
|
|
6836
|
+
}), h[3] = e19, h[4] = E);
|
|
6837
|
+
let D;
|
|
6838
|
+
h[5] === v ? D = h[6] : (D = v && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
6839
6839
|
className: "text-xs px-2 py-0.5 bg-(--amber-2) text-(--amber-11) rounded-full",
|
|
6840
6840
|
children: "Auth Required"
|
|
6841
|
-
}), h[5] = v, h[6] =
|
|
6842
|
-
let
|
|
6843
|
-
h[7] !==
|
|
6841
|
+
}), h[5] = v, h[6] = D);
|
|
6842
|
+
let O;
|
|
6843
|
+
h[7] !== E || h[8] !== D ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6844
6844
|
className: "flex items-center justify-between",
|
|
6845
|
-
children: [
|
|
6845
|
+
children: [T, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6846
6846
|
className: "flex items-center gap-2",
|
|
6847
|
-
children: [
|
|
6847
|
+
children: [E, D]
|
|
6848
6848
|
})]
|
|
6849
|
-
}), h[7] =
|
|
6850
|
-
let
|
|
6851
|
-
h[10] === S ?
|
|
6849
|
+
}), h[7] = E, h[8] = D, h[9] = O) : O = h[9];
|
|
6850
|
+
let k;
|
|
6851
|
+
h[10] === S ? k = h[11] : (k = S && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6852
6852
|
className: "flex items-start gap-2",
|
|
6853
6853
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "h-3 w-3 text-(--blue-11) mt-0.5 shrink-0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6854
6854
|
className: "text-xs text-foreground",
|
|
6855
6855
|
children: S
|
|
6856
6856
|
})]
|
|
6857
|
-
}), h[10] = S, h[11] =
|
|
6857
|
+
}), h[10] = S, h[11] = k), _ = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
6858
6858
|
className: "flex flex-col gap-1.5",
|
|
6859
6859
|
children: [
|
|
6860
|
-
D,
|
|
6861
6860
|
O,
|
|
6862
|
-
|
|
6861
|
+
k,
|
|
6862
|
+
w && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
6863
6863
|
className: "space-y-3",
|
|
6864
|
-
children: Object.entries(
|
|
6864
|
+
children: Object.entries(w).map(_temp$2)
|
|
6865
6865
|
})
|
|
6866
6866
|
]
|
|
6867
6867
|
}), h[0] = g, h[1] = _;
|
|
@@ -6950,9 +6950,9 @@ function getTriggerToneClass(e18) {
|
|
|
6950
6950
|
}
|
|
6951
6951
|
}
|
|
6952
6952
|
const ToolHistoryRow = (e18) => {
|
|
6953
|
-
let h = (0, import_compiler_runtime$3.c)(34), { toolName: g, state: _, input: y, result: b, approval: x, index: S, className: C, isActive: w } = e18,
|
|
6953
|
+
let h = (0, import_compiler_runtime$3.c)(34), { toolName: g, state: _, input: y, result: b, approval: x, index: S, className: C, isActive: w } = e18, D = S === void 0 ? 0 : S, O = w === void 0 ? true : w, k;
|
|
6954
6954
|
h[0] !== O || h[1] !== _ ? (k = !O && PENDING_STATES.has(_), h[0] = O, h[1] = _, h[2] = k) : k = h[2];
|
|
6955
|
-
let A = k, j = `tool-${
|
|
6955
|
+
let A = k, j = `tool-${D}`, M;
|
|
6956
6956
|
h[3] === C ? M = h[4] : (M = cn("w-full", C), h[3] = C, h[4] = M);
|
|
6957
6957
|
let N;
|
|
6958
6958
|
h[5] !== A || h[6] !== _ ? (N = 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", A ? "text-muted-foreground" : getTriggerToneClass(_)), h[5] = A, h[6] = _, h[7] = N) : N = h[7];
|
|
@@ -7822,22 +7822,22 @@ function routeIncomingChatChunk(e18, h) {
|
|
|
7822
7822
|
}
|
|
7823
7823
|
const Chatbot = (e18) => {
|
|
7824
7824
|
var _a;
|
|
7825
|
-
let [h, b] = (0, import_react.useState)(""), [x, S] = (0, import_react.useState)(e18.config), [C, w] = (0, import_react.useState)(e18.config), [T,
|
|
7825
|
+
let [h, b] = (0, import_react.useState)(""), [x, S] = (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);
|
|
7826
7826
|
Object.keys(e18.config).some((h2) => e18.config[h2] !== C[h2]) && (S(e18.config), w(e18.config));
|
|
7827
|
-
let
|
|
7828
|
-
|
|
7829
|
-
let
|
|
7827
|
+
let j = (0, import_react.useRef)(x);
|
|
7828
|
+
j.current = x;
|
|
7829
|
+
let M = (0, import_react.useRef)(null), N = (0, import_react.useRef)(null), { data: P } = useAsyncData(async () => (await e18.get_chat_history({})).messages, []), I = e18.value.length > 0 ? e18.value : P, { messages: L, sendMessage: R, setMessages: z, status: B, stop: V, error: H, regenerate: U, clearError: W, addToolApprovalResponse: G } = useChat({
|
|
7830
7830
|
sendAutomaticallyWhen: ({ messages: e19 }) => hasPendingToolCalls(e19),
|
|
7831
7831
|
transport: new DefaultChatTransport({ fetch: async (h2, g) => {
|
|
7832
7832
|
var _a2;
|
|
7833
7833
|
if (g === void 0) return fetch(h2);
|
|
7834
7834
|
let v = JSON.parse(g.body), y = g.signal, b2 = {
|
|
7835
|
-
max_tokens:
|
|
7836
|
-
temperature:
|
|
7837
|
-
top_p:
|
|
7838
|
-
top_k:
|
|
7839
|
-
frequency_penalty:
|
|
7840
|
-
presence_penalty:
|
|
7835
|
+
max_tokens: j.current.max_tokens,
|
|
7836
|
+
temperature: j.current.temperature,
|
|
7837
|
+
top_p: j.current.top_p,
|
|
7838
|
+
top_k: j.current.top_k,
|
|
7839
|
+
frequency_penalty: j.current.frequency_penalty,
|
|
7840
|
+
presence_penalty: j.current.presence_penalty
|
|
7841
7841
|
};
|
|
7842
7842
|
try {
|
|
7843
7843
|
let h3 = v.messages.map((e19) => {
|
|
@@ -7848,14 +7848,14 @@ const Chatbot = (e18) => {
|
|
|
7848
7848
|
};
|
|
7849
7849
|
}), g2 = generateUUID(), x2 = new ReadableStream({
|
|
7850
7850
|
start(h4) {
|
|
7851
|
-
|
|
7851
|
+
M.current = h4, N.current = g2;
|
|
7852
7852
|
let v2 = () => {
|
|
7853
7853
|
try {
|
|
7854
7854
|
h4.close();
|
|
7855
7855
|
} catch (e19) {
|
|
7856
7856
|
Logger.debug("Controller may already be closed", { error: e19 });
|
|
7857
7857
|
}
|
|
7858
|
-
|
|
7858
|
+
M.current = null, N.current = null, e18.cancel_prompt({ request_id: g2 }).catch((e19) => {
|
|
7859
7859
|
Logger.debug("cancel_prompt failed", { error: e19 });
|
|
7860
7860
|
});
|
|
7861
7861
|
};
|
|
@@ -7864,7 +7864,7 @@ const Chatbot = (e18) => {
|
|
|
7864
7864
|
};
|
|
7865
7865
|
},
|
|
7866
7866
|
cancel() {
|
|
7867
|
-
|
|
7867
|
+
M.current = null, N.current = null;
|
|
7868
7868
|
}
|
|
7869
7869
|
});
|
|
7870
7870
|
return e18.send_prompt({
|
|
@@ -7873,7 +7873,7 @@ const Chatbot = (e18) => {
|
|
|
7873
7873
|
config: b2
|
|
7874
7874
|
}).catch((e19) => {
|
|
7875
7875
|
var _a3;
|
|
7876
|
-
(_a3 =
|
|
7876
|
+
(_a3 = M.current) == null ? void 0 : _a3.error(e19), M.current = null, N.current = null;
|
|
7877
7877
|
}), createUIMessageStreamResponse({ stream: x2 });
|
|
7878
7878
|
} catch (e19) {
|
|
7879
7879
|
if (e19 instanceof Error && e19.name === "AbortError") return new Response("Aborted", { status: 499 });
|
|
@@ -7883,7 +7883,7 @@ const Chatbot = (e18) => {
|
|
|
7883
7883
|
} }),
|
|
7884
7884
|
messages: I,
|
|
7885
7885
|
onFinish: (h2) => {
|
|
7886
|
-
|
|
7886
|
+
E(void 0), D.current && (D.current.value = ""), Logger.debug("Finished streaming message:", h2), e18.setValue(h2.messages);
|
|
7887
7887
|
},
|
|
7888
7888
|
onError: (e19) => {
|
|
7889
7889
|
Logger.error("An error occurred:", e19);
|
|
@@ -7892,8 +7892,8 @@ const Chatbot = (e18) => {
|
|
|
7892
7892
|
useEventListener(e18.host, MarimoIncomingMessageEvent.TYPE, (e19) => {
|
|
7893
7893
|
let h2 = ChatMessageIncomingSchema.safeParse(e19.detail.message);
|
|
7894
7894
|
h2.success && routeIncomingChatChunk(h2.data, {
|
|
7895
|
-
controllerRef:
|
|
7896
|
-
activeRequestIdRef:
|
|
7895
|
+
controllerRef: M,
|
|
7896
|
+
activeRequestIdRef: N
|
|
7897
7897
|
});
|
|
7898
7898
|
});
|
|
7899
7899
|
let K = B === "submitted" || B === "streaming", q = (h2) => {
|
|
@@ -7912,12 +7912,12 @@ const Chatbot = (e18) => {
|
|
|
7912
7912
|
}, Z = e18.prompts.length > 0 ? "Type your message here, / for prompts" : "Type your message here...";
|
|
7913
7913
|
(0, import_react.useEffect)(() => {
|
|
7914
7914
|
var _a2;
|
|
7915
|
-
(_a2 =
|
|
7916
|
-
top:
|
|
7915
|
+
(_a2 = A.current) == null ? void 0 : _a2.scrollTo({
|
|
7916
|
+
top: A.current.scrollHeight,
|
|
7917
7917
|
behavior: "smooth"
|
|
7918
7918
|
});
|
|
7919
|
-
}, [L.length,
|
|
7920
|
-
let Q = (_a =
|
|
7919
|
+
}, [L.length, A]);
|
|
7920
|
+
let Q = (_a = k.current) == null ? void 0 : _a.view, $ = () => {
|
|
7921
7921
|
if (Q) {
|
|
7922
7922
|
let e19 = Q.state.doc.length;
|
|
7923
7923
|
Q.dispatch({ changes: {
|
|
@@ -7946,7 +7946,7 @@ const Chatbot = (e18) => {
|
|
|
7946
7946
|
}),
|
|
7947
7947
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7948
7948
|
className: "grow overflow-y-auto gap-4 pt-8 pb-4 px-2 flex flex-col",
|
|
7949
|
-
ref:
|
|
7949
|
+
ref: A,
|
|
7950
7950
|
children: [
|
|
7951
7951
|
L.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
7952
7952
|
className: "flex flex-col items-center justify-center h-full text-muted-foreground text-center p-4",
|
|
@@ -8018,7 +8018,7 @@ const Chatbot = (e18) => {
|
|
|
8018
8018
|
}, ..._ ?? []]
|
|
8019
8019
|
}), $();
|
|
8020
8020
|
},
|
|
8021
|
-
ref:
|
|
8021
|
+
ref: O,
|
|
8022
8022
|
inert: e18.disabled || void 0,
|
|
8023
8023
|
className: cn("flex w-full border-t border-(--slate-6) px-2 py-1 items-center", e18.disabled && "opacity-50 cursor-not-allowed"),
|
|
8024
8024
|
children: [
|
|
@@ -8038,12 +8038,12 @@ const Chatbot = (e18) => {
|
|
|
8038
8038
|
className: "rounded-sm mr-2",
|
|
8039
8039
|
placeholder: Z,
|
|
8040
8040
|
value: h,
|
|
8041
|
-
inputRef:
|
|
8041
|
+
inputRef: k,
|
|
8042
8042
|
maxHeight: e18.maxHeight ? `${e18.maxHeight / 2}px` : void 0,
|
|
8043
8043
|
onChange: b,
|
|
8044
8044
|
onSubmit: (e19, h2) => {
|
|
8045
8045
|
var _a2;
|
|
8046
|
-
h2.trim() && ((_a2 =
|
|
8046
|
+
h2.trim() && ((_a2 = O.current) == null ? void 0 : _a2.requestSubmit());
|
|
8047
8047
|
},
|
|
8048
8048
|
onClose: () => {
|
|
8049
8049
|
},
|
|
@@ -8064,7 +8064,7 @@ const Chatbot = (e18) => {
|
|
|
8064
8064
|
variant: "text",
|
|
8065
8065
|
size: "sm",
|
|
8066
8066
|
onClick: () => {
|
|
8067
|
-
|
|
8067
|
+
E(void 0), D.current && (D.current.value = "");
|
|
8068
8068
|
},
|
|
8069
8069
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-3" })
|
|
8070
8070
|
}),
|
|
@@ -8074,17 +8074,17 @@ const Chatbot = (e18) => {
|
|
|
8074
8074
|
size: "sm",
|
|
8075
8075
|
onClick: () => {
|
|
8076
8076
|
var _a2;
|
|
8077
|
-
return (_a2 =
|
|
8077
|
+
return (_a2 = D.current) == null ? void 0 : _a2.click();
|
|
8078
8078
|
},
|
|
8079
8079
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Paperclip, { className: "h-4" })
|
|
8080
8080
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
8081
8081
|
type: "file",
|
|
8082
|
-
ref:
|
|
8082
|
+
ref: D,
|
|
8083
8083
|
className: "hidden",
|
|
8084
8084
|
multiple: true,
|
|
8085
8085
|
accept: Array.isArray(e18.allowAttachments) ? e18.allowAttachments.join(",") : void 0,
|
|
8086
8086
|
onChange: (e19) => {
|
|
8087
|
-
e19.target.files &&
|
|
8087
|
+
e19.target.files && E([...e19.target.files]);
|
|
8088
8088
|
}
|
|
8089
8089
|
})] }),
|
|
8090
8090
|
K ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, {
|