@akropolys/kiku 1.7.6 → 1.7.7

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/index.js CHANGED
@@ -1629,16 +1629,26 @@ function ThinkingBlock({ text, isComplete, seconds: fixedSeconds }) {
1629
1629
  }, [isComplete]);
1630
1630
  const finalSeconds = fixedSeconds ?? seconds;
1631
1631
  const label = isComplete ? finalSeconds !== null && finalSeconds !== void 0 ? `Thought for ${finalSeconds}s` : "Thought process" : `Thinking${seconds ? ` \xB7 ${seconds}s` : "\u2026"}`;
1632
+ const expandable = !!text;
1632
1633
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("hsk-cb-think", !isComplete && "hsk-cb-think--live"), children: [
1633
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "hsk-cb-think-head", onClick: () => setIsOpen((o) => !o), "aria-expanded": isOpen, children: [
1634
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: !isComplete ? "hsk-cb-think-spin" : void 0, children: [
1635
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
1636
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 6v6l4 2" })
1637
- ] }),
1638
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }),
1639
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("hsk-cb-think-chevron", isOpen && "hsk-cb-think-chevron--open"), children: "\u25B6" })
1640
- ] }),
1641
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-think-body", children: text })
1634
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1635
+ "button",
1636
+ {
1637
+ type: "button",
1638
+ className: cn("hsk-cb-think-head", !expandable && "hsk-cb-think-head--static"),
1639
+ onClick: expandable ? () => setIsOpen((o) => !o) : void 0,
1640
+ "aria-expanded": expandable ? isOpen : void 0,
1641
+ children: [
1642
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: !isComplete ? "hsk-cb-think-spin" : void 0, children: [
1643
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
1644
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 6v6l4 2" })
1645
+ ] }),
1646
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }),
1647
+ expandable && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("hsk-cb-think-chevron", isOpen && "hsk-cb-think-chevron--open"), children: "\u25B6" })
1648
+ ]
1649
+ }
1650
+ ),
1651
+ expandable && isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-think-body", children: text })
1642
1652
  ] });
1643
1653
  }
1644
1654
  function ChatModal({
@@ -2085,7 +2095,7 @@ function ChatModal({
2085
2095
  const content = parsed.content;
2086
2096
  const isComplete = msg.thinking ? content.length > 0 || !(isLast && streaming) : parsed.isComplete;
2087
2097
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2088
- thinking && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
2098
+ (thinking || msg.thoughtForSeconds != null) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
2089
2099
  content && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-ai-text", children: [
2090
2100
  renderMarkdown(content, isLast && streaming),
2091
2101
  isLast && streaming && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { display: "inline-block", width: "0.5em", height: "1.05em", marginLeft: "2px", verticalAlign: "text-bottom", background: "currentColor", opacity: 0.55, borderRadius: "1px" } })
@@ -2191,11 +2201,11 @@ function ChatModal({
2191
2201
  ]
2192
2202
  }
2193
2203
  ),
2194
- (stopped || interrupted) && !loading && !streaming && messages[messages.length - 1]?.role === "assistant" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-stopped", children: [
2204
+ (stopped || interrupted) && !loading && !streaming && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-stopped", children: [
2195
2205
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-cb-stopped-label", children: stopped ? "You stopped this response." : "This response was interrupted." }),
2196
2206
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { className: "hsk-cb-continue", onClick: continueGenerating, children: [
2197
2207
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ContinueIcon, {}),
2198
- "Continue generating"
2208
+ messages[messages.length - 1]?.role === "assistant" ? "Continue generating" : "Generate response"
2199
2209
  ] })
2200
2210
  ] }),
2201
2211
  error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-error", children: getFriendlyError(error) }),