diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index 52cce207..750376b3 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -167,7 +167,8 @@ "text": "Text", "document": "Document", "actions": "Actions", - "open": "Open" + "open": "Open", + "all": "All Files" }, "agents": { "title": "Agents", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index dcbf9587..69fcc050 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -167,7 +167,8 @@ "text": "文本", "document": "文档", "actions": "操作", - "open": "打开" + "open": "打开", + "all": "所有文件" }, "agents": { "title": "智能体", @@ -284,7 +285,7 @@ "provider.search_placeholder": "搜索模型 ID 或名称", "provider.api.url.reset": "重置", "provider.api.url.preview": "预览: {{url}}", - "provider.api.url.tip": "/结尾忽略v1版本,#结尾强制使用输入地址", + "provider.api.url.tip": "/结尾忽略v1版本,#结尾��制使用输入地址", "models.default_assistant_model": "默认助手模型", "models.topic_naming_model": "话题命名模型", "models.translate_model": "翻译模型", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index 5f29fa4d..83a461d7 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -167,7 +167,8 @@ "text": "文本", "document": "文檔", "actions": "操作", - "open": "打開" + "open": "打開", + "all": "所有檔案" }, "agents": { "title": "智能體", diff --git a/src/renderer/src/pages/files/FilesPage.tsx b/src/renderer/src/pages/files/FilesPage.tsx index 5538fdab..5b197e39 100644 --- a/src/renderer/src/pages/files/FilesPage.tsx +++ b/src/renderer/src/pages/files/FilesPage.tsx @@ -14,9 +14,14 @@ import styled from 'styled-components' const FilesPage: FC = () => { const { t } = useTranslation() - const [fileType, setFileType] = useState(FileTypes.IMAGE) + const [fileType, setFileType] = useState('all') - const files = useLiveQuery(() => db.files.where('type').equals(fileType).sortBy('count'), [fileType]) + const files = useLiveQuery(() => { + if (fileType === 'all') { + return db.files.orderBy('count').toArray() + } + return db.files.where('type').equals(fileType).sortBy('count') + }, [fileType]) const dataSource = files?.map((file) => { return { @@ -62,6 +67,7 @@ const FilesPage: FC = () => { ] const menuItems = [ + { key: 'all', label: t('files.all'), icon: }, { key: FileTypes.IMAGE, label: t('files.image'), icon: }, { key: FileTypes.TEXT, label: t('files.text'), icon: }, { key: FileTypes.DOCUMENT, label: t('files.document'), icon: } @@ -77,7 +83,7 @@ const FilesPage: FC = () => { setFileType(key as FileTypes)} /> - {fileType === FileTypes.IMAGE ? ( + {fileType === FileTypes.IMAGE && files?.length > 0 ? ( {files?.map((file) => (