@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.js
CHANGED
|
@@ -1629,16 +1629,30 @@ 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)(
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
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
|
+
isComplete ? /* @__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", 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
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-cb-typing", "aria-hidden": "true", children: [
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", {}),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", {}),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", {})
|
|
1649
|
+
] }),
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }),
|
|
1651
|
+
expandable && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("hsk-cb-think-chevron", isOpen && "hsk-cb-think-chevron--open"), children: "\u25B6" })
|
|
1652
|
+
]
|
|
1653
|
+
}
|
|
1654
|
+
),
|
|
1655
|
+
expandable && isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-think-body", children: text })
|
|
1642
1656
|
] });
|
|
1643
1657
|
}
|
|
1644
1658
|
function ChatModal({
|
|
@@ -2064,13 +2078,14 @@ function ChatModal({
|
|
|
2064
2078
|
)) })
|
|
2065
2079
|
] }) : displayMessages.map((msg, idx) => {
|
|
2066
2080
|
const isLast = idx === displayMessages.length - 1;
|
|
2081
|
+
const isLastUser = msg.role === "user" && !displayMessages.slice(idx + 1).some((m) => m.role === "user");
|
|
2067
2082
|
const isUser = msg.role === "user";
|
|
2068
2083
|
const compareSources = sources.filter((s) => s.id && referencedIds.includes(s.id));
|
|
2069
2084
|
const showMatrix = isLast && lastIntent === "compare" && compareSources.length >= 2;
|
|
2070
2085
|
const displayContent = !isUser && showMatrix ? stripMarkdownTables(msg.content) : msg.content;
|
|
2071
2086
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-msg-group", ref: (el) => {
|
|
2072
2087
|
messageRefs.current[idx] = el;
|
|
2073
|
-
}, children: isUser ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className:
|
|
2088
|
+
}, children: isUser ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `hsk-cb-user-msg${isLastUser ? " hsk-sent" : ""}`, children: [
|
|
2074
2089
|
msg.images && msg.images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-user-imgs", children: msg.images.map((img, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: img, alt: `attachment ${i + 1}`, className: "hsk-cb-user-img-thumb" }, i)) }),
|
|
2075
2090
|
msg.content && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-user-bubble", children: /^@kiku\b/i.test(msg.content) ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
2076
2091
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-badge", children: "@kiku" }),
|
|
@@ -2085,7 +2100,7 @@ function ChatModal({
|
|
|
2085
2100
|
const content = parsed.content;
|
|
2086
2101
|
const isComplete = msg.thinking ? content.length > 0 || !(isLast && streaming) : parsed.isComplete;
|
|
2087
2102
|
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 }),
|
|
2103
|
+
(thinking || msg.thoughtForSeconds != null) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThinkingBlock, { text: thinking, isComplete, seconds: msg.thoughtForSeconds }),
|
|
2089
2104
|
content && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-ai-text", children: [
|
|
2090
2105
|
renderMarkdown(content, isLast && streaming),
|
|
2091
2106
|
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" } })
|
|
@@ -2110,6 +2125,23 @@ function ChatModal({
|
|
|
2110
2125
|
),
|
|
2111
2126
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-viz-disclaimer", children: "AI-generated preview \u2014 colours, size and placement may differ from the real product." })
|
|
2112
2127
|
] }),
|
|
2128
|
+
!isUser && (msg.knowledgeImages?.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-kimgs", children: msg.knowledgeImages.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-kimg-group", children: [
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-kimg-grid", children: ref.images.map((img, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2130
|
+
"img",
|
|
2131
|
+
{
|
|
2132
|
+
src: img.url,
|
|
2133
|
+
alt: img.note || ref.title || "Reference image",
|
|
2134
|
+
className: "hsk-cb-kimg",
|
|
2135
|
+
loading: "lazy",
|
|
2136
|
+
onClick: () => setLightboxSrc(img.url),
|
|
2137
|
+
onError: (e) => {
|
|
2138
|
+
e.target.style.display = "none";
|
|
2139
|
+
}
|
|
2140
|
+
},
|
|
2141
|
+
i
|
|
2142
|
+
)) }),
|
|
2143
|
+
(ref.title || ref.images[0]?.note) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-kimg-caption", children: ref.title || ref.images[0]?.note })
|
|
2144
|
+
] }, ref.entryId)) }),
|
|
2113
2145
|
showMatrix && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ComparisonMatrix, { sources: compareSources, defaultCurrency }),
|
|
2114
2146
|
(() => {
|
|
2115
2147
|
const msgReferencedIds = isLast ? referencedIds : msg.referencedIds ?? [];
|
|
@@ -2191,11 +2223,11 @@ function ChatModal({
|
|
|
2191
2223
|
]
|
|
2192
2224
|
}
|
|
2193
2225
|
),
|
|
2194
|
-
(stopped || interrupted) && !loading && !streaming && messages
|
|
2226
|
+
(stopped || interrupted) && !loading && !streaming && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-stopped", children: [
|
|
2195
2227
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-cb-stopped-label", children: stopped ? "You stopped this response." : "This response was interrupted." }),
|
|
2196
2228
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { className: "hsk-cb-continue", onClick: continueGenerating, children: [
|
|
2197
2229
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ContinueIcon, {}),
|
|
2198
|
-
"Continue generating"
|
|
2230
|
+
messages[messages.length - 1]?.role === "assistant" ? "Continue generating" : "Generate response"
|
|
2199
2231
|
] })
|
|
2200
2232
|
] }),
|
|
2201
2233
|
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-error", children: getFriendlyError(error) }),
|