@burtson-labs/bandit-engine 2.0.39 → 2.0.40

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.
Files changed (45) hide show
  1. package/dist/{aiProviderStore-XN7GCBHJ.mjs → aiProviderStore-JMA5RWX7.mjs} +2 -2
  2. package/dist/{chat-5QJNWB7I.mjs → chat-JMWPOSQ4.mjs} +5 -5
  3. package/dist/chat-provider.js +421 -20
  4. package/dist/chat-provider.js.map +1 -1
  5. package/dist/chat-provider.mjs +4 -4
  6. package/dist/{chunk-WO5KFNNW.mjs → chunk-26QQ4CLA.mjs} +62 -24
  7. package/dist/chunk-26QQ4CLA.mjs.map +1 -0
  8. package/dist/{chunk-CDQYBO3Q.mjs → chunk-2ZCR2TDY.mjs} +27 -5
  9. package/dist/chunk-2ZCR2TDY.mjs.map +1 -0
  10. package/dist/{chunk-ECRNIAG6.mjs → chunk-6ELNWXKC.mjs} +4 -4
  11. package/dist/{chunk-EOKIE5HZ.mjs → chunk-75W5VWPV.mjs} +3 -3
  12. package/dist/{chunk-JRCDANLN.mjs → chunk-7KEBNVCO.mjs} +67 -9
  13. package/dist/{chunk-JRCDANLN.mjs.map → chunk-7KEBNVCO.mjs.map} +1 -1
  14. package/dist/{chunk-3A2527TE.mjs → chunk-D3AGKOM6.mjs} +3 -3
  15. package/dist/{chunk-QU5S5QQP.mjs → chunk-QJYPWWA5.mjs} +379 -18
  16. package/dist/chunk-QJYPWWA5.mjs.map +1 -0
  17. package/dist/{chunk-QYH2T4L5.mjs → chunk-VIYBZO5W.mjs} +3 -3
  18. package/dist/{cli/cli.js → cli.js} +423 -10
  19. package/dist/cli.js.map +1 -0
  20. package/dist/{gateway-B0LJ3-jT.d.ts → gateway-5yt_3QDP.d.mts} +4 -4
  21. package/dist/{gateway-B0LJ3-jT.d.mts → gateway-5yt_3QDP.d.ts} +4 -4
  22. package/dist/index.d.mts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +598 -101
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +8 -8
  27. package/dist/management/management.js +596 -99
  28. package/dist/management/management.js.map +1 -1
  29. package/dist/management/management.mjs +6 -6
  30. package/dist/modals/chat-modal/chat-modal.js +430 -29
  31. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  32. package/dist/modals/chat-modal/chat-modal.mjs +4 -4
  33. package/dist/public-types.d.mts +1 -1
  34. package/dist/public-types.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-CDQYBO3Q.mjs.map +0 -1
  37. package/dist/chunk-QU5S5QQP.mjs.map +0 -1
  38. package/dist/chunk-WO5KFNNW.mjs.map +0 -1
  39. package/dist/cli/cli.js.map +0 -1
  40. /package/dist/{aiProviderStore-XN7GCBHJ.mjs.map → aiProviderStore-JMA5RWX7.mjs.map} +0 -0
  41. /package/dist/{chat-5QJNWB7I.mjs.map → chat-JMWPOSQ4.mjs.map} +0 -0
  42. /package/dist/{chunk-ECRNIAG6.mjs.map → chunk-6ELNWXKC.mjs.map} +0 -0
  43. /package/dist/{chunk-EOKIE5HZ.mjs.map → chunk-75W5VWPV.mjs.map} +0 -0
  44. /package/dist/{chunk-3A2527TE.mjs.map → chunk-D3AGKOM6.mjs.map} +0 -0
  45. /package/dist/{chunk-QYH2T4L5.mjs.map → chunk-VIYBZO5W.mjs.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-XUBYA5I7.mjs";
6
6
  import {
7
7
  useAIProviderStore
8
- } from "./chunk-QU5S5QQP.mjs";
8
+ } from "./chunk-QJYPWWA5.mjs";
9
9
  import {
10
10
  debugLogger
11
11
  } from "./chunk-KCI46M23.mjs";
