feat: add EPUB and MHTML document support
This commit is contained in:
@@ -31,7 +31,7 @@ const fileInputRef = ref<HTMLInputElement>();
|
||||
// Supported file types (matching backend)
|
||||
const SUPPORTED_TYPES = [
|
||||
// Documents
|
||||
'.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx',
|
||||
'.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.epub', '.mhtml',
|
||||
// Text
|
||||
'.txt', '.md', '.csv', '.json', '.xml', '.html',
|
||||
// Audio
|
||||
@@ -116,6 +116,7 @@ const getFileIcon = (fileName: string): string => {
|
||||
if (['doc', 'docx'].includes(ext || '')) return 'file-word';
|
||||
if (['xls', 'xlsx'].includes(ext || '')) return 'file-excel';
|
||||
if (['ppt', 'pptx'].includes(ext || '')) return 'file-powerpoint';
|
||||
if (['epub', 'mhtml'].includes(ext || '')) return 'file';
|
||||
if (['txt', 'md'].includes(ext || '')) return 'file';
|
||||
if (['mp3', 'wav', 'm4a', 'flac', 'ogg', 'aac'].includes(ext || '')) return 'sound';
|
||||
return 'file';
|
||||
|
||||
@@ -4786,6 +4786,8 @@ export default {
|
||||
fileTypeText: 'Plain Text',
|
||||
fileTypeJson: 'JSON Files',
|
||||
fileTypeImage: 'Images',
|
||||
fileTypeEbook: 'E-books',
|
||||
fileTypeWebArchive: 'Web Archives',
|
||||
fileTypeAudiovisual: 'Audio',
|
||||
engines: {
|
||||
builtin: {
|
||||
|
||||
@@ -4817,6 +4817,8 @@ export default {
|
||||
fileTypeText: '일반 텍스트',
|
||||
fileTypeJson: 'JSON 파일',
|
||||
fileTypeImage: '이미지',
|
||||
fileTypeEbook: '전자책',
|
||||
fileTypeWebArchive: '웹 아카이브',
|
||||
fileTypeAudiovisual: '오디오',
|
||||
engines: {
|
||||
builtin: {
|
||||
|
||||
@@ -4317,6 +4317,8 @@ export default {
|
||||
fileTypeText: 'Текстовые файлы',
|
||||
fileTypeJson: 'Файлы JSON',
|
||||
fileTypeImage: 'Изображения',
|
||||
fileTypeEbook: 'Электронные книги',
|
||||
fileTypeWebArchive: 'Веб-архивы',
|
||||
fileTypeAudiovisual: 'Аудио',
|
||||
engines: {
|
||||
builtin: {
|
||||
|
||||
@@ -4780,6 +4780,8 @@ export default {
|
||||
fileTypeText: "纯文本",
|
||||
fileTypeJson: "JSON 文件",
|
||||
fileTypeImage: "图片",
|
||||
fileTypeEbook: "电子书",
|
||||
fileTypeWebArchive: "网页存档",
|
||||
fileTypeAudiovisual: "音频",
|
||||
engines: {
|
||||
builtin: {
|
||||
|
||||
@@ -40,7 +40,7 @@ export function formatStringDate(date: any) {
|
||||
year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
|
||||
);
|
||||
}
|
||||
const DEFAULT_VALID_TYPES = new Set(["pdf", "txt", "md", "docx", "doc", "pptx", "ppt", "jpg", "jpeg", "png", "csv", "xlsx", "xls", "mp3", "wav", "m4a", "flac", "ogg"]);
|
||||
const DEFAULT_VALID_TYPES = new Set(["pdf", "txt", "md", "docx", "doc", "pptx", "ppt", "epub", "mhtml", "jpg", "jpeg", "png", "csv", "xlsx", "xls", "mp3", "wav", "m4a", "flac", "ogg"]);
|
||||
|
||||
/**
|
||||
* Returns true when the file should be **rejected**.
|
||||
|
||||
@@ -436,6 +436,8 @@ const fileTypeOptions = computed(() => [
|
||||
{ label: 'DOC', value: 'doc' },
|
||||
{ label: 'PPTX', value: 'pptx' },
|
||||
{ label: 'PPT', value: 'ppt' },
|
||||
{ label: 'EPUB', value: 'epub' },
|
||||
{ label: 'MHTML', value: 'mhtml' },
|
||||
{ label: 'TXT', value: 'txt' },
|
||||
{ label: 'MD', value: 'md' },
|
||||
{ label: 'URL', value: 'url' },
|
||||
|
||||
@@ -162,6 +162,8 @@ const fileTypeGroups = computed(() => {
|
||||
const officeExts = ['docx', 'doc'].filter(e => ft.has(e))
|
||||
const pptExts = ['pptx', 'ppt'].filter(e => ft.has(e))
|
||||
const excelExts = ['xlsx', 'xls'].filter(e => ft.has(e))
|
||||
const ebookExts = ['epub'].filter(e => ft.has(e))
|
||||
const webArchiveExts = ['mhtml'].filter(e => ft.has(e))
|
||||
const csvExts = ['csv'].filter(e => ft.has(e))
|
||||
const mdExts = ['md', 'markdown'].filter(e => ft.has(e))
|
||||
const txtExts = ['txt'].filter(e => ft.has(e))
|
||||
@@ -174,6 +176,8 @@ const fileTypeGroups = computed(() => {
|
||||
if (officeExts.length) groups.push({ key: 'office', label: t('kbSettings.parser.fileTypeWord'), icon: 'file-word', extensions: officeExts })
|
||||
if (pptExts.length) groups.push({ key: 'ppt', label: t('kbSettings.parser.fileTypePpt'), icon: 'file-powerpoint', extensions: pptExts })
|
||||
if (excelExts.length) groups.push({ key: 'excel', label: t('kbSettings.parser.fileTypeExcel'), icon: 'file-excel', extensions: excelExts })
|
||||
if (ebookExts.length) groups.push({ key: 'ebook', label: t('kbSettings.parser.fileTypeEbook'), icon: 'file', extensions: ebookExts })
|
||||
if (webArchiveExts.length) groups.push({ key: 'webarchive', label: t('kbSettings.parser.fileTypeWebArchive'), icon: 'file', extensions: webArchiveExts })
|
||||
if (csvExts.length) groups.push({ key: 'csv', label: t('kbSettings.parser.fileTypeCsv'), icon: 'file-excel', extensions: csvExts })
|
||||
if (mdExts.length) groups.push({ key: 'markdown', label: 'Markdown', icon: 'file-code', extensions: mdExts })
|
||||
if (txtExts.length) groups.push({ key: 'text', label: t('kbSettings.parser.fileTypeText'), icon: 'file', extensions: txtExts })
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<RouterView />
|
||||
</div>
|
||||
<div class="upload-mask" v-show="ismask">
|
||||
<input type="file" style="display: none" ref="uploadInput" accept=".pdf,.docx,.doc,.pptx,.ppt,.txt,.md,.jpg,.jpeg,.png,.csv,.xls,.xlsx" />
|
||||
<input type="file" style="display: none" ref="uploadInput" accept=".pdf,.docx,.doc,.pptx,.ppt,.epub,.mhtml,.txt,.md,.jpg,.jpeg,.png,.csv,.xls,.xlsx" />
|
||||
<UploadMask></UploadMask>
|
||||
</div>
|
||||
<!-- 全局设置模态框,供所有 platform 子路由使用 -->
|
||||
@@ -279,4 +279,4 @@ img {
|
||||
-o-user-drag: none;
|
||||
user-drag: none;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user