yt-chat-components 1.5.7 → 1.5.8
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/package.json +1 -1
- package/public/index.html +36 -8
- package/src/YtChatView/chatWidget/chatWindow/audioPlayer/AudioPlayer.tsx +225 -0
- package/src/YtChatView/chatWidget/chatWindow/audioPlayer/PCMAudioPlayer.js +101 -0
- package/src/YtChatView/chatWidget/chatWindow/audioRecorder/index.tsx +237 -0
- package/src/YtChatView/chatWidget/chatWindow/callInterface/index.tsx +1 -1
- package/src/YtChatView/chatWidget/chatWindow/chatMessage/index.tsx +25 -14
- package/src/YtChatView/chatWidget/chatWindow/index.tsx +96 -7
- package/src/YtChatView/chatWidget/chatWindow/inputMobile/index.module.css +134 -0
- package/src/YtChatView/chatWidget/chatWindow/inputMobile/inputMobile.js +170 -0
- package/src/YtChatView/chatWidget/index.tsx +11 -1
- package/src/YtChatView/components/TabSelector/index.jsx +102 -3
- package/src/YtChatView/components/TabSelector/index.module.css +115 -0
- package/src/YtChatView/logoBtn/index.jsx +1 -1
- package/src/YtChatView/mobileChat/index.jsx +1 -0
- package/src/YtChatView/mobileChatV2/index.jsx +712 -0
- package/src/YtChatView/mobileChatV2/index.module.css +269 -0
- package/src/YtChatView/previewDialog/index.jsx +1 -0
- package/src/YtChatView/previewDialogV2/index.jsx +28 -40
- package/src/index.tsx +2 -1
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
.p_closeImg {
|
|
2
|
+
width: 14px;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.p_toolDialog {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
height: calc(100vh - 60px);
|
|
10
|
+
background:url('https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/ai_modal_bg.png');
|
|
11
|
+
background-size: cover;
|
|
12
|
+
border-radius:8px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.p_toolDialog .p_toolLeft {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
width: 300px;
|
|
20
|
+
padding: 1.7rem 1.6rem 1.7rem 1.6rem;
|
|
21
|
+
|
|
22
|
+
border-top-left-radius: 8px;
|
|
23
|
+
border-bottom-left-radius: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.p_toolDialog .p_toolLeft .p_toolLogo {
|
|
27
|
+
user-select: none;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.p_toolDialog .p_toolLeft .p_toolLogo .p_logoImg {
|
|
33
|
+
width: 48px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.p_toolDialog .p_toolLeft .p_toolLogo .p_logoText {
|
|
37
|
+
font-weight: bold;
|
|
38
|
+
margin-left: 10px;
|
|
39
|
+
font-size: 30px;
|
|
40
|
+
background: linear-gradient(to right, #1551FF, #8F4BFF);
|
|
41
|
+
-webkit-background-clip: text;
|
|
42
|
+
-webkit-text-fill-color: transparent;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.p_toolDialog .p_toolLeft .p_historyDialog {
|
|
46
|
+
user-select: none;
|
|
47
|
+
margin-top: 20px;
|
|
48
|
+
margin-bottom: 20px;
|
|
49
|
+
border-radius: 10px;
|
|
50
|
+
flex: 1;
|
|
51
|
+
width: 100%;
|
|
52
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
|
|
53
|
+
border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1;
|
|
54
|
+
backdrop-filter: blur(10px);
|
|
55
|
+
position: relative;
|
|
56
|
+
max-height:calc(100% - 5.5rem - 60px);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.p_toolDialog .p_toolLeft .p_historyDialog ::-webkit-scrollbar-thumb {
|
|
60
|
+
border-radius: 10px;
|
|
61
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
|
|
62
|
+
background: #535353 !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle {
|
|
66
|
+
padding: 1.3rem 16px 0 16px;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_historyImg {
|
|
72
|
+
width: 25px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_dialogTitle {
|
|
76
|
+
margin-left: 10px;
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
font-size: 18px;
|
|
79
|
+
color: #333333;
|
|
80
|
+
line-height: 16px;
|
|
81
|
+
text-align: left;
|
|
82
|
+
font-style: normal;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyListEmpty {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: 50%;
|
|
88
|
+
left: 50%;
|
|
89
|
+
transform: translate(-50%, -50%);
|
|
90
|
+
text-align: center;
|
|
91
|
+
font-size: 12px;
|
|
92
|
+
color: #999999;
|
|
93
|
+
max-height: calc(100% - 3rem);
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList {
|
|
98
|
+
height: calc(100% - 3rem);
|
|
99
|
+
margin-top: 10px;
|
|
100
|
+
overflow-y: auto;
|
|
101
|
+
scrollbar-width: none !important; /* firefox */
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList::-webkit-scrollbar{
|
|
105
|
+
display:none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList:hover {
|
|
109
|
+
scrollbar-width: thin !important; /* firefox */
|
|
110
|
+
scrollbar-color: #ced4e3 transparent;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem {
|
|
114
|
+
padding: 7px 16px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_activeHistoryName {
|
|
118
|
+
color: #1552FF !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName {
|
|
122
|
+
color: #333333;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName:hover {
|
|
130
|
+
color: #171717;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.p_toolDialog .p_toolRight {
|
|
134
|
+
flex: 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.p_toolRightToRight {
|
|
138
|
+
width:300px;
|
|
139
|
+
display:flex;
|
|
140
|
+
flex-direction:column;
|
|
141
|
+
padding:2rem 1.6rem 1.8rem 1.6rem
|
|
142
|
+
}
|
|
143
|
+
.rightInnerContainer{
|
|
144
|
+
height:calc(100% - 80px);
|
|
145
|
+
flex:1;
|
|
146
|
+
display:flex;
|
|
147
|
+
flex-direction:column;
|
|
148
|
+
justify-content: space-between;
|
|
149
|
+
}
|
|
150
|
+
.p_toolRightToRight .rightSideTitle{
|
|
151
|
+
margin-bottom:1.4rem;
|
|
152
|
+
margin-top:10px;
|
|
153
|
+
margin-top:0;
|
|
154
|
+
font-size:18px;
|
|
155
|
+
font-weight:500;
|
|
156
|
+
display:flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
}
|
|
159
|
+
.p_toolRightToRight .rightSideTitle img{
|
|
160
|
+
margin-right:4px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.p_toolRightToRight .rightSideTitle .titleSideColumn{
|
|
164
|
+
color:#1551FF;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.p_toolRightToRight .rightSkillContainer{
|
|
168
|
+
min-height:40%;
|
|
169
|
+
}
|
|
170
|
+
.p_toolRightToRight .rightSkillContainer .rightSkillList{
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-wrap: wrap;
|
|
173
|
+
grid-template-columns: repeat(3, 1fr);
|
|
174
|
+
gap: 10px;
|
|
175
|
+
}
|
|
176
|
+
.p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem{
|
|
177
|
+
text-align: center;
|
|
178
|
+
cursor:pointer;
|
|
179
|
+
width:30%;
|
|
180
|
+
}
|
|
181
|
+
.p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem img{
|
|
182
|
+
width: 40px;
|
|
183
|
+
height: 40px;
|
|
184
|
+
border-radius:10px;
|
|
185
|
+
}
|
|
186
|
+
.p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem p{
|
|
187
|
+
margin-top:0px;
|
|
188
|
+
margin-bottom:4px;
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
text-overflow: ellipsis;
|
|
191
|
+
white-space: nowrap;
|
|
192
|
+
color: #333333;
|
|
193
|
+
}
|
|
194
|
+
.p_toolRightToRight .rightKnowledgeTitle{
|
|
195
|
+
nargin-top: 2.2rem;
|
|
196
|
+
margin-bottom: 1.4rem;
|
|
197
|
+
font-size:18px;
|
|
198
|
+
font-weight:500;
|
|
199
|
+
display:flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.p_toolRightToRight .rightKnowledgeTitle img{
|
|
204
|
+
margin-right:4px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.p_toolRightToRight .rightKnowledgeContainer{
|
|
208
|
+
position:relative;
|
|
209
|
+
}
|
|
210
|
+
.p_toolRightToRight .rightMoreButton{
|
|
211
|
+
background: url('../../assets/aicenter/moreAi.png');
|
|
212
|
+
background-size: 85% auto;
|
|
213
|
+
background-repeat: no-repeat;
|
|
214
|
+
background-position: bottom;
|
|
215
|
+
position: absolute;
|
|
216
|
+
bottom: 8px;
|
|
217
|
+
left: 0;
|
|
218
|
+
width: 100%;
|
|
219
|
+
height: 100%;
|
|
220
|
+
z-index: 1;
|
|
221
|
+
display: flex;
|
|
222
|
+
justify-content: center;
|
|
223
|
+
align-items: flex-end;
|
|
224
|
+
}
|
|
225
|
+
.p_toolRightToRight .rightMoreButton div{
|
|
226
|
+
width:calc(100% - 50px);
|
|
227
|
+
padding: 16px 16px 10px 20px;
|
|
228
|
+
font-weight: 500;
|
|
229
|
+
color: #ffffff;
|
|
230
|
+
line-height: 17px;
|
|
231
|
+
font-size: 12px;
|
|
232
|
+
cursor:pointer;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.p_newDialog {
|
|
236
|
+
width: 252px;
|
|
237
|
+
height: 40px;
|
|
238
|
+
min-height:40px;
|
|
239
|
+
background: linear-gradient( 45deg, #1551FF 0%, #8F4BFF 100%);
|
|
240
|
+
margin-top: 20px;
|
|
241
|
+
border-radius: 20px;
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
justify-content: center;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.p_newDialog img {
|
|
249
|
+
width: 18px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.p_newDialog .p_newDialogText {
|
|
253
|
+
color: #fff;
|
|
254
|
+
margin-left: 6px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.mobile_nav{
|
|
258
|
+
height: 60px;
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
justify-content: space-between;
|
|
262
|
+
padding: 0 20px;
|
|
263
|
+
|
|
264
|
+
.title{
|
|
265
|
+
color: #000;
|
|
266
|
+
font-size: 19px;
|
|
267
|
+
font-weight: bold;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -438,21 +438,6 @@ export class ToolDialogV2 extends React.Component {
|
|
|
438
438
|
|
|
439
439
|
renderCustomDropDown=(dropDownList)=>{
|
|
440
440
|
return null;
|
|
441
|
-
const { title } = this.props;
|
|
442
|
-
const { currentFlow } = this.state;
|
|
443
|
-
return <TabSelector
|
|
444
|
-
handleRowClick={(word)=> {
|
|
445
|
-
if(!this.isActiveMessage()){
|
|
446
|
-
this.setState({ dropDownList: [] });
|
|
447
|
-
this.handleSendMessage(word);
|
|
448
|
-
}else{
|
|
449
|
-
message.destroy();
|
|
450
|
-
message.info("请等待回复结束后再发送")
|
|
451
|
-
}
|
|
452
|
-
}}
|
|
453
|
-
welcomeWords={`Hi,欢迎使用${currentFlow.name||title},您可以这样问我:`}
|
|
454
|
-
dataList={this.state.knowledgeInfo?.question || []}
|
|
455
|
-
/>
|
|
456
441
|
}
|
|
457
442
|
|
|
458
443
|
render() {
|
|
@@ -552,31 +537,32 @@ export class ToolDialogV2 extends React.Component {
|
|
|
552
537
|
}
|
|
553
538
|
<div className="p_toolRight">
|
|
554
539
|
<MethodContext.Provider value={{registerChatMethods:this.registerChatMethods}}>
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
540
|
+
<ChatWidget
|
|
541
|
+
window_title={currentFlow?.name || title}
|
|
542
|
+
flow_id={currentFlow?.id || flowId}
|
|
543
|
+
tags={currentFlow?.keywords || tags}
|
|
544
|
+
is_enable_call={currentFlow?.is_enable_call || false}
|
|
545
|
+
host_url={hostUrl}
|
|
546
|
+
api_key={api_key}
|
|
547
|
+
session_id={this.state.sessionId}
|
|
548
|
+
userInfo={this.sessionUserInfo}
|
|
549
|
+
getHistoryList={this.getHistoryList}
|
|
550
|
+
setDropDownList={(list) => this.setState({ dropDownList: list })}
|
|
551
|
+
dropDownList={this.state.dropDownList}
|
|
552
|
+
baseConfig={{ isTitleSideIcon, logoWidth, agentUrl, ...assetMap }}
|
|
553
|
+
isShowUploadButton={isShowUploadButton}
|
|
554
|
+
isShowVoiceButton={isShowVoiceButton}
|
|
555
|
+
dropManUrl={currentFlow.character}
|
|
556
|
+
modalWidth={modalWidth}
|
|
557
|
+
isShowReadIcon={isShowReadIcon}
|
|
558
|
+
isShowChatHeader={false}
|
|
559
|
+
renderCustomDropDown={this.renderCustomDropDown}
|
|
560
|
+
isTagsHidden={true}
|
|
561
|
+
placeholder={'请输入您想咨询的问题'}
|
|
562
|
+
isEnableForV1={false}
|
|
563
|
+
questions={this.state.knowledgeInfo?.question || []}
|
|
564
|
+
voice={currentFlow.call_voice}
|
|
565
|
+
/>
|
|
580
566
|
</MethodContext.Provider>
|
|
581
567
|
</div>
|
|
582
568
|
{
|
|
@@ -609,6 +595,8 @@ export class ToolDialogV2 extends React.Component {
|
|
|
609
595
|
</div>
|
|
610
596
|
<TabSelector
|
|
611
597
|
isSimple={true}
|
|
598
|
+
keyShowSize={2}
|
|
599
|
+
isShowByPages={false}
|
|
612
600
|
handleRowClick={(word) => {
|
|
613
601
|
this.handleClick(word)
|
|
614
602
|
}}
|
package/src/index.tsx
CHANGED
|
@@ -5,8 +5,9 @@ import ToolDialog from "./YtChatView/previewDialog/index";
|
|
|
5
5
|
import LogoSplitBtn from "./YtChatView/logoSplitBtn/index";
|
|
6
6
|
import MobileChatPage from "./YtChatView/mobileChat";
|
|
7
7
|
import ToolDialogV2 from "./YtChatView/previewDialogV2/index";
|
|
8
|
+
import {MobileChatPageV2} from "./YtChatView/mobileChatV2";
|
|
8
9
|
|
|
9
10
|
// 手动注入 React 和 ReactDOM 到全局
|
|
10
11
|
window.React = React;
|
|
11
12
|
window.ReactDOM = ReactDOM;
|
|
12
|
-
export {ToolDialog, LogoSplitBtn, LogoBtn, MobileChatPage, ToolDialogV2}
|
|
13
|
+
export {ToolDialog, LogoSplitBtn, LogoBtn, MobileChatPage, ToolDialogV2, MobileChatPageV2}
|