@myun/gimi-chat 0.0.2 → 0.0.4

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 (206) hide show
  1. package/dist/apis/fetch.d.ts +64 -0
  2. package/dist/apis/fetch.js +512 -0
  3. package/dist/apis/useApi.d.ts +57 -0
  4. package/dist/apis/useApi.js +378 -0
  5. package/dist/assets/image/Subtract.png +0 -0
  6. package/dist/assets/image/ai-logo.png +0 -0
  7. package/dist/assets/image/copyIcon.png +0 -0
  8. package/dist/assets/image/deepthinkActive.png +0 -0
  9. package/dist/assets/image/empty-img-dark.png +0 -0
  10. package/dist/assets/image/empty-img.png +0 -0
  11. package/dist/assets/image/like_active.png +0 -0
  12. package/dist/assets/image/love.png +0 -0
  13. package/dist/assets/image/retry.png +0 -0
  14. package/dist/assets/image/soundOut.png +0 -0
  15. package/dist/assets/image/unlike_active.png +0 -0
  16. package/dist/assets/image/unlove.png +0 -0
  17. package/dist/assets/lottie/ai-bg.json +1704 -0
  18. package/dist/assets/lottie/ai-loading.json +192 -0
  19. package/dist/assets/lottie/ai-output-loading.json +272 -0
  20. package/dist/assets/lottie/ai-output-normal.json +17694 -0
  21. package/dist/assets/lottie/ai-output-strengthen.json +17321 -0
  22. package/dist/assets/lottie/ai-voice-play.json +1 -0
  23. package/dist/assets/lottie/living.json +705 -0
  24. package/dist/assets/lottie/myun-living.json +726 -0
  25. package/dist/assets/lottie/myun-loading.json +530 -0
  26. package/dist/components/ai-chat-dialogue/index.d.ts +16 -0
  27. package/dist/components/ai-chat-dialogue/index.js +1056 -0
  28. package/dist/components/ai-chat-dialogue/index.module.scss +272 -0
  29. package/dist/components/ai-chat-dialogue/message-parser.d.ts +36 -0
  30. package/dist/components/ai-chat-dialogue/message-parser.js +52 -0
  31. package/dist/components/ai-chat-dialogue/tlv.d.ts +7 -0
  32. package/dist/components/ai-chat-dialogue/tlv.js +32 -0
  33. package/dist/components/ai-chat-dialogue/volc-voice-call-client.d.ts +47 -0
  34. package/dist/components/ai-chat-dialogue/volc-voice-call-client.js +246 -0
  35. package/dist/components/ai-correction/index.d.ts +5 -0
  36. package/dist/components/ai-correction/index.js +45 -0
  37. package/dist/components/ai-loading/index.d.ts +3 -0
  38. package/dist/components/ai-loading/index.js +14 -0
  39. package/dist/components/ai-loading/index.module.scss +11 -0
  40. package/dist/components/answer-item/index.d.ts +27 -0
  41. package/dist/components/answer-item/index.js +194 -0
  42. package/dist/components/answer-item/index.module.scss +295 -0
  43. package/dist/components/ask-card/index.d.ts +10 -0
  44. package/dist/components/ask-card/index.js +76 -0
  45. package/dist/components/ask-card/index.module.scss +125 -0
  46. package/dist/components/chat-input/index.d.ts +31 -0
  47. package/dist/components/chat-input/index.js +433 -0
  48. package/dist/components/chat-input/index.module.scss +44 -0
  49. package/dist/components/chat-voice/VoiceCommunication.d.ts +7 -0
  50. package/dist/components/chat-voice/VoiceCommunication.js +69 -0
  51. package/dist/components/chat-voice/VoiceRecord.d.ts +7 -0
  52. package/dist/components/chat-voice/VoiceRecord.js +34 -0
  53. package/dist/components/conversation-delete/index.d.ts +5 -0
  54. package/dist/components/conversation-delete/index.js +24 -0
  55. package/dist/components/dots-loading/index.d.ts +2 -0
  56. package/dist/components/dots-loading/index.js +11 -0
  57. package/dist/components/dots-loading/index.module.scss +45 -0
  58. package/dist/components/empty/index.d.ts +9 -0
  59. package/dist/components/empty/index.js +32 -0
  60. package/dist/components/empty/index.module.scss +27 -0
  61. package/dist/components/excel-components/ExcelCard.d.ts +11 -0
  62. package/dist/components/excel-components/ExcelCard.js +35 -0
  63. package/dist/components/excel-components/ExcelExcuting.d.ts +10 -0
  64. package/dist/components/excel-components/ExcelExcuting.js +263 -0
  65. package/dist/components/excel-components/ExcelFailCard.d.ts +9 -0
  66. package/dist/components/excel-components/ExcelFailCard.js +20 -0
  67. package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -0
  68. package/dist/components/excel-components/ExcelSuccessCard.js +50 -0
  69. package/dist/components/excel-components/index.module.scss +210 -0
  70. package/dist/components/excel-components/styles.module.scss +186 -0
  71. package/dist/components/file-card/fileCardSidebar.d.ts +8 -0
  72. package/dist/components/file-card/fileCardSidebar.js +56 -0
  73. package/dist/components/file-card/index.d.ts +15 -0
  74. package/dist/components/file-card/index.js +97 -0
  75. package/dist/components/file-card/index.module.scss +139 -0
  76. package/dist/components/file-preview/index.d.ts +3 -0
  77. package/dist/components/file-preview/index.js +229 -0
  78. package/dist/components/file-preview/index.module.scss +120 -0
  79. package/dist/components/file-upload/index.d.ts +16 -0
  80. package/dist/components/file-upload/index.js +238 -0
  81. package/dist/components/file-upload/uploadV1.d.ts +16 -0
  82. package/dist/components/file-upload/uploadV1.js +267 -0
  83. package/dist/components/gimi-sidebar/index.d.ts +17 -0
  84. package/dist/components/gimi-sidebar/index.js +41 -0
  85. package/dist/components/gimi-sidebar/index.module.scss +136 -0
  86. package/dist/components/header/index.d.ts +5 -0
  87. package/dist/components/header/index.js +20 -0
  88. package/dist/components/header/index.module.scss +26 -0
  89. package/dist/components/iconfont-com/index.d.ts +11 -0
  90. package/dist/components/iconfont-com/index.js +29 -0
  91. package/dist/components/index.d.ts +1 -0
  92. package/dist/components/index.js +1 -0
  93. package/dist/components/knowledge-trace/KnowledgeIconComponent.d.ts +7 -0
  94. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +101 -0
  95. package/dist/components/knowledge-trace/classList.d.ts +6 -0
  96. package/dist/components/knowledge-trace/classList.js +72 -0
  97. package/dist/components/knowledge-trace/documentList.d.ts +6 -0
  98. package/dist/components/knowledge-trace/documentList.js +75 -0
  99. package/dist/components/knowledge-trace/index.d.ts +18 -0
  100. package/dist/components/knowledge-trace/index.js +155 -0
  101. package/dist/components/knowledge-trace/index.module.scss +262 -0
  102. package/dist/components/knowledge-trace/interfaces.d.ts +166 -0
  103. package/dist/components/knowledge-trace/interfaces.js +1 -0
  104. package/dist/components/knowledge-trace/videoList.d.ts +6 -0
  105. package/dist/components/knowledge-trace/videoList.js +91 -0
  106. package/dist/components/lottie-img/index.d.ts +8 -0
  107. package/dist/components/lottie-img/index.js +99 -0
  108. package/dist/components/message-actions/CopyButton.d.ts +7 -0
  109. package/dist/components/message-actions/CopyButton.js +33 -0
  110. package/dist/components/message-actions/LikeButton.d.ts +7 -0
  111. package/dist/components/message-actions/LikeButton.js +34 -0
  112. package/dist/components/message-actions/RegenerateButton.d.ts +5 -0
  113. package/dist/components/message-actions/RegenerateButton.js +27 -0
  114. package/dist/components/message-actions/UnLikeButton.d.ts +7 -0
  115. package/dist/components/message-actions/UnLikeButton.js +34 -0
  116. package/dist/components/message-actions/VoicePlay.d.ts +10 -0
  117. package/dist/components/message-actions/VoicePlay.js +74 -0
  118. package/dist/components/message-list/index.d.ts +19 -0
  119. package/dist/components/message-list/index.js +167 -0
  120. package/dist/components/message-list/index.module.scss +304 -0
  121. package/dist/components/no-microphone-root/index.d.ts +6 -0
  122. package/dist/components/no-microphone-root/index.js +36 -0
  123. package/dist/components/no-microphone-root/index.module.scss +42 -0
  124. package/dist/components/preset-agent-content/index.d.ts +8 -0
  125. package/dist/components/preset-agent-content/index.js +24 -0
  126. package/dist/components/preset-agent-content/index.module.scss +48 -0
  127. package/dist/components/quoted-content/index.d.ts +0 -0
  128. package/dist/components/quoted-content/index.js +171 -0
  129. package/dist/components/quoted-content/index.module.scss +76 -0
  130. package/dist/components/reasoning-content/index.d.ts +6 -0
  131. package/dist/components/reasoning-content/index.js +116 -0
  132. package/dist/components/reasoning-content/index.module.scss +164 -0
  133. package/dist/components/reference-content/index.d.ts +28 -0
  134. package/dist/components/reference-content/index.js +125 -0
  135. package/dist/components/reference-content/index.module.scss +73 -0
  136. package/dist/components/templates/CommonChat.d.ts +5 -0
  137. package/dist/components/templates/CommonChat.js +218 -0
  138. package/dist/components/templates/GimiChatComponent.d.ts +4 -0
  139. package/dist/components/templates/GimiChatComponent.js +23 -0
  140. package/dist/components/templates/demo/demo.d.ts +2 -0
  141. package/dist/components/templates/demo/demo.js +110 -0
  142. package/dist/components/templates/index.module.scss +119 -0
  143. package/dist/components/upload-list/index.d.ts +15 -0
  144. package/dist/components/upload-list/index.js +90 -0
  145. package/dist/components/upload-list/index.module.scss +119 -0
  146. package/dist/components/voice-bars/index.d.ts +4 -0
  147. package/dist/components/voice-bars/index.js +174 -0
  148. package/dist/components/voice-check-dialog/index.d.ts +8 -0
  149. package/dist/components/voice-check-dialog/index.js +163 -0
  150. package/dist/components/voice-check-dialog/index.module.scss +9 -0
  151. package/dist/components/voice-recording/index.d.ts +9 -0
  152. package/dist/components/voice-recording/index.js +54 -0
  153. package/dist/components/voice-recording/index.module.scss +41 -0
  154. package/dist/components/work-flow-content/demo.d.ts +3 -0
  155. package/dist/components/work-flow-content/demo.js +11 -0
  156. package/dist/components/work-flow-content/index.d.ts +6 -0
  157. package/dist/components/work-flow-content/index.js +55 -0
  158. package/dist/components/work-flow-content/index.module.scss +23 -0
  159. package/dist/constants.d.ts +24 -0
  160. package/dist/constants.js +24 -0
  161. package/dist/hooks/useChatActions.d.ts +12 -0
  162. package/dist/hooks/useChatActions.js +207 -0
  163. package/dist/hooks/useChatHistory.d.ts +8 -0
  164. package/dist/hooks/useChatHistory.js +225 -0
  165. package/dist/hooks/useChatMessage.d.ts +49 -0
  166. package/dist/hooks/useChatMessage.js +87 -0
  167. package/dist/hooks/useChatRecommend.d.ts +8 -0
  168. package/dist/hooks/useChatRecommend.js +126 -0
  169. package/dist/hooks/useChatStream.d.ts +20 -0
  170. package/dist/hooks/useChatStream.js +244 -0
  171. package/dist/hooks/useChatUI.d.ts +32 -0
  172. package/dist/hooks/useChatUI.js +134 -0
  173. package/dist/hooks/useChatVoice.d.ts +11 -0
  174. package/dist/hooks/useChatVoice.js +379 -0
  175. package/dist/hooks/useCommonChatAPI.d.ts +27 -0
  176. package/dist/hooks/useCommonChatAPI.js +1276 -0
  177. package/dist/hooks/useFile.d.ts +13 -0
  178. package/dist/hooks/useFile.js +288 -0
  179. package/dist/hooks/useKnowledgeService.d.ts +17 -0
  180. package/dist/hooks/useKnowledgeService.js +210 -0
  181. package/dist/hooks/useLastEventId.d.ts +8 -0
  182. package/dist/hooks/useLastEventId.js +66 -0
  183. package/dist/hooks/useLongPoll.d.ts +3 -0
  184. package/dist/hooks/useLongPoll.js +111 -0
  185. package/dist/hooks/useScroll.d.ts +4 -0
  186. package/dist/hooks/useScroll.js +172 -0
  187. package/dist/index.d.ts +1 -0
  188. package/dist/index.js +1 -0
  189. package/dist/interfaces/chatMessage.d.ts +139 -0
  190. package/dist/interfaces/fileInterface.d.ts +10 -0
  191. package/dist/interfaces/fileInterface.js +11 -0
  192. package/dist/interfaces/knowledgeTrace.d.ts +177 -0
  193. package/dist/store/hooks.d.ts +4 -0
  194. package/dist/store/hooks.js +3 -0
  195. package/dist/store/index.d.ts +7 -0
  196. package/dist/store/index.js +7 -0
  197. package/dist/store/slices/gimiMenuSlice.d.ts +95 -0
  198. package/dist/store/slices/gimiMenuSlice.js +251 -0
  199. package/dist/utils/chatInputUtil.d.ts +19 -0
  200. package/dist/utils/chatInputUtil.js +45 -0
  201. package/dist/utils/tools.d.ts +50 -0
  202. package/dist/utils/tools.js +474 -0
  203. package/dist/utils/voice-stream.d.ts +119 -0
  204. package/dist/utils/voice-stream.js +1162 -0
  205. package/package.json +2 -3
  206. package/LICENSE +0 -21
