@myun/gimi-chat 0.0.3 → 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.
- package/dist/apis/fetch.d.ts +64 -0
- package/dist/apis/fetch.js +512 -0
- package/dist/apis/useApi.d.ts +57 -0
- package/dist/apis/useApi.js +378 -0
- package/dist/assets/image/Subtract.png +0 -0
- package/dist/assets/image/ai-logo.png +0 -0
- package/dist/assets/image/copyIcon.png +0 -0
- package/dist/assets/image/deepthinkActive.png +0 -0
- package/dist/assets/image/empty-img-dark.png +0 -0
- package/dist/assets/image/empty-img.png +0 -0
- package/dist/assets/image/like_active.png +0 -0
- package/dist/assets/image/love.png +0 -0
- package/dist/assets/image/retry.png +0 -0
- package/dist/assets/image/soundOut.png +0 -0
- package/dist/assets/image/unlike_active.png +0 -0
- package/dist/assets/image/unlove.png +0 -0
- package/dist/assets/lottie/ai-bg.json +1704 -0
- package/dist/assets/lottie/ai-loading.json +192 -0
- package/dist/assets/lottie/ai-output-loading.json +272 -0
- package/dist/assets/lottie/ai-output-normal.json +17694 -0
- package/dist/assets/lottie/ai-output-strengthen.json +17321 -0
- package/dist/assets/lottie/ai-voice-play.json +1 -0
- package/dist/assets/lottie/living.json +705 -0
- package/dist/assets/lottie/myun-living.json +726 -0
- package/dist/assets/lottie/myun-loading.json +530 -0
- package/dist/components/ai-chat-dialogue/index.d.ts +16 -0
- package/dist/components/ai-chat-dialogue/index.js +1056 -0
- package/dist/components/ai-chat-dialogue/index.module.scss +272 -0
- package/dist/components/ai-chat-dialogue/message-parser.d.ts +36 -0
- package/dist/components/ai-chat-dialogue/message-parser.js +52 -0
- package/dist/components/ai-chat-dialogue/tlv.d.ts +7 -0
- package/dist/components/ai-chat-dialogue/tlv.js +32 -0
- package/dist/components/ai-chat-dialogue/volc-voice-call-client.d.ts +47 -0
- package/dist/components/ai-chat-dialogue/volc-voice-call-client.js +246 -0
- package/dist/components/ai-correction/index.d.ts +5 -0
- package/dist/components/ai-correction/index.js +45 -0
- package/dist/components/ai-loading/index.d.ts +3 -0
- package/dist/components/ai-loading/index.js +14 -0
- package/dist/components/ai-loading/index.module.scss +11 -0
- package/dist/components/answer-item/index.d.ts +27 -0
- package/dist/components/answer-item/index.js +194 -0
- package/dist/components/answer-item/index.module.scss +295 -0
- package/dist/components/ask-card/index.d.ts +10 -0
- package/dist/components/ask-card/index.js +76 -0
- package/dist/components/ask-card/index.module.scss +125 -0
- package/dist/components/chat-input/index.d.ts +31 -0
- package/dist/components/chat-input/index.js +433 -0
- package/dist/components/chat-input/index.module.scss +44 -0
- package/dist/components/chat-voice/VoiceCommunication.d.ts +7 -0
- package/dist/components/chat-voice/VoiceCommunication.js +69 -0
- package/dist/components/chat-voice/VoiceRecord.d.ts +7 -0
- package/dist/components/chat-voice/VoiceRecord.js +34 -0
- package/dist/components/conversation-delete/index.d.ts +5 -0
- package/dist/components/conversation-delete/index.js +24 -0
- package/dist/components/dots-loading/index.d.ts +2 -0
- package/dist/components/dots-loading/index.js +11 -0
- package/dist/components/dots-loading/index.module.scss +45 -0
- package/dist/components/empty/index.d.ts +9 -0
- package/dist/components/empty/index.js +32 -0
- package/dist/components/empty/index.module.scss +27 -0
- package/dist/components/excel-components/ExcelCard.d.ts +11 -0
- package/dist/components/excel-components/ExcelCard.js +35 -0
- package/dist/components/excel-components/ExcelExcuting.d.ts +10 -0
- package/dist/components/excel-components/ExcelExcuting.js +263 -0
- package/dist/components/excel-components/ExcelFailCard.d.ts +9 -0
- package/dist/components/excel-components/ExcelFailCard.js +20 -0
- package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -0
- package/dist/components/excel-components/ExcelSuccessCard.js +50 -0
- package/dist/components/excel-components/index.module.scss +210 -0
- package/dist/components/excel-components/styles.module.scss +186 -0
- package/dist/components/file-card/fileCardSidebar.d.ts +8 -0
- package/dist/components/file-card/fileCardSidebar.js +56 -0
- package/dist/components/file-card/index.d.ts +15 -0
- package/dist/components/file-card/index.js +97 -0
- package/dist/components/file-card/index.module.scss +139 -0
- package/dist/components/file-preview/index.d.ts +3 -0
- package/dist/components/file-preview/index.js +229 -0
- package/dist/components/file-preview/index.module.scss +120 -0
- package/dist/components/file-upload/index.d.ts +16 -0
- package/dist/components/file-upload/index.js +238 -0
- package/dist/components/file-upload/uploadV1.d.ts +16 -0
- package/dist/components/file-upload/uploadV1.js +267 -0
- package/dist/components/gimi-sidebar/index.d.ts +17 -0
- package/dist/components/gimi-sidebar/index.js +41 -0
- package/dist/components/gimi-sidebar/index.module.scss +136 -0
- package/dist/components/header/index.d.ts +5 -0
- package/dist/components/header/index.js +20 -0
- package/dist/components/header/index.module.scss +26 -0
- package/dist/components/iconfont-com/index.d.ts +11 -0
- package/dist/components/iconfont-com/index.js +29 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/knowledge-trace/KnowledgeIconComponent.d.ts +7 -0
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +101 -0
- package/dist/components/knowledge-trace/classList.d.ts +6 -0
- package/dist/components/knowledge-trace/classList.js +72 -0
- package/dist/components/knowledge-trace/documentList.d.ts +6 -0
- package/dist/components/knowledge-trace/documentList.js +75 -0
- package/dist/components/knowledge-trace/index.d.ts +18 -0
- package/dist/components/knowledge-trace/index.js +155 -0
- package/dist/components/knowledge-trace/index.module.scss +262 -0
- package/dist/components/knowledge-trace/interfaces.d.ts +166 -0
- package/dist/components/knowledge-trace/interfaces.js +1 -0
- package/dist/components/knowledge-trace/videoList.d.ts +6 -0
- package/dist/components/knowledge-trace/videoList.js +91 -0
- package/dist/components/lottie-img/index.d.ts +8 -0
- package/dist/components/lottie-img/index.js +99 -0
- package/dist/components/message-actions/CopyButton.d.ts +7 -0
- package/dist/components/message-actions/CopyButton.js +33 -0
- package/dist/components/message-actions/LikeButton.d.ts +7 -0
- package/dist/components/message-actions/LikeButton.js +34 -0
- package/dist/components/message-actions/RegenerateButton.d.ts +5 -0
- package/dist/components/message-actions/RegenerateButton.js +27 -0
- package/dist/components/message-actions/UnLikeButton.d.ts +7 -0
- package/dist/components/message-actions/UnLikeButton.js +34 -0
- package/dist/components/message-actions/VoicePlay.d.ts +10 -0
- package/dist/components/message-actions/VoicePlay.js +74 -0
- package/dist/components/message-list/index.d.ts +19 -0
- package/dist/components/message-list/index.js +167 -0
- package/dist/components/message-list/index.module.scss +304 -0
- package/dist/components/no-microphone-root/index.d.ts +6 -0
- package/dist/components/no-microphone-root/index.js +36 -0
- package/dist/components/no-microphone-root/index.module.scss +42 -0
- package/dist/components/preset-agent-content/index.d.ts +8 -0
- package/dist/components/preset-agent-content/index.js +24 -0
- package/dist/components/preset-agent-content/index.module.scss +48 -0
- package/dist/components/quoted-content/index.d.ts +0 -0
- package/dist/components/quoted-content/index.js +171 -0
- package/dist/components/quoted-content/index.module.scss +76 -0
- package/dist/components/reasoning-content/index.d.ts +6 -0
- package/dist/components/reasoning-content/index.js +116 -0
- package/dist/components/reasoning-content/index.module.scss +164 -0
- package/dist/components/reference-content/index.d.ts +28 -0
- package/dist/components/reference-content/index.js +125 -0
- package/dist/components/reference-content/index.module.scss +73 -0
- package/dist/components/templates/CommonChat.d.ts +5 -0
- package/dist/components/templates/CommonChat.js +218 -0
- package/dist/components/templates/GimiChatComponent.d.ts +4 -0
- package/dist/components/templates/GimiChatComponent.js +23 -0
- package/dist/components/templates/demo/demo.d.ts +2 -0
- package/dist/components/templates/demo/demo.js +110 -0
- package/dist/components/templates/index.module.scss +119 -0
- package/dist/components/upload-list/index.d.ts +15 -0
- package/dist/components/upload-list/index.js +90 -0
- package/dist/components/upload-list/index.module.scss +119 -0
- package/dist/components/voice-bars/index.d.ts +4 -0
- package/dist/components/voice-bars/index.js +174 -0
- package/dist/components/voice-check-dialog/index.d.ts +8 -0
- package/dist/components/voice-check-dialog/index.js +163 -0
- package/dist/components/voice-check-dialog/index.module.scss +9 -0
- package/dist/components/voice-recording/index.d.ts +9 -0
- package/dist/components/voice-recording/index.js +54 -0
- package/dist/components/voice-recording/index.module.scss +41 -0
- package/dist/components/work-flow-content/demo.d.ts +3 -0
- package/dist/components/work-flow-content/demo.js +11 -0
- package/dist/components/work-flow-content/index.d.ts +6 -0
- package/dist/components/work-flow-content/index.js +55 -0
- package/dist/components/work-flow-content/index.module.scss +23 -0
- package/dist/constants.d.ts +24 -0
- package/dist/constants.js +24 -0
- package/dist/hooks/useChatActions.d.ts +12 -0
- package/dist/hooks/useChatActions.js +207 -0
- package/dist/hooks/useChatHistory.d.ts +8 -0
- package/dist/hooks/useChatHistory.js +225 -0
- package/dist/hooks/useChatMessage.d.ts +49 -0
- package/dist/hooks/useChatMessage.js +87 -0
- package/dist/hooks/useChatRecommend.d.ts +8 -0
- package/dist/hooks/useChatRecommend.js +126 -0
- package/dist/hooks/useChatStream.d.ts +20 -0
- package/dist/hooks/useChatStream.js +244 -0
- package/dist/hooks/useChatUI.d.ts +32 -0
- package/dist/hooks/useChatUI.js +134 -0
- package/dist/hooks/useChatVoice.d.ts +11 -0
- package/dist/hooks/useChatVoice.js +379 -0
- package/dist/hooks/useCommonChatAPI.d.ts +27 -0
- package/dist/hooks/useCommonChatAPI.js +1276 -0
- package/dist/hooks/useFile.d.ts +13 -0
- package/dist/hooks/useFile.js +288 -0
- package/dist/hooks/useKnowledgeService.d.ts +17 -0
- package/dist/hooks/useKnowledgeService.js +210 -0
- package/dist/hooks/useLastEventId.d.ts +8 -0
- package/dist/hooks/useLastEventId.js +66 -0
- package/dist/hooks/useLongPoll.d.ts +3 -0
- package/dist/hooks/useLongPoll.js +111 -0
- package/dist/hooks/useScroll.d.ts +4 -0
- package/dist/hooks/useScroll.js +172 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/chatMessage.d.ts +139 -0
- package/dist/interfaces/fileInterface.d.ts +10 -0
- package/dist/interfaces/fileInterface.js +11 -0
- package/dist/interfaces/knowledgeTrace.d.ts +177 -0
- package/dist/store/hooks.d.ts +4 -0
- package/dist/store/hooks.js +3 -0
- package/dist/store/index.d.ts +7 -0
- package/dist/store/index.js +7 -0
- package/dist/store/slices/gimiMenuSlice.d.ts +95 -0
- package/dist/store/slices/gimiMenuSlice.js +251 -0
- package/dist/utils/chatInputUtil.d.ts +19 -0
- package/dist/utils/chatInputUtil.js +45 -0
- package/dist/utils/tools.d.ts +50 -0
- package/dist/utils/tools.js +474 -0
- package/dist/utils/voice-stream.d.ts +119 -0
- package/dist/utils/voice-stream.js +1162 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1,246 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
import VERTC, { MediaType, RoomProfileType, StreamIndex } from '@volcengine/rtc';
|
|
12
|
+
import { string2tlv } from "./tlv";
|
|
13
|
+
export var COMMAND = /*#__PURE__*/function (COMMAND) {
|
|
14
|
+
COMMAND["INTERRUPT"] = "interrupt";
|
|
15
|
+
return COMMAND;
|
|
16
|
+
}({});
|
|
17
|
+
|
|
18
|
+
// 2打断优先级枚举
|
|
19
|
+
export var INTERRUPT_PRIORITY = /*#__PURE__*/function (INTERRUPT_PRIORITY) {
|
|
20
|
+
INTERRUPT_PRIORITY[INTERRUPT_PRIORITY["NONE"] = 0] = "NONE";
|
|
21
|
+
INTERRUPT_PRIORITY[INTERRUPT_PRIORITY["HIGH"] = 1] = "HIGH";
|
|
22
|
+
INTERRUPT_PRIORITY[INTERRUPT_PRIORITY["MEDIUM"] = 2] = "MEDIUM";
|
|
23
|
+
INTERRUPT_PRIORITY[INTERRUPT_PRIORITY["LOW"] = 3] = "LOW";
|
|
24
|
+
return INTERRUPT_PRIORITY;
|
|
25
|
+
}({});
|
|
26
|
+
export var VolcVoiceCallClient = /*#__PURE__*/function () {
|
|
27
|
+
function VolcVoiceCallClient(opts) {
|
|
28
|
+
_classCallCheck(this, VolcVoiceCallClient);
|
|
29
|
+
_defineProperty(this, "engine", null);
|
|
30
|
+
_defineProperty(this, "cfg", void 0);
|
|
31
|
+
_defineProperty(this, "handlers", {});
|
|
32
|
+
// 后端接口:在 init 传入即可
|
|
33
|
+
_defineProperty(this, "startVoiceChat", void 0);
|
|
34
|
+
_defineProperty(this, "stopVoiceChat", void 0);
|
|
35
|
+
_defineProperty(this, "startVoiceChatParams", void 0);
|
|
36
|
+
_defineProperty(this, "stopVoiceChatParams", void 0);
|
|
37
|
+
this.cfg = opts.rtcConfig;
|
|
38
|
+
this.startVoiceChat = opts.startVoiceChat;
|
|
39
|
+
this.stopVoiceChat = opts.stopVoiceChat;
|
|
40
|
+
this.startVoiceChatParams = opts.startVoiceChatParams;
|
|
41
|
+
this.stopVoiceChatParams = opts.stopVoiceChatParams;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 注册“接收二进制消息”的回调(AI 推送的状态/字幕)
|
|
45
|
+
_createClass(VolcVoiceCallClient, [{
|
|
46
|
+
key: "onBinaryMessage",
|
|
47
|
+
value: function onBinaryMessage(cb) {
|
|
48
|
+
this.handlers.onBinaryMessage = cb;
|
|
49
|
+
}
|
|
50
|
+
// 注册“错误”回调(RTC 引擎异常)
|
|
51
|
+
}, {
|
|
52
|
+
key: "onError",
|
|
53
|
+
value: function onError(cb) {
|
|
54
|
+
this.handlers.onError = cb;
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "bindEvents",
|
|
58
|
+
value: function bindEvents() {
|
|
59
|
+
var _this = this;
|
|
60
|
+
if (!this.engine) return;
|
|
61
|
+
// 1. 监听 RTC 引擎的全局错误事件
|
|
62
|
+
this.engine.on(VERTC.events.onError, function (e) {
|
|
63
|
+
var _this$handlers$onErro, _this$handlers;
|
|
64
|
+
(_this$handlers$onErro = (_this$handlers = _this.handlers).onError) === null || _this$handlers$onErro === void 0 || _this$handlers$onErro.call(_this$handlers, e);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// 注册接收二进制消息(机器人发送的字幕、状态等二进制数据)
|
|
68
|
+
this.engine.on(VERTC.events.onRoomBinaryMessageReceived, function (e) {
|
|
69
|
+
var _this$handlers$onBina, _this$handlers2;
|
|
70
|
+
(_this$handlers$onBina = (_this$handlers2 = _this.handlers).onBinaryMessage) === null || _this$handlers$onBina === void 0 || _this$handlers$onBina.call(_this$handlers2, e.message);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "connect",
|
|
75
|
+
value: function () {
|
|
76
|
+
var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
77
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
78
|
+
while (1) switch (_context.prev = _context.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
if (!this.engine) {
|
|
81
|
+
// 创建 RTC 引擎
|
|
82
|
+
this.engine = VERTC.createEngine(this.cfg.appId);
|
|
83
|
+
// 监听RTC引擎,注册事件
|
|
84
|
+
this.bindEvents();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 加入房间
|
|
88
|
+
_context.next = 3;
|
|
89
|
+
return this.engine.joinRoom(
|
|
90
|
+
// 1. 房间鉴权 Token(必填)
|
|
91
|
+
this.cfg.token, // 2. 房间 ID(必填)
|
|
92
|
+
"".concat(this.cfg.roomId), {
|
|
93
|
+
userId: this.cfg.userId,
|
|
94
|
+
extraInfo: JSON.stringify({
|
|
95
|
+
call_scene: 'RTC-AIGC',
|
|
96
|
+
user_name: this.cfg.userId,
|
|
97
|
+
user_id: this.cfg.userId
|
|
98
|
+
})
|
|
99
|
+
}, {
|
|
100
|
+
isAutoPublish: true,
|
|
101
|
+
// 自动发布本地音频流(麦克风采集的声音)到房间
|
|
102
|
+
isAutoSubscribeAudio: true,
|
|
103
|
+
// 自动订阅房间内其他用户的音频流(比如AI机器人的语音)
|
|
104
|
+
roomProfileType: RoomProfileType.chat // 房间场景类型:聊天场景(适配语音交互的音频参数)
|
|
105
|
+
});
|
|
106
|
+
case 3:
|
|
107
|
+
_context.next = 5;
|
|
108
|
+
return this.engine.startAudioCapture();
|
|
109
|
+
case 5:
|
|
110
|
+
_context.next = 7;
|
|
111
|
+
return this.startVoiceChat(this.startVoiceChatParams || {});
|
|
112
|
+
case 7:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
115
|
+
}
|
|
116
|
+
}, _callee, this);
|
|
117
|
+
}));
|
|
118
|
+
function connect() {
|
|
119
|
+
return _connect.apply(this, arguments);
|
|
120
|
+
}
|
|
121
|
+
return connect;
|
|
122
|
+
}() // 清理资源 + 离开房间
|
|
123
|
+
}, {
|
|
124
|
+
key: "disconnect",
|
|
125
|
+
value: function () {
|
|
126
|
+
var _disconnect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
127
|
+
var _this$engine, _this$engine2;
|
|
128
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
129
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
_context2.prev = 0;
|
|
132
|
+
_context2.next = 3;
|
|
133
|
+
return this.stopVoiceChat(this.stopVoiceChatParams || {});
|
|
134
|
+
case 3:
|
|
135
|
+
_context2.next = 7;
|
|
136
|
+
break;
|
|
137
|
+
case 5:
|
|
138
|
+
_context2.prev = 5;
|
|
139
|
+
_context2.t0 = _context2["catch"](0);
|
|
140
|
+
case 7:
|
|
141
|
+
_context2.prev = 7;
|
|
142
|
+
_context2.next = 10;
|
|
143
|
+
return (_this$engine = this.engine) === null || _this$engine === void 0 ? void 0 : _this$engine.stopAudioCapture();
|
|
144
|
+
case 10:
|
|
145
|
+
_context2.next = 14;
|
|
146
|
+
break;
|
|
147
|
+
case 12:
|
|
148
|
+
_context2.prev = 12;
|
|
149
|
+
_context2.t1 = _context2["catch"](7);
|
|
150
|
+
case 14:
|
|
151
|
+
_context2.prev = 14;
|
|
152
|
+
_context2.next = 17;
|
|
153
|
+
return (_this$engine2 = this.engine) === null || _this$engine2 === void 0 ? void 0 : _this$engine2.leaveRoom();
|
|
154
|
+
case 17:
|
|
155
|
+
_context2.next = 21;
|
|
156
|
+
break;
|
|
157
|
+
case 19:
|
|
158
|
+
_context2.prev = 19;
|
|
159
|
+
_context2.t2 = _context2["catch"](14);
|
|
160
|
+
case 21:
|
|
161
|
+
if (this.engine) {
|
|
162
|
+
try {
|
|
163
|
+
VERTC.destroyEngine(this.engine);
|
|
164
|
+
} catch (_unused4) {}
|
|
165
|
+
}
|
|
166
|
+
this.engine = null;
|
|
167
|
+
case 23:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context2.stop();
|
|
170
|
+
}
|
|
171
|
+
}, _callee2, this, [[0, 5], [7, 12], [14, 19]]);
|
|
172
|
+
}));
|
|
173
|
+
function disconnect() {
|
|
174
|
+
return _disconnect.apply(this, arguments);
|
|
175
|
+
}
|
|
176
|
+
return disconnect;
|
|
177
|
+
}() // 静音 音频采集控制:
|
|
178
|
+
}, {
|
|
179
|
+
key: "setAudioEnable",
|
|
180
|
+
value: function () {
|
|
181
|
+
var _setAudioEnable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(enable) {
|
|
182
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
183
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
if (this.engine) {
|
|
186
|
+
_context3.next = 2;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
return _context3.abrupt("return");
|
|
190
|
+
case 2:
|
|
191
|
+
if (!enable) {
|
|
192
|
+
_context3.next = 8;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
_context3.next = 5;
|
|
196
|
+
return this.engine.startAudioCapture();
|
|
197
|
+
case 5:
|
|
198
|
+
// 音频发布(控制是否把自己的语音发送到房间)
|
|
199
|
+
this.engine.publishStream(MediaType.AUDIO);
|
|
200
|
+
_context3.next = 11;
|
|
201
|
+
break;
|
|
202
|
+
case 8:
|
|
203
|
+
// 取消发布(控制是否把自己的语音发送到房间)
|
|
204
|
+
this.engine.unpublishStream(MediaType.AUDIO);
|
|
205
|
+
// stopAudioCapture(关闭麦克风)
|
|
206
|
+
_context3.next = 11;
|
|
207
|
+
return this.engine.stopAudioCapture();
|
|
208
|
+
case 11:
|
|
209
|
+
case "end":
|
|
210
|
+
return _context3.stop();
|
|
211
|
+
}
|
|
212
|
+
}, _callee3, this);
|
|
213
|
+
}));
|
|
214
|
+
function setAudioEnable(_x) {
|
|
215
|
+
return _setAudioEnable.apply(this, arguments);
|
|
216
|
+
}
|
|
217
|
+
return setAudioEnable;
|
|
218
|
+
}() // 静音机器人播报(把机器人远端音频在本地播放音量置 0)
|
|
219
|
+
}, {
|
|
220
|
+
key: "mutePlayback",
|
|
221
|
+
value: function mutePlayback() {
|
|
222
|
+
if (!this.engine) return;
|
|
223
|
+
var botUserId = this.cfg.agentName;
|
|
224
|
+
if (!botUserId) return;
|
|
225
|
+
this.engine.setPlaybackVolume(this.cfg.agentName, StreamIndex.STREAM_INDEX_MAIN, 0);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// 打断 AI 发言 (发送二进制控制指令给机器人,实现 “打断 AI 说话” 的功能)
|
|
229
|
+
}, {
|
|
230
|
+
key: "interrupt",
|
|
231
|
+
value: function interrupt() {
|
|
232
|
+
var interruptMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INTERRUPT_PRIORITY.HIGH;
|
|
233
|
+
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
234
|
+
if (!this.engine) return;
|
|
235
|
+
|
|
236
|
+
// demo 协议:type='ctrl',body 里 Command/InterruptMode/Message
|
|
237
|
+
var payload = {
|
|
238
|
+
Command: COMMAND.INTERRUPT,
|
|
239
|
+
InterruptMode: interruptMode,
|
|
240
|
+
Message: message
|
|
241
|
+
};
|
|
242
|
+
this.engine.sendUserBinaryMessage(this.cfg.agentName, string2tlv(JSON.stringify(payload), 'ctrl'));
|
|
243
|
+
}
|
|
244
|
+
}]);
|
|
245
|
+
return VolcVoiceCallClient;
|
|
246
|
+
}();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
var AICorrection = function AICorrection(_ref) {
|
|
3
|
+
var value = _ref.value;
|
|
4
|
+
var data = {
|
|
5
|
+
score: '',
|
|
6
|
+
comment: ''
|
|
7
|
+
};
|
|
8
|
+
try {
|
|
9
|
+
var jsonObj = JSON.parse(value);
|
|
10
|
+
data = jsonObj.result;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
// console.error(error);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
style: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
gap: '20px'
|
|
20
|
+
}
|
|
21
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u6839\u636E\u8003\u751F\u7684\u56DE\u7B54\uFF0C\u7ED9\u51FA\u4EE5\u4E0B\u5F97\u5206\u53CA\u8BC4\u8BED\uFF1A"), /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
style: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
gap: '10px'
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
28
|
+
style: {
|
|
29
|
+
fontSize: '18px',
|
|
30
|
+
fontWeight: 600
|
|
31
|
+
}
|
|
32
|
+
}, "\u5F97\u5206"), /*#__PURE__*/React.createElement("span", null, data.score, "\u5206")), /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
style: {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
gap: '10px'
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
39
|
+
style: {
|
|
40
|
+
fontSize: '18px',
|
|
41
|
+
fontWeight: 600
|
|
42
|
+
}
|
|
43
|
+
}, "\u8BC4\u8BED"), /*#__PURE__*/React.createElement("span", null, data.comment)));
|
|
44
|
+
};
|
|
45
|
+
export default AICorrection;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from "./index.module.scss";
|
|
3
|
+
import LottieImg from "../lottie-img";
|
|
4
|
+
var AiLoading = function AiLoading() {
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
className: styles.aiLoading
|
|
7
|
+
}, /*#__PURE__*/React.createElement(LottieImg, {
|
|
8
|
+
name: "aiLoading",
|
|
9
|
+
size: [30, 50]
|
|
10
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: styles.text
|
|
12
|
+
}, "\u6570\u636E\u52A0\u8F7D\u4E2D~"));
|
|
13
|
+
};
|
|
14
|
+
export default AiLoading;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IChatMessageItem } from '../../interfaces/chatMessage';
|
|
3
|
+
interface AnswerItemProps {
|
|
4
|
+
item: IChatMessageItem;
|
|
5
|
+
onSucess: (pollResult: any, messageId: number) => void;
|
|
6
|
+
onFailure: (pollResult: any, messageId: number) => void;
|
|
7
|
+
onRetry: (pollResult: any, messageId: number) => void;
|
|
8
|
+
showCommend?: (id: number) => boolean;
|
|
9
|
+
showOpera?: (id: number) => boolean;
|
|
10
|
+
handleShowCourse: (v: any) => void;
|
|
11
|
+
handleClickPromptWord?: (prompt: string) => void;
|
|
12
|
+
handleClickAskList: (item: any, operation: string, key: string, value?: string) => void;
|
|
13
|
+
playTTSByText: (text: string) => void;
|
|
14
|
+
stopTTSByText: () => void;
|
|
15
|
+
isVoicePlaying: boolean;
|
|
16
|
+
onCopyCallback?: () => void;
|
|
17
|
+
onLikeCallback?: () => void;
|
|
18
|
+
onUnLikeCallback?: () => void;
|
|
19
|
+
onRegenerateClick?: () => void;
|
|
20
|
+
enableCopy?: boolean;
|
|
21
|
+
enableLike?: boolean;
|
|
22
|
+
enableUnLike?: boolean;
|
|
23
|
+
enableRegenerate?: boolean;
|
|
24
|
+
enableVoicePlay?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare const AnswerItem: React.FC<AnswerItemProps>;
|
|
27
|
+
export default AnswerItem;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from "./index.module.scss";
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import ReasoningContent from "../reasoning-content/index";
|
|
5
|
+
import { processString } from "../../utils/tools";
|
|
6
|
+
import { MMarkdown } from '@myun/gimi-design';
|
|
7
|
+
import AskCard from "../ask-card";
|
|
8
|
+
import WorkFlowContent from "../work-flow-content";
|
|
9
|
+
import ExcelSuccessCard from "../excel-components/ExcelSuccessCard";
|
|
10
|
+
import AICorrection from "../ai-correction/index";
|
|
11
|
+
import KnowledgeIconGroup from "../knowledge-trace/KnowledgeIconComponent";
|
|
12
|
+
import ExcelCard from "../excel-components/ExcelCard";
|
|
13
|
+
import { CheckCircleFilled } from '@ant-design/icons';
|
|
14
|
+
import VoicePlay from "../message-actions/VoicePlay";
|
|
15
|
+
import { useAppSelector } from "../../store/hooks";
|
|
16
|
+
import CopyButton from "../message-actions/CopyButton";
|
|
17
|
+
import LikeButton from "../message-actions/LikeButton";
|
|
18
|
+
import UnLikeButton from "../message-actions/UnLikeButton";
|
|
19
|
+
import RegenerateButton from "../message-actions/RegenerateButton";
|
|
20
|
+
var AnswerItem = function AnswerItem(_ref) {
|
|
21
|
+
var _agentDetail$voiceCon;
|
|
22
|
+
var item = _ref.item,
|
|
23
|
+
onSucess = _ref.onSucess,
|
|
24
|
+
onFailure = _ref.onFailure,
|
|
25
|
+
onRetry = _ref.onRetry,
|
|
26
|
+
showOpera = _ref.showOpera,
|
|
27
|
+
showCommend = _ref.showCommend,
|
|
28
|
+
handleShowCourse = _ref.handleShowCourse,
|
|
29
|
+
handleClickPromptWord = _ref.handleClickPromptWord,
|
|
30
|
+
handleClickAskList = _ref.handleClickAskList,
|
|
31
|
+
playTTSByText = _ref.playTTSByText,
|
|
32
|
+
stopTTSByText = _ref.stopTTSByText,
|
|
33
|
+
isVoicePlaying = _ref.isVoicePlaying,
|
|
34
|
+
onCopyCallback = _ref.onCopyCallback,
|
|
35
|
+
onLikeCallback = _ref.onLikeCallback,
|
|
36
|
+
onUnLikeCallback = _ref.onUnLikeCallback,
|
|
37
|
+
onRegenerateClick = _ref.onRegenerateClick,
|
|
38
|
+
_ref$enableCopy = _ref.enableCopy,
|
|
39
|
+
enableCopy = _ref$enableCopy === void 0 ? true : _ref$enableCopy,
|
|
40
|
+
_ref$enableLike = _ref.enableLike,
|
|
41
|
+
enableLike = _ref$enableLike === void 0 ? true : _ref$enableLike,
|
|
42
|
+
_ref$enableUnLike = _ref.enableUnLike,
|
|
43
|
+
enableUnLike = _ref$enableUnLike === void 0 ? true : _ref$enableUnLike,
|
|
44
|
+
_ref$enableRegenerate = _ref.enableRegenerate,
|
|
45
|
+
enableRegenerate = _ref$enableRegenerate === void 0 ? true : _ref$enableRegenerate,
|
|
46
|
+
_ref$enableVoicePlay = _ref.enableVoicePlay,
|
|
47
|
+
enableVoicePlay = _ref$enableVoicePlay === void 0 ? true : _ref$enableVoicePlay;
|
|
48
|
+
var isMsgRecieving = useAppSelector(function (state) {
|
|
49
|
+
return state.gimiMenu.isMsgRecieving;
|
|
50
|
+
});
|
|
51
|
+
var messageList = useAppSelector(function (state) {
|
|
52
|
+
return state.gimiMenu.messageList || [];
|
|
53
|
+
});
|
|
54
|
+
var _React$useMemo = React.useMemo(function () {
|
|
55
|
+
var _item$moduleInfo, _item$moduleInfo2, _messageList;
|
|
56
|
+
var contentStr = item.content && processString(item.content) || '';
|
|
57
|
+
var showContentFlag = Boolean(contentStr);
|
|
58
|
+
var showAskTag = item.moduleType === 'ask' || ((_item$moduleInfo = item.moduleInfo) === null || _item$moduleInfo === void 0 ? void 0 : _item$moduleInfo.moduleType) === 'ask';
|
|
59
|
+
var showSkillTag = item.moduleType === 'skill' || ((_item$moduleInfo2 = item.moduleInfo) === null || _item$moduleInfo2 === void 0 ? void 0 : _item$moduleInfo2.moduleType) === 'skill';
|
|
60
|
+
var showOperation = (showContentFlag || showSkillTag) && !showAskTag && !isMsgRecieving;
|
|
61
|
+
var showTaskSuccess = (contentStr === null || contentStr === void 0 ? void 0 : contentStr.indexOf('<excel>')) > -1 && !isMsgRecieving;
|
|
62
|
+
var showRegerate = item.id === ((_messageList = messageList[messageList.length - 1]) === null || _messageList === void 0 ? void 0 : _messageList.id);
|
|
63
|
+
return {
|
|
64
|
+
showContentFlag: showContentFlag,
|
|
65
|
+
showAskTag: showAskTag,
|
|
66
|
+
showSkillTag: showSkillTag,
|
|
67
|
+
showOperation: showOperation,
|
|
68
|
+
showTaskSuccess: showTaskSuccess,
|
|
69
|
+
showRegerate: showRegerate
|
|
70
|
+
};
|
|
71
|
+
}, [item.content, item.moduleType, item.moduleInfo, isMsgRecieving, messageList]),
|
|
72
|
+
showContentFlag = _React$useMemo.showContentFlag,
|
|
73
|
+
showAskTag = _React$useMemo.showAskTag,
|
|
74
|
+
showSkillTag = _React$useMemo.showSkillTag,
|
|
75
|
+
showOperation = _React$useMemo.showOperation,
|
|
76
|
+
showTaskSuccess = _React$useMemo.showTaskSuccess,
|
|
77
|
+
showRegerate = _React$useMemo.showRegerate;
|
|
78
|
+
var agentDetail = useAppSelector(function (state) {
|
|
79
|
+
return state.gimiMenu.agentObj || {};
|
|
80
|
+
});
|
|
81
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: styles.title
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: classNames(styles.answer)
|
|
85
|
+
}, item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
|
|
86
|
+
chatItem: item
|
|
87
|
+
}), item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
|
|
88
|
+
item: item
|
|
89
|
+
}), showTaskSuccess && /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: styles.completed
|
|
91
|
+
}, /*#__PURE__*/React.createElement(CheckCircleFilled, {
|
|
92
|
+
className: styles.checkIcon
|
|
93
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
94
|
+
className: styles.checkText
|
|
95
|
+
}, "\u672C\u6B21\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF01")), showContentFlag && /*#__PURE__*/React.createElement(MMarkdown, {
|
|
96
|
+
content: processString(item.content || ''),
|
|
97
|
+
customRender: [{
|
|
98
|
+
type: 'excel',
|
|
99
|
+
component: ExcelSuccessCard
|
|
100
|
+
}, {
|
|
101
|
+
type: 'knowledge',
|
|
102
|
+
component: function component(value) {
|
|
103
|
+
var newVal = {
|
|
104
|
+
content: value.value,
|
|
105
|
+
messageId: item.id
|
|
106
|
+
};
|
|
107
|
+
return /*#__PURE__*/React.createElement(KnowledgeIconGroup, {
|
|
108
|
+
value: newVal
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
type: 'correction',
|
|
113
|
+
component: AICorrection
|
|
114
|
+
}],
|
|
115
|
+
showLoading: item.loading
|
|
116
|
+
}), showAskTag && /*#__PURE__*/React.createElement(AskCard, {
|
|
117
|
+
item: item,
|
|
118
|
+
moduleInfo: item.moduleInfo,
|
|
119
|
+
handleClickAskList: handleClickAskList
|
|
120
|
+
}), showSkillTag && /*#__PURE__*/React.createElement(ExcelCard, {
|
|
121
|
+
onRetry: onRetry,
|
|
122
|
+
item: item,
|
|
123
|
+
moduleInfo: item.moduleInfo,
|
|
124
|
+
onSucess: onSucess,
|
|
125
|
+
onFailure: onFailure
|
|
126
|
+
}), item.stop === 1 && /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: styles.stop
|
|
128
|
+
}, item.vipLevel === 1 && item.reasoningStatus === 3 ? '已停止推理' : '已停止内容输出'), showOperation && /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: styles.opera
|
|
130
|
+
}, (showOpera === null || showOpera === void 0 ? void 0 : showOpera(item.id)) && !item.loading && /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: styles.opera_item
|
|
132
|
+
}, enableCopy && /*#__PURE__*/React.createElement(CopyButton, {
|
|
133
|
+
item: item,
|
|
134
|
+
onCopyCallback: onCopyCallback
|
|
135
|
+
}), enableLike && /*#__PURE__*/React.createElement(LikeButton, {
|
|
136
|
+
item: item,
|
|
137
|
+
onLikeCallback: onLikeCallback
|
|
138
|
+
}), enableUnLike && /*#__PURE__*/React.createElement(UnLikeButton, {
|
|
139
|
+
item: item,
|
|
140
|
+
onUnLikeCallback: onUnLikeCallback
|
|
141
|
+
}), enableVoicePlay && !showAskTag && !showSkillTag && ((_agentDetail$voiceCon = agentDetail.voiceConfigs) === null || _agentDetail$voiceCon === void 0 ? void 0 : _agentDetail$voiceCon.length) > 0 && /*#__PURE__*/React.createElement(VoicePlay, {
|
|
142
|
+
playTTSByText: playTTSByText,
|
|
143
|
+
stopTTSByText: stopTTSByText,
|
|
144
|
+
isVoicePlaying: isVoicePlaying,
|
|
145
|
+
text: processString(item.content || ''),
|
|
146
|
+
messageId: item.id
|
|
147
|
+
}), showRegerate && enableRegenerate && /*#__PURE__*/React.createElement(RegenerateButton, {
|
|
148
|
+
onRegenerateClick: onRegenerateClick
|
|
149
|
+
}))), (item.relatedResourceList || []).length > 0 && (showCommend === null || showCommend === void 0 ? void 0 : showCommend(item.id)) && /*#__PURE__*/React.createElement("div", {
|
|
150
|
+
className: styles.quickInputList
|
|
151
|
+
}, (item.relatedResourceList || []).map(function (item, index) {
|
|
152
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
className: styles.quickInputItem,
|
|
154
|
+
key: index,
|
|
155
|
+
onClick: function onClick() {
|
|
156
|
+
return handleClickPromptWord === null || handleClickPromptWord === void 0 ? void 0 : handleClickPromptWord(item.recommendQuestions);
|
|
157
|
+
}
|
|
158
|
+
}, item.recommendQuestions);
|
|
159
|
+
})), (item.relatedCourseRecommendation || []).length > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
className: styles.course_recommend
|
|
161
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
162
|
+
className: styles.course_recommend_header
|
|
163
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
className: styles.course_recommend_header_title
|
|
165
|
+
}, "\u76F8\u5173\u8BFE\u7A0B\u63A8\u8350"), (item.relatedCourseRecommendation || []).length > 4 && /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: styles.course_recommend_header_more,
|
|
167
|
+
onClick: function onClick() {
|
|
168
|
+
handleShowCourse(item);
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
171
|
+
className: styles.all
|
|
172
|
+
}, "\u5168\u90E8\u8BFE\u7A0B"))), /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: styles.course_recommend_list
|
|
174
|
+
}, (item.relatedCourseRecommendation || []).map(function (course, i) {
|
|
175
|
+
if (i > 3) return null;
|
|
176
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
177
|
+
className: styles.courseItem,
|
|
178
|
+
key: course.id,
|
|
179
|
+
onClick: function onClick() {
|
|
180
|
+
return window.open(course.productType === 'project' ? "/project-product/".concat(course.productId || course.id) : "/new-product/".concat(course.productId || course.id));
|
|
181
|
+
}
|
|
182
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
183
|
+
className: styles.cover
|
|
184
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
185
|
+
src: course.productUrl,
|
|
186
|
+
alt: ""
|
|
187
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: classNames(styles.courseTitle, 'ellipsis-3')
|
|
189
|
+
}, course !== null && course !== void 0 && course.showStyle ? /*#__PURE__*/React.createElement("span", {
|
|
190
|
+
className: classNames(styles.newEquityLabel, styles["newEquityLabel-".concat(course.showStyle)])
|
|
191
|
+
}, course === null || course === void 0 ? void 0 : course.equityLabel) : null, course.name));
|
|
192
|
+
}))))));
|
|
193
|
+
};
|
|
194
|
+
export default AnswerItem;
|