Skip to content

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

:art: ai

Vanessaaab0a269de3c
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts
index 592453ea54..f78c14608a 100644
--- a/app/src/ai/actions.ts
+++ b/app/src/ai/actions.ts
@@ -64,7 +64,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
}
}, {
iconHTML: Constants.ZWSP,
- label: window.siyuan.languages.save,
+ label: `${window.siyuan.languages.aiCustomAction} & ${window.siyuan.languages.save}`,
click() {
const dialog = new Dialog({
title: window.siyuan.languages.save,
@@ -89,11 +89,19 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
dialog.destroy();
});
btnsElement[1].addEventListener("click", () => {
+ const memo = dialog.element.querySelector("textarea").value;
window.siyuan.storage[Constants.LOCAL_AI].push({
name: inputElement.value,
- memo: dialog.element.querySelector("textarea").value,
+ memo
});
setStorageVal(Constants.LOCAL_AI, window.siyuan.storage[Constants.LOCAL_AI]);
+ fetchPost("/api/ai/chatGPTWithAction", {
+ ids,
+ action: memo,
+ }, (response) => {
+ dialog.destroy();
+ fillContent(protyle, response.data, elements);
+ });
dialog.destroy();
});
}