yt-chat-components 1.7.4 → 1.7.6
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/src/YtChatView/chatWidget/chatWindow/audioPlayer/AudioPlayer.tsx +0 -1
- package/src/YtChatView/chatWidget/chatWindow/callInterface/index.tsx +1 -1
- package/src/YtChatView/chatWidget/chatWindow/chatMessage/index.tsx +7 -1
- package/src/YtChatView/chatWidget/chatWindow/index.tsx +16 -5
- package/src/YtChatView/chatWidget/chatWindow/inputMobile/inputMobile.jsx +17 -3
- package/src/YtChatView/chatWidget/chatWindow/utils.ts +127 -75
- package/src/YtChatView/chatWidget/index.tsx +3 -0
- package/src/YtChatView/components/TabSelector/index.jsx +0 -1
- package/src/YtChatView/mobileChat/index.jsx +0 -3
- package/src/YtChatView/mobileChatV2/index.jsx +3 -5
package/package.json
CHANGED
|
@@ -52,7 +52,6 @@ export class AudioPlayer {
|
|
|
52
52
|
|
|
53
53
|
connect(token : string) {
|
|
54
54
|
// cosyvoice 流式语言合成 2元、万字
|
|
55
|
-
console.log('token = ', token)
|
|
56
55
|
const socketUrl = `wss://nls-gateway-cn-beijing.aliyuncs.com/ws/v1?token=${token}`;
|
|
57
56
|
// 普通语言合成 1元、万字
|
|
58
57
|
// const socketUrl = `wss://nls-gateway.cn-shanghai.aliyuncs.com/ws/v1?token=${this.token}`;
|
|
@@ -377,7 +377,7 @@ const CallInterface: React.FC<CallInterfaceProps> = ({
|
|
|
377
377
|
} else if (message.type === 'connected') {
|
|
378
378
|
setCallStatus('connected');
|
|
379
379
|
if (message.audioData) {
|
|
380
|
-
|
|
380
|
+
handleAudioChunkData(message.audioData)
|
|
381
381
|
}
|
|
382
382
|
} else if (message.type === 'complete-audio') {
|
|
383
383
|
// 处理从后端返回的完整音频响应
|
|
@@ -396,7 +396,13 @@ export default function ChatMessage({
|
|
|
396
396
|
alt={''}
|
|
397
397
|
fallback="data:image/png;base64,iVBORw0KG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QG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="
|
|
398
398
|
/>
|
|
399
|
-
}
|
|
399
|
+
},
|
|
400
|
+
a: ({node, ...props}) => {
|
|
401
|
+
if (props.href?.startsWith('http')) {
|
|
402
|
+
return <a {...props} target="_blank" rel="noopener noreferrer"/>;
|
|
403
|
+
}
|
|
404
|
+
return <a {...props} />;
|
|
405
|
+
},
|
|
400
406
|
}), [isSubmittingForm]); // 依赖 isSubmittingForm 刷新ui
|
|
401
407
|
|
|
402
408
|
const getStatusIcon = (status: CustomThoughtChainItem['status'], icon?: React.ReactNode) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import {extractMessageFromOutput} from './utils';
|
|
2
|
+
import {checkAndRequestMicrophonePermission, extractMessageFromOutput} from './utils';
|
|
3
3
|
import React, {Context, forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react';
|
|
4
4
|
import {ChatMessageType, embedAppExtend, InputValueType, MessageItem, MessageType} from './types/chatWidget';
|
|
5
5
|
import ChatMessage from './chatMessage';
|
|
@@ -160,7 +160,8 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
|
|
|
160
160
|
voice,
|
|
161
161
|
onSmartRobotClick,
|
|
162
162
|
isShowMobileInputArea,
|
|
163
|
-
isInH5Page
|
|
163
|
+
isInH5Page,
|
|
164
|
+
welcomeWords
|
|
164
165
|
}, ref) => {
|
|
165
166
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
166
167
|
const lastMessage = useRef<HTMLDivElement>(null);
|
|
@@ -660,7 +661,11 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
|
|
|
660
661
|
|
|
661
662
|
// 处理打电话按钮点击
|
|
662
663
|
const handleCallButtonClick = () => {
|
|
663
|
-
|
|
664
|
+
checkAndRequestMicrophonePermission().then((isGranted) => {
|
|
665
|
+
if (isGranted) {
|
|
666
|
+
setShowCallInterface(true);
|
|
667
|
+
}
|
|
668
|
+
});
|
|
664
669
|
};
|
|
665
670
|
|
|
666
671
|
// 处理挂断电话
|
|
@@ -1038,7 +1043,7 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
|
|
|
1038
1043
|
keyShowSize={4}
|
|
1039
1044
|
agentName={window_title}
|
|
1040
1045
|
agentUrl={agentUrl}
|
|
1041
|
-
welcomeWords={
|
|
1046
|
+
welcomeWords={welcomeWords || '很高兴认识您,您有什么问题尽可咨询我!'}
|
|
1042
1047
|
handleRowClick={(word) => {
|
|
1043
1048
|
if(!receivingMessageRef.current){
|
|
1044
1049
|
handleSendMessage(word)
|
|
@@ -1373,7 +1378,13 @@ const ChatWindow = forwardRef<ChatWindowRef, ChatWindowProps>(({
|
|
|
1373
1378
|
<div
|
|
1374
1379
|
className="w_send_voice_box"
|
|
1375
1380
|
style={receivingMessage ? {cursor: 'not-allowed'} : {}}
|
|
1376
|
-
onClick={
|
|
1381
|
+
onClick={() => {
|
|
1382
|
+
checkAndRequestMicrophonePermission().then(isGranted => {
|
|
1383
|
+
if (isGranted){
|
|
1384
|
+
startConnectAndRecord();
|
|
1385
|
+
}
|
|
1386
|
+
})
|
|
1387
|
+
}}
|
|
1377
1388
|
>
|
|
1378
1389
|
<img src={recordState ? soundWavePng : (speakUrl || luyinPng)} style={{width: 35}}
|
|
1379
1390
|
className={recordState ? "w_recordIng" : ''}></img>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";// 音波动画组件
|
|
2
2
|
import styles from "./index.module.css";
|
|
3
3
|
import {Input, message} from "antd";
|
|
4
|
+
import {checkAndRequestMicrophonePermission} from "../utils";
|
|
4
5
|
|
|
5
6
|
class InputMobile extends React.Component {
|
|
6
7
|
constructor(props) {
|
|
@@ -54,13 +55,26 @@ class InputMobile extends React.Component {
|
|
|
54
55
|
handleRecordClick = () => {
|
|
55
56
|
const {onStartRecordClick} = this.props;
|
|
56
57
|
if (this.state.isVoice && !this.state.isRecording) {
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
checkAndRequestMicrophonePermission().then(isGranted => {
|
|
59
|
+
if (isGranted) {
|
|
60
|
+
this.startRecording();
|
|
61
|
+
onStartRecordClick();
|
|
62
|
+
}
|
|
63
|
+
})
|
|
59
64
|
} else {
|
|
60
65
|
this.stopRecording();
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
|
|
69
|
+
handleSwitchVoice = () => {
|
|
70
|
+
// 如果正在录音,则停止录音
|
|
71
|
+
if (this.state.isRecording) {
|
|
72
|
+
this.stopRecording();
|
|
73
|
+
}else {
|
|
74
|
+
this.setState({isVoice: !this.state.isVoice})
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
64
78
|
render() {
|
|
65
79
|
const {isShowVoiceButton, disabled, placeholder, onSendClick, inputRef, onSmartRobotClick = () => {}, isInH5Page } = this.props;
|
|
66
80
|
return (
|
|
@@ -75,7 +89,7 @@ class InputMobile extends React.Component {
|
|
|
75
89
|
{
|
|
76
90
|
isShowVoiceButton &&
|
|
77
91
|
<div
|
|
78
|
-
onClick={
|
|
92
|
+
onClick={this.handleSwitchVoice}
|
|
79
93
|
className={styles.m_voiceToggle}
|
|
80
94
|
>
|
|
81
95
|
<img
|
|
@@ -1,75 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
import {message} from "antd";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export function getChatPosition(
|
|
5
|
+
triggerPosition: DOMRect,
|
|
6
|
+
Cwidth:number,
|
|
7
|
+
Cheight:number,
|
|
8
|
+
position?: string,
|
|
9
|
+
): { top: string; left: string;
|
|
10
|
+
position?: string, } {
|
|
11
|
+
if (!triggerPosition) {
|
|
12
|
+
return { top: "0px", left: "0px" }; // Return empty string if trigger position is not available
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { top, left, width, height } = triggerPosition;
|
|
16
|
+
|
|
17
|
+
const distance = 5; // Adjust this value to set the desired distance from the trigger
|
|
18
|
+
if(!position) return { top: distance + height+ "px", left: width + "px" };
|
|
19
|
+
|
|
20
|
+
switch (position) {
|
|
21
|
+
case "top-left":
|
|
22
|
+
return { top: - distance - Cheight + "px", left: -Cwidth + "px" };
|
|
23
|
+
case "top-center":
|
|
24
|
+
return { top: - distance - Cheight + "px", left: width/2-Cwidth / 2 + "px" };
|
|
25
|
+
case "top-right":
|
|
26
|
+
return { top: - distance - Cheight + "px", left: width+ "px" };
|
|
27
|
+
case "center-left":
|
|
28
|
+
return { top: width/2-Cheight/2 + "px", left: -Cwidth - distance + "px" };
|
|
29
|
+
case "center-right":
|
|
30
|
+
return {
|
|
31
|
+
top: width/2-Cheight/2 + "px",
|
|
32
|
+
left: width + distance + "px",
|
|
33
|
+
};
|
|
34
|
+
case "bottom-right":
|
|
35
|
+
return { top: distance + height+ "px", left: width + "px" };
|
|
36
|
+
case "bottom-center":
|
|
37
|
+
return {
|
|
38
|
+
top: distance + height+ "px",
|
|
39
|
+
left: width/2-Cwidth / 2 + "px",
|
|
40
|
+
};
|
|
41
|
+
case "bottom-left":
|
|
42
|
+
return { top: distance + height+ "px", left: -Cwidth + "px"};
|
|
43
|
+
default:
|
|
44
|
+
return { top: distance + height+ "px", left: width + "px" };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function getAnimationOrigin(position?:string) {
|
|
49
|
+
if(!position) return "origin-top-left";
|
|
50
|
+
switch (position) {
|
|
51
|
+
case "top-left":
|
|
52
|
+
return 'origin-bottom-right'
|
|
53
|
+
case "top-center":
|
|
54
|
+
return "origin-bottom";
|
|
55
|
+
case "top-right":
|
|
56
|
+
return "origin-bottom-left";
|
|
57
|
+
case "center-left":
|
|
58
|
+
return "origin-center";
|
|
59
|
+
case "center-right":
|
|
60
|
+
return "origin-center";
|
|
61
|
+
case "bottom-right":
|
|
62
|
+
return "origin-top-left";
|
|
63
|
+
case "bottom-center":
|
|
64
|
+
return "origin-top";
|
|
65
|
+
case "bottom-left":
|
|
66
|
+
return "origin-top-right"
|
|
67
|
+
default:
|
|
68
|
+
return "origin-top-left"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function extractMessageFromOutput(output:{type:string, message:any}){
|
|
73
|
+
const {type, message} = output;
|
|
74
|
+
if(type === "text") return message;
|
|
75
|
+
if (type ==="message") return message.text;
|
|
76
|
+
if(type==="object") return message.text;
|
|
77
|
+
return "Unknown message structure"
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 麦克风权限检查及请求
|
|
82
|
+
*/
|
|
83
|
+
export async function checkAndRequestMicrophonePermission() {
|
|
84
|
+
// 检查是否支持 navigator.mediaDevices 和 getUserMedia
|
|
85
|
+
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
|
86
|
+
console.error('您的浏览器不支持麦克风访问');
|
|
87
|
+
alert('您的浏览器不支持麦克风访问,请使用最新版本的浏览器尝试。');
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
// 尝试获取麦克风权限
|
|
93
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
94
|
+
console.log('麦克风权限已授予');
|
|
95
|
+
|
|
96
|
+
// 如果成功获取权限,关闭音频流以释放麦克风资源
|
|
97
|
+
stream.getTracks().forEach(track => track.stop());
|
|
98
|
+
return true;
|
|
99
|
+
} catch (err) {
|
|
100
|
+
let alertMessage = '获取麦克风失败:';
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
switch(err.name) {
|
|
103
|
+
case 'NotAllowedError':
|
|
104
|
+
case 'PermissionDeniedError': // 部分浏览器可能使用 PermissionDeniedError
|
|
105
|
+
alertMessage += '您已拒绝麦克风访问权限。请在浏览器设置中允许此网站访问麦克风。';
|
|
106
|
+
break;
|
|
107
|
+
case 'NotFoundError':
|
|
108
|
+
alertMessage += '未找到可用的麦克风设备。';
|
|
109
|
+
break;
|
|
110
|
+
case 'NotReadableError':
|
|
111
|
+
alertMessage += '麦克风设备正在被占用或无法访问。';
|
|
112
|
+
break;
|
|
113
|
+
case 'SecurityError':
|
|
114
|
+
alertMessage += '安全错误,可能是由于页面不是通过HTTPS提供服务。';
|
|
115
|
+
break;
|
|
116
|
+
default:
|
|
117
|
+
alertMessage += err;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
console.error(alertMessage);
|
|
121
|
+
|
|
122
|
+
// 提供用户友好的提示信息
|
|
123
|
+
message.warning (alertMessage + '\n如果您希望使用录音功能,请按照提示调整设置。');
|
|
124
|
+
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -59,6 +59,7 @@ export default function ChatWidget({
|
|
|
59
59
|
isShowMobileInputArea,
|
|
60
60
|
isInH5Page,
|
|
61
61
|
chatWindowRef,
|
|
62
|
+
welcomeWords,
|
|
62
63
|
}: {
|
|
63
64
|
is_enable_call:boolean,
|
|
64
65
|
tags: [];
|
|
@@ -111,6 +112,7 @@ export default function ChatWidget({
|
|
|
111
112
|
isShowMobileInputArea?: boolean;
|
|
112
113
|
isInH5Page: boolean;
|
|
113
114
|
chatWindowRef?: object;
|
|
115
|
+
welcomeWords?: string;
|
|
114
116
|
}) {
|
|
115
117
|
const [open, setOpen] = useState(start_open);
|
|
116
118
|
const [messages, setMessages] = useState<ChatMessageType[]>([]);
|
|
@@ -193,6 +195,7 @@ export default function ChatWidget({
|
|
|
193
195
|
onSmartRobotClick={onSmartRobotClick}
|
|
194
196
|
isShowMobileInputArea={isShowMobileInputArea}
|
|
195
197
|
isInH5Page={isInH5Page}
|
|
198
|
+
welcomeWords={welcomeWords}
|
|
196
199
|
/>
|
|
197
200
|
</div>
|
|
198
201
|
);
|
|
@@ -114,7 +114,6 @@ const TabSelector = ({
|
|
|
114
114
|
borderBottom: 'transparent !important',
|
|
115
115
|
}}
|
|
116
116
|
renderTabBar={(props, DefaultTabBar) => {
|
|
117
|
-
console.log(" " , activeKey , props.activeKey)
|
|
118
117
|
return (
|
|
119
118
|
<div className={props.activeKey === activeKey ? styles.tabBarActive : styles.tabBar}>
|
|
120
119
|
<DefaultTabBar {...props} style={{ marginBottom: '0px' }}/>
|
|
@@ -403,10 +403,8 @@ export class MobileChatPage extends React.Component {
|
|
|
403
403
|
userInfo.code = sessionId;
|
|
404
404
|
}
|
|
405
405
|
const operationId = userInfo['code'] || '';
|
|
406
|
-
console.log('getCurrentFlowHistory', flowId, operationId)
|
|
407
406
|
getHistoryList(this.props.hostUrl, flowId, operationId).then((res) => {
|
|
408
407
|
if(res.status === 200){
|
|
409
|
-
console.log('getCurrentFlowHistory', res.data)
|
|
410
408
|
this.setState({ historyList: res.data });
|
|
411
409
|
}
|
|
412
410
|
});
|
|
@@ -429,7 +427,6 @@ export class MobileChatPage extends React.Component {
|
|
|
429
427
|
}else{
|
|
430
428
|
const currentScene = sceneData||this.state.sceneInfo;
|
|
431
429
|
const currentFlow = currentScene.flows[0];
|
|
432
|
-
console.log('getHistoryList', sceneData, currentFlow)
|
|
433
430
|
const dropDownList = this.getDropDownList(currentFlow.welcome_words);
|
|
434
431
|
if(!isEmpty(sceneData)){
|
|
435
432
|
this.setState({ currentFlow, dropDownList })
|
|
@@ -543,8 +543,8 @@ export class MobileChatPageV2 extends React.Component {
|
|
|
543
543
|
<div className="drawer-history-header" style={{marginTop:0, padding: '54px 14px 14px 14px', background: 'linear-gradient( 71deg, #E1E9FF 0%, #FFFFFF 100%)', position: "relative"}}>
|
|
544
544
|
<img src={icon_history_headerbg} style={{position: 'absolute', right: 0, bottom: 0, width: '40%', zIndex:0}}/>
|
|
545
545
|
<div className="drawer-history-header-title" style={{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
|
|
546
|
-
<img style={{width:
|
|
547
|
-
<span style={{fontSize:
|
|
546
|
+
<img style={{width: 45}} src={agentUrl}/>
|
|
547
|
+
<span style={{fontSize: 19, marginLeft: 10}}>{agentName}</span>
|
|
548
548
|
</div>
|
|
549
549
|
</div>
|
|
550
550
|
<div
|
|
@@ -575,7 +575,7 @@ export class MobileChatPageV2 extends React.Component {
|
|
|
575
575
|
justifyContent: 'center',
|
|
576
576
|
cursor: 'pointer',
|
|
577
577
|
padding: '30px 14px 15px 14px',
|
|
578
|
-
borderBottom: this.state.currentTabKey === item.id ? '2px solid #2850FF' : '2px solid #fff'
|
|
578
|
+
// borderBottom: this.state.currentTabKey === item.id ? '2px solid #2850FF' : '2px solid #fff'
|
|
579
579
|
}}
|
|
580
580
|
onClick={() => this.setState({currentTabKey: item.id})}
|
|
581
581
|
>
|
|
@@ -674,8 +674,6 @@ export class MobileChatPageV2 extends React.Component {
|
|
|
674
674
|
<img src={"https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/kai_yuan/common/call.png"}
|
|
675
675
|
alt="call"
|
|
676
676
|
onClick={() => {
|
|
677
|
-
console.log(this.chatWindowRef);
|
|
678
|
-
|
|
679
677
|
this.chatWindowRef.current.handleCallButtonClick()
|
|
680
678
|
}}
|
|
681
679
|
/>
|