@akropolys/kiku 1.7.6 → 1.7.8
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 +45 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -13
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +96 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1597,16 +1597,30 @@ 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(
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
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
|
+
isComplete ? /* @__PURE__ */ jsxs6("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1611
|
+
/* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1612
|
+
/* @__PURE__ */ jsx7("path", { d: "M12 6v6l4 2" })
|
|
1613
|
+
] }) : /* @__PURE__ */ jsxs6("span", { className: "hsk-cb-typing", "aria-hidden": "true", children: [
|
|
1614
|
+
/* @__PURE__ */ jsx7("span", {}),
|
|
1615
|
+
/* @__PURE__ */ jsx7("span", {}),
|
|
1616
|
+
/* @__PURE__ */ jsx7("span", {})
|
|
1617
|
+
] }),
|
|
1618
|
+
/* @__PURE__ */ jsx7("span", { children: label }),
|
|
1619
|
+
expandable && /* @__PURE__ */ jsx7("span", { className: cn("hsk-cb-think-chevron", isOpen && "hsk-cb-think-chevron--open"), children: "\u25B6" })
|
|
1620
|
+
]
|
|
1621
|
+
}
|
|
1622
|
+
),
|
|
1623
|
+
expandable && isOpen && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-think-body", children: text })
|
|
1610
1624
|
] });
|
|
1611
1625
|
}
|
|
1612
1626
|
function ChatModal({
|
|
@@ -2032,13 +2046,14 @@ function ChatModal({
|
|
|
2032
2046
|
)) })
|
|
2033
2047
|
] }) : displayMessages.map((msg, idx) => {
|
|
2034
2048
|
const isLast = idx === displayMessages.length - 1;
|
|
2049
|
+
const isLastUser = msg.role === "user" && !displayMessages.slice(idx + 1).some((m) => m.role === "user");
|
|
2035
2050
|
const isUser = msg.role === "user";
|
|
2036
2051
|
const compareSources = sources.filter((s) => s.id && referencedIds.includes(s.id));
|
|
2037
2052
|
const showMatrix = isLast && lastIntent === "compare" && compareSources.length >= 2;
|
|
2038
2053
|
const displayContent = !isUser && showMatrix ? stripMarkdownTables(msg.content) : msg.content;
|
|
2039
2054
|
return /* @__PURE__ */ jsx7("div", { className: "hsk-cb-msg-group", ref: (el) => {
|
|
2040
2055
|
messageRefs.current[idx] = el;
|
|
2041
|
-
}, children: isUser ? /* @__PURE__ */ jsxs6("div", { className:
|
|
2056
|
+
}, children: isUser ? /* @__PURE__ */ jsxs6("div", { className: `hsk-cb-user-msg${isLastUser ? " hsk-sent" : ""}`, children: [
|
|
2042
2057
|
msg.images && msg.images.length > 0 && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-user-imgs", children: msg.images.map((img, i) => /* @__PURE__ */ jsx7("img", { src: img, alt: `attachment ${i + 1}`, className: "hsk-cb-user-img-thumb" }, i)) }),
|
|
2043
2058
|
msg.content && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-user-bubble", children: /^@kiku\b/i.test(msg.content) ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2044
2059
|
/* @__PURE__ */ jsx7("span", { className: "hsk-kiku-badge", children: "@kiku" }),
|
|
@@ -2053,7 +2068,7 @@ function ChatModal({
|
|
|
2053
2068
|
const content = parsed.content;
|
|
2054
2069
|
const isComplete = msg.thinking ? content.length > 0 || !(isLast && streaming) : parsed.isComplete;
|
|
2055
2070
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2056
|
-
thinking && /* @__PURE__ */ jsx7(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
|
|
2071
|
+
(thinking || msg.thoughtForSeconds != null) && /* @__PURE__ */ jsx7(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
|
|
2057
2072
|
content && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-ai-text", children: [
|
|
2058
2073
|
renderMarkdown(content, isLast && streaming),
|
|
2059
2074
|
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" } })
|
|
@@ -2078,6 +2093,23 @@ function ChatModal({
|
|
|
2078
2093
|
),
|
|
2079
2094
|
/* @__PURE__ */ jsx7("div", { className: "hsk-cb-viz-disclaimer", children: "AI-generated preview \u2014 colours, size and placement may differ from the real product." })
|
|
2080
2095
|
] }),
|
|
2096
|
+
!isUser && (msg.knowledgeImages?.length ?? 0) > 0 && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-kimgs", children: msg.knowledgeImages.map((ref) => /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-kimg-group", children: [
|
|
2097
|
+
/* @__PURE__ */ jsx7("div", { className: "hsk-cb-kimg-grid", children: ref.images.map((img, i) => /* @__PURE__ */ jsx7(
|
|
2098
|
+
"img",
|
|
2099
|
+
{
|
|
2100
|
+
src: img.url,
|
|
2101
|
+
alt: img.note || ref.title || "Reference image",
|
|
2102
|
+
className: "hsk-cb-kimg",
|
|
2103
|
+
loading: "lazy",
|
|
2104
|
+
onClick: () => setLightboxSrc(img.url),
|
|
2105
|
+
onError: (e) => {
|
|
2106
|
+
e.target.style.display = "none";
|
|
2107
|
+
}
|
|
2108
|
+
},
|
|
2109
|
+
i
|
|
2110
|
+
)) }),
|
|
2111
|
+
(ref.title || ref.images[0]?.note) && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-kimg-caption", children: ref.title || ref.images[0]?.note })
|
|
2112
|
+
] }, ref.entryId)) }),
|
|
2081
2113
|
showMatrix && /* @__PURE__ */ jsx7(ComparisonMatrix, { sources: compareSources, defaultCurrency }),
|
|
2082
2114
|
(() => {
|
|
2083
2115
|
const msgReferencedIds = isLast ? referencedIds : msg.referencedIds ?? [];
|
|
@@ -2159,11 +2191,11 @@ function ChatModal({
|
|
|
2159
2191
|
]
|
|
2160
2192
|
}
|
|
2161
2193
|
),
|
|
2162
|
-
(stopped || interrupted) && !loading && !streaming && messages
|
|
2194
|
+
(stopped || interrupted) && !loading && !streaming && messages.length > 0 && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-stopped", children: [
|
|
2163
2195
|
/* @__PURE__ */ jsx7("span", { className: "hsk-cb-stopped-label", children: stopped ? "You stopped this response." : "This response was interrupted." }),
|
|
2164
2196
|
/* @__PURE__ */ jsxs6("button", { className: "hsk-cb-continue", onClick: continueGenerating, children: [
|
|
2165
2197
|
/* @__PURE__ */ jsx7(ContinueIcon, {}),
|
|
2166
|
-
"Continue generating"
|
|
2198
|
+
messages[messages.length - 1]?.role === "assistant" ? "Continue generating" : "Generate response"
|
|
2167
2199
|
] })
|
|
2168
2200
|
] }),
|
|
2169
2201
|
error && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-error", children: getFriendlyError(error) }),
|