@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.mjs CHANGED
@@ -1597,16 +1597,26 @@ function ThinkingBlock({ text, isComplete, seconds: fixedSeconds }) {
1597
1597
  }, [isComplete]);
1598
1598
  const finalSeconds = fixedSeconds ?? seconds;
1599
1599
  const label = isComplete ? finalSeconds !== null && finalSeconds !== void 0 ? `Thought for ${finalSeconds}s` : "Thought process" : `Thinking${seconds ? ` \xB7 ${seconds}s` : "\u2026"}`;
1600
+ const expandable = !!text;
1600
1601
  return /* @__PURE__ */ jsxs6("div", { className: cn("hsk-cb-think", !isComplete && "hsk-cb-think--live"), children: [
1601
- /* @__PURE__ */ jsxs6("button", { type: "button", className: "hsk-cb-think-head", onClick: () => setIsOpen((o) => !o), "aria-expanded": isOpen, children: [
1602
- /* @__PURE__ */ jsxs6("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: [
1603
- /* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "10" }),
1604
- /* @__PURE__ */ jsx7("path", { d: "M12 6v6l4 2" })
1605
- ] }),
1606
- /* @__PURE__ */ jsx7("span", { children: label }),
1607
- /* @__PURE__ */ jsx7("span", { className: cn("hsk-cb-think-chevron", isOpen && "hsk-cb-think-chevron--open"), children: "\u25B6" })
1608
- ] }),
1609
- isOpen && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-think-body", children: text })
1602
+ /* @__PURE__ */ jsxs6(
1603
+ "button",
1604
+ {
1605
+ type: "button",
1606
+ className: cn("hsk-cb-think-head", !expandable && "hsk-cb-think-head--static"),
1607
+ onClick: expandable ? () => setIsOpen((o) => !o) : void 0,
1608
+ "aria-expanded": expandable ? isOpen : void 0,
1609
+ children: [
1610
+ /* @__PURE__ */ jsxs6("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: [
1611
+ /* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "10" }),
1612
+ /* @__PURE__ */ jsx7("path", { d: "M12 6v6l4 2" })
1613
+ ] }),
1614
+ /* @__PURE__ */ jsx7("span", { children: label }),
1615
+ expandable && /* @__PURE__ */ jsx7("span", { className: cn("hsk-cb-think-chevron", isOpen && "hsk-cb-think-chevron--open"), children: "\u25B6" })
1616
+ ]
1617
+ }
1618
+ ),
1619
+ expandable && isOpen && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-think-body", children: text })
1610
1620
  ] });
1611
1621
  }
1612
1622
  function ChatModal({
@@ -2053,7 +2063,7 @@ function ChatModal({
2053
2063
  const content = parsed.content;
2054
2064
  const isComplete = msg.thinking ? content.length > 0 || !(isLast && streaming) : parsed.isComplete;
2055
2065
  return /* @__PURE__ */ jsxs6(Fragment3, { children: [
2056
- thinking && /* @__PURE__ */ jsx7(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
2066
+ (thinking || msg.thoughtForSeconds != null) && /* @__PURE__ */ jsx7(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
2057
2067
  content && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-ai-text", children: [
2058
2068
  renderMarkdown(content, isLast && streaming),
2059
2069
  isLast && streaming && /* @__PURE__ */ jsx7("span", { style: { display: "inline-block", width: "0.5em", height: "1.05em", marginLeft: "2px", verticalAlign: "text-bottom", background: "currentColor", opacity: 0.55, borderRadius: "1px" } })
@@ -2159,11 +2169,11 @@ function ChatModal({
2159
2169
  ]
2160
2170
  }
2161
2171
  ),
2162
- (stopped || interrupted) && !loading && !streaming && messages[messages.length - 1]?.role === "assistant" && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-stopped", children: [
2172
+ (stopped || interrupted) && !loading && !streaming && messages.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-stopped", children: [
2163
2173
  /* @__PURE__ */ jsx7("span", { className: "hsk-cb-stopped-label", children: stopped ? "You stopped this response." : "This response was interrupted." }),
2164
2174
  /* @__PURE__ */ jsxs6("button", { className: "hsk-cb-continue", onClick: continueGenerating, children: [
2165
2175
  /* @__PURE__ */ jsx7(ContinueIcon, {}),
2166
- "Continue generating"
2176
+ messages[messages.length - 1]?.role === "assistant" ? "Continue generating" : "Generate response"
2167
2177
  ] })
2168
2178
  ] }),
2169
2179
  error && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-error", children: getFriendlyError(error) }),