@mujian/js-sdk 0.0.6-beta.24 → 0.0.6-beta.26

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.
@@ -1,4 +1,3 @@
1
1
  export declare const iframeDOMLoaded = "\n(function () {\n function emit_loaded_event() {\n window.parent.postMessage({ type: 'MJ_DOM_CONTENT_LOADED', iframeId: '123' }, '*');\n }\n\n if (window.document.readyState === 'loading') {\n window.document.addEventListener('DOMContentLoaded', emit_loaded_event, { once: true });\n } else {\n emit_loaded_event();\n }\n})();\n";
2
- export declare const iframeAdjustViewport: string;
3
2
  export declare const init = "\n(async function () {\n\nwindow.$mujian2 = window.parent.$mujian;\nconst result = await $mujian2?.ai.chat.project.getInfo();\nconsole.log('result', result);\n\n})();\n";
4
3
  export declare const thirdParty = "\n<script src=\"https://cdn.jsdmirror.com/npm/@fortawesome/fontawesome-free/js/all.min.js\"></script>\n<script src=\"https://cdn.jsdmirror.com/npm/@tailwindcss/browser/dist/index.global.min.js\"></script>\n<script src=\"https://cdn.jsdmirror.com/npm/jquery/dist/jquery.min.js\"></script>\n<script src=\"https://cdn.jsdmirror.com/npm/jquery-ui/dist/jquery-ui.min.js\"></script>\n<link rel=\"stylesheet\" href=\"https://cdn.jsdmirror.com/npm/jquery-ui/themes/base/theme.min.css\" />\n<script src=\"https://cdn.jsdmirror.com/npm/jquery-ui-touch-punch\"></script>\n";
package/dist/react.js CHANGED
@@ -235,7 +235,6 @@ function messageFormatting(mes, sanitizerOverrides = {}) {
235
235
  });
236
236
  return mes;
237
237
  }
238
- window.parent.innerHeight, window.parent.innerHeight;
239
238
  const init = `
240
239
  (async function () {
241
240
 
@@ -771,6 +770,8 @@ async function* callSdk(mujian, content, type = 'generate', signal) {
771
770
  });
772
771
  }
773
772
  const NOT_SAVED_MSG_ID_PREFIX = 'not_saved';
773
+ const FALLBACK_MESSAGE = `<!-- 此条HTML消息为系统提示,请勿复读 -->
774
+ 哎呀,AI线路好像抽风了,重说一下试试吧~`;
774
775
  const useChatStreaming = ({ common, setError, setMessages, mujian })=>{
775
776
  const { body } = common;
776
777
  const [isStreaming, setIsStreaming] = useState(false);
@@ -888,10 +889,15 @@ const useChatStreaming = ({ common, setError, setMessages, mujian })=>{
888
889
  const newMessages = [
889
890
  ...prev
890
891
  ];
891
- newMessages[newMessages.length - 1] = {
892
+ const lastMessage = {
892
893
  ...newMessages[newMessages.length - 1],
893
894
  isStreaming: false
894
895
  };
896
+ if (!lastMessage.swipes[lastMessage.activeSwipeId]) {
897
+ lastMessage.swipes[lastMessage.activeSwipeId] = FALLBACK_MESSAGE;
898
+ lastMessage.content = FALLBACK_MESSAGE;
899
+ }
900
+ newMessages[newMessages.length - 1] = lastMessage;
895
901
  return newMessages;
896
902
  });
897
903
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mujian/js-sdk",
3
- "version": "0.0.6-beta.24",
3
+ "version": "0.0.6-beta.26",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {