Skip to content

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

:sparkles: AI Agent https://github.com/siyuan-note/siyuan/issues/17797

Daniel2b2d38152810
diff --git a/app/appearance/langs/ar_SA.json b/app/appearance/langs/ar_SA.json
index 117d36c846..7fe32df475 100644
--- a/app/appearance/langs/ar_SA.json
+++ b/app/appearance/langs/ar_SA.json
@@ -16,6 +16,8 @@
"agentActionDelete": "حذف",
"agentActionCreate": "إنشاء",
"agentActionMove": "نقل",
+ "agentNotifyConfirm": "وكيل SiYuan يحتاج إلى تأكيدك",
+ "agentNotifyDone": "وكيل SiYuan قد استجاب",
"agentActionRename": "إعادة تسمية",
"agentConfirmApprove": "موافقة",
"agentConfirmReject": "رفض",
diff --git a/app/appearance/langs/de_DE.json b/app/appearance/langs/de_DE.json
index d831538451..6fe47cb56c 100644
--- a/app/appearance/langs/de_DE.json
+++ b/app/appearance/langs/de_DE.json
@@ -16,6 +16,8 @@
"agentActionDelete": "löschen",
"agentActionCreate": "erstellen",
"agentActionMove": "verschieben",
+ "agentNotifyConfirm": "SiYuan Agent benötigt Ihre Bestätigung",
+ "agentNotifyDone": "SiYuan Agent hat geantwortet",
"agentActionRename": "umbenennen",
"agentConfirmApprove": "Genehmigen",
"agentConfirmReject": "Ablehnen",
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index 17e33d894c..40219531d4 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -16,6 +16,8 @@
"agentActionDelete": "delete",
"agentActionCreate": "create",
"agentActionMove": "move",
+ "agentNotifyConfirm": "SiYuan agent needs your confirmation",
+ "agentNotifyDone": "SiYuan agent has responded",
"agentActionRename": "rename",
"agentConfirmApprove": "Approve",
"agentConfirmReject": "Reject",
diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json
index 670476a18a..d3825114dd 100644
--- a/app/appearance/langs/es_ES.json
+++ b/app/appearance/langs/es_ES.json
@@ -16,6 +16,8 @@
"agentActionDelete": "eliminar",
"agentActionCreate": "crear",
"agentActionMove": "mover",
+ "agentNotifyConfirm": "El agente SiYuan necesita tu confirmación",
+ "agentNotifyDone": "El agente SiYuan ha respondido",
"agentActionRename": "renombrar",
"agentConfirmApprove": "Aprobar",
"agentConfirmReject": "Rechazar",
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index 6819f89ff3..26730d81f7 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -16,6 +16,8 @@
"agentActionDelete": "supprimer",
"agentActionCreate": "créer",
"agentActionMove": "déplacer",
+ "agentNotifyConfirm": "L'agent SiYuan a besoin de votre confirmation",
+ "agentNotifyDone": "L'agent SiYuan a répondu",
"agentActionRename": "renommer",
"agentConfirmApprove": "Approuver",
"agentConfirmReject": "Rejeter",
diff --git a/app/appearance/langs/he_IL.json b/app/appearance/langs/he_IL.json
index 8504142217..197642aa04 100644
--- a/app/appearance/langs/he_IL.json
+++ b/app/appearance/langs/he_IL.json
@@ -16,6 +16,8 @@
"agentActionDelete": "מחק",
"agentActionCreate": "צור",
"agentActionMove": "העבר",
+ "agentNotifyConfirm": "סוכן SiYuan זקוק לאישורך",
+ "agentNotifyDone": "סוכן SiYuan הגיב",
"agentActionRename": "שנה שם",
"agentConfirmApprove": "אשר",
"agentConfirmReject": "דחה",
diff --git a/app/appearance/langs/hi_IN.json b/app/appearance/langs/hi_IN.json
index 1adf191b48..94668165c1 100644
--- a/app/appearance/langs/hi_IN.json
+++ b/app/appearance/langs/hi_IN.json
@@ -16,6 +16,8 @@
"agentActionDelete": "हटाएं",
"agentActionCreate": "बनाएं",
"agentActionMove": "स्थानांतरित करें",
+ "agentNotifyConfirm": "SiYuan एजेंट को आपकी पुष्टि चाहिए",
+ "agentNotifyDone": "SiYuan एजेंट ने उत्तर दिया",
"agentActionRename": "नाम बदलें",
"agentConfirmApprove": "स्वीकृत करें",
"agentConfirmReject": "अस्वीकृत करें",
diff --git a/app/appearance/langs/id_ID.json b/app/appearance/langs/id_ID.json
index 924ed9f618..0566eae967 100644
--- a/app/appearance/langs/id_ID.json
+++ b/app/appearance/langs/id_ID.json
@@ -16,6 +16,8 @@
"agentActionDelete": "hapus",
"agentActionCreate": "buat",
"agentActionMove": "pindahkan",
+ "agentNotifyConfirm": "Agen SiYuan butuh konfirmasi Anda",
+ "agentNotifyDone": "Agen SiYuan telah merespons",
"agentActionRename": "ganti nama",
"agentConfirmApprove": "Setujui",
"agentConfirmReject": "Tolak",
diff --git a/app/appearance/langs/it_IT.json b/app/appearance/langs/it_IT.json
index 8f26f7f278..8ff4c9ebc5 100644
--- a/app/appearance/langs/it_IT.json
+++ b/app/appearance/langs/it_IT.json
@@ -16,6 +16,8 @@
"agentActionDelete": "elimina",
"agentActionCreate": "crea",
"agentActionMove": "sposta",
+ "agentNotifyConfirm": "L'agente SiYuan ha bisogno della tua conferma",
+ "agentNotifyDone": "L'agente SiYuan ha risposto",
"agentActionRename": "rinomina",
"agentConfirmApprove": "Approva",
"agentConfirmReject": "Rifiuta",
diff --git a/app/appearance/langs/ja_JP.json b/app/appearance/langs/ja_JP.json
index eb63ccc811..9beef90a77 100644
--- a/app/appearance/langs/ja_JP.json
+++ b/app/appearance/langs/ja_JP.json
@@ -16,6 +16,8 @@
"agentActionDelete": "削除",
"agentActionCreate": "作成",
"agentActionMove": "移動",
+ "agentNotifyConfirm": "SiYuan エージェントが確認を必要としています",
+ "agentNotifyDone": "SiYuan エージェントが応答しました",
"agentActionRename": "名前変更",
"agentConfirmApprove": "承認",
"agentConfirmReject": "拒否",
diff --git a/app/appearance/langs/ko_KR.json b/app/appearance/langs/ko_KR.json
index f67c2c8bbc..4bfa52beb5 100644
--- a/app/appearance/langs/ko_KR.json
+++ b/app/appearance/langs/ko_KR.json
@@ -16,6 +16,8 @@
"agentActionDelete": "삭제",
"agentActionCreate": "생성",
"agentActionMove": "이동",
+ "agentNotifyConfirm": "SiYuan 에이전트가 확인이 필요합니다",
+ "agentNotifyDone": "SiYuan 에이전트가 응답했습니다",
"agentActionRename": "이름 변경",
"agentConfirmApprove": "승인",
"agentConfirmReject": "거부",
diff --git a/app/appearance/langs/nl_NL.json b/app/appearance/langs/nl_NL.json
index 84de110dc7..66a2c9f7e4 100644
--- a/app/appearance/langs/nl_NL.json
+++ b/app/appearance/langs/nl_NL.json
@@ -16,6 +16,8 @@
"agentActionDelete": "verwijderen",
"agentActionCreate": "aanmaken",
"agentActionMove": "verplaatsen",
+ "agentNotifyConfirm": "SiYuan agent heeft uw bevestiging nodig",
+ "agentNotifyDone": "SiYuan agent heeft gereageerd",
"agentActionRename": "hernoemen",
"agentConfirmApprove": "Goedkeuren",
"agentConfirmReject": "Afwijzen",
diff --git a/app/appearance/langs/pl_PL.json b/app/appearance/langs/pl_PL.json
index 6f3ecafe2d..53a78afcd2 100644
--- a/app/appearance/langs/pl_PL.json
+++ b/app/appearance/langs/pl_PL.json
@@ -16,6 +16,8 @@
"agentActionDelete": "usuń",
"agentActionCreate": "utwórz",
"agentActionMove": "przenieś",
+ "agentNotifyConfirm": "Agent SiYuan potrzebuje Twojego potwierdzenia",
+ "agentNotifyDone": "Agent SiYuan odpowiedział",
"agentActionRename": "zmień nazwę",
"agentConfirmApprove": "Zatwierdź",
"agentConfirmReject": "Odrzuć",
diff --git a/app/appearance/langs/pt_BR.json b/app/appearance/langs/pt_BR.json
index 065df1659c..9fd3c59980 100644
--- a/app/appearance/langs/pt_BR.json
+++ b/app/appearance/langs/pt_BR.json
@@ -16,6 +16,8 @@
"agentActionDelete": "excluir",
"agentActionCreate": "criar",
"agentActionMove": "mover",
+ "agentNotifyConfirm": "O agente SiYuan precisa da sua confirmação",
+ "agentNotifyDone": "O agente SiYuan respondeu",
"agentActionRename": "renomear",
"agentConfirmApprove": "Aprovar",
"agentConfirmReject": "Rejeitar",
diff --git a/app/appearance/langs/ru_RU.json b/app/appearance/langs/ru_RU.json
index 4e14fe9af4..90d011ce21 100644
--- a/app/appearance/langs/ru_RU.json
+++ b/app/appearance/langs/ru_RU.json
@@ -16,6 +16,8 @@
"agentActionDelete": "удалить",
"agentActionCreate": "создать",
"agentActionMove": "переместить",
+ "agentNotifyConfirm": "Агент SiYuan нуждается в подтверждении",
+ "agentNotifyDone": "Агент SiYuan ответил",
"agentActionRename": "переименовать",
"agentConfirmApprove": "Одобрить",
"agentConfirmReject": "Отклонить",
diff --git a/app/appearance/langs/sk_SK.json b/app/appearance/langs/sk_SK.json
index 17e3810572..61b26df5e4 100644
--- a/app/appearance/langs/sk_SK.json
+++ b/app/appearance/langs/sk_SK.json
@@ -16,6 +16,8 @@
"agentActionDelete": "zmazať",
"agentActionCreate": "vytvoriť",
"agentActionMove": "presunúť",
+ "agentNotifyConfirm": "Agent SiYuan potrebuje vaše potvrdenie",
+ "agentNotifyDone": "Agent SiYuan odpovedal",
"agentActionRename": "premenovať",
"agentConfirmApprove": "Schváliť",
"agentConfirmReject": "Odmietnuť",
diff --git a/app/appearance/langs/th_TH.json b/app/appearance/langs/th_TH.json
index d4706c3117..b053496443 100644
--- a/app/appearance/langs/th_TH.json
+++ b/app/appearance/langs/th_TH.json
@@ -16,6 +16,8 @@
"agentActionDelete": "ลบ",
"agentActionCreate": "สร้าง",
"agentActionMove": "ย้าย",
+ "agentNotifyConfirm": "เอเจนต์ SiYuan ต้องการการยืนยันจากคุณ",
+ "agentNotifyDone": "เอเจนต์ SiYuan ตอบกลับแล้ว",
"agentActionRename": "เปลี่ยนชื่อ",
"agentConfirmApprove": "อนุมัติ",
"agentConfirmReject": "ปฏิเสธ",
diff --git a/app/appearance/langs/tr_TR.json b/app/appearance/langs/tr_TR.json
index 801ef87c58..fced6323c5 100644
--- a/app/appearance/langs/tr_TR.json
+++ b/app/appearance/langs/tr_TR.json
@@ -16,6 +16,8 @@
"agentActionDelete": "sil",
"agentActionCreate": "oluştur",
"agentActionMove": "taşı",
+ "agentNotifyConfirm": "SiYuan ajanı onayınızı bekliyor",
+ "agentNotifyDone": "SiYuan ajanı yanıtladı",
"agentActionRename": "yeniden adlandır",
"agentConfirmApprove": "Onayla",
"agentConfirmReject": "Reddet",
diff --git a/app/appearance/langs/uk_UA.json b/app/appearance/langs/uk_UA.json
index cd044c9f75..3c0e7aa038 100644
--- a/app/appearance/langs/uk_UA.json
+++ b/app/appearance/langs/uk_UA.json
@@ -16,6 +16,8 @@
"agentActionDelete": "видалити",
"agentActionCreate": "створити",
"agentActionMove": "перемістити",
+ "agentNotifyConfirm": "Агент SiYuan потребує підтвердження",
+ "agentNotifyDone": "Агент SiYuan відповів",
"agentActionRename": "перейменувати",
"agentConfirmApprove": "Підтвердити",
"agentConfirmReject": "Відхилити",
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index 6820e4593f..df8242ca78 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -16,6 +16,8 @@
"agentActionDelete": "刪除",
"agentActionCreate": "創建",
"agentActionMove": "移動",
+ "agentNotifyConfirm": "思源智能體需要你的確認",
+ "agentNotifyDone": "思源智能體已回覆",
"agentActionRename": "重命名",
"agentConfirmApprove": "確認執行",
"agentConfirmReject": "拒絕",
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index dd421e59ad..4339344433 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -16,6 +16,8 @@
"agentActionDelete": "删除",
"agentActionCreate": "创建",
"agentActionMove": "移动",
+ "agentNotifyConfirm": "思源智能体需要你的确认",
+ "agentNotifyDone": "思源智能体已回复",
"agentActionRename": "重命名",
"agentConfirmApprove": "确认执行",
"agentConfirmReject": "拒绝",
diff --git a/app/electron/main.js b/app/electron/main.js
index 0336670e84..6e32b8fd3c 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -973,13 +973,19 @@ app.whenReady().then(() => {
case "showItemInFolder":
shell.showItemInFolder(data.filePath);
break;
- case "notification":
- new Notification({
+ case "notification": {
+ const n = new Notification({
title: data.title,
body: data.body,
timeoutType: data.timeoutType,
- }).show();
+ });
+ n.on("click", () => {
+ currentWindow.focus();
+ currentWindow.show();
+ });
+ n.show();
break;
+ }
case "setSpellCheckerLanguages":
BrowserWindow.getAllWindows().forEach(item => {
item.webContents.session.setSpellCheckerLanguages(data.languages);
diff --git a/app/src/layout/dock/AgentChat.ts b/app/src/layout/dock/AgentChat.ts
index bc1bae7f6c..ac678ac82c 100644
--- a/app/src/layout/dock/AgentChat.ts
+++ b/app/src/layout/dock/AgentChat.ts
@@ -11,6 +11,7 @@ import {escapeHtml} from "../../util/escape";
import {fetchPost} from "../../util/fetch";
import {confirmDialog} from "../../dialog/confirmDialog";
import * as dayjs from "dayjs";
+import {sendNotification} from "../../plugin/platformUtils";
import {
bindThinkingCardToggle,
createThinkingCardElement,
@@ -1232,6 +1233,10 @@ export class AgentChat extends Model {
this.updateTokenDisplay();
this.setStreaming(false);
await this.saveSession();
+ if (savedContent && (!document.hasFocus() || document.hidden)) {
+ const L = window.siyuan.languages;
+ sendNotification({title: L.agentNotifyDone, timeoutType: "default"});
+ }
}
private flushThinkingStep() {
@@ -1453,6 +1458,9 @@ export class AgentChat extends Model {
this.scrollToBottom(true);
this.hasInterveningCard = true;
this.pendingConfirms.push({type: "confirm", name, args, confirmID, status: "pending"});
+ if (!document.hasFocus() || document.hidden) {
+ sendNotification({title: L.agentNotifyConfirm, body: "", timeoutType: "default"});
+ }
}
private async postConfirm(confirmID: string, approved: boolean, always?: boolean) {
@@ -1715,4 +1723,5 @@ export class AgentChat extends Model {
}
return d.format("YYYY-MM-DD HH:mm");
}
+
}