Skip to content

Commit

Permalink
chore: types import error
Browse files Browse the repository at this point in the history
  • Loading branch information
YyumeiZhang committed Jul 22, 2024
1 parent bd283ad commit 6fc3c5f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/semi-ui/chat/chatBox/chatBoxContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Message, Metadata } from '../interface';
import MarkdownRender from '../../markdownRender';
import { cssClasses, strings } from '@douyinfe/semi-foundation/chat/constants';
import { MDXProps } from 'mdx/types';
import { FileAttachment, ImageAttachment } from '..//attachment';
import { FileAttachment, ImageAttachment } from '../attachment';
import Code from './code';

const { PREFIX_CHAT_BOX } = cssClasses;
Expand All @@ -28,7 +28,7 @@ const ChatBoxContent = (props: ChatBoxContentProps) => {
'SemiFile': FileAttachment,
'img': ImageAttachment,
...customMarkDownComponents
}), [customMarkDownComponents])
}), [customMarkDownComponents]);

const wrapCls = useMemo(() => {
const isUser = role === ROLE.USER;
Expand All @@ -48,18 +48,18 @@ const ChatBoxContent = (props: ChatBoxContentProps) => {
</span>;
} else {
let realContent = '';
if (typeof content === 'string') {
if (typeof content === 'string') {
realContent = content;
} else if (Array.isArray(content)){
} else if (Array.isArray(content)) {
realContent = content.map((item)=> {
if (item.type === 'text') {
return item.text;
} else if (item.type === 'image_url') {
return `![image](${item.image_url.url})`;
} else if (item.type === 'file_url') {
const {name, size, url, type} = item.file_url;
const { name, size, url, type } = item.file_url;
const realType = name.split('.').pop() ?? type?.split('/').pop();
return `<SemiFile url={'${url}'} name={'${name}'} size={'${size}'} type={'${realType}'}></SemiFile>`
return `<SemiFile url={'${url}'} name={'${name}'} size={'${size}'} type={'${realType}'}></SemiFile>`;
}
return '';
}).join('\n\n');
Expand Down

0 comments on commit 6fc3c5f

Please sign in to comment.