Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Fix Cannot read properties of null

Daniel6eba606fc21a
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts
index ecbc97b51b..a22f4f0faa 100644
--- a/app/src/ai/actions.ts
+++ b/app/src/ai/actions.ts
@@ -151,8 +151,8 @@ const filterAI = (element: HTMLElement, inputElement: HTMLInputElement) => {
item.classList.remove("fn__none");
}
});
- element.querySelector(".b3-list-item--focus").classList.remove("b3-list-item--focus");
- element.querySelector(".b3-list-item:not(.fn__none)").classList.add("b3-list-item--focus");
+ element.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
+ element.querySelector(".b3-list-item:not(.fn__none)")?.classList.add("b3-list-item--focus");
};
export const AIActions = (elements: Element[], protyle: IProtyle) => {
@@ -226,6 +226,9 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
event.preventDefault();
event.stopPropagation();
const currentElement = listElement.querySelector(".b3-list-item--focus") as HTMLElement;
+ if (!currentElement) {
+ return;
+ }
if (currentElement.dataset.type === "custom") {
customDialog(protyle, ids, elements);
menu.close();