@@ -501,13 +501,17 @@ var useConversationStore = create3((set, get) => ({
501
501
  const updatedConversations = conversations.map((c) => {
502
502
  if (c.id === currentId && c.history.length > 0) {
503
503
  const updatedHistory = [...c.history];
504
+ const existingImages = updatedHistory[updatedHistory.length - 1].images;
505
+ const nextImages = Array.isArray(images) && images.length > 0 ? [...images] : Array.isArray(existingImages) && existingImages.length > 0 ? [...existingImages] : existingImages;
504
506
  updatedHistory[updatedHistory.length - 1] = {
505
507
  ...updatedHistory[updatedHistory.length - 1],
506
508
  answer,
507
509
  memoryUpdated,
508
- images: images ?? updatedHistory[updatedHistory.length - 1].images,
510
+ images: nextImages,
509
511
  sourceFiles: sourceFiles ?? updatedHistory[updatedHistory.length - 1].sourceFiles,
510
- cancelled: cancelled ?? updatedHistory[updatedHistory.length - 1].cancelled
512
+ cancelled: cancelled ?? updatedHistory[updatedHistory.length - 1].cancelled,
513
+ placeholder: false,
514
+ rawQuestion: void 0
511
515
  };
512
516
  return normalizeConversation({ ...c, history: updatedHistory, updatedAt: /* @__PURE__ */ new Date() });
513
517
  }
@@ -588,6 +592,24 @@ var useConversationStore = create3((set, get) => ({
588
592
  });
589
593
  continue;
590
594
  }
595
+ if (Array.isArray(existing.history) && Array.isArray(conversation.history)) {
596
+ const mergedHistory = conversation.history.map((incomingEntry, index) => {
597
+ const existingEntry = existing.history[index];
598
+ if (!existingEntry) {
599
+ return incomingEntry;
600
+ }
601
+ const mergedImagesSource = Array.isArray(incomingEntry.images) && incomingEntry.images.length > 0 ? incomingEntry.images : existingEntry.images;
602
+ const mergedImages = Array.isArray(mergedImagesSource) && mergedImagesSource.length > 0 ? [...mergedImagesSource] : mergedImagesSource;
603
+ return {
604
+ ...existingEntry,
605
+ ...incomingEntry,
606
+ images: mergedImages,
607
+ placeholder: incomingEntry.placeholder ?? existingEntry.placeholder,
608
+ rawQuestion: incomingEntry.rawQuestion ?? existingEntry.rawQuestion
609
+ };
610
+ });
611
+ conversation.history = mergedHistory;
612
+ }
591
613
  }
592
614
  next.set(conversation.id, conversation);
593
615
  toPersist.push(conversation);
@@ -4652,7 +4674,7 @@ var useVectorStore = () => {
4652
4674
  const [hasCompatibleProvider, setHasCompatibleProvider] = useState2(false);
4653
4675
  const checkProviderCompatibility = useCallback2(async () => {
4654
4676
  try {
4655
- const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-XN7GCBHJ.mjs");
4677
+ const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-JMA5RWX7.mjs");
4656
4678
  const aiProviderState = useAIProviderStore2.getState();
4657
4679
  const provider = aiProviderState.provider;
4658
4680
  const config = aiProviderState.config;
@@ -5694,4 +5716,4 @@ export {
5694
5716
  useNotification,
5695
5717
  NotificationProvider
5696
5718
  };
5697
- //# sourceMappingURL=chunk-CDQYBO3Q.mjs.map
5719
+ //# sourceMappingURL=chunk-2ZCR2TDY.mjs.map