feat(knowledge-base): Enhance file processing and localization

- Update useKnowledgeFiles hook to filter only completed processing files
- Improve localization messages for knowledge base file management
- Refactor delete and remove file button translations across locales
- Update confirmation messages to clarify file deletion behavior
This commit is contained in:
kangfenmao 2025-03-05 14:59:30 +08:00
parent dcaac54c75
commit 3d701b98aa
7 changed files with 24 additions and 14 deletions

View File

@ -11,8 +11,13 @@ export const useKnowledgeFiles = () => {
useEffect(() => {
const items = bases.map((kb) => kb.items).flat()
const fileItems = items.filter((item) => item.type === 'file')
const fileItems = items
.filter((item) => item.type === 'file')
.filter((item) => item.processingStatus === 'completed')
const files = fileItems.map((item) => item.content as FileType)
!isEmpty(files) && setKnowledgeFiles(files)
}, [bases])

View File

@ -600,8 +600,9 @@
"app_data": "App Data",
"app_logs": "App Logs",
"app_knowledge": "Knowledge Base Files",
"app_knowledge.remove_all": "Remove Files",
"app_knowledge.remove_all_confirm": "Removing knowledge base files will not delete the knowledge base itself, which will reduce the storage space occupied. Continue?",
"app_knowledge.button.delete": "Delete File",
"app_knowledge.remove_all": "Remove Knowledge Base Files",
"app_knowledge.remove_all_confirm": "Deleting knowledge base files will reduce the storage space occupied, but will not delete the knowledge base vector data, after deletion, the source file will no longer be able to be opened. Continue?",
"app_knowledge.remove_all_success": "Files removed successfully",
"clear_cache": {
"button": "Clear Cache",
@ -902,7 +903,7 @@
"title": "Data Backup",
"confirm": "Are you sure you want to backup data?",
"confirm.button": "Select Backup Location",
"content": "Backup operation will cover all application data, including chat history, settings, and knowledge base. Please note that the backup process may take some time, thank you for your patience.",
"content": "Backup all data, including chat history, settings, and knowledge base. Please note that the backup process may take some time, thank you for your patience.",
"progress": {
"title": "Backup Progress",
"preparing": "Preparing backup...",

View File

@ -600,8 +600,9 @@
"app_data": "アプリデータ",
"app_logs": "アプリログ",
"app_knowledge": "ナレッジベースファイル",
"app_knowledge.remove_all": "ファイルを削除",
"app_knowledge.remove_all_confirm": "ナレッジベースファイルを削除してもナレッジベース自体は削除されません。これにより、ストレージ容量を節約できます。続行しますか?",
"app_knowledge.button.delete": "ファイルを削除",
"app_knowledge.remove_all": "ナレッジベースファイルを削除",
"app_knowledge.remove_all_confirm": "ナレッジベースファイルを削除すると、ナレッジベース自体は削除されません。これにより、ストレージ容量を節約できます。続行しますか?",
"app_knowledge.remove_all_success": "ファイル削除成功",
"clear_cache": {
"button": "キャッシュをクリア",

View File

@ -600,7 +600,8 @@
"app_data": "Данные приложения",
"app_logs": "Логи приложения",
"app_knowledge": "База знаний",
"app_knowledge.remove_all": "Удалить файлы",
"app_knowledge.button.delete": "Удалить файл",
"app_knowledge.remove_all": "Удалить файлы базы знаний",
"app_knowledge.remove_all_confirm": "Удаление файлов базы знаний не удалит саму базу знаний, что позволит уменьшить занимаемый объем памяти, продолжить?",
"app_knowledge.remove_all_success": "Файлы удалены успешно",
"clear_cache": {

View File

@ -600,8 +600,9 @@
"app_data": "应用数据",
"app_logs": "应用日志",
"app_knowledge": "知识库文件",
"app_knowledge.remove_all": "删除文件",
"app_knowledge.remove_all_confirm": "删除知识库文件不会删除知识库本身,可以减少存储空间占用,删除之后文件无法再打开,是否继续?",
"app_knowledge.button.delete": "删除文件",
"app_knowledge.remove_all": "删除知识库文件",
"app_knowledge.remove_all_confirm": "删除知识库文件可以减少存储空间占用,但不会删除知识库向量化数据,删除之后将无法打开源文件,是否删除?",
"app_knowledge.remove_all_success": "文件删除成功",
"clear_cache": {
"button": "清除缓存",
@ -902,7 +903,7 @@
"title": "数据备份",
"confirm": "确定要备份数据吗?",
"confirm.button": "选择备份位置",
"content": "备份操作将涵盖所有应用数据,包括聊天记录、设置、知识库等所有数据。请注意,备份过程可能需要一些时间,感谢您的耐心等待。",
"content": "备份全部数据,包括聊天记录、设置、知识库等所有数据。请注意,备份过程可能需要一些时间,感谢您的耐心等待。",
"progress": {
"title": "备份进度",
"preparing": "准备备份...",

View File

@ -600,8 +600,9 @@
"app_data": "應用數據",
"app_logs": "應用日誌",
"app_knowledge": "知識庫文件",
"app_knowledge.remove_all": "刪除文件",
"app_knowledge.remove_all_confirm": "刪除知識庫文件不會刪除知識庫本身,可以減少存儲空間占用,刪除之後文件無法再打開,是否繼續?",
"app_knowledge.button.delete": "刪除文件",
"app_knowledge.remove_all": "刪除知識庫文件",
"app_knowledge.remove_all_confirm": "刪除知識庫文件可以减少存储空间占用,但不会删除知识库向量化数据,删除之后将无法打开源文件,是否删除?",
"app_knowledge.remove_all_success": "文件刪除成功",
"clear_cache": {
"button": "清除緩存",
@ -902,7 +903,7 @@
"title": "資料備份",
"confirm": "確定要備份資料嗎?",
"confirm.button": "選擇備份位置",
"content": "備份操作將涵蓋所有應用資料,包括聊天記錄、設定、知識庫等全部資料。請注意,備份過程可能需要一些時間,感謝您的耐心等待。",
"content": "備份全部資料,包括聊天記錄、設定、知識庫等全部資料。請注意,備份過程可能需要一些時間,感謝您的耐心等待。",
"progress": {
"title": "備份進度",
"preparing": "準備備份...",

View File

@ -407,7 +407,7 @@ const DataSettings: FC = () => {
<SettingRowTitle>{t('settings.data.app_knowledge')}</SettingRowTitle>
<HStack alignItems="center" gap="5px">
<Button onClick={handleRemoveAllFiles} danger>
{t('settings.data.app_knowledge.remove_all')}
{t('settings.data.app_knowledge.button.delete')}
</Button>
</HStack>
</SettingRow>