@apteva/apteva-kit 0.1.10 → 0.1.12
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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +41 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -22
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -591,6 +591,22 @@ function parseMarkdown(content) {
|
|
|
591
591
|
let i = 0;
|
|
592
592
|
while (i < lines.length) {
|
|
593
593
|
const line = lines[i];
|
|
594
|
+
const h2Match = line.match(/^##\s+(.*)$/);
|
|
595
|
+
if (h2Match) {
|
|
596
|
+
result.push(
|
|
597
|
+
/* @__PURE__ */ jsx6("h2", { className: "apteva-md-h2", children: parseInlineMarkdown(h2Match[1], `${key}`) }, `h2${key++}`)
|
|
598
|
+
);
|
|
599
|
+
i++;
|
|
600
|
+
continue;
|
|
601
|
+
}
|
|
602
|
+
const h3Match = line.match(/^###\s+(.*)$/);
|
|
603
|
+
if (h3Match) {
|
|
604
|
+
result.push(
|
|
605
|
+
/* @__PURE__ */ jsx6("h3", { className: "apteva-md-h3", children: parseInlineMarkdown(h3Match[1], `${key}`) }, `h3${key++}`)
|
|
606
|
+
);
|
|
607
|
+
i++;
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
594
610
|
const ulMatch = line.match(/^(\s*)([-*+])\s+(.*)$/);
|
|
595
611
|
if (ulMatch) {
|
|
596
612
|
const listItems = [];
|
|
@@ -599,7 +615,7 @@ function parseMarkdown(content) {
|
|
|
599
615
|
const itemMatch = lines[i].match(/^(\s*)([-*+])\s+(.*)$/);
|
|
600
616
|
if (itemMatch && itemMatch[1].length === indent) {
|
|
601
617
|
listItems.push(
|
|
602
|
-
/* @__PURE__ */ jsx6("li", { children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
|
|
618
|
+
/* @__PURE__ */ jsx6("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
|
|
603
619
|
);
|
|
604
620
|
i++;
|
|
605
621
|
} else {
|
|
@@ -607,7 +623,7 @@ function parseMarkdown(content) {
|
|
|
607
623
|
}
|
|
608
624
|
}
|
|
609
625
|
result.push(
|
|
610
|
-
/* @__PURE__ */ jsx6("ul", { className: "
|
|
626
|
+
/* @__PURE__ */ jsx6("ul", { className: "apteva-md-ul", children: listItems }, `ul${key++}`)
|
|
611
627
|
);
|
|
612
628
|
continue;
|
|
613
629
|
}
|
|
@@ -619,7 +635,7 @@ function parseMarkdown(content) {
|
|
|
619
635
|
const itemMatch = lines[i].match(/^(\s*)(\d+)\.\s+(.*)$/);
|
|
620
636
|
if (itemMatch && itemMatch[1].length === indent) {
|
|
621
637
|
listItems.push(
|
|
622
|
-
/* @__PURE__ */ jsx6("li", { children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
|
|
638
|
+
/* @__PURE__ */ jsx6("li", { className: "apteva-md-li", children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
|
|
623
639
|
);
|
|
624
640
|
i++;
|
|
625
641
|
} else {
|
|
@@ -627,7 +643,7 @@ function parseMarkdown(content) {
|
|
|
627
643
|
}
|
|
628
644
|
}
|
|
629
645
|
result.push(
|
|
630
|
-
/* @__PURE__ */ jsx6("ol", { className: "
|
|
646
|
+
/* @__PURE__ */ jsx6("ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
|
|
631
647
|
);
|
|
632
648
|
continue;
|
|
633
649
|
}
|
|
@@ -646,20 +662,20 @@ function parseMarkdown(content) {
|
|
|
646
662
|
return result;
|
|
647
663
|
}
|
|
648
664
|
function MarkdownContent({ content, className = "" }) {
|
|
649
|
-
return /* @__PURE__ */ jsx6("div", { className: `
|
|
665
|
+
return /* @__PURE__ */ jsx6("div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
|
|
650
666
|
}
|
|
651
667
|
|
|
652
668
|
// src/components/Chat/ToolCall.tsx
|
|
653
669
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
654
670
|
function ToolCall({ name, status }) {
|
|
655
|
-
return /* @__PURE__ */ jsxs5("div", { className: "
|
|
656
|
-
status === "running" && /* @__PURE__ */ jsx7("div", { className: "
|
|
657
|
-
status === "completed" && /* @__PURE__ */ jsx7("div", { className: "
|
|
658
|
-
status === "error" && /* @__PURE__ */ jsx7("div", { className: "
|
|
659
|
-
/* @__PURE__ */ jsx7("span", { className: "
|
|
660
|
-
status === "running" && /* @__PURE__ */ jsx7("span", { className: "
|
|
661
|
-
status === "completed" && /* @__PURE__ */ jsx7("span", { className: "
|
|
662
|
-
status === "error" && /* @__PURE__ */ jsx7("span", { className: "
|
|
671
|
+
return /* @__PURE__ */ jsxs5("div", { className: "apteva-tool-call", children: [
|
|
672
|
+
status === "running" && /* @__PURE__ */ jsx7("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-running" }),
|
|
673
|
+
status === "completed" && /* @__PURE__ */ jsx7("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-completed" }),
|
|
674
|
+
status === "error" && /* @__PURE__ */ jsx7("div", { className: "apteva-tool-call-dot apteva-tool-call-dot-error" }),
|
|
675
|
+
/* @__PURE__ */ jsx7("span", { className: "apteva-tool-call-name", children: name }),
|
|
676
|
+
status === "running" && /* @__PURE__ */ jsx7("span", { className: "apteva-tool-call-status", children: "Running..." }),
|
|
677
|
+
status === "completed" && /* @__PURE__ */ jsx7("span", { className: "apteva-tool-call-status apteva-tool-call-status-completed", children: "Completed" }),
|
|
678
|
+
status === "error" && /* @__PURE__ */ jsx7("span", { className: "apteva-tool-call-status apteva-tool-call-status-error", children: "Error" })
|
|
663
679
|
] });
|
|
664
680
|
}
|
|
665
681
|
|
|
@@ -715,7 +731,7 @@ function MessageList({ messages, onAction }) {
|
|
|
715
731
|
listRef.current.scrollTop = listRef.current.scrollHeight;
|
|
716
732
|
}
|
|
717
733
|
}, [messages]);
|
|
718
|
-
return /* @__PURE__ */ jsx9("div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3", children: messages.length === 0 ? /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ jsxs7("div", { className: "text-center space-y-2", children: [
|
|
734
|
+
return /* @__PURE__ */ jsx9("div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3 apteva-scrollbar-hidden", children: messages.length === 0 ? /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ jsxs7("div", { className: "text-center space-y-2", children: [
|
|
719
735
|
/* @__PURE__ */ jsx9("div", { className: "text-4xl", children: "\u{1F4AC}" }),
|
|
720
736
|
/* @__PURE__ */ jsx9("p", { children: "No messages yet. Start a conversation!" })
|
|
721
737
|
] }) }) : messages.map((message) => /* @__PURE__ */ jsx9(Message, { message, onAction }, message.id)) });
|
|
@@ -990,6 +1006,8 @@ function Chat({
|
|
|
990
1006
|
threadId,
|
|
991
1007
|
initialMessages = [],
|
|
992
1008
|
context,
|
|
1009
|
+
apiUrl,
|
|
1010
|
+
apiKey,
|
|
993
1011
|
useMock = false,
|
|
994
1012
|
onThreadChange,
|
|
995
1013
|
onMessageSent,
|
|
@@ -1003,6 +1021,14 @@ function Chat({
|
|
|
1003
1021
|
const [messages, setMessages] = useState2(initialMessages);
|
|
1004
1022
|
const [isLoading, setIsLoading] = useState2(false);
|
|
1005
1023
|
const [currentThreadId, setCurrentThreadId] = useState2(threadId || null);
|
|
1024
|
+
useEffect3(() => {
|
|
1025
|
+
if (apiUrl || apiKey) {
|
|
1026
|
+
aptevaClient.configure({
|
|
1027
|
+
...apiUrl && { apiUrl },
|
|
1028
|
+
...apiKey && { apiKey }
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
}, [apiUrl, apiKey]);
|
|
1006
1032
|
useEffect3(() => {
|
|
1007
1033
|
if (threadId) {
|
|
1008
1034
|
console.log("Loading thread:", threadId);
|
|
@@ -1080,7 +1106,6 @@ function Chat({
|
|
|
1080
1106
|
...context && { system: context }
|
|
1081
1107
|
},
|
|
1082
1108
|
(chunk) => {
|
|
1083
|
-
console.log("[Chat] Chunk:", chunk);
|
|
1084
1109
|
switch (chunk.type) {
|
|
1085
1110
|
case "start":
|
|
1086
1111
|
break;
|
|
@@ -1218,13 +1243,7 @@ function Chat({
|
|
|
1218
1243
|
}
|
|
1219
1244
|
};
|
|
1220
1245
|
return /* @__PURE__ */ jsxs9("div", { className: cn("flex flex-col h-full bg-white dark:bg-gray-900", className), children: [
|
|
1221
|
-
showHeader && /* @__PURE__ */
|
|
1222
|
-
/* @__PURE__ */ jsx11("h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }),
|
|
1223
|
-
/* @__PURE__ */ jsxs9("p", { className: "!text-xs !text-gray-500 dark:!text-gray-400", children: [
|
|
1224
|
-
"Agent: ",
|
|
1225
|
-
agentId
|
|
1226
|
-
] })
|
|
1227
|
-
] }),
|
|
1246
|
+
showHeader && /* @__PURE__ */ jsx11("div", { className: "px-4 py-3 bg-white dark:bg-gray-900", children: /* @__PURE__ */ jsx11("h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }) }),
|
|
1228
1247
|
/* @__PURE__ */ jsx11(MessageList, { messages, onAction }),
|
|
1229
1248
|
isLoading && /* @__PURE__ */ jsx11("div", { className: "px-4 py-2 !text-sm !text-gray-500 dark:!text-gray-400 italic", children: "AI is thinking..." }),
|
|
1230
1249
|
/* @__PURE__ */ jsx11(Composer, { onSendMessage: handleSendMessage, placeholder, disabled: isLoading, onFileUpload })
|