yt-chat-components 0.2.0 → 0.4.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/.idea/sonarlint/issuestore/index.pb +0 -2
- package/build/static/js/bundle.min.js +1 -1
- package/package.json +7 -6
- package/public/index.html +13 -13
- package/src/YtChatView/chatWidget/chatWindow/index.tsx +5 -4
- package/src/YtChatView/chatWidget/index.tsx +2 -2
- package/src/YtChatView/previewDialog/index.jsx +10 -6
- package/src/chatWidget/chatWindow/index.tsx +2 -2
- package/src/chatWidget/index.tsx +2 -8
- package/.idea/sonarlint/issuestore/6/c/6c024c1d0ad64656b9d4b0695ec3c49c0454addf +0 -0
- package/yt-chat-components-0.1.0.tgz +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yt-chat-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "build/static/js/bundle.min.js",
|
|
5
5
|
"module": "build/static/js/bundle.min.js",
|
|
6
6
|
"types": "build/static/js/index.d.ts",
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"antd": "5.24.2",
|
|
13
12
|
"@ant-design/icons": "5.0.0",
|
|
14
|
-
"lodash": "^4.17.21",
|
|
15
13
|
"@testing-library/jest-dom": "^5.16.5",
|
|
16
14
|
"@testing-library/react": "^13.4.0",
|
|
17
15
|
"@testing-library/user-event": "^13.5.0",
|
|
@@ -19,10 +17,12 @@
|
|
|
19
17
|
"@types/node": "^16.18.37",
|
|
20
18
|
"@types/react": "^18.2.14",
|
|
21
19
|
"@types/react-dom": "^18.2.6",
|
|
20
|
+
"antd": "5.24.2",
|
|
22
21
|
"axios": "^1.4.0",
|
|
22
|
+
"lodash": "^4.17.21",
|
|
23
23
|
"lucide-react": "^0.256.0",
|
|
24
|
-
"react": "^18.
|
|
25
|
-
"react-dom": "^18.
|
|
24
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
25
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
26
26
|
"react-markdown": "^8.0.7",
|
|
27
27
|
"react-scripts": "5.0.1",
|
|
28
28
|
"react-shadow": "^20.3.0",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"typescript": "^4.9.5",
|
|
32
32
|
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
33
33
|
"uuid": "^10.0.0",
|
|
34
|
-
"web-vitals": "^2.1.4"
|
|
34
|
+
"web-vitals": "^2.1.4",
|
|
35
|
+
"yt-chat-components": "^0.2.0"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
38
|
"start": "react-scripts start",
|
package/public/index.html
CHANGED
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
<!-- />-->
|
|
20
20
|
<!-- </body>-->
|
|
21
21
|
|
|
22
|
-
<body style="width: 100vw; height: 100vh; margin:0 "
|
|
23
|
-
<yt-page-chat
|
|
24
|
-
title="菜鸟驿站"
|
|
25
|
-
host-url="https://ai-api.yuntu.cn"
|
|
26
|
-
flow-id="a8e7ebd8-9bf7-499b-9e4a-c235078a0910"
|
|
27
|
-
user-info='{"id": "123", "name": "John Doe", "code":"1606451129" }'
|
|
28
|
-
tags='["tag1", "tag2", "tag3"]'
|
|
29
|
-
box-style='{"height":"100%"}'
|
|
30
|
-
scene-id="e6fb45ea-3415-44e1-a1c8-5e98963bf512"
|
|
31
|
-
is-show-side-right=true
|
|
32
|
-
|
|
33
|
-
</body
|
|
22
|
+
<!-- <body style="width: 100vw; height: 100vh; margin:0 ">-->
|
|
23
|
+
<!-- <yt-page-chat-->
|
|
24
|
+
<!-- title="菜鸟驿站"-->
|
|
25
|
+
<!-- host-url="https://ai-api.yuntu.cn"-->
|
|
26
|
+
<!-- flow-id="a8e7ebd8-9bf7-499b-9e4a-c235078a0910"-->
|
|
27
|
+
<!-- user-info='{"id": "123", "name": "John Doe", "code":"1606451129" }'-->
|
|
28
|
+
<!-- tags='["tag1", "tag2", "tag3"]'-->
|
|
29
|
+
<!-- box-style='{"height":"100%"}'-->
|
|
30
|
+
<!-- scene-id="e6fb45ea-3415-44e1-a1c8-5e98963bf512"-->
|
|
31
|
+
<!-- is-show-side-right=true-->
|
|
32
|
+
<!-- />-->
|
|
33
|
+
<!-- </body>-->
|
|
34
34
|
|
|
35
35
|
<body style="width: 100vw; height: 100vh; position: relative; margin: unset ">
|
|
36
36
|
<yt-split-modal-chat
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
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"
|
|
43
43
|
host-url="https://ai-api.yuntu.cn"
|
|
44
44
|
user-info='{"id": "123", "name": "John Doe", "code":"1606451129" }'
|
|
45
|
-
flow-id="
|
|
45
|
+
flow-id="3fa4348a-ba83-4054-80d7-594f5cf2f5b5"
|
|
46
46
|
scene-id="e6fb45ea-3415-44e1-a1c8-5e98963bf512"
|
|
47
47
|
/>
|
|
48
48
|
</body>
|
|
@@ -120,7 +120,7 @@ export default function ChatWindow({
|
|
|
120
120
|
const scrollContainerRef = useRef(null);
|
|
121
121
|
const [showLeftArrow, setShowLeftArrow] = useState(false); // 控制左侧箭头显示
|
|
122
122
|
const [showRightArrow, setShowRightArrow] = useState(false); // 控制右侧箭头显示
|
|
123
|
-
const
|
|
123
|
+
const isStream = true;//是否流式输出(手动开关)
|
|
124
124
|
const [recordState, setRecordState] = useState(false); // 录音状态。true为正在录音,false为停止录音
|
|
125
125
|
const [tagList, setTagList] = useState([]); // 问题标签列表
|
|
126
126
|
|
|
@@ -307,7 +307,7 @@ export default function ChatWindow({
|
|
|
307
307
|
handleScroll();
|
|
308
308
|
sendMessage(
|
|
309
309
|
embedAppExtend,
|
|
310
|
-
|
|
310
|
+
isStream,
|
|
311
311
|
handleMessageContent,
|
|
312
312
|
abortControllerRef.current.signal,
|
|
313
313
|
hostUrl,
|
|
@@ -323,7 +323,7 @@ export default function ChatWindow({
|
|
|
323
323
|
)
|
|
324
324
|
.then((res) => {
|
|
325
325
|
// 非流式输出
|
|
326
|
-
if(!
|
|
326
|
+
if(!isStream){
|
|
327
327
|
sendMessageNoStream(res);
|
|
328
328
|
}
|
|
329
329
|
getHistoryList();
|
|
@@ -664,7 +664,7 @@ export default function ChatWindow({
|
|
|
664
664
|
<div
|
|
665
665
|
className="w_tagListClass"
|
|
666
666
|
style={{
|
|
667
|
-
bottom: fileList.length > 0 ? '130px' : '80px',
|
|
667
|
+
// bottom: fileList.length > 0 ? '130px' : '80px',
|
|
668
668
|
display: tagList.length > 0 ? '' : 'none',
|
|
669
669
|
}}
|
|
670
670
|
>
|
|
@@ -674,6 +674,7 @@ export default function ChatWindow({
|
|
|
674
674
|
className="w_tagItemBox"
|
|
675
675
|
onClick={() => {
|
|
676
676
|
handleClick(item?.name);
|
|
677
|
+
setFileList([]);
|
|
677
678
|
}}
|
|
678
679
|
>
|
|
679
680
|
<div>
|
|
@@ -2232,7 +2232,7 @@ input::-ms-input-placeholder { /* Microsoft Edge */
|
|
|
2232
2232
|
}
|
|
2233
2233
|
|
|
2234
2234
|
.w_tagListClass {
|
|
2235
|
-
position: absolute;
|
|
2235
|
+
// position: absolute;
|
|
2236
2236
|
width: 100%;
|
|
2237
2237
|
height: fit-content;
|
|
2238
2238
|
// background: #F9FAFB;
|
|
@@ -2301,7 +2301,7 @@ input::-ms-input-placeholder { /* Microsoft Edge */
|
|
|
2301
2301
|
box-shadow: none !important;
|
|
2302
2302
|
color: #333;
|
|
2303
2303
|
outline: 0;
|
|
2304
|
-
padding: 5px 10px 0 10px;
|
|
2304
|
+
// padding: 5px 10px 0 10px;
|
|
2305
2305
|
width: 100%;
|
|
2306
2306
|
|
|
2307
2307
|
box-sizing: border-box;
|
|
@@ -347,10 +347,14 @@ export class ToolDialog extends React.Component {
|
|
|
347
347
|
// 获取历史对话列表
|
|
348
348
|
getHistoryList = (sceneData) => {
|
|
349
349
|
const realFlowId = sceneData?.flows[0].id || this.props.flowId;
|
|
350
|
-
if(sceneData){
|
|
350
|
+
if(!isEmpty(sceneData)){
|
|
351
351
|
const currentFlow = sceneData.flows[0];
|
|
352
|
+
console.log("111111111",sceneData)
|
|
352
353
|
const dropDownList = this.getDropDownList(currentFlow.welcome_words);
|
|
353
354
|
this.setState({ currentFlow, dropDownList })
|
|
355
|
+
}else{
|
|
356
|
+
this.setState({ dropDownList:defaultList })
|
|
357
|
+
|
|
354
358
|
}
|
|
355
359
|
this.getCurrentFlowHistory(realFlowId)
|
|
356
360
|
};
|
|
@@ -391,8 +395,8 @@ export class ToolDialog extends React.Component {
|
|
|
391
395
|
|
|
392
396
|
render() {
|
|
393
397
|
const dialogHeight = 650;
|
|
394
|
-
const { title, flowId, hostUrl, setDialogVisible, userInfo, boxStyle, isShowSideRight } = this.props;
|
|
395
|
-
const { sceneInfo, currentFlow } = this.state;
|
|
398
|
+
const { title, flowId, hostUrl, setDialogVisible, userInfo, boxStyle, isShowSideRight, tags = [] } = this.props;
|
|
399
|
+
const { sceneInfo, currentFlow = {} } = this.state;
|
|
396
400
|
const { flows=[], name: sceneName } = sceneInfo;
|
|
397
401
|
return (
|
|
398
402
|
<div style={boxStyle}>
|
|
@@ -449,9 +453,9 @@ export class ToolDialog extends React.Component {
|
|
|
449
453
|
</div>
|
|
450
454
|
<div className="p_toolRight">
|
|
451
455
|
<ChatWidget
|
|
452
|
-
window_title={currentFlow
|
|
453
|
-
flow_id={currentFlow
|
|
454
|
-
tags={currentFlow?.keywords||
|
|
456
|
+
window_title={currentFlow?.name || title}
|
|
457
|
+
flow_id={currentFlow?.id || flowId}
|
|
458
|
+
tags={currentFlow?.keywords || tags}
|
|
455
459
|
host_url={hostUrl}
|
|
456
460
|
api_key={api_key}
|
|
457
461
|
session_id={this.state.sessionId}
|
|
@@ -91,7 +91,7 @@ export default function ChatWindow({
|
|
|
91
91
|
);
|
|
92
92
|
}, [triggerRef, width, height, position]);
|
|
93
93
|
|
|
94
|
-
const
|
|
94
|
+
const isStream = true;
|
|
95
95
|
|
|
96
96
|
/* Initial listener for loss of focus that refocuses User input after a small delay */
|
|
97
97
|
|
|
@@ -291,7 +291,7 @@ export default function ChatWindow({
|
|
|
291
291
|
addMessage({ message: value, isSend: true });
|
|
292
292
|
setSendingMessage(true);
|
|
293
293
|
setValue("");
|
|
294
|
-
|
|
294
|
+
isStream ? sendMessageStreamWrapper() : sendMessageWrapper();
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
|
package/src/chatWidget/index.tsx
CHANGED
|
@@ -2178,14 +2178,8 @@ input::-ms-input-placeholder { /* Microsoft Edge */
|
|
|
2178
2178
|
window_title={"测试"}
|
|
2179
2179
|
input_container_style={input_container_style}
|
|
2180
2180
|
tweaks={tweaks}
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
// 学涯
|
|
2184
|
-
flowId={"a8e7ebd8-9bf7-499b-9e4a-c235078a0910"}
|
|
2185
|
-
// 心理
|
|
2186
|
-
// flowId={"2d5ae455-86d8-4769-833b-7815c38ac859"}
|
|
2187
|
-
// hostUrl={"http://localhost:7860"}
|
|
2188
|
-
hostUrl={"https://ai-api.yuntu.cn"}
|
|
2181
|
+
flowId={flow_id}
|
|
2182
|
+
hostUrl={host_url}
|
|
2189
2183
|
updateLastMessage={updateLastMessage}
|
|
2190
2184
|
addMessage={addMessage}
|
|
2191
2185
|
messages={messages}
|
|
File without changes
|
|
Binary file
|