diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts index 85b7c6a26..8d2ced11d 100644 --- a/app/src/ai/actions.ts +++ b/app/src/ai/actions.ts @@ -28,7 +28,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { submenu: [{ label: window.siyuan.languages.aiTranslate_zh_CN, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate as follows to [zh_CN]"}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -36,7 +36,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiTranslate_ja_JP, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate as follows to [ja_JP]"}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -44,7 +44,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiTranslate_ko_KR, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate as follows to [ko_KR]"}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -52,7 +52,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiTranslate_en_US, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate as follows to [en_US]"}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -60,7 +60,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiTranslate_es_ES, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate as follows to [es_ES]"}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -68,7 +68,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiTranslate_fr_FR, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate as follows to [fr_FR]"}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -76,7 +76,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiTranslate_de_DE, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Translate as follows to [de_DE]"}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -85,7 +85,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiExtractSummary, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Summarize"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: window.siyuan.languages.aiExtractSummary}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); @@ -93,12 +93,20 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }, { label: window.siyuan.languages.aiBrainStorm, click() { - fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Brainstorm"}, (response) => { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: window.siyuan.languages.aiBrainStorm}, (response) => { focusByRange(protyle.toolbar.range); insertHTML(response.data, protyle, true); }); } }, { + label: window.siyuan.languages.aiFixGrammarSpell, + click() { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: window.siyuan.languages.aiFixGrammarSpell}, (response) => { + focusByRange(protyle.toolbar.range); + insertHTML(response.data, protyle, true); + }); + } + },{ label: window.siyuan.languages.aiCustomAction, click() { const dialog = new Dialog({