An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Close the user guide when exiting Fix https://github.com/siyuan-note/siyuan/issues/10322
Daniel248bf8041522
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 1695105053..7f024883ed 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1157,7 +1157,6 @@"task.history.database.index.commit": "Execute history database index commit","task.database.index.embedBlock": "Execute database index embed block","task.reload.ui": "Execute reload UI",- "task.upgrade.userGuide": "Execute upgrade user guide","task.asset.database.index.full": "Execute asset database rebuild index","task.asset.database.index.commit": "Execute asset database index commit"},@@ -1408,6 +1407,7 @@"229": "Deleting cloud storage unreferenced snapshots...","230": "Deleting cloud storage unreferenced check indexes...","231": "Deleting unreferenced data objects in cloud storage...",- "232": "The cloud data storage has been purged. [%d] snapshots and [%d] data objects have been deleted, and a total of [%s] disk space has been released"+ "232": "The cloud data storage has been purged. [%d] snapshots and [%d] data objects have been deleted, and a total of [%s] disk space has been released",+ "233": "Closing user guide..."}}diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 31648733c5..4bed06fa47 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1157,7 +1157,6 @@"task.history.database.index.commit": "Ejecutar la confirmación del índice de la base de datos del historial","task.database.index.embedBlock": "Ejecutar bloque de incrustación de índice de base de datos","task.reload.ui": "IU de recarga de tareas",- "task.upgrade.userGuide": "Ejecutar la guía de usuario de actualización","task.asset.database.index.full": "Ejecutar índice de reconstrucción de base de datos de activos","task.asset.database.index.commit": "Ejecutar confirmación del índice de la base de datos de activos"},@@ -1408,6 +1407,7 @@"229": "Eliminando instantáneas sin referencia del almacenamiento en la nube...","230": "Eliminando índices de verificación sin referencia del almacenamiento en la nube...","231": "Eliminar objetos de datos no referenciados en el almacenamiento en la nube...",- "232": "Se ha eliminado el almacenamiento de datos en la nube. Se han eliminado [%d] instantáneas y [%d] objetos de datos, y se ha liberado un total de [%s] espacio en disco"+ "232": "Se ha eliminado el almacenamiento de datos en la nube. Se han eliminado [%d] instantáneas y [%d] objetos de datos, y se ha liberado un total de [%s] espacio en disco",+ "233": "Cerrando la guía del usuario..."}}diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex 8ac5193493..82847dc50a 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1157,7 +1157,6 @@"task.history.database.index.commit": "Effectuer la validation de l'index de la base de données d'historique","task.database.index.embedBlock": "Exécuter le bloc d'intégration d'index de base de données","task.reload.ui": "Interface utilisateur de rechargement de tâche",- "task.upgrade.userGuide": "Mise à niveau de la tâche de guide utilisateur","task.asset.database.index.full": "Exécuter l'index de reconstruction de la base de données d'actifs","task.asset.database.index.commit": "Exécuter la validation de l'index de la base de données des actifs"},@@ -1408,6 +1407,7 @@"229": "Suppression des instantanés non référencés du stockage cloud...","230": "Suppression des index de vérification non référencés du stockage cloud...","231": "Suppression des objets de données non référencés dans le stockage cloud...",- "232": "Le stockage de données cloud a été purgé. [%d] instantanés et [%d] objets de données ont été supprimés, et un total de [%s] espace disque a été libéré"+ "232": "Le stockage de données cloud a été purgé. [%d] instantanés et [%d] objets de données ont été supprimés, et un total de [%s] espace disque a été libéré",+ "233": "Fermeture du guide de l'utilisateur..."}}diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 04a839adb8..a25eb4dcc2 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1157,7 +1157,6 @@"task.history.database.index.commit": "執行歷史資料庫索引提交","task.database.index.embedBlock": "執行資料庫索引嵌入塊","task.reload.ui": "執行重載界面",- "task.upgrade.userGuide": "執行升級用戶指南","task.asset.database.index.full": "執行資源文件數據庫重建索引","task.asset.database.index.commit": "執行資源文件數據庫索引提交"},@@ -1408,6 +1407,7 @@"229": "正在刪除雲端儲存未引用快照...","230": "正在刪除雲端儲存未引用校驗快照...","231": "正在刪除雲端儲存未引用資料物件...",- "232": "雲端資料儲存清理完畢,已刪除 [%d] 個快照和 [%d] 個資料對象,共釋放 [%s] 磁碟空間"+ "232": "雲端資料儲存清理完畢,已刪除 [%d] 個快照和 [%d] 個資料對象,共釋放 [%s] 磁碟空間",+ "233": "正在關閉使用者指南..."}}diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 969c89a96d..db3763bca8 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1157,7 +1157,6 @@"task.history.database.index.commit": "执行历史数据库索引提交","task.database.index.embedBlock": "执行数据库索引嵌入块","task.reload.ui": "执行重载界面",- "task.upgrade.userGuide": "执行升级用户指南","task.asset.database.index.full": "执行资源文件数据库重建索引","task.asset.database.index.commit": "执行资源文件数据库索引提交"},@@ -1408,6 +1407,7 @@"229": "正在删除云端存储未引用快照...","230": "正在删除云端存储未引用校验快照...","231": "正在删除云端存储未引用数据对象...",- "232": "云端数据存储清理完毕,已删除 [%d] 个快照和 [%d] 个数据对象,共释放 [%s] 磁盘空间"+ "232": "云端数据存储清理完毕,已删除 [%d] 个快照和 [%d] 个数据对象,共释放 [%s] 磁盘空间",+ "233": "正在关闭用户指南..."}}diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex f6784af0cc..aed770dfd8 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -40,7 +40,6 @@ import ("github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/conf""github.com/siyuan-note/siyuan/kernel/sql"- "github.com/siyuan-note/siyuan/kernel/task""github.com/siyuan-note/siyuan/kernel/treenode""github.com/siyuan-note/siyuan/kernel/util""golang.org/x/mod/semver"@@ -284,7 +283,6 @@ func InitConf() {Conf.System.KernelVersion = util.VerConf.System.IsInsider = util.IsInsider- task.AppendTask(task.UpgradeUserGuide, upgradeUserGuide)}if nil == Conf.System.NetworkProxy {Conf.System.NetworkProxy = &conf.NetworkProxy{}@@ -533,7 +531,6 @@ var exitLock = sync.Mutex{}func Close(force bool, execInstallPkg int) (exitCode int) {exitLock.Lock()defer exitLock.Unlock()- util.IsExiting.Store(true)logging.LogInfof("exiting kernel [force=%v, execInstallPkg=%d]", force, execInstallPkg)util.PushMsg(Conf.Language(95), 10000*60)@@ -550,6 +547,10 @@ func Close(force bool, execInstallPkg int) (exitCode int) {}}+ // Close the user guide when exiting https://github.com/siyuan-note/siyuan/issues/10322+ closeUserGuide()++ util.IsExiting.Store(true)waitSecondForExecInstallPkg := falseif !skipNewVerInstallPkg() {if newVerInstallPkgPath := getNewVerInstallPkgPath(); "" != newVerInstallPkgPath {@@ -945,7 +946,7 @@ func clearWorkspaceTemp() {logging.LogInfof("cleared workspace temp")}-func upgradeUserGuide() {+func closeUserGuide() {defer logging.Recover()dirs, err := os.ReadDir(util.DataDir)@@ -976,10 +977,20 @@ func upgradeUserGuide() {data, readErr := filelock.ReadFile(boxConfPath)if nil != readErr {logging.LogErrorf("read box conf [%s] failed: %s", boxConfPath, readErr)+ if removeErr := filelock.Remove(boxDirPath); nil != removeErr {+ logging.LogErrorf("remove corrupted user guide box [%s] failed: %s", boxDirPath, removeErr)+ } else {+ logging.LogInfof("removed corrupted user guide box [%s]", boxDirPath)+ }continue}if readErr = gulu.JSON.UnmarshalJSON(data, boxConf); nil != readErr {logging.LogErrorf("parse box conf [%s] failed: %s", boxConfPath, readErr)+ if removeErr := filelock.Remove(boxDirPath); nil != removeErr {+ logging.LogErrorf("remove corrupted user guide box [%s] failed: %s", boxDirPath, removeErr)+ } else {+ logging.LogInfof("removed corrupted user guide box [%s]", boxDirPath)+ }continue}@@ -987,19 +998,14 @@ func upgradeUserGuide() {continue}- logging.LogInfof("upgrading user guide box [%s]", boxID)+ msgId := util.PushMsg(Conf.language(233), 30000)unindex(boxID)-- if err = filelock.Remove(boxDirPath); nil != err {- return+ if removeErr := filelock.Remove(boxDirPath); nil != removeErr {+ logging.LogErrorf("remove corrupted user guide box [%s] failed: %s", boxDirPath, removeErr)}- p := filepath.Join(util.WorkingDir, "guide", boxID)- if err = filelock.Copy(p, boxDirPath); nil != err {- return- }-- index(boxID)- logging.LogInfof("upgraded user guide box [%s]", boxID)+ sql.WaitForWritingDatabase()+ util.PushClearMsg(msgId)+ logging.LogInfof("closed user guide box [%s]", boxID)}}diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex a8c041462a..7b70d54853 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -190,7 +190,10 @@ func syncData(exit, byHand bool) {if exit {ExitSyncSucc = 0logging.LogInfof("sync before exit")- util.PushMsg(Conf.Language(81), 1000*60*15)+ msgId := util.PushMsg(Conf.Language(81), 1000*60*15)+ defer func() {+ util.PushClearMsg(msgId)+ }()}now := util.CurrentTimeMillis()diff --git a/kernel/task/queue.go b/kernel/task/queue.goindex 3d30f5ff28..4eba696ba5 100644--- a/kernel/task/queue.go+++ b/kernel/task/queue.go@@ -97,7 +97,6 @@ const (HistoryDatabaseIndexCommit = "task.history.database.index.commit" // 历史数据库索引提交DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块ReloadUI = "task.reload.ui" // 重载 UI- UpgradeUserGuide = "task.upgrade.userGuide" // 升级用户指南文档笔记本AssetContentDatabaseIndexFull = "task.asset.database.index.full" // 资源文件数据库重建索引AssetContentDatabaseIndexCommit = "task.asset.database.index.commit" // 资源文件数据库索引提交)