Skip to content

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

:rotating_light:

Vanessa67f095c5228d
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts
index 0aea42ec0e..8de2287c28 100644
--- a/app/src/ai/actions.ts
+++ b/app/src/ai/actions.ts
@@ -81,7 +81,7 @@ const editDialog = (customName: string, customMemo: string) => {
dialog.destroy();
});
nameElement.focus();
-}
+};
const customDialog = (protyle: IProtyle, ids: string[], elements: Element[]) => {
const dialog = new Dialog({
@@ -134,7 +134,7 @@ const customDialog = (protyle: IProtyle, ids: string[], elements: Element[]) =>
dialog.destroy();
});
nameElement.focus();
-}
+};
const filterAI = (element: HTMLElement, inputElement: HTMLInputElement) => {
element.querySelectorAll(".b3-list-item").forEach(item => {
@@ -143,17 +143,17 @@ const filterAI = (element: HTMLElement, inputElement: HTMLInputElement) => {
} else {
item.classList.add("fn__none");
}
- })
- element.querySelectorAll('.b3-menu__separator').forEach(item => {
+ });
+ element.querySelectorAll(".b3-menu__separator").forEach(item => {
if (inputElement.value) {
item.classList.add("fn__none");
} else {
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");
-}
+};
export const AIActions = (elements: Element[], protyle: IProtyle) => {
window.siyuan.menus.menu.remove();
@@ -164,7 +164,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
const menu = new Menu("ai", () => {
focusByRange(protyle.toolbar.range);
});
- let customHTML = ""
+ let customHTML = "";
window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }) => {
customHTML += `<div data-action="${item.memo || item.name}" class="b3-list-item b3-list-item--narrow ariaLabel" aria-label="${escapeAriaLabel(item.memo)}">
<span class="b3-list-item__text">${escapeHtml(item.name)}</span>
@@ -258,7 +258,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
});
inputElement.addEventListener("compositionend", () => {
filterAI(element, inputElement);
- })
+ });
inputElement.addEventListener("input", (event: KeyboardEvent) => {
if (event.isComposing) {
return;
diff --git a/app/src/config/ai.ts b/app/src/config/ai.ts
index 2c8d7e1d83..2751d4f2f6 100644
--- a/app/src/config/ai.ts
+++ b/app/src/config/ai.ts
@@ -160,12 +160,12 @@ export const ai = {
</div>`;
},
bindEvent: () => {
- const togglePassword = ai.element.querySelector('.b3-form__icona-icon[data-action="togglePassword"]')
+ const togglePassword = ai.element.querySelector('.b3-form__icona-icon[data-action="togglePassword"]');
togglePassword.addEventListener("click", () => {
const isEye = togglePassword.firstElementChild.getAttribute("xlink:href") === "#iconEye";
togglePassword.firstElementChild.setAttribute("xlink:href", isEye ? "#iconEyeoff" : "#iconEye");
togglePassword.previousElementSibling.setAttribute("type", isEye ? "text" : "password");
- })
+ });
ai.element.querySelectorAll("input, select").forEach((item) => {
item.addEventListener("change", () => {
fetchPost("/api/setting/setAI", {
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts
index 0e065a2d3c..cac63620d7 100644
--- a/app/src/protyle/render/av/filter.ts
+++ b/app/src/protyle/render/av/filter.ts
@@ -140,9 +140,9 @@ export const setFilter = async (options: {
contents: [newValue],
},
type: "rollup"
- }
+ };
} else {
- newFilter.value = newValue
+ newFilter.value = newValue;
}
let isSame = false;
options.data.view.filters.find((filter, index) => {
@@ -225,7 +225,7 @@ export const setFilter = async (options: {
type: filterValue.type
};
} else {
- filterValue = item.value.rollup.contents[0]
+ filterValue = item.value.rollup.contents[0];
}
return true;
}
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index c83bd7f132..4f229c57b4 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -366,10 +366,10 @@ export const openMenuPanel = (options: {
}
targetElement.classList.remove("dragover__bottom", "dragover__top");
const blockIDs: string[] = [];
- const contents: IAVCellValue[] = []
+ const contents: IAVCellValue[] = [];
targetElement.parentElement.querySelectorAll(".fn__grab").forEach(item => {
- const dateElement = item.nextElementSibling as HTMLElement
- blockIDs.push(dateElement.dataset.id)
+ const dateElement = item.nextElementSibling as HTMLElement;
+ blockIDs.push(dateElement.dataset.id);
contents.push({
isDetached: !dateElement.style.color,
type: "block",
@@ -377,8 +377,8 @@ export const openMenuPanel = (options: {
content: dateElement.textContent,
id: dateElement.dataset.id
}
- })
- })
+ });
+ });
updateCellsValue(options.protyle, options.blockElement as HTMLElement, {
blockIDs,
contents,
diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts
index 89357b11d1..dc3c0353f0 100644
--- a/app/src/protyle/render/av/relation.ts
+++ b/app/src/protyle/render/av/relation.ts
@@ -237,11 +237,11 @@ const filterItem = (menuElement: Element, cellElement: HTMLElement, keyword: str
const cells = response.data.rows.values as IAVCellValue[] || [];
let html = "";
let selectHTML = "";
- const hasIds: string[] = []
+ const hasIds: string[] = [];
cellElement.querySelectorAll("span").forEach((item) => {
hasIds.push(item.dataset.id);
selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item${item.textContent.indexOf(keyword) > -1 ? "" : " fn__none"}" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || "Untitled")}</button>`;
- })
+ });
cells.forEach((item) => {
if (!hasIds.includes(item.block.id)) {
html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled");
@@ -267,11 +267,11 @@ export const bindRelationEvent = (options: {
const cells = response.data.rows.values as IAVCellValue[] || [];
let html = "";
let selectHTML = "";
- const hasIds: string[] = []
+ const hasIds: string[] = [];
options.cellElements[0].querySelectorAll("span").forEach((item) => {
hasIds.push(item.dataset.id);
selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || "Untitled")}</button>`;
- })
+ });
cells.forEach((item) => {
if (!hasIds.includes(item.block.id)) {
html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled");
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 94d481e6de..4ebc80f120 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -79,10 +79,10 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v
if (!hasFilter) {
data.filters.find(filterItem => {
if (filterItem.value.type === item.type && item.id === filterItem.column) {
- hasFilter = true
- return true
+ hasFilter = true;
+ return true;
}
- })
+ });
}
if (!item.hidden) {
if (item.pin) {
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 374a53b0b5..89aee57170 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1412,7 +1412,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (selectsElement.length === 0) {
selectsElement = [nodeElement];
}
- AIActions(selectsElement, protyle)
+ AIActions(selectsElement, protyle);
return;
}