@@ -0,0 +1,111 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import React from 'react';
12
+ import useApi from "../apis/useApi";
13
+ import { Toast } from '@douyinfe/semi-ui';
14
+ export var useExcelExcuteLongPoll = function useExcelExcuteLongPoll(requestStatus, maxPolltime, requestId) {
15
+ var _useApi = useApi(),
16
+ getSkillData = _useApi.getSkillData;
17
+ // 存储定时器实例
18
+ var intervalRef = React.useRef(undefined);
19
+ // 存储轮询开始时间
20
+ var startTimeRef = React.useRef(0);
21
+ // 轮询结果
22
+ var _React$useState = React.useState(null),
23
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24
+ pollResult = _React$useState2[0],
25
+ setPollResult = _React$useState2[1];
26
+ var onPoll = React.useCallback( /*#__PURE__*/function () {
27
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestId) {
28
+ var res;
29
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
30
+ while (1) switch (_context.prev = _context.next) {
31
+ case 0:
32
+ _context.prev = 0;
33
+ _context.next = 3;
34
+ return getSkillData(requestId);
35
+ case 3:
36
+ res = _context.sent;
37
+ return _context.abrupt("return", res);
38
+ case 7:
39
+ _context.prev = 7;
40
+ _context.t0 = _context["catch"](0);
41
+ console.error('轮询请求失败:', _context.t0);
42
+ throw _context.t0;
43
+ case 11:
44
+ case "end":
45
+ return _context.stop();
46
+ }
47
+ }, _callee, null, [[0, 7]]);
48
+ }));
49
+ return function (_x) {
50
+ return _ref.apply(this, arguments);
51
+ };
52
+ }(), []);
53
+ React.useEffect(function () {
54
+ // 记录轮询开始时间
55
+ startTimeRef.current = Date.now();
56
+ var handlePoll = /*#__PURE__*/function () {
57
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
58
+ var elapsedTime, result, shouldStopPolling;
59
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
60
+ while (1) switch (_context2.prev = _context2.next) {
61
+ case 0:
62
+ elapsedTime = Date.now() - startTimeRef.current;
63
+ if (!(elapsedTime >= maxPolltime)) {
64
+ _context2.next = 5;
65
+ break;
66
+ }
67
+ Toast.warning('轮询已超过最大时长,自动终止');
68
+ clearInterval(intervalRef.current);
69
+ return _context2.abrupt("return");
70
+ case 5:
71
+ if (!(requestStatus === 1 || requestStatus === 2)) {
72
+ _context2.next = 7;
73
+ break;
74
+ }
75
+ return _context2.abrupt("return");
76
+ case 7:
77
+ _context2.next = 9;
78
+ return onPoll(requestId);
79
+ case 9:
80
+ result = _context2.sent;
81
+ // 判断是否需要停止轮询的条件
82
+ shouldStopPolling = result.status === 0 && (result.result.requestStatus === 1 || result.result.requestStatus === 2) || result.status !== 0; // 如果满足停止条件,清除定时器并设置结果
83
+ if (shouldStopPolling) {
84
+ clearInterval(intervalRef.current);
85
+ setPollResult(result);
86
+ }
87
+ case 12:
88
+ case "end":
89
+ return _context2.stop();
90
+ }
91
+ }, _callee2);
92
+ }));
93
+ return function handlePoll() {
94
+ return _ref2.apply(this, arguments);
95
+ };
96
+ }();
97
+
98
+ // 启动定时轮询
99
+ intervalRef.current = setInterval(handlePoll, 10000);
100
+
101
+ // 组件销毁时清除定时器
102
+ return function () {
103
+ if (intervalRef.current) {
104
+ clearInterval(intervalRef.current);
105
+ }
106
+ };
107
+ }, [maxPolltime, requestId, requestStatus, onPoll]);
108
+ return {
109
+ pollResult: pollResult
110
+ };
111
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ declare type UseScrollReturnType = [() => void, (animate?: boolean) => void, number, () => void, () => void, boolean, boolean];
3
+ declare const useScroll: (containerRef: React.RefObject<HTMLDivElement>, bottomPosition?: number) => UseScrollReturnType;
4
+ export default useScroll;
@@ -0,0 +1,172 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React from 'react';
8
+ import { throttle } from 'lodash';
9
+ var useScroll = function useScroll(containerRef) {
10
+ var _containerRef$current4;
11
+ var bottomPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
12
+ var _React$useState = React.useState(0),
13
+ _React$useState2 = _slicedToArray(_React$useState, 2),
14
+ currentPosition = _React$useState2[0],
15
+ setCurrentPosition = _React$useState2[1];
16
+ var _React$useState3 = React.useState(false),
17
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
18
+ isScrolling = _React$useState4[0],
19
+ setIsScrolling = _React$useState4[1];
20
+ var _React$useState5 = React.useState(false),
21
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
22
+ isUserScroll = _React$useState6[0],
23
+ setIsUserScroll = _React$useState6[1];
24
+
25
+ // 使用一个ref对象管理所有临时状态,避免重渲染
26
+ var refs = React.useRef({
27
+ scrollTimeout: 0,
28
+ interactionTimer: null,
29
+ lastScrollTop: 0,
30
+ isUserInteracting: false
31
+ }).current;
32
+
33
+ // 标记用户交互状态
34
+ var markUserInteraction = React.useCallback(function (isInteracting) {
35
+ refs.isUserInteracting = isInteracting;
36
+ setIsUserScroll(isInteracting);
37
+
38
+ // 清理之前的定时器
39
+ if (refs.interactionTimer) {
40
+ clearTimeout(refs.interactionTimer);
41
+ }
42
+
43
+ // 用户交互2秒后自动恢复自动滚动
44
+ // if (isInteracting) {
45
+ // refs.interactionTimer = setTimeout(() => {
46
+ // refs.isUserInteracting = false;
47
+ // setIsUserScroll(false);
48
+ // }, 2000);
49
+ // }
50
+ }, []);
51
+
52
+ // 基础滚动到底部
53
+ var scrollBottom = React.useCallback(function () {
54
+ if (containerRef.current) {
55
+ containerRef.current.scrollTop = containerRef.current.scrollHeight;
56
+ }
57
+ }, [containerRef.current]);
58
+
59
+ // 智能滚动到底部(只在非用户交互时执行)
60
+ var throttledScrollToBottom = React.useCallback(throttle(function () {
61
+ if (!refs.isUserInteracting) {
62
+ scrollBottom();
63
+ }
64
+ }, 300), [scrollBottom]);
65
+
66
+ // 强制滚动到底部
67
+ var scrollBottomForce = React.useCallback(function () {
68
+ var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
69
+ if (containerRef.current) {
70
+ markUserInteraction(false); // 重置为用户非交互状态
71
+
72
+ if (animate) {
73
+ containerRef.current.scrollTo({
74
+ top: containerRef.current.scrollHeight,
75
+ behavior: 'smooth'
76
+ });
77
+ } else {
78
+ scrollBottom();
79
+ }
80
+ }
81
+ }, [containerRef.current, markUserInteraction, scrollBottom]);
82
+
83
+ // 更新滚动位置
84
+ var updateScrollHeight = React.useCallback(function () {
85
+ if (containerRef.current) {
86
+ var _containerRef$current = containerRef.current,
87
+ scrollTop = _containerRef$current.scrollTop,
88
+ scrollHeight = _containerRef$current.scrollHeight,
89
+ clientHeight = _containerRef$current.clientHeight;
90
+ var position = scrollHeight - clientHeight - scrollTop;
91
+ setCurrentPosition(position);
92
+ }
93
+ }, [containerRef.current]);
94
+
95
+ // 滚轮事件处理 - 检测用户向上滚动意图
96
+ var handleWheel = React.useCallback(throttle(function (e) {
97
+ // 向上滚动时立即停止自动滚动
98
+ if (e.deltaY < 0) {
99
+ markUserInteraction(true);
100
+ }
101
+ }, 100), [markUserInteraction]);
102
+
103
+ // 滚动事件处理
104
+ var handleScroll = React.useCallback(throttle(function () {
105
+ if (!containerRef.current) return;
106
+ var _containerRef$current2 = containerRef.current,
107
+ scrollTop = _containerRef$current2.scrollTop,
108
+ scrollHeight = _containerRef$current2.scrollHeight,
109
+ clientHeight = _containerRef$current2.clientHeight;
110
+ var position = Math.max(0, scrollHeight - clientHeight - scrollTop);
111
+ setCurrentPosition(position);
112
+ setIsScrolling(true);
113
+
114
+ // 检测滚动方向
115
+ var scrollDelta = scrollTop - refs.lastScrollTop;
116
+ if (Math.abs(scrollDelta) > 2) {
117
+ if (scrollDelta < 0) {
118
+ // 向上滚动:用户可能在看历史消息
119
+ markUserInteraction(true);
120
+ } else if (position <= 5) {
121
+ // 向下滚动到底部:恢复自动滚动
122
+ markUserInteraction(false);
123
+ }
124
+ refs.lastScrollTop = scrollTop;
125
+ }
126
+
127
+ // 设置滚动结束状态
128
+ if (refs.scrollTimeout) clearTimeout(refs.scrollTimeout);
129
+ refs.scrollTimeout = setTimeout(function () {
130
+ setIsScrolling(false);
131
+ }, 200);
132
+ }, 150), [containerRef.current, markUserInteraction]);
133
+
134
+ // 事件监听器
135
+ React.useEffect(function () {
136
+ var container = containerRef.current;
137
+ if (!container) return;
138
+ container.addEventListener('scroll', handleScroll);
139
+ container.addEventListener('wheel', handleWheel, {
140
+ passive: true
141
+ });
142
+ return function () {
143
+ container.removeEventListener('scroll', handleScroll);
144
+ container.removeEventListener('wheel', handleWheel);
145
+
146
+ // 清理定时器
147
+ if (refs.scrollTimeout) clearTimeout(refs.scrollTimeout);
148
+ if (refs.interactionTimer) clearTimeout(refs.interactionTimer);
149
+ };
150
+ }, [containerRef.current, handleScroll, handleWheel]);
151
+
152
+ // 内容变化时自动滚动
153
+ React.useEffect(function () {
154
+ if (!containerRef.current || refs.isUserInteracting) return;
155
+ var _containerRef$current3 = containerRef.current,
156
+ scrollTop = _containerRef$current3.scrollTop,
157
+ scrollHeight = _containerRef$current3.scrollHeight,
158
+ clientHeight = _containerRef$current3.clientHeight;
159
+ var distanceToBottom = scrollHeight - clientHeight - scrollTop;
160
+
161
+ // 只有当距离底部较近时才自动滚动
162
+ if (distanceToBottom <= bottomPosition * 2) {
163
+ requestAnimationFrame(function () {
164
+ if (containerRef.current) {
165
+ containerRef.current.scrollTop = containerRef.current.scrollHeight;
166
+ }
167
+ });
168
+ }
169
+ }, [(_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.scrollHeight, bottomPosition]);
170
+ return [throttledScrollToBottom, scrollBottomForce, currentPosition, scrollBottom, updateScrollHeight, isScrolling, isUserScroll];
171
+ };
172
+ export default useScroll;
@@ -0,0 +1 @@
1
+ export * from './components';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./components";
@@ -0,0 +1,139 @@
1
+ import { MCPItem } from "../types/answer";
2
+ import { FileItem } from "../types/file";
3
+
4
+ /**
5
+ * 聊天消息主接口
6
+ */
7
+ export interface IChatMessageItem {
8
+ /** 代理ID(可选,无值时为 null) */
9
+ agentId?: number | null;
10
+ /** 机器人ID(可选,无值时为 null) */
11
+ botId?: string | null;
12
+ /** 聊天ID */
13
+ chatId?: string;
14
+ /** 消息内容 */
15
+ content?: string;
16
+ /** 内容状态标识 */
17
+ contentState?: boolean;
18
+ /** 内容类型 */
19
+ contentType?: number;
20
+ /** 会话ID */
21
+ conversationId?: string;
22
+ /** 创建时间(时间戳格式) */
23
+ createdTime?: number;
24
+ /** 消息唯一标识ID */
25
+ id: number;
26
+ /** 问题ID(可选,无值时为 null) */
27
+ questionId?: number | null;
28
+ /** 输入模型(空字符串) */
29
+ inputModel?: string | null;
30
+ /** 是否完整输出标识 */
31
+ isCompleteOut?: number;
32
+ /** 是否系统自动发送标识 */
33
+ isSystemAuto?: number;
34
+ /** 标记标识 */
35
+ mark?: number;
36
+ /** 消息附件文件(可选,无值时为 null) */
37
+ messageFiles?: null | FileItem; // 若后续明确文件结构,可替换 unknown[] 为具体文件接口
38
+ /** 消息ID(可选,无值时为 null) */
39
+ messageId?: number | string | null;
40
+ /** 模块类型 */
41
+ moduleType?: string;
42
+ /** 是否需要搜索标识 */
43
+ needSearch?: boolean;
44
+ /** 查询内容(可选,无值时为 null) */
45
+ query?: null | string;
46
+ /** 引用产品ID列表(字符串格式,多个用分隔符分隔) */
47
+ quoteProductIds?: string;
48
+ /** 引用产品列表(可选,无值时为 null) */
49
+ quoteProductList?: null | {productId: number}[]; // 若后续明确产品结构,可替换 unknown[] 为具体产品接口
50
+ /** 引用教学模型ID列表(字符串格式,多个用分隔符分隔) */
51
+ quoteTeachModelIds?: string;
52
+ /** 引用教学模型列表(可选,无值时为 null) */
53
+ quoteTeachModelList?: null | {teachModelId: number}[]; // 若后续明确模型结构,可替换 unknown[] 为具体模型接口
54
+ /** 推理内容(可选,无值时为 null) */
55
+ reasoningContent?: null | string;
56
+ /** 推理内容状态标识 */
57
+ reasoningContentState?: boolean;
58
+ /** 相关内容数量 */
59
+ relatedCount?: number | null;
60
+ /** 相关课程推荐(可选,无值时为 null) */
61
+ relatedCourseRecommendation?: null | unknown[]; // 若后续明确课程结构,可替换 unknown[] 为具体课程接口
62
+ /** 相关资源列表 */
63
+ relatedResourceList?: RelatedResource[] | null;
64
+ /** 角色标识 */
65
+ role?: number;
66
+ /** 章节ID(可选,无值时为 null) */
67
+ sectionId?: number | string | null;
68
+ /** 技能结果(可选,无值时为 null) */
69
+ skillResult?: null | unknown;
70
+ /** 令牌数量 */
71
+ tokens?: number;
72
+ /** 工具调用(可选,无值时为 null) */
73
+ toolCall?: null | unknown;
74
+ /** 消息类型 */
75
+ type?: number;
76
+ /** 更新时间(时间戳格式) */
77
+ updatedTime?: number;
78
+ /** 视频资源列表(可选,无值时为 null) */
79
+ videoResourceList?: null | unknown[]; // 若后续明确视频结构,可替换 unknown[] 为具体视频接口
80
+ /** VIP等级 */
81
+ vipLevel?: number;
82
+
83
+ moduleInfo?: ModuleInfo | null;
84
+
85
+ reTryed?: boolean;
86
+
87
+ selectValue?: string;
88
+
89
+ disableUploadFile?: boolean;
90
+
91
+ mcp?: MCPItem | null;
92
+
93
+ loading?: boolean;
94
+
95
+ stop?: number;
96
+
97
+ reasoningStatus?: number;
98
+ /** 是否展开推理内容 */
99
+ expand?: boolean;
100
+ /** 推理内容是否加载中 */
101
+ reasoningLoading?: boolean;
102
+ /** 消息是否加载中 */
103
+ msgLoading?: boolean;
104
+ }
105
+
106
+ interface ModuleInfo {
107
+ moduleType: string;
108
+ id: string;
109
+ data: {
110
+ results: {
111
+ skillResult: {
112
+ message: string;
113
+ requestId: number;
114
+ requestStatus: number;
115
+ };
116
+ askShowInfo: {
117
+ questionContent: string;
118
+ answerType: number;
119
+ };
120
+ };
121
+ };
122
+ }
123
+
124
+ /**
125
+ * 相关资源子接口
126
+ */
127
+ interface RelatedResource {
128
+ /** 资源内容(JSON字符串格式,包含推荐问题列表) */
129
+ content: string;
130
+ /** 资源唯一标识ID */
131
+ id: number;
132
+ /** 关联的消息ID */
133
+ messageId: number;
134
+ /** 资源总数量 */
135
+ totalCount: number;
136
+ /** 资源类型 */
137
+ type: number;
138
+ recommendQuestions: string;
139
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum FileStatus {
2
+ UPLOADING = "uploading",
3
+ UPLOAD_FAILED = "uploadFail",
4
+ UPLOAD_SUCCESS = "success",
5
+ PADDING = "padding",
6
+ RETRING = "retring",
7
+ ANALYSE_FAILED = "analyseFailed",
8
+ ANALYSE_SUCCESS = "analyseSuccess",
9
+ NETWORK_ERROR = "networkError"
10
+ }
@@ -0,0 +1,11 @@
1
+ export var FileStatus = /*#__PURE__*/function (FileStatus) {
2
+ FileStatus["UPLOADING"] = "uploading";
3
+ FileStatus["UPLOAD_FAILED"] = "uploadFail";
4
+ FileStatus["UPLOAD_SUCCESS"] = "success";
5
+ FileStatus["PADDING"] = "padding";
6
+ FileStatus["RETRING"] = "retring";
7
+ FileStatus["ANALYSE_FAILED"] = "analyseFailed";
8
+ FileStatus["ANALYSE_SUCCESS"] = "analyseSuccess";
9
+ FileStatus["NETWORK_ERROR"] = "networkError";
10
+ return FileStatus;
11
+ }({});
@@ -0,0 +1,177 @@
1
+ /**
2
+ * 产品信息接口
3
+ */
4
+ export interface IProduct {
5
+ /** 产品ID(必选) */
6
+ id: number;
7
+ /** 产品名称(必选) */
8
+ name: string;
9
+ /** 产品包别名(可选) */
10
+ nickName?: string;
11
+ /**
12
+ * 产品类型(必选)
13
+ * - single: 单个产品
14
+ * - resource: 资源产品包
15
+ * - vip: 会员产品包
16
+ */
17
+ productType: 'single' | 'product';
18
+ /** 产品封面URL(可选) */
19
+ productUrl?: string;
20
+ /** 产品封面Token(可选) */
21
+ productToken?: string;
22
+ /** 产品介绍(可选) */
23
+ intro?: string;
24
+ /** 产品详细介绍(可选) */
25
+ details?: string;
26
+ /** 产品分类ID(可选) */
27
+ categoryId?: number;
28
+ /** 产品分类名称(可选) */
29
+ categoryName?: string;
30
+ /** 课程模块数(可选,注意:字段类型为String,按原始定义保留) */
31
+ courseNum?: string;
32
+ /** 教学模块数(可选,注意:字段类型为String,按原始定义保留) */
33
+ modelNum?: string;
34
+ /**
35
+ * 是否发布(必选)
36
+ * - 1: 是
37
+ * - 0: 否
38
+ */
39
+ state: 1 | 0;
40
+ /**
41
+ * 是否公开(必选,推测值为 1:是 / 0:否,与state保持一致格式)
42
+ */
43
+ publiced: 1 | 0;
44
+ /** 更新时间(可选,格式建议为 ISO 8601 字符串,如:2025-11-10T10:00:00Z) */
45
+ updatedAt?: string;
46
+ /** 机构ID(可选) */
47
+ agencyId?: number;
48
+ /** 系列ID(可选) */
49
+ seriesId?: number;
50
+ /** 系列名称(可选) */
51
+ seriesName?: string;
52
+ /**
53
+ * 产品资源类型(可选)
54
+ * - course: 课程
55
+ * - special: 专题
56
+ */
57
+ resourceType?: 'course' | 'special';
58
+ /** 授课形式(可选) */
59
+ teachingType?: string;
60
+ /** 标签(可选,若为多个标签建议改为 string[],此处按原始定义保留) */
61
+ label?: string;
62
+ /** 权益标签(可选,若为多个标签建议改为 string[],此处按原始定义保留) */
63
+ equityLabel?: string;
64
+ /** 权益类型名称列表(可选) */
65
+ benefitTypeNames?: string[];
66
+ /**
67
+ * 展示样式(可选)
68
+ * - 0: 不展示
69
+ * - 1: 免费畅看
70
+ * - 2: 计次计费单课
71
+ * - 3: 暂无权益
72
+ */
73
+ showStyle?: 0 | 1 | 2 | 3;
74
+ /**
75
+ * 是否过期(可选,推测值为 1:是 / 0:否,与state保持一致格式)
76
+ */
77
+ isExpired?: 1 | 0;
78
+ /**
79
+ * 是否被选中(可选)
80
+ * - 1: 是
81
+ * - 0: 否
82
+ */
83
+ isChecked?: 1 | 0;
84
+ /** 课堂ID(必选,关联所属课堂) */
85
+ gradeId: number;
86
+ // 状态标识
87
+ isJoinClass: number; // 是否加入班级(1:是;0:否,非null)
88
+ isDelete: number; // 资源是否已删除 (1:删除 0 :未删除)
89
+ isActive?: boolean; // 是否高亮
90
+ }
91
+
92
+ /**
93
+ * 教学模块资源信息接口
94
+ */
95
+ export interface ITeachingModuleResource {
96
+ /** 教学模块ID(可选,允许为null) */
97
+ id?: number | null;
98
+ /** 教学模块名称(可选,允许为null) */
99
+ name?: string | null;
100
+ /** 资源类型(必选) */
101
+ teachingModuleType: string;
102
+ /** 资源ID(必选) */
103
+ hostId: number;
104
+ /** 资源访问Token(必选) */
105
+ fileToken: string;
106
+ /** 视频类型(如mp4、avi等,必选) */
107
+ suffix: string;
108
+ /** 资源URL地址(必选) */
109
+ url: string;
110
+ /** 资源来源(必选,如:upload-用户上传、system-系统内置等) */
111
+ origin: string;
112
+ /** 资源大小(单位:字节,必选,对应后端Long类型,前端用number兼容) */
113
+ size: number;
114
+ /** 资料大小(已做单位转换,如:10MB、200KB等,必选) */
115
+ sizeUnit: string;
116
+ /** 课程模块ID(必选) */
117
+ courseId: number;
118
+ /** 阶段ID(必选,如课程的章节/阶段划分) */
119
+ phaseId: number;
120
+ /** 产品ID(必选,关联所属产品) */
121
+ productId: number;
122
+ /**
123
+ * 产品类型(必选)
124
+ * - single: 单个产品
125
+ * - resource: 资源产品包
126
+ * - vip: 会员产品包
127
+ */
128
+ productType: 'single' | 'product';
129
+ /** 课堂ID(必选,关联所属课堂) */
130
+ gradeId: number;
131
+ /**是否加入班级,1:是;0:否 */
132
+ isJoinClass: number;
133
+ isDelete: number; // 资源是否已删除 (1:删除 0 :未删除)
134
+ isActive?: boolean; // 是否高亮
135
+ }
136
+
137
+ export interface IVideoResource {
138
+ // 基础信息
139
+ id?: number; // 教学模块ID(允许为null)
140
+ name?: string; // 教学模块名称(允许为null)
141
+ teachingModuleType: string; // 资源类型(非null)
142
+ hostId: number; // 资源ID(非null)
143
+
144
+ // 视频/文件相关信息
145
+ duration: number; // 时长(分钟,非null)
146
+ fileToken: string; // token(非null)
147
+ suffix: string; // 视频类型(非null)
148
+ url: string; // URL地址(非null)
149
+ origin: string; // 来源(非null)
150
+ size: number; // 大小(字节,非null)
151
+ durationToHms: string; // 时长(时:分:秒,非null)
152
+ durationSecond: number; // 时长(秒,非null)
153
+ sizeUnit: string; // 资料大小(单位转换,非null)
154
+ coverUrl: string; // 视频封面
155
+
156
+ // 时间信息
157
+ startedAt?: string; // 开始时间(允许为null)
158
+ endedAt?: string; // 结束时间(允许为null)
159
+ startedAtSecond?: string // 开始时间(秒)
160
+
161
+ // 关联ID信息(去重后保留唯一字段)
162
+ courseId: number; // 课程模块ID(非null)
163
+ phaseId: number; // 阶段ID(非null)
164
+ productId: number; // 产品ID(非null)
165
+ gradeId: number; // 课堂ID(非null)
166
+ // 状态标识
167
+ isJoinClass: number; // 是否加入班级(1:是;0:否,非null)
168
+ isDelete: number; // 资源是否已删除 (1:删除 0 :未删除)
169
+ sliceId: string; // 视频切片ID(非null)
170
+ /**
171
+ * 产品类型(必选)
172
+ * - single: 单个产品
173
+ * - resource: 资源产品包
174
+ * - vip: 会员产品包
175
+ */
176
+ productType: 'single' | 'product';
177
+ }
@@ -0,0 +1,4 @@
1
+ import type { TypedUseSelectorHook } from 'react-redux';
2
+ import type { RootState, AppDispatch } from './index';
3
+ export declare const useAppDispatch: () => AppDispatch;
4
+ export declare const useAppSelector: TypedUseSelectorHook<RootState>;
@@ -0,0 +1,3 @@
1
+ import { useDispatch, useSelector } from 'react-redux';
2
+ export var useAppDispatch = useDispatch;
3
+ export var useAppSelector = useSelector;
@@ -0,0 +1,7 @@
1
+ import { EnhancedStore } from '@reduxjs/toolkit';
2
+ import { GimiMenuState } from './slices/gimiMenuSlice';
3
+ export declare const store: EnhancedStore<{
4
+ gimiMenu: GimiMenuState;
5
+ }>;
6
+ export declare type RootState = ReturnType<typeof store.getState>;
7
+ export declare type AppDispatch = typeof store.dispatch;