wujingjing
2025-03-12 5e5a4437ea7531d018f429a44f39641e5aa1c6fc
src/components/chat/components/playBar/hook/useUploadFile.ts
@@ -16,7 +16,22 @@
   return true;
};
export type FileType = 'doc' | 'docx' | 'pdf' | 'md' | 'xls' | 'xlsx' | 'png' | 'jpg' | 'jpeg' | 'gif' | 'json' | 'txt' | 'csv';
export type FileType =
   | 'dot'
   | 'doc'
   | 'docx'
   | 'pdf'
   | 'md'
   | 'xls'
   | 'xlsx'
   | 'png'
   | 'jpg'
   | 'jpeg'
   | 'gif'
   | 'json'
   | 'txt'
   | 'text'
   | 'csv';
export type FileGroupType = 'word' | 'pdf' | 'excel' | 'image' | 'json' | 'md' | 'csv' | 'txt';
export type UploadFile = {
   name: string;
@@ -32,12 +47,14 @@
export const getFileGroupType = (type: FileType): FileGroupType => {
   switch (type) {
      case 'dot':
      case 'doc':
      case 'docx':
         return 'word';
      case 'csv':
         return 'csv';
      case 'txt':
      case 'text':
         return 'txt';
      case 'md':
@@ -102,8 +119,8 @@
         return '';
   }
};
const supportFileType = ['doc', 'docx', 'md', 'xls', 'xlsx', 'png', 'jpg', 'jpeg', 'gif', 'json', 'pdf','csv', 'txt'];
// const supportFileType = ['csv', 'txt'];
// const supportFileType = ['doc', 'docx', 'md', 'xls', 'xlsx', 'png', 'jpg', 'jpeg', 'gif', 'json', 'pdf','csv', 'txt'];
const supportFileType = ['csv', 'txt', 'text', 'dot', 'doc', 'docx', 'pdf'];
export const getFileSuffix = (name: string): FileType => {
   if (!name) return 'txt';
@@ -181,7 +198,8 @@
      reset: resetOpenFileDialog,
      onChange: onPickFileChange,
   } = useFileDialog({
      accept: 'text/csv,text/plain', // Only accept csv and txt files
      accept:
         'text/csv,text/plain,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document', // Accept csv, txt, doc, docx and pdf files
      reset: true,
   });