mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-12 15:11:10 +08:00
🎨 ai
This commit is contained in:
parent
134fbaa88f
commit
aab0a269de
@ -64,7 +64,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
label: window.siyuan.languages.save,
|
label: `${window.siyuan.languages.aiCustomAction} & ${window.siyuan.languages.save}`,
|
||||||
click() {
|
click() {
|
||||||
const dialog = new Dialog({
|
const dialog = new Dialog({
|
||||||
title: window.siyuan.languages.save,
|
title: window.siyuan.languages.save,
|
||||||
@ -89,11 +89,19 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
});
|
});
|
||||||
btnsElement[1].addEventListener("click", () => {
|
btnsElement[1].addEventListener("click", () => {
|
||||||
|
const memo = dialog.element.querySelector("textarea").value;
|
||||||
window.siyuan.storage[Constants.LOCAL_AI].push({
|
window.siyuan.storage[Constants.LOCAL_AI].push({
|
||||||
name: inputElement.value,
|
name: inputElement.value,
|
||||||
memo: dialog.element.querySelector("textarea").value,
|
memo
|
||||||
});
|
});
|
||||||
setStorageVal(Constants.LOCAL_AI, window.siyuan.storage[Constants.LOCAL_AI]);
|
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();
|
dialog.destroy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user