Skip to content

Commit

Permalink
fix: solve the warning message when paste text int the chat input (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingwanying authored Sep 4, 2024
1 parent 6acb67e commit bc3eb44
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions assistant/src/Chat/components/InputAreaRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,16 @@ const InputAreaRender = (props: {
}

const files = event.clipboardData.files;
if (!files.length) return;

if (files.length > 0) {
const file = files[0];
const uniqueUid = `${Date.now()}`;
const newFile = new File([file], uniqueUid, { type: file.type });
if (file.type.includes('image')) {
handleUpload({ file: newFile, uid: uniqueUid });
} else {
AntMessage.warning('只支持图片格式');
}
} else {
AntMessage.warning('粘贴失败');
}
const file = files[0];

if (!file.type.includes('image')) return;

const uniqueUid = `${Date.now()}`;
const newFile = new File([file], uniqueUid, { type: file.type });

handleUpload({ file: newFile, uid: uniqueUid });
};

return (
Expand Down

0 comments on commit bc3eb44

Please sign in to comment.