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

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

@ -193,7 +193,7 @@ const Conversations = () => {
date={item.last_received_time} date={item.last_received_time}
unread={item.unread_msg_count} unread={item.unread_msg_count}
className={ 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' : '' String(item.sn) === String(tabSelectedConversation?.sn) ? ' bg-neutral-200' : ''
].join(' ') ].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 { FileAddOutlined } from '@ant-design/icons';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { API_HOST } from '@/config'; 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' /> <Button key={'addPic'} type='text' disabled={disabled} icon={<FileAddOutlined />} size={'middle'} className='text-primary rounded-none' />
</Tooltip>
</Upload> </Upload>
); );
}; };

@ -24,11 +24,11 @@ const InputTemplate = ({ disabled = false, invokeSendMessage }) => {
const searchInputRef = useRef(null); const searchInputRef = useRef(null);
const { notification } = App.useApp(); const { notification } = App.useApp();
const loginUser = useAuthStore((state) => state.loginUser); 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 currentConversation = useConversationStore((state) => state.currentConversation);
const templates = useConversationStore((state) => state.templates); const templates = useConversationStore((state) => state.templates);
// : customer, agent // : 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(() => { useEffect(() => {
setDataSource(templates); setDataSource(templates);
return () => {}; return () => {};

@ -249,7 +249,7 @@ const InputComposer = () => {
onPaste={handlePaste} onPaste={handlePaste}
ref={textInputRef} ref={textInputRef}
size='large' maxLength={2000} showCount={textabled} 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} rows={2}
disabled={!textabled} disabled={!textabled}
value={textContent} value={textContent}

@ -43,7 +43,7 @@ const MessagesList = ({ messages, handlePreview, reference, longListLoading, get
return prev; return prev;
}, []); }, []);
return ( 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) => { {(objArr || []).map((part, index) => {
if (part.type === 'link') { if (part.type === 'link') {
return ( return (

Loading…
Cancel
Save