An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: fix https://github.com/siyuan-note/siyuan/issues/6423
Vanessa5deacf31d5c5
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex ed92cbed49..865d3134ce 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1,4 +1,6 @@{+ "microphoneDenied": "Need to allow Siyuan to access the microphone in System Preferences",+ "microphoneNotAccess": "Access to the microphone is denied, go to System Preferences to reset","dynamicLoadBlocks": "Number of dynamically loaded blocks","dynamicLoadBlocksTip": "This value contains the number of subblocks. If there are many code blocks, formula blocks or chart blocks that need to be rendered, it is recommended not to set too large","googleAnalytics": "Google Analytics",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex eaf5982cb8..bf25650d25 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1,4 +1,6 @@{+ "microphoneDenied": "Necesito permitir que Siyuan acceda al micrófono en Preferencias del Sistema",+ "microphoneNotAccess": "Acceso al micrófono denegado, ve a Preferencias del Sistema para reiniciar","dynamicLoadBlocks": "Número de bloques cargados dinámicamente","dynamicLoadBlocksTip": "Este valor contiene el número de subbloques. Si hay muchos bloques de código, bloques de fórmulas o bloques de gráficos que necesitan renderizarse, se recomienda no configurarlos demasiado grandes","googleAnalytics": "Google Analytics",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex ad42d4a3aa..d2411ac47b 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1,4 +1,6 @@{+ "microphoneDenied": "Vous devez autoriser Siyuan à accéder au microphone dans les Préférences Système",+ "microphoneNotAccess": "L'accès au microphone est refusé, allez dans les Préférences Système pour réinitialiser","dynamicLoadBlocks": "Nombre de blocs chargés dynamiquement","dynamicLoadBlocksTip": "Cette valeur contient le nombre de sous-blocs. S'il y a beaucoup de blocs de code, de blocs de formule ou de blocs de graphique qui doivent être rendus, il est recommandé de ne pas définir trop grand","googleAnalytics": "Google Analytics",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 8fbd7841b5..ba26e48dbb 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1,4 +1,6 @@{+ "microphoneDenied": "需在系統偏好設置中允許思源訪問麥克風",+ "microphoneNotAccess": "麥克風被拒絕訪問,可前往系統偏好設置中重新設置","dynamicLoadBlocks": "動態加載塊數","dynamicLoadBlocksTip": "該值包含了子塊數。如果需要渲染的代碼塊、公式塊或圖表塊較多,建議不要設置過大","googleAnalytics": "Google Analytics",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 449950c961..36c2adb708 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1,4 +1,6 @@{+ "microphoneDenied": "需在系统偏好设置中允许思源访问麦克风",+ "microphoneNotAccess": "麦克风被拒绝访问,可前往系统偏好设置中重新设置","dynamicLoadBlocks": "动态加载块数","dynamicLoadBlocksTip": "该值包含了子块数。如果需要渲染的代码块、公式块或图表块较多,建议不要设置过大","googleAnalytics": "Google Analytics",diff --git a/app/electron-builder-darwin-arm64.yml b/app/electron-builder-darwin-arm64.ymlindex 761d3bc20c..f1487f75db 100644--- a/app/electron-builder-darwin-arm64.yml+++ b/app/electron-builder-darwin-arm64.yml@@ -18,6 +18,8 @@ mac:gatekeeperAssess: falsehardenedRuntime: trueentitlements: "../../entitlements.mas.plist"+ extendInfo:+ - NSMicrophoneUsageDescription: "This app requires microphone access to record audio."entitlementsInherit: "../../entitlements.mas.plist"extraResources:- from: "kernel-darwin-arm64"@@ -51,4 +53,4 @@ extraResources:to: "appearance/themes/daylight"filter: "!**/{.DS_Store,custom.css}"- from: "pandoc/pandoc-darwin-amd64.zip"- to: "pandoc.zip"\ No newline at end of file+ to: "pandoc.zip"diff --git a/app/electron-builder-darwin.yml b/app/electron-builder-darwin.ymlindex c77baf539a..e980e20809 100644--- a/app/electron-builder-darwin.yml+++ b/app/electron-builder-darwin.yml@@ -18,6 +18,8 @@ mac:gatekeeperAssess: falsehardenedRuntime: trueentitlements: "../../entitlements.mas.plist"+ extendInfo:+ - NSMicrophoneUsageDescription: "This app requires microphone access to record audio."entitlementsInherit: "../../entitlements.mas.plist"extraResources:- from: "kernel-darwin"@@ -50,4 +52,4 @@ extraResources:to: "appearance/themes/daylight"filter: "!**/{.DS_Store,custom.css}"- from: "pandoc/pandoc-darwin-amd64.zip"- to: "pandoc.zip"\ No newline at end of file+ to: "pandoc.zip"diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.tsindex db489b4b1b..5a7d129b35 100644--- a/app/src/protyle/breadcrumb/index.ts+++ b/app/src/protyle/breadcrumb/index.ts@@ -19,7 +19,7 @@ import {openFileById} from "../../editor/util";import {getAllModels} from "../../layout/getAll";/// #endif/// #if !BROWSER-import {getCurrentWindow} from "@electron/remote";+import {getCurrentWindow, systemPreferences} from "@electron/remote";/// #endifimport {onGet} from "../util/onGet";import {saveScroll} from "../scroll/saveScroll";@@ -130,6 +130,20 @@ export class Breadcrumb {/// #endif}+ private startRecord(protyle: IProtyle) {+ this.messageId = showMessage(`<div class="fn__flex fn__flex-wrap">+<span class="fn__flex-center">${window.siyuan.languages.recording}</span><span class="fn__space"></span>+<button class="b3-button b3-button--white">${window.siyuan.languages.endRecord}</button></div>`, -1);+ document.querySelector(`#message [data-id="${this.messageId}"] button`).addEventListener("click", () => {+ this.mediaRecorder.stopRecording();+ hideMessage(this.messageId);+ const file: File = new File([this.mediaRecorder.buildWavFileBlob()],+ `record${(new Date()).getTime()}.wav`, {type: "video/webm"});+ uploadFiles(protyle, [file]);+ });+ this.mediaRecorder.startRecordingNewWavFile();+ }+private showMenu(protyle: IProtyle, position: { x: number, y: number }) {let id;const cursorNodeElement = hasClosestBlock(getEditorRange(protyle.element).startContainer);@@ -164,7 +178,23 @@ export class Breadcrumb {current: this.mediaRecorder && this.mediaRecorder.isRecording,icon: "iconRecord",label: this.mediaRecorder?.isRecording ? window.siyuan.languages.endRecord : window.siyuan.languages.startRecord,- click: () => {+ click: async () => {+ /// #if !BROWSER+ if (window.siyuan.config.system.os === "darwin") {+ const status = systemPreferences.getMediaAccessStatus('microphone')+ if (["denied", "restricted", "unknown"].includes(status)) {+ showMessage(window.siyuan.languages.microphoneDenied);+ return;+ } else if (status === "not-determined") {+ const isAccess = await systemPreferences.askForMediaAccess('microphone')+ if (!isAccess) {+ showMessage(window.siyuan.languages.microphoneNotAccess);+ return;+ }+ }+ }+ /// #endif+if (!this.mediaRecorder) {navigator.mediaDevices.getUserMedia({audio: true}).then((mediaStream: MediaStream) => {this.mediaRecorder = new RecordMedia(mediaStream);@@ -178,8 +208,7 @@ export class Breadcrumb {const right = e.inputBuffer.getChannelData(1);this.mediaRecorder.cloneChannelData(left, right);};- this.mediaRecorder.startRecordingNewWavFile();- this.messageId = showMessage(window.siyuan.languages.recording, -1);+ this.startRecord(protyle);}).catch(() => {showMessage(window.siyuan.languages["record-tip"]);});@@ -194,8 +223,7 @@ export class Breadcrumb {uploadFiles(protyle, [file]);} else {hideMessage(this.messageId);- this.messageId = showMessage(window.siyuan.languages.recording, -1);- this.mediaRecorder.startRecordingNewWavFile();+ this.startRecord(protyle)}}}).element);