@jfvilas/kwirth-plugin-chapete 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/front.js +15 -1
  2. package/package.json +1 -1
package/front.js CHANGED
@@ -283,6 +283,12 @@
283
283
  observer.observe(document.body);
284
284
  return () => observer.disconnect();
285
285
  }, [containerRef.current]);
286
+ const [notStartedTop, setNotStartedTop] = (0, import_react4.useState)(0);
287
+ (0, import_react4.useEffect)(() => {
288
+ if (data.started || !containerRef.current) return;
289
+ const top = containerRef.current.getBoundingClientRect().top;
290
+ if (top !== notStartedTop) setNotStartedTop(top);
291
+ });
286
292
  (0, import_react4.useEffect)(() => {
287
293
  bottomRef.current?.scrollIntoView({ block: "end" });
288
294
  }, [data.entries.length, data.entries[data.entries.length - 1]?.pendingId]);
@@ -346,7 +352,15 @@
346
352
  ));
347
353
  };
348
354
  if (!data.started) {
349
- return /* @__PURE__ */ import_react4.default.createElement(import_material4.Stack, { ref: containerRef, alignItems: "center", justifyContent: "center", spacing: 1, sx: { width: "100%", height: `${containerHeight}px`, px: 4, textAlign: "center" } }, /* @__PURE__ */ import_react4.default.createElement(import_material4.Typography, { variant: "h6", color: "text.secondary" }, "Chapete not started"), /* @__PURE__ */ import_react4.default.createElement(import_material4.Typography, { variant: "body2", color: "text.secondary", sx: { maxWidth: 480 } }, "Start the channel (tab settings \u2699 \u2192 Start), pick an LLM and start chatting."));
355
+ return /* @__PURE__ */ import_react4.default.createElement(import_material4.Stack, { ref: containerRef, alignItems: "center", justifyContent: "center", sx: { flex: 1, width: "100%", minHeight: `calc(100vh - ${notStartedTop}px - 8px)`, px: 4 } }, /* @__PURE__ */ import_react4.default.createElement(
356
+ import_kwirth_common_front.ChannelNotStarted,
357
+ {
358
+ icon: /* @__PURE__ */ import_react4.default.createElement(ChapeteThought, { color: "primary" }),
359
+ name: "Chapete",
360
+ hint: "Chapete not started. Start the channel to pick an LLM and start chatting.",
361
+ channelObject: props.channelObject
362
+ }
363
+ ));
350
364
  }
351
365
  return /* @__PURE__ */ import_react4.default.createElement(import_material4.Box, { ref: containerRef, sx: { display: "flex", flexDirection: "column", width: "100%", height: `${containerHeight}px`, p: 1, boxSizing: "border-box" } }, /* @__PURE__ */ import_react4.default.createElement(import_material4.Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { px: 1, pb: 1 } }, /* @__PURE__ */ import_react4.default.createElement(import_material4.Chip, { label: `LLM: ${instanceConfig?.llmId || "(none)"}`, size: "small", variant: "outlined" }), /* @__PURE__ */ import_react4.default.createElement(import_material4.Chip, { label: `Temperature: ${instanceConfig?.temperature ?? "-"}`, size: "small", variant: "outlined" }), /* @__PURE__ */ import_react4.default.createElement(import_material4.Box, { sx: { flex: 1 } }), /* @__PURE__ */ import_react4.default.createElement(import_material4.Tooltip, { title: "Start a new conversation" }, /* @__PURE__ */ import_react4.default.createElement("span", null, /* @__PURE__ */ import_react4.default.createElement(import_material4.IconButton, { size: "small", "aria-label": "New chat", onClick: newChat, disabled: data.entries.length === 0 || thinking }, /* @__PURE__ */ import_react4.default.createElement(import_icons2.Add, { fontSize: "small" })))), /* @__PURE__ */ import_react4.default.createElement(import_material4.Tooltip, { title: "System prompt of the channel" }, /* @__PURE__ */ import_react4.default.createElement(import_material4.IconButton, { size: "small", "aria-label": "System prompt", onClick: () => setSystemOpen(true) }, /* @__PURE__ */ import_react4.default.createElement(import_icons2.Settings, { fontSize: "small" })))), /* @__PURE__ */ import_react4.default.createElement(import_material4.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", px: 1 } }, data.entries.length === 0 && /* @__PURE__ */ import_react4.default.createElement(import_material4.Stack, { alignItems: "center", justifyContent: "center", sx: { height: "100%" } }, /* @__PURE__ */ import_react4.default.createElement(import_material4.Typography, { variant: "body2", color: "text.secondary" }, "Ask anything. Enter sends, Shift+Enter adds a new line.")), data.entries.map((entry, index) => bubble(entry, index)), data.signals.map((s, index) => /* @__PURE__ */ import_react4.default.createElement(import_material4.Typography, { key: `s${index}`, variant: "caption", color: "text.secondary", component: "div" }, "*** ", s, " ***")), /* @__PURE__ */ import_react4.default.createElement("div", { ref: bottomRef })), /* @__PURE__ */ import_react4.default.createElement(import_material4.Stack, { direction: "row", spacing: 1, alignItems: "flex-end", sx: { pt: 1 } }, /* @__PURE__ */ import_react4.default.createElement(
352
366
  import_material4.TextField,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "@jfvilas/kwirth-plugin-chapete",
4
4
  "displayName": "Chapete",
5
5
  "extensionType": "plugin",
6
- "version": "0.1.2",
6
+ "version": "0.1.3",
7
7
  "description": "Chat with an LLM from Kwirth, using the LLMs configured in the core",
8
8
  "icon": "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 14A3 3 0 0 1 5.2 8.2A3.6 3.6 0 0 1 11.6 5.6A3.5 3.5 0 0 1 18.2 7.6A3.05 3.05 0 0 1 17.6 13.6A12 12 0 0 1 6 14Z'/><circle cx='18.6' cy='17.4' r='1.6' fill='currentColor' stroke='none'/><circle cx='21.3' cy='20.7' r='1.05' fill='currentColor' stroke='none'/></svg>",
9
9
  "website": "https://kwirthmagnify.dev",