yt-chat-components 0.1.0 → 0.3.0
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/build/static/js/bundle.min.js +1 -1
- package/package.json +9 -7
- package/public/index.html +27 -25
- package/src/YtChatView/chatWidget/chatWindow/index.tsx +195 -177
- package/src/YtChatView/chatWidget/index.tsx +127 -29
- package/src/YtChatView/logoBtn/index.jsx +2 -3
- package/src/YtChatView/logoSplitBtn/index.jsx +3 -3
- package/src/YtChatView/previewDialog/index.jsx +147 -59
- package/src/assets/aicenter/btn_answer.png +0 -0
- package/src/assets/aicenter/history.png +0 -0
- package/src/assets/aicenter/moreAi.png +0 -0
- package/src/assets/aicenter/self_knowledge.png +0 -0
- package/src/assets/aicenter/self_skills.png +0 -0
- package/src/assets/aicenter/sendmessage.png +0 -0
- package/src/chatWidget/index.tsx +8 -10
- package/src/index.tsx +1 -51
- package/build/asset-manifest.json +0 -16
- package/build/index.html +0 -1
- package/build/static/css/main.6f7c593d.css +0 -2
- package/build/static/css/main.6f7c593d.css.map +0 -1
- package/build/static/js/main.cb252095.js +0 -3
- package/build/static/js/main.cb252095.js.LICENSE.txt +0 -134
- package/build/static/js/main.cb252095.js.map +0 -1
- package/build/static/media/aiavatar.74bafa995cce4c01b804.png +0 -0
- package/build/static/media/history-list-empty.1eb65b1550aef4e8c8a4.png +0 -0
- package/build/static/media/moreBg.9fc998472925cecd89f2.png +0 -0
|
@@ -13,6 +13,8 @@ import { Button, message as messageTip, Progress } from 'antd'
|
|
|
13
13
|
import { CloseOutlined } from "@ant-design/icons";
|
|
14
14
|
import moreAi from '../../assets/aicenter/moreAi.png';
|
|
15
15
|
import moreBg from '../../assets/aicenter/moreBg.png';
|
|
16
|
+
import self_knowledge from '../../assets/aicenter/self_knowledge.png';
|
|
17
|
+
import self_skills from '../../assets/aicenter/self_skills.png';
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
const style=`
|
|
@@ -24,6 +26,9 @@ const style=`
|
|
|
24
26
|
.p_toolDialog {
|
|
25
27
|
display: flex;
|
|
26
28
|
height:100%;
|
|
29
|
+
background:url('https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/ai/ai_modal_bg.png');
|
|
30
|
+
background-size: cover;
|
|
31
|
+
border-radius:8px;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
.p_toolDialog .p_toolLeft {
|
|
@@ -31,9 +36,9 @@ const style=`
|
|
|
31
36
|
flex-direction: column;
|
|
32
37
|
align-items: center;
|
|
33
38
|
width: 300px;
|
|
34
|
-
height: 100%;
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
// height: 100%;
|
|
40
|
+
padding: 1.5rem 1.6rem 2rem 2.4rem;
|
|
41
|
+
|
|
37
42
|
border-top-left-radius: 8px;
|
|
38
43
|
border-bottom-left-radius: 8px;
|
|
39
44
|
}
|
|
@@ -45,13 +50,12 @@ const style=`
|
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
.p_toolDialog .p_toolLeft .p_toolLogo .p_logoImg {
|
|
48
|
-
width:
|
|
53
|
+
width: 48px;
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
.p_toolDialog .p_toolLeft .p_toolLogo .p_logoText {
|
|
52
57
|
font-weight: bold;
|
|
53
58
|
margin-left: 10px;
|
|
54
|
-
padding-top: 16px;
|
|
55
59
|
font-size: 30px;
|
|
56
60
|
background: linear-gradient(to right, #1551FF, #8F4BFF);
|
|
57
61
|
-webkit-background-clip: text;
|
|
@@ -69,6 +73,7 @@ const style=`
|
|
|
69
73
|
border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1;
|
|
70
74
|
backdrop-filter: blur(10px);
|
|
71
75
|
position: relative;
|
|
76
|
+
max-height:calc(100% - 5.5rem - 60px);
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
.p_toolDialog .p_toolLeft .p_historyDialog ::-webkit-scrollbar-thumb {
|
|
@@ -78,20 +83,23 @@ const style=`
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle {
|
|
81
|
-
padding:
|
|
86
|
+
padding: 1.3rem 16px 0 16px;
|
|
82
87
|
display: flex;
|
|
83
88
|
align-items: center;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_historyImg {
|
|
87
|
-
width:
|
|
92
|
+
width: 25px;
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_dialogTitle {
|
|
91
|
-
font-weight: bold;
|
|
92
|
-
font-size: 16px;
|
|
93
96
|
margin-left: 10px;
|
|
94
|
-
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
font-size: 18px;
|
|
99
|
+
color: #333333;
|
|
100
|
+
line-height: 16px;
|
|
101
|
+
text-align: left;
|
|
102
|
+
font-style: normal;
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyListEmpty {
|
|
@@ -102,15 +110,22 @@ const style=`
|
|
|
102
110
|
text-align: center;
|
|
103
111
|
font-size: 12px;
|
|
104
112
|
color: #999999;
|
|
113
|
+
max-height: calc(100% - 3rem);
|
|
114
|
+
|
|
105
115
|
}
|
|
106
116
|
|
|
107
117
|
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList {
|
|
118
|
+
height: calc(100% - 3rem);
|
|
108
119
|
margin-top: 10px;
|
|
109
120
|
// height: 360px;
|
|
110
121
|
overflow-y: auto;
|
|
111
122
|
scrollbar-width: none !important; /* firefox */
|
|
112
123
|
}
|
|
113
124
|
|
|
125
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList::-webkit-scrollbar{
|
|
126
|
+
display:none;
|
|
127
|
+
}
|
|
128
|
+
|
|
114
129
|
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList:hover {
|
|
115
130
|
scrollbar-width: thin !important; /* firefox */
|
|
116
131
|
scrollbar-color: #ced4e3 transparent;
|
|
@@ -141,25 +156,36 @@ const style=`
|
|
|
141
156
|
// width: calc(100% - 300px - 300px);
|
|
142
157
|
}
|
|
143
158
|
|
|
144
|
-
.p_toolRightToRight{
|
|
159
|
+
.p_toolRightToRight {
|
|
145
160
|
width:300px;
|
|
146
161
|
display:flex;
|
|
147
162
|
flex-direction:column;
|
|
148
|
-
padding:
|
|
163
|
+
padding:2.5rem 1.6rem 1.8rem 1.6rem
|
|
149
164
|
}
|
|
150
165
|
.rightInnerContainer{
|
|
151
166
|
height:calc(100% - 80px);
|
|
152
167
|
flex:1;
|
|
168
|
+
display:flex;
|
|
169
|
+
flex-direction:column;
|
|
170
|
+
justify-content: space-between;
|
|
153
171
|
}
|
|
154
172
|
.p_toolRightToRight .rightSideTitle{
|
|
155
|
-
margin-bottom:
|
|
173
|
+
margin-bottom:1.4rem;
|
|
174
|
+
margin-top:10px;
|
|
156
175
|
margin-top:0;
|
|
157
176
|
font-size:18px;
|
|
158
177
|
font-weight:500;
|
|
178
|
+
display:flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
}
|
|
181
|
+
.p_toolRightToRight .rightSideTitle img{
|
|
182
|
+
margin-right:4px;
|
|
159
183
|
}
|
|
184
|
+
|
|
160
185
|
.p_toolRightToRight .rightSideTitle .titleSideColumn{
|
|
161
186
|
color:#1551FF;
|
|
162
187
|
}
|
|
188
|
+
|
|
163
189
|
.p_toolRightToRight .rightSkillContainer{
|
|
164
190
|
min-height:40%;
|
|
165
191
|
}
|
|
@@ -167,7 +193,6 @@ const style=`
|
|
|
167
193
|
display: grid;
|
|
168
194
|
grid-template-columns: repeat(3, 1fr);
|
|
169
195
|
gap: 10px;
|
|
170
|
-
margin-bottom: 20px;
|
|
171
196
|
}
|
|
172
197
|
.p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem{
|
|
173
198
|
text-align: center;
|
|
@@ -175,19 +200,30 @@ const style=`
|
|
|
175
200
|
}
|
|
176
201
|
.p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem img{
|
|
177
202
|
width: 40px;
|
|
178
|
-
|
|
203
|
+
height: 40px;
|
|
204
|
+
border-radius:10px;
|
|
179
205
|
}
|
|
180
206
|
.p_toolRightToRight .rightSkillContainer .rightSkillList .rightSkillItem p{
|
|
207
|
+
margin-top:0px;
|
|
208
|
+
margin-bottom:4px;
|
|
181
209
|
overflow: hidden;
|
|
182
210
|
text-overflow: ellipsis;
|
|
183
211
|
white-space: nowrap;
|
|
184
212
|
width:80px;
|
|
213
|
+
color: #333333;
|
|
185
214
|
}
|
|
186
215
|
.p_toolRightToRight .rightKnowledgeTitle{
|
|
187
|
-
margin-bottom:
|
|
216
|
+
margin-bottom:1.4rem;
|
|
188
217
|
font-size:18px;
|
|
189
218
|
font-weight:500;
|
|
219
|
+
display:flex;
|
|
220
|
+
align-items: center;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.p_toolRightToRight .rightKnowledgeTitle img{
|
|
224
|
+
margin-right:4px;
|
|
190
225
|
}
|
|
226
|
+
|
|
191
227
|
.p_toolRightToRight .rightKnowledgeContainer{
|
|
192
228
|
position:relative;
|
|
193
229
|
}
|
|
@@ -219,7 +255,8 @@ const style=`
|
|
|
219
255
|
.p_newDialog {
|
|
220
256
|
width: 252px;
|
|
221
257
|
height: 40px;
|
|
222
|
-
|
|
258
|
+
min-height:40px;
|
|
259
|
+
background: linear-gradient( 45deg, #1551FF 0%, #8F4BFF 100%);
|
|
223
260
|
margin-top: 20px;
|
|
224
261
|
border-radius: 20px;
|
|
225
262
|
cursor: pointer;
|
|
@@ -253,11 +290,29 @@ const defaultList = [
|
|
|
253
290
|
},
|
|
254
291
|
];
|
|
255
292
|
|
|
293
|
+
const formatFileSize = (bytes) => {
|
|
294
|
+
// 如果字节数为0,直接返回
|
|
295
|
+
if(isEmpty(bytes)) {
|
|
296
|
+
return { formattedSize: 0, unit: 'B' };
|
|
297
|
+
}
|
|
298
|
+
if(bytes === 0) return { formattedSize: 0, unit: 'B' };
|
|
299
|
+
|
|
300
|
+
// 定义单位和对应的字节数(1024进制)
|
|
301
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
|
302
|
+
// 计算合适的单位索引
|
|
303
|
+
const index = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
304
|
+
// 将字节数转换为目标单位
|
|
305
|
+
const size = bytes / Math.pow(1024, index);
|
|
306
|
+
// 保留两位小数,并去除多余的0
|
|
307
|
+
const formattedSize = size.toFixed(2).replace(/\.?0+$/, '');
|
|
308
|
+
return { formattedSize, unit: units[index] }
|
|
309
|
+
}
|
|
310
|
+
|
|
256
311
|
|
|
257
312
|
const api_key = 'sk-mniUFDpcWwvNF3iFzssXa6etN-S_Y4AApyHYcBU44L0';
|
|
258
313
|
|
|
259
314
|
|
|
260
|
-
class ToolDialog extends React.Component {
|
|
315
|
+
export class ToolDialog extends React.Component {
|
|
261
316
|
state = {
|
|
262
317
|
historyList: [], // 历史对话列表
|
|
263
318
|
sessionId: uuidv4(), // 当前激活的对话对应的sessionId
|
|
@@ -267,14 +322,17 @@ class ToolDialog extends React.Component {
|
|
|
267
322
|
};
|
|
268
323
|
|
|
269
324
|
async componentDidMount() {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if(isEmpty(sceneData)) {
|
|
325
|
+
if(isEmpty(this.props.sceneId)){
|
|
326
|
+
// 兼容非场景打开的情况
|
|
273
327
|
this.getHistoryList();
|
|
274
|
-
}
|
|
275
|
-
this.
|
|
328
|
+
}else{
|
|
329
|
+
const sceneData = await this.getSceneInfo();
|
|
330
|
+
if(isEmpty(sceneData)) {
|
|
331
|
+
this.getHistoryList();
|
|
332
|
+
} else {
|
|
333
|
+
this.getHistoryList(sceneData);
|
|
334
|
+
}
|
|
276
335
|
}
|
|
277
|
-
this.setState({dropDownList:defaultList})
|
|
278
336
|
}
|
|
279
337
|
|
|
280
338
|
getCurrentFlowHistory=(flowId)=>{
|
|
@@ -288,13 +346,17 @@ class ToolDialog extends React.Component {
|
|
|
288
346
|
|
|
289
347
|
// 获取历史对话列表
|
|
290
348
|
getHistoryList = (sceneData) => {
|
|
291
|
-
const realFlowId = sceneData
|
|
292
|
-
|
|
349
|
+
const realFlowId = sceneData?.flows[0].id || this.props.flowId;
|
|
350
|
+
if(!isEmpty(sceneData)){
|
|
351
|
+
const currentFlow = sceneData.flows[0];
|
|
352
|
+
const dropDownList = this.getDropDownList(currentFlow.welcome_words);
|
|
353
|
+
this.setState({ currentFlow, dropDownList })
|
|
354
|
+
}
|
|
293
355
|
this.getCurrentFlowHistory(realFlowId)
|
|
294
356
|
};
|
|
295
357
|
|
|
296
358
|
getSceneInfo = async ()=>{
|
|
297
|
-
const res = await getSceneInfo(this.props.hostUrl, this.props.sceneId,api_key);
|
|
359
|
+
const res = await getSceneInfo(this.props.hostUrl, this.props.sceneId, api_key);
|
|
298
360
|
if(res.status === 200){
|
|
299
361
|
this.setState({ sceneInfo: res.data });
|
|
300
362
|
}
|
|
@@ -308,16 +370,29 @@ class ToolDialog extends React.Component {
|
|
|
308
370
|
return;
|
|
309
371
|
}
|
|
310
372
|
this.setState({ sessionId: uuidv4() });
|
|
311
|
-
this.setState({ dropDownList:
|
|
373
|
+
this.setState({ dropDownList: this.getDropDownList(this.state.currentFlow.welcome_words) })
|
|
312
374
|
}
|
|
375
|
+
|
|
313
376
|
updateSessionId = (sessionId) => {
|
|
314
377
|
this.setState({ sessionId });
|
|
315
378
|
};
|
|
316
379
|
|
|
380
|
+
getDropDownList = (welcome_words)=>{
|
|
381
|
+
if(isEmpty(welcome_words)){
|
|
382
|
+
return defaultList;
|
|
383
|
+
}
|
|
384
|
+
return welcome_words.map((question,index)=>(
|
|
385
|
+
{
|
|
386
|
+
backgroundImg:defaultList[index].backgroundImg,
|
|
387
|
+
title:question,
|
|
388
|
+
}
|
|
389
|
+
))
|
|
390
|
+
}
|
|
391
|
+
|
|
317
392
|
render() {
|
|
318
393
|
const dialogHeight = 650;
|
|
319
|
-
const { title, flowId, hostUrl, setDialogVisible, userInfo,
|
|
320
|
-
const {
|
|
394
|
+
const { title, flowId, hostUrl, setDialogVisible, userInfo, boxStyle, isShowSideRight, tags = [] } = this.props;
|
|
395
|
+
const { sceneInfo, currentFlow = {} } = this.state;
|
|
321
396
|
const { flows=[], name: sceneName } = sceneInfo;
|
|
322
397
|
return (
|
|
323
398
|
<div style={boxStyle}>
|
|
@@ -374,49 +449,62 @@ class ToolDialog extends React.Component {
|
|
|
374
449
|
</div>
|
|
375
450
|
<div className="p_toolRight">
|
|
376
451
|
<ChatWidget
|
|
377
|
-
window_title={currentFlow
|
|
378
|
-
flow_id={currentFlow
|
|
379
|
-
tags={tags}
|
|
452
|
+
window_title={currentFlow?.name || title}
|
|
453
|
+
flow_id={currentFlow?.id || flowId}
|
|
454
|
+
tags={currentFlow?.keywords || tags}
|
|
380
455
|
host_url={hostUrl}
|
|
381
|
-
// height={dialogHeight + 'px'}
|
|
382
456
|
api_key={api_key}
|
|
383
457
|
session_id={this.state.sessionId}
|
|
384
458
|
userInfo={userInfo}
|
|
385
459
|
getHistoryList={this.getHistoryList}
|
|
386
460
|
setDropDownList={(list) => this.setState({ dropDownList: list })}
|
|
387
|
-
dropDownList={dropDownList}
|
|
461
|
+
dropDownList={this.state.dropDownList}
|
|
388
462
|
/>
|
|
389
463
|
</div>
|
|
390
464
|
{
|
|
391
465
|
isShowSideRight&&
|
|
392
466
|
<div className={"p_toolRightToRight"}>
|
|
393
467
|
<div className={"rightInnerContainer"}>
|
|
394
|
-
<
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
{
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
468
|
+
<div>
|
|
469
|
+
<h3 className={"rightSideTitle"}>
|
|
470
|
+
<img width={15} src={self_skills}/>
|
|
471
|
+
<span style={{ color: "#333333" }}>专项技能</span>
|
|
472
|
+
</h3>
|
|
473
|
+
<div className={"rightSkillContainer"}>
|
|
474
|
+
<div className={"rightSkillList"}>
|
|
475
|
+
{flows.slice(0,12).map((item) => (
|
|
476
|
+
<div className={"rightSkillItem"} key={item.id} onClick={()=>{
|
|
477
|
+
// 右侧点击一个技能,更新sessionId,切换当前flow信息,重新查询历史记录
|
|
478
|
+
this.setState({
|
|
479
|
+
sessionId: uuidv4(),
|
|
480
|
+
currentFlow: item,
|
|
481
|
+
dropDownList: this.getDropDownList(item.welcome_words)
|
|
482
|
+
});
|
|
483
|
+
this.getCurrentFlowHistory(item.id);
|
|
484
|
+
}}>
|
|
485
|
+
<img
|
|
486
|
+
src={item.icon}
|
|
487
|
+
alt={item.name}/>
|
|
488
|
+
<p>{item.name}</p>
|
|
489
|
+
</div>
|
|
490
|
+
))}
|
|
491
|
+
</div>
|
|
409
492
|
</div>
|
|
410
493
|
</div>
|
|
411
|
-
<
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
494
|
+
<div>
|
|
495
|
+
<h3 className={"rightKnowledgeTitle"}>
|
|
496
|
+
<img width={15} src={self_knowledge}/>
|
|
497
|
+
<span style={{ color: "#333333" }}>个人知识库</span>
|
|
498
|
+
</h3>
|
|
499
|
+
<div className={"rightKnowledgeContainer"}>
|
|
500
|
+
<img src={moreBg}/>
|
|
501
|
+
<div style={{position:'absolute', top:'40px',left:'16px'}}>
|
|
502
|
+
<div>文件总数<span style={{padding:8,fontSize:'20px',fontWeight:700}}>{currentFlow.k_count||0}</span>个</div>
|
|
503
|
+
<div style={{marginTop:10}}>文件总量<span style={{padding:8,fontSize:'20px',fontWeight:700}}>{formatFileSize(currentFlow.k_size).formattedSize}</span>{formatFileSize(currentFlow.k_size).unit}</div>
|
|
504
|
+
</div>
|
|
505
|
+
<div className={"rightMoreButton"}>
|
|
506
|
+
<div className={"rightMoreTitle"} onClick={()=>messageTip.info("敬请期待")}>训练你的专属知识库</div>
|
|
507
|
+
</div>
|
|
420
508
|
</div>
|
|
421
509
|
</div>
|
|
422
510
|
</div>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/chatWidget/index.tsx
CHANGED
|
@@ -250,6 +250,8 @@ textarea {
|
|
|
250
250
|
/* 2 */
|
|
251
251
|
padding: 0;
|
|
252
252
|
/* 3 */
|
|
253
|
+
border-top-left-radius: 50px;
|
|
254
|
+
border-bottom-left-radius: 50px;
|
|
253
255
|
}
|
|
254
256
|
|
|
255
257
|
/*
|
|
@@ -752,9 +754,11 @@ video {
|
|
|
752
754
|
align-items: center;
|
|
753
755
|
border-top-width: 1px;
|
|
754
756
|
--tw-border-opacity: 1;
|
|
755
|
-
border-color: rgb(229 231 235 / var(--tw-border-opacity));
|
|
757
|
+
// border-color: rgb(229 231 235 / var(--tw-border-opacity));
|
|
756
758
|
--tw-bg-opacity: 1;
|
|
757
|
-
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
759
|
+
// background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
760
|
+
border-top-right-radius: 50px;
|
|
761
|
+
border-bottom-right-radius: 50px;
|
|
758
762
|
}
|
|
759
763
|
|
|
760
764
|
.cl-chat-message {
|
|
@@ -2174,14 +2178,8 @@ input::-ms-input-placeholder { /* Microsoft Edge */
|
|
|
2174
2178
|
window_title={"测试"}
|
|
2175
2179
|
input_container_style={input_container_style}
|
|
2176
2180
|
tweaks={tweaks}
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
// 学涯
|
|
2180
|
-
flowId={"a8e7ebd8-9bf7-499b-9e4a-c235078a0910"}
|
|
2181
|
-
// 心理
|
|
2182
|
-
// flowId={"2d5ae455-86d8-4769-833b-7815c38ac859"}
|
|
2183
|
-
// hostUrl={"http://localhost:7860"}
|
|
2184
|
-
hostUrl={"https://ai-api.yuntu.cn"}
|
|
2181
|
+
flowId={flow_id}
|
|
2182
|
+
hostUrl={host_url}
|
|
2185
2183
|
updateLastMessage={updateLastMessage}
|
|
2186
2184
|
addMessage={addMessage}
|
|
2187
2185
|
messages={messages}
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
|
-
import r2wc from '@r2wc/react-to-web-component';
|
|
4
3
|
import LogoBtn from './YtChatView/logoBtn/index';
|
|
5
4
|
import ToolDialog from "./YtChatView/previewDialog/index";
|
|
6
5
|
import LogoSplitBtn from "./YtChatView/logoSplitBtn/index";
|
|
@@ -8,53 +7,4 @@ import LogoSplitBtn from "./YtChatView/logoSplitBtn/index";
|
|
|
8
7
|
// 手动注入 React 和 ReactDOM 到全局
|
|
9
8
|
window.React = React;
|
|
10
9
|
window.ReactDOM = ReactDOM;
|
|
11
|
-
|
|
12
|
-
customElements.define('yt-chat', r2wc(LogoBtn, {
|
|
13
|
-
shadow: "closed",
|
|
14
|
-
props: {
|
|
15
|
-
left: "number",
|
|
16
|
-
right: "number",
|
|
17
|
-
top: "number",
|
|
18
|
-
bottom: "number",
|
|
19
|
-
width: "number",
|
|
20
|
-
height: "number",
|
|
21
|
-
iconUrl: "string",
|
|
22
|
-
title: "string",
|
|
23
|
-
flowId: "string",
|
|
24
|
-
hostUrl: "string",
|
|
25
|
-
userInfo: "json",
|
|
26
|
-
tags: "json"
|
|
27
|
-
},
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
customElements.define('yt-page-chat', r2wc(ToolDialog, {
|
|
31
|
-
shadow: "closed",
|
|
32
|
-
props: {
|
|
33
|
-
title: "string",
|
|
34
|
-
flowId: "string",
|
|
35
|
-
hostUrl: "string",
|
|
36
|
-
setDialogVisible: "function",
|
|
37
|
-
userInfo: "json",
|
|
38
|
-
tags: "json",
|
|
39
|
-
boxStyle: "json"
|
|
40
|
-
},
|
|
41
|
-
}));
|
|
42
|
-
|
|
43
|
-
customElements.define('yt-split-modal-chat', r2wc(LogoSplitBtn, {
|
|
44
|
-
shadow: "closed",
|
|
45
|
-
props: {
|
|
46
|
-
left: "number",
|
|
47
|
-
right: "number",
|
|
48
|
-
top: "number",
|
|
49
|
-
bottom: "number",
|
|
50
|
-
width: "number",
|
|
51
|
-
height: "number",
|
|
52
|
-
iconUrl: "string",
|
|
53
|
-
title: "string",
|
|
54
|
-
flowId: "string",
|
|
55
|
-
hostUrl: "string",
|
|
56
|
-
userInfo: "json",
|
|
57
|
-
tags: "json",
|
|
58
|
-
sceneId: "string"
|
|
59
|
-
},
|
|
60
|
-
}));
|
|
10
|
+
export {ToolDialog, LogoSplitBtn, LogoBtn}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": {
|
|
3
|
-
"main.css": "/static/css/main.6f7c593d.css",
|
|
4
|
-
"main.js": "/static/js/main.cb252095.js",
|
|
5
|
-
"static/media/moreBg.png": "/static/media/moreBg.9fc998472925cecd89f2.png",
|
|
6
|
-
"static/media/history-list-empty.png": "/static/media/history-list-empty.1eb65b1550aef4e8c8a4.png",
|
|
7
|
-
"static/media/aiavatar.png": "/static/media/aiavatar.74bafa995cce4c01b804.png",
|
|
8
|
-
"index.html": "/index.html",
|
|
9
|
-
"main.6f7c593d.css.map": "/static/css/main.6f7c593d.css.map",
|
|
10
|
-
"main.cb252095.js.map": "/static/js/main.cb252095.js.map"
|
|
11
|
-
},
|
|
12
|
-
"entrypoints": [
|
|
13
|
-
"static/css/main.6f7c593d.css",
|
|
14
|
-
"static/js/main.cb252095.js"
|
|
15
|
-
]
|
|
16
|
-
}
|
package/build/index.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Document</title><script defer="defer" src="/static/js/main.cb252095.js"></script><link href="/static/css/main.6f7c593d.css" rel="stylesheet"></head><body style="width:100vw;height:100vh;position:relative;margin:unset"><yt-split-modal-chat right="100" bottom="100" width="50" height="50" title="菜鸟驿站" icon-url="https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/school/ccit/user/xc//image/ebfaf4da-c1d9-46fb-a0b1-f159e95cffc2_AI招生咨询小助手.png" host-url="https://ai-api.yuntu.cn" user-info='{"id": "123", "name": "John Doe", "code":"1606451129" }' flow-id="a8e7ebd8-9bf7-499b-9e4a-c235078a0910" scene-id="e6fb45ea-3415-44e1-a1c8-5e98963bf512"/></body></html>
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.previewDialog_p_closeImg__i5\+iA{cursor:pointer;width:14px}.previewDialog_p_toolDialog__3xb34{display:flex}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB{align-items:center;background:linear-gradient(180deg,#cfdafc,#f0f3ff);border-bottom-left-radius:8px;border-top-left-radius:8px;display:flex;flex-direction:column;padding:24px}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_toolLogo__-za2Z{align-items:center;display:flex;-webkit-user-select:none;user-select:none}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_toolLogo__-za2Z .previewDialog_p_logoImg__Bq08Z{width:60px}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_toolLogo__-za2Z .previewDialog_p_logoText__L3Iij{-webkit-text-fill-color:#0000;background:linear-gradient(90deg,#1551ff,#8f4bff);-webkit-background-clip:text;font-size:30px;font-weight:700;margin-left:10px;padding-top:16px}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:linear-gradient(180deg,#ffffff80,#fff0);border-image:linear-gradient(180deg,#fff,#fff0) 1 1;border-radius:10px;flex:1 1;margin-bottom:20px;margin-top:20px;position:relative;-webkit-user-select:none;user-select:none;width:100%}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R ::-webkit-scrollbar-thumb{background:#535353!important;border-radius:10px;-webkit-box-shadow:inset 0 0 5px #0003}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyTitle__vCSO9{align-items:center;display:flex;padding:16px 16px 0}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyTitle__vCSO9 .previewDialog_p_historyImg__QCbo8{width:20px}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyTitle__vCSO9 .previewDialog_p_dialogTitle__vqPzy{color:#666;font-size:16px;font-weight:700;margin-left:10px}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyListEmpty__2rf\+k{color:#999;font-size:12px;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%)}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyList__Rpgyz{margin-top:10px;overflow-y:auto;scrollbar-width:none!important}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyList__Rpgyz:hover{scrollbar-color:#ced4e3 #0000;scrollbar-width:thin!important}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyList__Rpgyz .previewDialog_p_historyItem__Kw7cV{padding:7px 16px}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyList__Rpgyz .previewDialog_p_historyItem__Kw7cV .previewDialog_p_activeHistoryName__TloOq{color:#1552ff!important}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyList__Rpgyz .previewDialog_p_historyItem__Kw7cV .previewDialog_p_historyName__U2GGT{color:#333;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolLeft__LM7jB .previewDialog_p_historyDialog__D4O6R .previewDialog_p_historyList__Rpgyz .previewDialog_p_historyItem__Kw7cV .previewDialog_p_historyName__U2GGT:hover{color:#171717}.previewDialog_p_toolDialog__3xb34 .previewDialog_p_toolRight__9aGBc{flex:1 1;width:calc(100% - 300px)}.previewDialog_p_newDialog__QFzaB{align-items:center;background:linear-gradient(244deg,#828efe,#4b4fff);border-radius:20px;cursor:pointer;display:flex;height:40px;justify-content:center;margin-top:20px;width:252px}.previewDialog_p_newDialog__QFzaB img{width:18px}.previewDialog_p_newDialog__QFzaB .previewDialog_p_newDialogText__2Ne7Z{color:#fff;margin-left:6px}.yt-chat-modal .ant-modal-content{padding:0!important}
|
|
2
|
-
/*# sourceMappingURL=main.6f7c593d.css.map*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static/css/main.6f7c593d.css","mappings":"AAAA,kCAEE,cAAe,CADf,UAEF,CAEA,mCACE,YACF,CAEA,oEAGE,kBAAmB,CAGnB,kDAA6D,CAG7D,6BAA8B,CAD9B,0BAA2B,CAP3B,YAAa,CACb,qBAAsB,CAKtB,YAGF,CAEA,qGAGE,kBAAmB,CADnB,YAAa,CADb,wBAAiB,CAAjB,gBAGF,CAEA,qIACE,UACF,CAEA,sIAOE,6BAAoC,CAFpC,iDAAuD,CACvD,4BAA6B,CAF7B,cAAe,CAHf,eAAiB,CACjB,gBAAiB,CACjB,gBAKF,CAEA,0GASE,kCAA2B,CAA3B,0BAA2B,CAF3B,kDAA6F,CAC7F,mDAAyF,CAJzF,kBAAmB,CACnB,QAAO,CAFP,kBAAmB,CADnB,eAAgB,CAQhB,iBAAkB,CATlB,wBAAiB,CAAjB,gBAAiB,CAKjB,UAKF,CAEA,oIAGE,4BAA8B,CAF9B,kBAAmB,CACnB,sCAEF,CAEA,+IAGE,kBAAmB,CADnB,YAAa,CADb,mBAGF,CAEA,kLACE,UACF,CAEA,mLAIE,UAAc,CAFd,cAAe,CADf,eAAiB,CAEjB,gBAEF,CAEA,oJAOE,UAAc,CADd,cAAe,CAHf,QAAS,CAFT,iBAAkB,CAIlB,iBAAkB,CAHlB,OAAQ,CAER,8BAIF,CAEA,8IACE,eAAgB,CAEhB,eAAgB,CAChB,8BACF,CAEA,oJAEE,6BAAoC,CADpC,8BAEF,CAEA,kLACE,gBACF,CAEA,4NACE,uBACF,CAEA,sNACE,UAAc,CAId,cAAe,CAHf,eAAgB,CAChB,sBAAuB,CACvB,kBAEF,CAEA,4NACE,aACF,CAEA,qEACE,QAAO,CACP,wBACF,CAEA,kCAQE,kBAAmB,CALnB,kDAA6D,CAE7D,kBAAmB,CACnB,cAAe,CACf,YAAa,CALb,WAAY,CAOZ,sBAAuB,CALvB,eAAgB,CAHhB,WASF,CAEA,sCACE,UACF,CAEA,wEACE,UAAW,CACX,eACF,CC9IA,kCACI,mBACJ","sources":["YtChatView/previewDialog/index.module.css","YtChatView/logoSplitBtn/index.css"],"sourcesContent":[".p_closeImg {\n width: 14px;\n cursor: pointer;\n}\n\n.p_toolDialog {\n display: flex;\n}\n\n.p_toolDialog .p_toolLeft {\n display: flex;\n flex-direction: column;\n align-items: center;\n /*width: 300px;*/\n /*height: 100%;*/\n background: linear-gradient(180deg, #CFDAFC 0%, #F0F3FF 100%);\n padding: 24px;\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n}\n\n.p_toolDialog .p_toolLeft .p_toolLogo {\n user-select: none;\n display: flex;\n align-items: center;\n}\n\n.p_toolDialog .p_toolLeft .p_toolLogo .p_logoImg {\n width: 60px;\n}\n\n.p_toolDialog .p_toolLeft .p_toolLogo .p_logoText {\n font-weight: bold;\n margin-left: 10px;\n padding-top: 16px;\n font-size: 30px;\n background: linear-gradient(to right, #1551FF, #8F4BFF);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog {\n user-select: none;\n margin-top: 20px;\n margin-bottom: 20px;\n border-radius: 10px;\n flex: 1;\n width: 100%;\n background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);\n border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1;\n backdrop-filter: blur(10px);\n position: relative;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog ::-webkit-scrollbar-thumb {\n border-radius: 10px;\n -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);\n background: #535353 !important;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle {\n padding: 16px 16px 0 16px;\n display: flex;\n align-items: center;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_historyImg {\n width: 20px;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_dialogTitle {\n font-weight: bold;\n font-size: 16px;\n margin-left: 10px;\n color: #666666;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyListEmpty {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-size: 12px;\n color: #999999;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList {\n margin-top: 10px;\n /*height: 360px;*/\n overflow-y: auto;\n scrollbar-width: none !important; /* firefox */\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList:hover {\n scrollbar-width: thin !important; /* firefox */\n scrollbar-color: #ced4e3 transparent;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem {\n padding: 7px 16px;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_activeHistoryName {\n color: #1552FF !important;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName {\n color: #333333;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName:hover {\n color: #171717;\n}\n\n.p_toolDialog .p_toolRight {\n flex: 1;\n width: calc(100% - 300px);\n}\n\n.p_newDialog {\n width: 252px;\n height: 40px;\n background: linear-gradient(244deg, #828EFE 0%, #4B4FFF 100%);\n margin-top: 20px;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p_newDialog img {\n width: 18px;\n}\n\n.p_newDialog .p_newDialogText {\n color: #fff;\n margin-left: 6px;\n}","/* Modal 样式 */\n.yt-chat-modal .ant-modal-content {\n padding: 0 !important;\n}"],"names":[],"sourceRoot":""}
|