@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,378 @@
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
+ import { createFetch } from "./fetch";
6
+ import { useAppSelector } from "../store/hooks";
7
+ import React from 'react';
8
+ var useApi = function useApi() {
9
+ var token = useAppSelector(function (state) {
10
+ return state.gimiMenu.token;
11
+ });
12
+ var baseURL = useAppSelector(function (state) {
13
+ return state.gimiMenu.baseUrl;
14
+ });
15
+ var apiRef = React.useRef(createFetch({
16
+ baseURL: baseURL,
17
+ timeout: 10000,
18
+ headers: {
19
+ 'Authorization': 'Bearer ' + token,
20
+ 'X-Mc-Domain': location.hostname,
21
+ 'Content-Type': 'application/json'
22
+ }
23
+ }));
24
+ apiRef.current = createFetch({
25
+ baseURL: baseURL,
26
+ timeout: 10000,
27
+ headers: {
28
+ 'Authorization': 'Bearer ' + token,
29
+ 'X-Mc-Domain': location.hostname,
30
+ 'Content-Type': 'application/json'
31
+ }
32
+ });
33
+ var getAiCorrection = /*#__PURE__*/function () {
34
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
35
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
36
+ while (1) switch (_context.prev = _context.next) {
37
+ case 0:
38
+ return _context.abrupt("return", apiRef.current.get('/mexam/api/question/user-answer', {
39
+ params: params
40
+ }));
41
+ case 1:
42
+ case "end":
43
+ return _context.stop();
44
+ }
45
+ }, _callee);
46
+ }));
47
+ return function getAiCorrection(_x) {
48
+ return _ref.apply(this, arguments);
49
+ };
50
+ }();
51
+ var deleteConversationById = /*#__PURE__*/function () {
52
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(conversationId) {
53
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
54
+ while (1) switch (_context2.prev = _context2.next) {
55
+ case 0:
56
+ return _context2.abrupt("return", apiRef.current.delete('/mbot/web/conversation', {
57
+ params: {
58
+ id: conversationId
59
+ }
60
+ }));
61
+ case 1:
62
+ case "end":
63
+ return _context2.stop();
64
+ }
65
+ }, _callee2);
66
+ }));
67
+ return function deleteConversationById(_x2) {
68
+ return _ref2.apply(this, arguments);
69
+ };
70
+ }();
71
+ var getAgentDetail = /*#__PURE__*/function () {
72
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(agentId) {
73
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
74
+ while (1) switch (_context3.prev = _context3.next) {
75
+ case 0:
76
+ return _context3.abrupt("return", apiRef.current.get('/mcourse/web/agent/detail', {
77
+ params: {
78
+ agentId: agentId
79
+ }
80
+ }));
81
+ case 1:
82
+ case "end":
83
+ return _context3.stop();
84
+ }
85
+ }, _callee3);
86
+ }));
87
+ return function getAgentDetail(_x3) {
88
+ return _ref3.apply(this, arguments);
89
+ };
90
+ }();
91
+ var handleMark = /*#__PURE__*/function () {
92
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
93
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
94
+ while (1) switch (_context4.prev = _context4.next) {
95
+ case 0:
96
+ return _context4.abrupt("return", apiRef.current.post('/mbot/web/agent-message/mark', params));
97
+ case 1:
98
+ case "end":
99
+ return _context4.stop();
100
+ }
101
+ }, _callee4);
102
+ }));
103
+ return function handleMark(_x4) {
104
+ return _ref4.apply(this, arguments);
105
+ };
106
+ }();
107
+ var stopStreamOut = /*#__PURE__*/function () {
108
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
109
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
110
+ while (1) switch (_context5.prev = _context5.next) {
111
+ case 0:
112
+ return _context5.abrupt("return", apiRef.current.post('/mbot/web/agent-message/stopStreamOut', {
113
+ params: params
114
+ }));
115
+ case 1:
116
+ case "end":
117
+ return _context5.stop();
118
+ }
119
+ }, _callee5);
120
+ }));
121
+ return function stopStreamOut(_x5) {
122
+ return _ref5.apply(this, arguments);
123
+ };
124
+ }();
125
+ var getMessageList = /*#__PURE__*/function () {
126
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
127
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
128
+ while (1) switch (_context6.prev = _context6.next) {
129
+ case 0:
130
+ return _context6.abrupt("return", apiRef.current.post('/mbot/web/agent-message/page/history', params));
131
+ case 1:
132
+ case "end":
133
+ return _context6.stop();
134
+ }
135
+ }, _callee6);
136
+ }));
137
+ return function getMessageList(_x6) {
138
+ return _ref6.apply(this, arguments);
139
+ };
140
+ }();
141
+ var getProbeList = /*#__PURE__*/function () {
142
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
143
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
144
+ while (1) switch (_context7.prev = _context7.next) {
145
+ case 0:
146
+ return _context7.abrupt("return", apiRef.current.get('/mbot/web/related-resource/probeQuestion', {
147
+ params: params
148
+ }));
149
+ case 1:
150
+ case "end":
151
+ return _context7.stop();
152
+ }
153
+ }, _callee7);
154
+ }));
155
+ return function getProbeList(_x7) {
156
+ return _ref7.apply(this, arguments);
157
+ };
158
+ }();
159
+
160
+ // 获取会话标题
161
+ var getMessageTitle = /*#__PURE__*/function () {
162
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(conversationId) {
163
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
164
+ while (1) switch (_context8.prev = _context8.next) {
165
+ case 0:
166
+ return _context8.abrupt("return", apiRef.current.get("/mbot/web/conversation/".concat(conversationId)));
167
+ case 1:
168
+ case "end":
169
+ return _context8.stop();
170
+ }
171
+ }, _callee8);
172
+ }));
173
+ return function getMessageTitle(_x8) {
174
+ return _ref8.apply(this, arguments);
175
+ };
176
+ }();
177
+
178
+ // 获取技能数据
179
+ var getSkillData = /*#__PURE__*/function () {
180
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(requestId) {
181
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
182
+ while (1) switch (_context9.prev = _context9.next) {
183
+ case 0:
184
+ return _context9.abrupt("return", apiRef.current.get('/mflux/web/tools/request/status', {
185
+ params: {
186
+ requestId: requestId
187
+ }
188
+ }));
189
+ case 1:
190
+ case "end":
191
+ return _context9.stop();
192
+ }
193
+ }, _callee9);
194
+ }));
195
+ return function getSkillData(_x9) {
196
+ return _ref9.apply(this, arguments);
197
+ };
198
+ }();
199
+
200
+ // 知识库溯源 - 课程
201
+ var getProductList = /*#__PURE__*/function () {
202
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
203
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
204
+ while (1) switch (_context10.prev = _context10.next) {
205
+ case 0:
206
+ return _context10.abrupt("return", apiRef.current.post('/mcourse/web/trace/product', {
207
+ params: params
208
+ }));
209
+ case 1:
210
+ case "end":
211
+ return _context10.stop();
212
+ }
213
+ }, _callee10);
214
+ }));
215
+ return function getProductList(_x10) {
216
+ return _ref10.apply(this, arguments);
217
+ };
218
+ }();
219
+
220
+ // 知识库溯源 - 文档资源
221
+ var getFileResourceList = /*#__PURE__*/function () {
222
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
223
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
224
+ while (1) switch (_context11.prev = _context11.next) {
225
+ case 0:
226
+ return _context11.abrupt("return", apiRef.current.post('/mcourse/web/trace/resource', params));
227
+ case 1:
228
+ case "end":
229
+ return _context11.stop();
230
+ }
231
+ }, _callee11);
232
+ }));
233
+ return function getFileResourceList(_x11) {
234
+ return _ref11.apply(this, arguments);
235
+ };
236
+ }();
237
+
238
+ // 知识库溯源 - 视频切片
239
+ var getVideoSliceList = /*#__PURE__*/function () {
240
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
241
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
242
+ while (1) switch (_context12.prev = _context12.next) {
243
+ case 0:
244
+ return _context12.abrupt("return", apiRef.current.post('/mcourse/web/trace/video', params));
245
+ case 1:
246
+ case "end":
247
+ return _context12.stop();
248
+ }
249
+ }, _callee12);
250
+ }));
251
+ return function getVideoSliceList(_x12) {
252
+ return _ref12.apply(this, arguments);
253
+ };
254
+ }();
255
+
256
+ // 创建会话
257
+ var createRoomId = /*#__PURE__*/function () {
258
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
259
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
260
+ while (1) switch (_context13.prev = _context13.next) {
261
+ case 0:
262
+ return _context13.abrupt("return", apiRef.current.post('/mbot/web/conversation', params));
263
+ case 1:
264
+ case "end":
265
+ return _context13.stop();
266
+ }
267
+ }, _callee13);
268
+ }));
269
+ return function createRoomId(_x13) {
270
+ return _ref13.apply(this, arguments);
271
+ };
272
+ }();
273
+
274
+ /** 获取rtc配置 */
275
+ var getRtcConfig = /*#__PURE__*/function () {
276
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
277
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
278
+ while (1) switch (_context14.prev = _context14.next) {
279
+ case 0:
280
+ return _context14.abrupt("return", apiRef.current.post("/mbot/web/bot/rtc-config/all"));
281
+ case 1:
282
+ case "end":
283
+ return _context14.stop();
284
+ }
285
+ }, _callee14);
286
+ }));
287
+ return function getRtcConfig() {
288
+ return _ref14.apply(this, arguments);
289
+ };
290
+ }();
291
+
292
+ /** 启动语音聊天 */
293
+ var startVoiceChat = /*#__PURE__*/function () {
294
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
295
+ var roomId, taskId, custom;
296
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
297
+ while (1) switch (_context15.prev = _context15.next) {
298
+ case 0:
299
+ roomId = params.roomId, taskId = params.taskId, custom = params.custom;
300
+ return _context15.abrupt("return", apiRef.current.post("/mbot/web/bot/startVoiceChat", {
301
+ custom: custom,
302
+ roomId: roomId,
303
+ taskId: taskId
304
+ }));
305
+ case 2:
306
+ case "end":
307
+ return _context15.stop();
308
+ }
309
+ }, _callee15);
310
+ }));
311
+ return function startVoiceChat(_x14) {
312
+ return _ref15.apply(this, arguments);
313
+ };
314
+ }();
315
+
316
+ /** 停止语音聊天 */
317
+ var stopVoiceChat = /*#__PURE__*/function () {
318
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
319
+ var appId, roomId, taskId;
320
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
321
+ while (1) switch (_context16.prev = _context16.next) {
322
+ case 0:
323
+ appId = params.appId, roomId = params.roomId, taskId = params.taskId;
324
+ return _context16.abrupt("return", apiRef.current.post("/mbot/web/bot/stopVoiceChat", {
325
+ appId: appId,
326
+ roomId: roomId,
327
+ taskId: taskId
328
+ }));
329
+ case 2:
330
+ case "end":
331
+ return _context16.stop();
332
+ }
333
+ }, _callee16);
334
+ }));
335
+ return function stopVoiceChat(_x15) {
336
+ return _ref16.apply(this, arguments);
337
+ };
338
+ }();
339
+ /** 获取用户第一次使用 */
340
+ var getUserFirstUse = /*#__PURE__*/function () {
341
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref17) {
342
+ var type;
343
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
344
+ while (1) switch (_context17.prev = _context17.next) {
345
+ case 0:
346
+ type = _ref17.type;
347
+ return _context17.abrupt("return", apiRef.current.get("/mcourse/web/user-first-use/check-and-mark?featureType=".concat(type)));
348
+ case 2:
349
+ case "end":
350
+ return _context17.stop();
351
+ }
352
+ }, _callee17);
353
+ }));
354
+ return function getUserFirstUse(_x16) {
355
+ return _ref18.apply(this, arguments);
356
+ };
357
+ }();
358
+ return {
359
+ getSkillData: getSkillData,
360
+ getProductList: getProductList,
361
+ getFileResourceList: getFileResourceList,
362
+ getVideoSliceList: getVideoSliceList,
363
+ getMessageTitle: getMessageTitle,
364
+ getProbeList: getProbeList,
365
+ getMessageList: getMessageList,
366
+ stopStreamOut: stopStreamOut,
367
+ createRoomId: createRoomId,
368
+ getRtcConfig: getRtcConfig,
369
+ startVoiceChat: startVoiceChat,
370
+ stopVoiceChat: stopVoiceChat,
371
+ getUserFirstUse: getUserFirstUse,
372
+ handleMark: handleMark,
373
+ getAgentDetail: getAgentDetail,
374
+ deleteConversationById: deleteConversationById,
375
+ getAiCorrection: getAiCorrection
376
+ };
377
+ };
378
+ export default useApi;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file