diff --git a/apps/desktop/capabilities/default.json b/apps/desktop/capabilities/default.json index 3f402d4..3d50064 100644 --- a/apps/desktop/capabilities/default.json +++ b/apps/desktop/capabilities/default.json @@ -3,6 +3,5 @@ "identifier": "default", "description": "主窗口默认能力", "windows": ["main"], - "permissions": ["core:default", "opener:default"] + "permissions": ["core:default", "opener:default", "dialog:default"] } - diff --git a/docs/FEATURES.md b/docs/FEATURES.md index ffc28fa..faf518d 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -230,6 +230,7 @@ ### 2026-08-17 +- 修复:知识库「添加目录 → 浏览…」无响应——为 dialog 插件在 capabilities 中补充权限(`dialog:default`),并让选择器异常在前端可见。 - 知识库「添加目录」弹窗支持两种方式选择目录:手动输入路径,或点击「浏览…」调起系统原生文件夹选择器(接入 tauri-plugin-dialog)。 - 知识库新增「目录来源」:支持添加多个本地目录批量导入(后缀过滤默认全部、可开关递归子目录),只收录文本 / 图片视频 / 音频三类文件其余忽略,支持重新扫描增量导入与按来源删除。 - 新增「知识库」选项卡与完整操作界面:知识库管理(新建/编辑/删除)、多格式文档上传(文本类 + PDF)、自动分块与全文检索(FTS5 trigram + BM25)、文档预览 / 重新切分 / 删除、检索结果一键复制。 diff --git a/ui/src/pages/KnowledgeBasePage.tsx b/ui/src/pages/KnowledgeBasePage.tsx index 42c9ba1..247e301 100644 --- a/ui/src/pages/KnowledgeBasePage.tsx +++ b/ui/src/pages/KnowledgeBasePage.tsx @@ -777,9 +777,11 @@ function SourceModal({ const [path, setPath] = useState(""); const [extensions, setExtensions] = useState(""); const [recursive, setRecursive] = useState(true); + const [browseMsg, setBrowseMsg] = useState(null); const valid = path.trim().length > 0; async function handleBrowse() { + setBrowseMsg(null); try { const dir = await openDialog({ directory: true, @@ -788,9 +790,11 @@ function SourceModal({ }); if (typeof dir === "string" && dir) { setPath(dir); + } else { + setBrowseMsg("已取消选择"); } - } catch { - // 取消或选择器异常时不改变当前输入 + } catch (e) { + setBrowseMsg(`无法打开文件夹选择器:${String(e)}`); } } @@ -827,6 +831,9 @@ function SourceModal({ 浏览… + {browseMsg ? ( +
{browseMsg}
+ ) : null}