fix: 修复知识库目录浏览按钮无响应——为 dialog 插件补充 capabilities 权限,选择器异常改为前端可见
This commit is contained in:
@@ -777,9 +777,11 @@ function SourceModal({
|
||||
const [path, setPath] = useState("");
|
||||
const [extensions, setExtensions] = useState("");
|
||||
const [recursive, setRecursive] = useState(true);
|
||||
const [browseMsg, setBrowseMsg] = useState<string | null>(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({
|
||||
浏览…
|
||||
</button>
|
||||
</div>
|
||||
{browseMsg ? (
|
||||
<div className="mt-1 text-[11px] text-slate-500">{browseMsg}</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div>
|
||||
<label className="mb-1 block text-xs text-slate-400">后缀过滤(可选)</label>
|
||||
|
||||
Reference in New Issue
Block a user