diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts index 85b7c6a26..d4e278111 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); }); @@ -99,6 +99,14 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { }); } }, { + label: window.siyuan.languages.aiFixGrammarSpell, + click() { + fetchPost("/api/ai/chatGPTWithAction", {ids, action: "Identify the language used in the following text and mark it as {x}, correct the grammar and spelling errors, return the result in language {x}"}, (response) => { + focusByRange(protyle.toolbar.range); + insertHTML(response.data, protyle, true); + }); + } + },{ label: window.siyuan.languages.aiCustomAction, click() { const dialog = new Dialog({