@smart-cloud/ai-kit-ui 1.3.11 → 1.3.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-cloud/ai-kit-ui",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -65,9 +65,8 @@ const USE_AUDIO = false; // Set to true to enable audio recording feature (requi
65
65
  // New: history storage support
66
66
  const DEFAULT_PRESERVATION_TIME_DAYS = 1;
67
67
  const DEFAULT_HISTORY_STORAGE: HistoryStorageMode = "localstorage";
68
- const HISTORY_STORAGE_KEY = `ai-kit-chatbot-history-v1:${
69
- typeof window !== "undefined" ? window.location.hostname : "unknown"
70
- }`;
68
+ const HISTORY_STORAGE_KEY = `ai-kit-chatbot-history-v1:${typeof window !== "undefined" ? window.location.hostname : "unknown"
69
+ }`;
71
70
 
72
71
  export const DEFAULT_CHATBOT_LABELS: Required<AiChatbotLabels> = {
73
72
  modalTitle: "AI Assistant",
@@ -223,7 +222,7 @@ const formatStatusEvent = (
223
222
  case "backend:response":
224
223
  return I18n.get(
225
224
  labels.assistantThinkingLabel ??
226
- DEFAULT_CHATBOT_LABELS.assistantThinkingLabel,
225
+ DEFAULT_CHATBOT_LABELS.assistantThinkingLabel,
227
226
  );
228
227
  case "done":
229
228
  return msg || I18n.get("Done.");
@@ -964,9 +963,9 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
964
963
  blob instanceof File
965
964
  ? blob
966
965
  : new File([blob], attachment.name || "attachment", {
967
- type:
968
- attachment.type || blob.type || "application/octet-stream",
969
- });
966
+ type:
967
+ attachment.type || blob.type || "application/octet-stream",
968
+ });
970
969
 
971
970
  const objectUrl = createObjectUrl(file);
972
971
  if (!objectUrl) continue;
@@ -1055,7 +1054,7 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
1055
1054
  try {
1056
1055
  const activeSessionId =
1057
1056
  sessionRef.current &&
1058
- Date.now() - sessionRef.current.storedAt <
1057
+ Date.now() - sessionRef.current.storedAt <
1059
1058
  emptyHistoryAfterDays * TWENTY_FOUR_HOURS_MS
1060
1059
  ? sessionRef.current.id
1061
1060
  : undefined;
@@ -1149,7 +1148,7 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
1149
1148
  try {
1150
1149
  const activeSessionId =
1151
1150
  sessionRef.current &&
1152
- Date.now() - sessionRef.current.storedAt <
1151
+ Date.now() - sessionRef.current.storedAt <
1153
1152
  emptyHistoryAfterDays * TWENTY_FOUR_HOURS_MS
1154
1153
  ? sessionRef.current.id
1155
1154
  : undefined;
@@ -1777,53 +1776,53 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
1777
1776
  att.mediaType === "image" ||
1778
1777
  (!att.mediaType && att.type.startsWith("image/")),
1779
1778
  ).length > 0 && (
1780
- <Group
1781
- className="ai-thumbs ai-message-thumbs"
1782
- gap="xs"
1783
- >
1784
- {msg.attachments
1785
- .filter(
1786
- (att) =>
1787
- att.mediaType === "image" ||
1788
- (!att.mediaType &&
1789
- att.type.startsWith("image/")),
1790
- )
1791
- .map((attachment) => (
1792
- <button
1793
- key={attachment.id}
1794
- type="button"
1795
- className="thumb"
1796
- style={{
1797
- backgroundImage: attachment.objectUrl
1798
- ? `url(${attachment.objectUrl})`
1799
- : undefined,
1800
- backgroundSize: "cover",
1801
- backgroundPosition: "center",
1802
- backgroundRepeat: "no-repeat",
1803
- }}
1804
- onClick={() =>
1805
- openAttachmentPreview(
1806
- attachment.objectUrl,
1807
- attachment.name,
1808
- )
1809
- }
1810
- disabled={!attachment.objectUrl}
1811
- title={
1812
- attachment.name || I18n.get("View image")
1813
- }
1814
- aria-label={
1815
- attachment.name || I18n.get("View image")
1816
- }
1817
- >
1818
- {!attachment.objectUrl && (
1819
- <Text size="xs" c="dimmed">
1820
- {I18n.get("Image no longer available")}
1821
- </Text>
1822
- )}
1823
- </button>
1824
- ))}
1825
- </Group>
1826
- )}
1779
+ <Group
1780
+ className="ai-thumbs ai-message-thumbs"
1781
+ gap="xs"
1782
+ >
1783
+ {msg.attachments
1784
+ .filter(
1785
+ (att) =>
1786
+ att.mediaType === "image" ||
1787
+ (!att.mediaType &&
1788
+ att.type.startsWith("image/")),
1789
+ )
1790
+ .map((attachment) => (
1791
+ <button
1792
+ key={attachment.id}
1793
+ type="button"
1794
+ className="thumb"
1795
+ style={{
1796
+ backgroundImage: attachment.objectUrl
1797
+ ? `url(${attachment.objectUrl})`
1798
+ : undefined,
1799
+ backgroundSize: "cover",
1800
+ backgroundPosition: "center",
1801
+ backgroundRepeat: "no-repeat",
1802
+ }}
1803
+ onClick={() =>
1804
+ openAttachmentPreview(
1805
+ attachment.objectUrl,
1806
+ attachment.name,
1807
+ )
1808
+ }
1809
+ disabled={!attachment.objectUrl}
1810
+ title={
1811
+ attachment.name || I18n.get("View image")
1812
+ }
1813
+ aria-label={
1814
+ attachment.name || I18n.get("View image")
1815
+ }
1816
+ >
1817
+ {!attachment.objectUrl && (
1818
+ <Text size="xs" c="dimmed">
1819
+ {I18n.get("Image no longer available")}
1820
+ </Text>
1821
+ )}
1822
+ </button>
1823
+ ))}
1824
+ </Group>
1825
+ )}
1827
1826
 
1828
1827
  {/* Audio attachments */}
1829
1828
  {msg.attachments
@@ -2000,7 +1999,7 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
2000
1999
  onClose={cancelReset}
2001
2000
  centered
2002
2001
  title={I18n.get("Reset conversation")}
2003
- style={{ position: "fixed" }}
2002
+ style={{ zIndex: "var(--mb-z-index)", position: "fixed" }}
2004
2003
  left={0}
2005
2004
  >
2006
2005
  <Text size="sm">