@apteva/apteva-kit 0.1.10 → 0.1.11

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 CHANGED
@@ -167,6 +167,8 @@ interface ChatProps {
167
167
  threadId?: string | null;
168
168
  initialMessages?: Message[];
169
169
  context?: string;
170
+ apiUrl?: string;
171
+ apiKey?: string;
170
172
  useMock?: boolean;
171
173
  onThreadChange?: (threadId: string) => void;
172
174
  onMessageSent?: (message: Message) => void;
@@ -281,7 +283,7 @@ interface UseAptevaKitReturn {
281
283
  error: Error | null;
282
284
  }
283
285
 
284
- declare function Chat({ agentId, threadId, initialMessages, context, useMock, onThreadChange, onMessageSent, onAction, onFileUpload, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
286
+ declare function Chat({ agentId, threadId, initialMessages, context, apiUrl, apiKey, useMock, onThreadChange, onMessageSent, onAction, onFileUpload, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
285
287
 
286
288
  declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, useMock, planMode, onPlanModeChange, enableFileUpload, onStart, onProgress, onChunk, onComplete, onError, onFileUpload, onAction, loadingText, showProgress, enableStreaming, resultRenderer, className, }: CommandProps): react_jsx_runtime.JSX.Element;
287
289
 
package/dist/index.d.ts CHANGED
@@ -167,6 +167,8 @@ interface ChatProps {
167
167
  threadId?: string | null;
168
168
  initialMessages?: Message[];
169
169
  context?: string;
170
+ apiUrl?: string;
171
+ apiKey?: string;
170
172
  useMock?: boolean;
171
173
  onThreadChange?: (threadId: string) => void;
172
174
  onMessageSent?: (message: Message) => void;
@@ -281,7 +283,7 @@ interface UseAptevaKitReturn {
281
283
  error: Error | null;
282
284
  }
283
285
 
284
- declare function Chat({ agentId, threadId, initialMessages, context, useMock, onThreadChange, onMessageSent, onAction, onFileUpload, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
286
+ declare function Chat({ agentId, threadId, initialMessages, context, apiUrl, apiKey, useMock, onThreadChange, onMessageSent, onAction, onFileUpload, placeholder, showHeader, headerTitle, className, }: ChatProps): react_jsx_runtime.JSX.Element;
285
287
 
286
288
  declare function Command({ agentId, command: initialCommand, context, autoExecute, allowInput, placeholder, submitButtonText, variant, useMock, planMode, onPlanModeChange, enableFileUpload, onStart, onProgress, onChunk, onComplete, onError, onFileUpload, onAction, loadingText, showProgress, enableStreaming, resultRenderer, className, }: CommandProps): react_jsx_runtime.JSX.Element;
287
289
 
package/dist/index.js 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__ */ _jsxruntime.jsx.call(void 0, "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__ */ _jsxruntime.jsx.call(void 0, "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__ */ _jsxruntime.jsx.call(void 0, "li", { children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
618
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "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__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "list-disc pl-5 my-1", children: listItems }, `ul${key++}`)
626
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "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__ */ _jsxruntime.jsx.call(void 0, "li", { children: parseInlineMarkdown(itemMatch[3], `${key}`) }, `li${key++}`)
638
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "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__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "list-decimal pl-5 my-1", children: listItems }, `ol${key++}`)
646
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "apteva-md-ol", children: listItems }, `ol${key++}`)
631
647
  );
632
648
  continue;
633
649
  }
@@ -646,7 +662,7 @@ function parseMarkdown(content) {
646
662
  return result;
647
663
  }
648
664
  function MarkdownContent({ content, className = "" }) {
649
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `markdown-content !text-sm leading-relaxed whitespace-pre-wrap ${className}`, children: parseMarkdown(content) });
665
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `apteva-md ${className}`, children: parseMarkdown(content) });
650
666
  }
651
667
 
652
668
  // src/components/Chat/ToolCall.tsx
@@ -715,7 +731,7 @@ function MessageList({ messages, onAction }) {
715
731
  listRef.current.scrollTop = listRef.current.scrollHeight;
716
732
  }
717
733
  }, [messages]);
718
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3", children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center space-y-2", children: [
734
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3 apteva-scrollbar-hidden", children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center space-y-2", children: [
719
735
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-4xl", children: "\u{1F4AC}" }),
720
736
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "No messages yet. Start a conversation!" })
721
737
  ] }) }) : messages.map((message) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 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] = _react.useState.call(void 0, initialMessages);
1004
1022
  const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
1005
1023
  const [currentThreadId, setCurrentThreadId] = _react.useState.call(void 0, threadId || null);
1024
+ _react.useEffect.call(void 0, () => {
1025
+ if (apiUrl || apiKey) {
1026
+ aptevaClient.configure({
1027
+ ...apiUrl && { apiUrl },
1028
+ ...apiKey && { apiKey }
1029
+ });
1030
+ }
1031
+ }, [apiUrl, apiKey]);
1006
1032
  _react.useEffect.call(void 0, () => {
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__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("flex flex-col h-full bg-white dark:bg-gray-900", className), children: [
1221
- showHeader && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-4 py-3 bg-white dark:bg-gray-900", children: [
1222
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }),
1223
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "!text-xs !text-gray-500 dark:!text-gray-400", children: [
1224
- "Agent: ",
1225
- agentId
1226
- ] })
1227
- ] }),
1246
+ showHeader && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 py-3 bg-white dark:bg-gray-900", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }) }),
1228
1247
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MessageList, { messages, onAction }),
1229
1248
  isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 py-2 !text-sm !text-gray-500 dark:!text-gray-400 italic", children: "AI is thinking..." }),
1230
1249
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Composer, { onSendMessage: handleSendMessage, placeholder, disabled: isLoading, onFileUpload })