dev/chat
Lei OT 1 year ago
parent c58ee8319e
commit 77966e159e

@ -142,7 +142,7 @@ export const sentMsgTypeMapped = {
contentToRender: (msg) => ({
...msg,
...mediaMsg.contentToRender(msg),
text: msg?.name || '',
text: (msg?.name || '') + `\n${msg?.text || ''}`,
title: msg?.name || '',
originText: msg?.name || '',
whatsapp_msg_type: 'document',
@ -363,13 +363,13 @@ export const whatsappMsgTypeMapped = {
data: (msg) => ({
id: msg.wamid,
title: msg.document?.filename || '',
text: msg.document?.caption || msg.document?.filename || '',
data: { uri: msg.document.link, extension: 'PDF', status: { click: false, download: true, loading: 0 } },
text: (msg.document?.filename || '') + `\n${msg.document?.caption || ''}`,
data: { uri: msg.document.link, status: { click: false, download: true, loading: 0 } },
originText: msg.document?.caption || msg.document?.filename || '',
}),
renderForReply: (msg) => ({
id: msg.wamid,
message: msg.document?.caption || msg.document?.filename || '',
message: msg.document?.caption || msg.document?.filename || '[文件]',
}),
},
contacts: {

@ -193,7 +193,7 @@ const Conversations = () => {
date={item.last_received_time}
unread={item.unread_msg_count}
className={
[String(item.sn) === String(currentConversation.sn) ? '__active text-primary border-y-0 border-e-0 border-s-4 border-solid border-whatsapp-bg bg-whatsapp-bg' : '',
[String(item.sn) === String(currentConversation.sn) ? '__active text-primary bg-whatsapp-bg' : '',
String(item.sn) === String(tabSelectedConversation?.sn) ? ' bg-neutral-200' : ''
].join(' ')
}

@ -1,4 +1,4 @@
import { Upload, Button, message } from 'antd';
import { Upload, Button, message, Tooltip } from 'antd';
import { FileAddOutlined } from '@ant-design/icons';
import { v4 as uuid } from 'uuid';
import { API_HOST } from '@/config';
@ -78,7 +78,9 @@ const ImageUpload = ({ disabled, invokeUploadFileMessage, invokeSendUploadMessag
}
}}
>
<Tooltip title={'图片, 视频, 语音, 附件'} placement={'bottom'}>
<Button key={'addPic'} type='text' disabled={disabled} icon={<FileAddOutlined />} size={'middle'} className='text-primary rounded-none' />
</Tooltip>
</Upload>
);
};

@ -24,11 +24,11 @@ const InputTemplate = ({ disabled = false, invokeSendMessage }) => {
const searchInputRef = useRef(null);
const { notification } = App.useApp();
const loginUser = useAuthStore((state) => state.loginUser);
loginUser.username = loginUser.accountList[0].OPI_NameEN.split(' ')?.[0] || loginUser.username;
loginUser.usernameEN = loginUser.accountList[0].OPI_NameEN.split(' ')?.[0] || loginUser.username;
const currentConversation = useConversationStore((state) => state.currentConversation);
const templates = useConversationStore((state) => state.templates);
// : customer, agent
const valueMapped = { ...cloneDeep(currentConversation), ...objectMapper(loginUser, { username: [{ key: 'agent_name' }, { key: 'your_name' }] }) };
const valueMapped = { ...cloneDeep(currentConversation), ...objectMapper(loginUser, { usernameEN: [{ key: 'agent_name' }, { key: 'your_name' }] }) };
useEffect(() => {
setDataSource(templates);
return () => {};

@ -249,7 +249,7 @@ const InputComposer = () => {
onPaste={handlePaste}
ref={textInputRef}
size='large' maxLength={2000} showCount={textabled}
placeholder={gt24h ? 'This session has expired. Please send a template message to activate the session' : 'Enter 发送, Shift+Enter 换行'}
placeholder={gt24h ? 'This session has expired. Please send a template message to activate the session' : 'Enter 发送, Shift+Enter 换行\n支持复制粘贴 [截图/文件] 以备发送'}
rows={2}
disabled={!textabled}
value={textContent}

@ -43,7 +43,7 @@ const MessagesList = ({ messages, handlePreview, reference, longListLoading, get
return prev;
}, []);
return (
<span className={`text-base leading-5 emoji-text ${extraClass}`}>
<span className={`text-base leading-5 emoji-text whitespace-pre-wrap ${extraClass}`}>
{(objArr || []).map((part, index) => {
if (part.type === 'link') {
return (

Loading…
Cancel
Save