Skip to content

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

:art: 加入针对内容块的人工智能辅助支持 https://github.com/siyuan-note/siyuan/issues/7566

Liang Dingca65fd777f5c
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts
index 85b7c6a26d..d4e2781119 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({