@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,119 @@
|
|
|
1
|
+
.uploadBox {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
min-width: 228px; /* 最小宽度保证 */
|
|
5
|
+
max-width: 380px; /* 最大宽度限制 */
|
|
6
|
+
width: fit-content; /* 自动适应内容宽度 */
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
background: var(---, #f2f3f7);
|
|
10
|
+
padding: 14px 16px 14px 12px;
|
|
11
|
+
margin-bottom: 12px;
|
|
12
|
+
position: relative;
|
|
13
|
+
}
|
|
14
|
+
.uploadIcon img {
|
|
15
|
+
width: 24px;
|
|
16
|
+
height: 22px;
|
|
17
|
+
margin-right: 8px;
|
|
18
|
+
img {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
object-fit: cover;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.uploadName {
|
|
25
|
+
flex: 1; /* 让文件名占满剩余空间 */
|
|
26
|
+
color: #2e394c;
|
|
27
|
+
font-family: 'PingFang SC';
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
line-height: normal;
|
|
32
|
+
min-width: 0; /* 关键:允许flex子元素缩小到内容尺寸以下 */
|
|
33
|
+
|
|
34
|
+
.uploadfileName {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
max-width: 100%; /* 限制整个文件名区域宽度 */
|
|
38
|
+
|
|
39
|
+
.fileName {
|
|
40
|
+
/* 动态计算可用宽度,减去扩展名和间距 */
|
|
41
|
+
flex: 1;
|
|
42
|
+
min-width: 0; /* 允许文件名进一步缩小 */
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
margin-right: 4px; /* 与扩展名保持一点距离 */
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.fileExtension {
|
|
50
|
+
white-space: nowrap; /* 确保扩展名不换行 */
|
|
51
|
+
color: #717F94; /* 可以给扩展名一个不同的颜色区分 */
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.sizeText {
|
|
56
|
+
.size{
|
|
57
|
+
margin-right: 4px;
|
|
58
|
+
font-size: 12px; /* 修复之前的语法错误,添加单位px */
|
|
59
|
+
color: #717F94;
|
|
60
|
+
}
|
|
61
|
+
.errorText {
|
|
62
|
+
color: #f33;
|
|
63
|
+
font-family: 'PingFang SC';
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
font-style: normal;
|
|
66
|
+
font-weight: 400;
|
|
67
|
+
line-height: normal;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.uploadStatus,
|
|
73
|
+
.uploadLoading {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
margin-left: 8px;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
color: #717F94;
|
|
80
|
+
img {
|
|
81
|
+
width: 18px;
|
|
82
|
+
height: 18px;
|
|
83
|
+
object-fit: cover;
|
|
84
|
+
margin-left: 5px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
.delIcon {
|
|
88
|
+
position: absolute;
|
|
89
|
+
right: -7px;
|
|
90
|
+
top: -5px;
|
|
91
|
+
width: 14px;
|
|
92
|
+
height: 14px;
|
|
93
|
+
background-color: rgba($color: #000000, $alpha: 0.6);
|
|
94
|
+
color: white;
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
background-color: white;
|
|
101
|
+
img {
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 100%;
|
|
104
|
+
object-fit: cover;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.uploadError {
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
color: #4086ff;
|
|
110
|
+
text-align: right;
|
|
111
|
+
font-family: 'PingFang SC';
|
|
112
|
+
font-size: 14px;
|
|
113
|
+
font-style: normal;
|
|
114
|
+
font-weight: 400;
|
|
115
|
+
line-height: normal;
|
|
116
|
+
margin-left: 20px;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
export default function VoiceBars(_ref) {
|
|
13
|
+
var _ref$parentWidth = _ref.parentWidth,
|
|
14
|
+
parentWidth = _ref$parentWidth === void 0 ? undefined : _ref$parentWidth;
|
|
15
|
+
var containerWidth = parentWidth !== null && parentWidth !== void 0 ? parentWidth : 0;
|
|
16
|
+
var total = containerWidth > 0 ? Math.floor(containerWidth / 12) : 20;
|
|
17
|
+
var _React$useState = React.useState(function () {
|
|
18
|
+
return Array(total).fill(8);
|
|
19
|
+
}),
|
|
20
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
21
|
+
volumes = _React$useState2[0],
|
|
22
|
+
setVolumes = _React$useState2[1];
|
|
23
|
+
var totalRef = React.useRef(total);
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
totalRef.current = total;
|
|
26
|
+
setVolumes(function (prev) {
|
|
27
|
+
return prev.length === total ? prev : Array(total).fill(8);
|
|
28
|
+
});
|
|
29
|
+
}, [total]);
|
|
30
|
+
React.useEffect(function () {
|
|
31
|
+
var stream = null;
|
|
32
|
+
var audioContext = null;
|
|
33
|
+
var animationFrameId = null;
|
|
34
|
+
var gainNode = null;
|
|
35
|
+
var stopped = false;
|
|
36
|
+
var lastUpdateTime = 0;
|
|
37
|
+
var removeResumeListener = null;
|
|
38
|
+
var start = /*#__PURE__*/function () {
|
|
39
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
40
|
+
var _navigator$mediaDevic, AudioContextCtor, tryResume, source, analyser, dataArray, loop;
|
|
41
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
42
|
+
while (1) switch (_context.prev = _context.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
_context.prev = 0;
|
|
45
|
+
if ((_navigator$mediaDevic = navigator.mediaDevices) !== null && _navigator$mediaDevic !== void 0 && _navigator$mediaDevic.getUserMedia) {
|
|
46
|
+
_context.next = 3;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
return _context.abrupt("return");
|
|
50
|
+
case 3:
|
|
51
|
+
_context.next = 5;
|
|
52
|
+
return navigator.mediaDevices.getUserMedia({
|
|
53
|
+
audio: {
|
|
54
|
+
echoCancellation: true,
|
|
55
|
+
noiseSuppression: true,
|
|
56
|
+
autoGainControl: true
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
case 5:
|
|
60
|
+
stream = _context.sent;
|
|
61
|
+
AudioContextCtor = window.AudioContext || window.webkitAudioContext;
|
|
62
|
+
if (AudioContextCtor) {
|
|
63
|
+
_context.next = 9;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return _context.abrupt("return");
|
|
67
|
+
case 9:
|
|
68
|
+
audioContext = new AudioContextCtor();
|
|
69
|
+
tryResume = function tryResume() {
|
|
70
|
+
if (audioContext && audioContext.state === 'suspended') {
|
|
71
|
+
audioContext.resume().catch(function () {});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
tryResume();
|
|
75
|
+
window.addEventListener('pointerdown', tryResume);
|
|
76
|
+
source = audioContext.createMediaStreamSource(stream);
|
|
77
|
+
analyser = audioContext.createAnalyser();
|
|
78
|
+
analyser.fftSize = 1024;
|
|
79
|
+
analyser.smoothingTimeConstant = 0.85;
|
|
80
|
+
dataArray = new Uint8Array(analyser.frequencyBinCount);
|
|
81
|
+
gainNode = audioContext.createGain();
|
|
82
|
+
gainNode.gain.value = 0;
|
|
83
|
+
source.connect(analyser);
|
|
84
|
+
analyser.connect(gainNode);
|
|
85
|
+
gainNode.connect(audioContext.destination);
|
|
86
|
+
loop = function loop(t) {
|
|
87
|
+
if (stopped) return;
|
|
88
|
+
if (t - lastUpdateTime >= 33) {
|
|
89
|
+
analyser.getByteFrequencyData(dataArray);
|
|
90
|
+
var sum = 0;
|
|
91
|
+
for (var i = 0; i < dataArray.length; i++) {
|
|
92
|
+
sum += dataArray[i];
|
|
93
|
+
}
|
|
94
|
+
var avg = sum / dataArray.length;
|
|
95
|
+
var level = Math.min(1, Math.max(0, (avg - 10) / 70));
|
|
96
|
+
var count = totalRef.current;
|
|
97
|
+
var baseHeight = 8;
|
|
98
|
+
var maxExtra = 28;
|
|
99
|
+
var newBars = Array(count).fill(0).map(function (_, i) {
|
|
100
|
+
var phase = t / 180 + i * 0.9;
|
|
101
|
+
var shape = 0.25 + 0.75 * Math.abs(Math.sin(phase));
|
|
102
|
+
return baseHeight + maxExtra * level * shape;
|
|
103
|
+
});
|
|
104
|
+
setVolumes(newBars);
|
|
105
|
+
lastUpdateTime = t;
|
|
106
|
+
}
|
|
107
|
+
animationFrameId = requestAnimationFrame(loop);
|
|
108
|
+
};
|
|
109
|
+
animationFrameId = requestAnimationFrame(loop);
|
|
110
|
+
return _context.abrupt("return", function () {
|
|
111
|
+
window.removeEventListener('pointerdown', tryResume);
|
|
112
|
+
});
|
|
113
|
+
case 28:
|
|
114
|
+
_context.prev = 28;
|
|
115
|
+
_context.t0 = _context["catch"](0);
|
|
116
|
+
return _context.abrupt("return");
|
|
117
|
+
case 31:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
121
|
+
}, _callee, null, [[0, 28]]);
|
|
122
|
+
}));
|
|
123
|
+
return function start() {
|
|
124
|
+
return _ref2.apply(this, arguments);
|
|
125
|
+
};
|
|
126
|
+
}();
|
|
127
|
+
start().then(function (cleanup) {
|
|
128
|
+
if (typeof cleanup === 'function') {
|
|
129
|
+
removeResumeListener = cleanup;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return function () {
|
|
133
|
+
var _removeResumeListener;
|
|
134
|
+
stopped = true;
|
|
135
|
+
if (animationFrameId !== null) {
|
|
136
|
+
cancelAnimationFrame(animationFrameId);
|
|
137
|
+
}
|
|
138
|
+
(_removeResumeListener = removeResumeListener) === null || _removeResumeListener === void 0 || _removeResumeListener();
|
|
139
|
+
if (stream) {
|
|
140
|
+
stream.getTracks().forEach(function (track) {
|
|
141
|
+
return track.stop();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (audioContext) {
|
|
145
|
+
audioContext.close();
|
|
146
|
+
}
|
|
147
|
+
if (gainNode) {
|
|
148
|
+
try {
|
|
149
|
+
gainNode.disconnect();
|
|
150
|
+
} catch (_unused2) {}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}, []);
|
|
154
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
style: {
|
|
156
|
+
display: 'flex',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
justifyContent: 'center',
|
|
159
|
+
height: 40,
|
|
160
|
+
gap: 6
|
|
161
|
+
}
|
|
162
|
+
}, volumes.map(function (h, i) {
|
|
163
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
key: i,
|
|
165
|
+
style: {
|
|
166
|
+
width: 6,
|
|
167
|
+
height: h,
|
|
168
|
+
background: '#4f8cff',
|
|
169
|
+
borderRadius: 4,
|
|
170
|
+
transition: 'height 0.1s ease-out'
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
})));
|
|
174
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import styles from "./index.module.scss";
|
|
16
|
+
import NoMicrophoneModalContent from "../no-microphone-root";
|
|
17
|
+
import { useAppDispatch, useAppSelector } from "../../store/hooks";
|
|
18
|
+
import { setShowMicWarning } from "../../store/slices/gimiMenuSlice";
|
|
19
|
+
var VoiceCheckDialog = function VoiceCheckDialog(_ref) {
|
|
20
|
+
var _layout$x, _layout$y;
|
|
21
|
+
var className = _ref.className,
|
|
22
|
+
style = _ref.style,
|
|
23
|
+
trigger = _ref.trigger;
|
|
24
|
+
var showMicWarning = useAppSelector(function (state) {
|
|
25
|
+
return state.gimiMenu.showMicWarning;
|
|
26
|
+
});
|
|
27
|
+
var dispatch = useAppDispatch();
|
|
28
|
+
var _React$useState = React.useState(null),
|
|
29
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
+
layout = _React$useState2[0],
|
|
31
|
+
setLayout = _React$useState2[1];
|
|
32
|
+
var dialogRef = React.useRef(null);
|
|
33
|
+
var triggerRef = React.useRef(null);
|
|
34
|
+
React.useLayoutEffect(function () {
|
|
35
|
+
var calculateLayout = function calculateLayout() {
|
|
36
|
+
if (triggerRef.current && dialogRef.current) {
|
|
37
|
+
var triggerRect = triggerRef.current.getBoundingClientRect();
|
|
38
|
+
var dialogRect = dialogRef.current.getBoundingClientRect();
|
|
39
|
+
var w = dialogRect.width;
|
|
40
|
+
var h = dialogRect.height;
|
|
41
|
+
var vw = window.innerWidth;
|
|
42
|
+
var vh = window.innerHeight;
|
|
43
|
+
|
|
44
|
+
// Priority: Top, Bottom, Left, Right
|
|
45
|
+
// Default to Top (Align Left)
|
|
46
|
+
var directions = [
|
|
47
|
+
// Top (Align Left)
|
|
48
|
+
{
|
|
49
|
+
x: triggerRect.left + 50,
|
|
50
|
+
y: triggerRect.top - h
|
|
51
|
+
},
|
|
52
|
+
// Bottom (Align Left)
|
|
53
|
+
{
|
|
54
|
+
x: triggerRect.left,
|
|
55
|
+
y: triggerRect.bottom
|
|
56
|
+
},
|
|
57
|
+
// Left (Align Top)
|
|
58
|
+
{
|
|
59
|
+
x: triggerRect.left - w,
|
|
60
|
+
y: triggerRect.top
|
|
61
|
+
},
|
|
62
|
+
// Right (Align Top)
|
|
63
|
+
{
|
|
64
|
+
x: triggerRect.right,
|
|
65
|
+
y: triggerRect.top
|
|
66
|
+
}];
|
|
67
|
+
var bestPos = null;
|
|
68
|
+
|
|
69
|
+
// 1. Try to find a position that fully fits
|
|
70
|
+
for (var _i = 0, _directions = directions; _i < _directions.length; _i++) {
|
|
71
|
+
var pos = _directions[_i];
|
|
72
|
+
var fitH = pos.x >= 0 && pos.x + w <= vw;
|
|
73
|
+
var fitV = pos.y >= 0 && pos.y + h <= vh;
|
|
74
|
+
if (fitH && fitV) {
|
|
75
|
+
bestPos = pos;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 2. If no full fit, try Top/Bottom but shift X to fit
|
|
81
|
+
if (!bestPos) {
|
|
82
|
+
// Try Top
|
|
83
|
+
var top = triggerRect.top - h;
|
|
84
|
+
if (top >= 0) {
|
|
85
|
+
// Check X
|
|
86
|
+
var left = triggerRect.left;
|
|
87
|
+
if (left + w > vw) left = vw - w;
|
|
88
|
+
if (left < 0) left = 0;
|
|
89
|
+
bestPos = {
|
|
90
|
+
x: left,
|
|
91
|
+
y: top
|
|
92
|
+
};
|
|
93
|
+
} else {
|
|
94
|
+
// Try Bottom
|
|
95
|
+
var _top = triggerRect.bottom;
|
|
96
|
+
if (_top + h <= vh) {
|
|
97
|
+
var _left = triggerRect.left;
|
|
98
|
+
if (_left + w > vw) _left = vw - w;
|
|
99
|
+
if (_left < 0) _left = 0;
|
|
100
|
+
bestPos = {
|
|
101
|
+
x: _left,
|
|
102
|
+
y: _top
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 3. Fallback: Force Top (or Bottom) and Clamp
|
|
109
|
+
if (!bestPos) {
|
|
110
|
+
var _top2 = triggerRect.top - h;
|
|
111
|
+
// If really no space on top, try bottom
|
|
112
|
+
if (_top2 < 0 && triggerRect.bottom + h < vh) {
|
|
113
|
+
_top2 = triggerRect.bottom;
|
|
114
|
+
}
|
|
115
|
+
var _left2 = triggerRect.left;
|
|
116
|
+
|
|
117
|
+
// Clamp
|
|
118
|
+
if (_left2 + w > vw) _left2 = vw - w;
|
|
119
|
+
if (_left2 < 0) _left2 = 0;
|
|
120
|
+
if (_top2 + h > vh) _top2 = vh - h;
|
|
121
|
+
if (_top2 < 0) _top2 = 0;
|
|
122
|
+
bestPos = {
|
|
123
|
+
x: _left2,
|
|
124
|
+
y: _top2
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
setLayout(bestPos);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
if (showMicWarning) {
|
|
131
|
+
calculateLayout();
|
|
132
|
+
window.addEventListener('resize', calculateLayout);
|
|
133
|
+
} else {
|
|
134
|
+
setLayout(null);
|
|
135
|
+
}
|
|
136
|
+
return function () {
|
|
137
|
+
window.removeEventListener('resize', calculateLayout);
|
|
138
|
+
};
|
|
139
|
+
}, [showMicWarning]);
|
|
140
|
+
var onCancel = function onCancel() {
|
|
141
|
+
dispatch(setShowMicWarning({
|
|
142
|
+
showMicWarning: false
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
145
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, trigger && /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
ref: triggerRef,
|
|
147
|
+
style: {
|
|
148
|
+
display: 'flex'
|
|
149
|
+
}
|
|
150
|
+
}, trigger), showMicWarning && /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
ref: dialogRef,
|
|
152
|
+
className: classNames(styles['voice-check-dialog'], className),
|
|
153
|
+
style: _objectSpread({
|
|
154
|
+
left: "".concat((_layout$x = layout === null || layout === void 0 ? void 0 : layout.x) !== null && _layout$x !== void 0 ? _layout$x : 0, "px"),
|
|
155
|
+
top: "".concat((_layout$y = layout === null || layout === void 0 ? void 0 : layout.y) !== null && _layout$y !== void 0 ? _layout$y : 0, "px"),
|
|
156
|
+
opacity: layout ? 1 : 0,
|
|
157
|
+
visibility: layout ? 'visible' : 'hidden'
|
|
158
|
+
}, style)
|
|
159
|
+
}, /*#__PURE__*/React.createElement(NoMicrophoneModalContent, {
|
|
160
|
+
onOk: onCancel
|
|
161
|
+
})));
|
|
162
|
+
};
|
|
163
|
+
export default VoiceCheckDialog;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Tooltip } from '@douyinfe/semi-ui';
|
|
2
|
+
import VoiceBars from "../voice-bars";
|
|
3
|
+
import styles from "./index.module.scss";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
var CHECK_ICON_ADDRESS = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/04/8b0e2_20260104154821.png';
|
|
6
|
+
var CANCEL_ICON_ADDRESS = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202601/04/94bfe_20260104154857.png';
|
|
7
|
+
var VoiceRecording = function VoiceRecording(_ref) {
|
|
8
|
+
var recordingCount = _ref.recordingCount,
|
|
9
|
+
stopRecording = _ref.stopRecording,
|
|
10
|
+
containerWidth = _ref.containerWidth;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: styles.main
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: styles.text
|
|
15
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
16
|
+
className: styles.font_weight_600
|
|
17
|
+
}, "\u8BED\u97F3\u8F93\u5165\u4E2D"), recordingCount > 0 && recordingCount <= 10 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
18
|
+
className: styles.font_weight_400
|
|
19
|
+
}, "(\u5012\u8BA1\u65F6"), /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
className: styles.count
|
|
21
|
+
}, recordingCount), /*#__PURE__*/React.createElement("span", {
|
|
22
|
+
className: styles.font_weight_400
|
|
23
|
+
}, "\u79D2)"))), /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: styles.voice_bar
|
|
25
|
+
}, /*#__PURE__*/React.createElement(VoiceBars, {
|
|
26
|
+
parentWidth: containerWidth - 48 * 2 - 20 * 2 - 10
|
|
27
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
style: {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
gap: '10px'
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
33
|
+
content: "\u653E\u5F03\u8F6C\u5199",
|
|
34
|
+
arrowPointAtCenter: true
|
|
35
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
36
|
+
className: styles.icon,
|
|
37
|
+
src: CANCEL_ICON_ADDRESS,
|
|
38
|
+
alt: "\u653E\u5F03\u8F6C\u5199",
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
stopRecording(false);
|
|
41
|
+
}
|
|
42
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
43
|
+
content: "\u5F00\u59CB\u8F6C\u5199",
|
|
44
|
+
arrowPointAtCenter: true
|
|
45
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
46
|
+
className: styles.icon,
|
|
47
|
+
src: CHECK_ICON_ADDRESS,
|
|
48
|
+
alt: "\u5F00\u59CB\u8F6C\u5199",
|
|
49
|
+
onClick: function onClick() {
|
|
50
|
+
stopRecording(true);
|
|
51
|
+
}
|
|
52
|
+
})))));
|
|
53
|
+
};
|
|
54
|
+
export default VoiceRecording;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.main {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding: 20px;
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
border: 1px solid rgba(223, 232, 247, 1);
|
|
10
|
+
.text {
|
|
11
|
+
font-family: PingFang SC;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
font-style: Semibold;
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
line-height: 18px;
|
|
16
|
+
letter-spacing: 0px;
|
|
17
|
+
.font_weight_600 {
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
margin-right: 5px;
|
|
20
|
+
}
|
|
21
|
+
.font_weight_400 {
|
|
22
|
+
font-weight: 400;
|
|
23
|
+
}
|
|
24
|
+
.count {
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
color: #007aff;
|
|
27
|
+
padding: 0 5px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
.voice_bar {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
width: 100%;
|
|
35
|
+
.icon {
|
|
36
|
+
width: 48px;
|
|
37
|
+
height: 48px;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import WorkFlowContent from "./index";
|
|
3
|
+
var Demo = function Demo() {
|
|
4
|
+
return /*#__PURE__*/React.createElement(WorkFlowContent, {
|
|
5
|
+
chatItem: {
|
|
6
|
+
mcp: '这是一条工作流内容',
|
|
7
|
+
status: 'executeWorkflowByDescription'
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
export default Demo;
|