Skip to content

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

:art: 校验索引发现文件系统相关问题并修复后自动刷新界面

Liang Ding675318dbbc2c
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index e4653d3bc8..881c7b1de9 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -1087,6 +1087,7 @@
"186": "Locking cloud sync directory",
"187": "Unlocking cloud sync directory",
"188": "Failed to lock the cloud sync directory, please try again later",
- "189": "Cloud sync directory is still locked by other devices, please try again later"
+ "189": "Cloud sync directory is still locked by other devices, please try again later",
+ "190": "A problem was found while validating the index, which has been automatically fixed"
}
}
diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json
index 6bea310a7c..d48f93140e 100644
--- a/app/appearance/langs/es_ES.json
+++ b/app/appearance/langs/es_ES.json
@@ -1087,6 +1087,7 @@
"186": "Bloqueando el directorio de sincronización de la nube",
"187": "Desbloqueando el directorio de sincronización en la nube",
"188": "Error al bloquear el directorio de sincronizaci\u00f3n en la nube, int\u00e1ntelo de nuevo m\u00e1s tarde",
- "189": "El directorio de sincronización en la nube todavía está bloqueado por otros dispositivos, inténtalo de nuevo más tarde"
+ "189": "El directorio de sincronización en la nube todavía está bloqueado por otros dispositivos, inténtalo de nuevo más tarde",
+ "190": "Se encontro un problema al validar el indice, el cual se soluciono automaticamente"
}
}
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index 07ce846867..71222c1d7d 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -1087,6 +1087,7 @@
"186": "Verrouillage du répertoire de synchronisation cloud",
"187": "Déverrouillage du répertoire de synchronisation cloud",
"188": "Échec du verrouillage du répertoire de synchronisation cloud, veuillez réessayer plus tard",
- "189": "Le répertoire de synchronisation cloud est toujours verrouillé par d'autres appareils, veuillez réessayer plus tard"
+ "189": "Le répertoire de synchronisation cloud est toujours verrouillé par d'autres appareils, veuillez réessayer plus tard",
+ "190": "Un problème a été trouvé lors de la validation de l'index, qui a été automatiquement corrigé"
}
}
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index b901cefe7e..3eaac3e05c 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -1087,6 +1087,7 @@
"186": "正在鎖定雲端同步目錄",
"187": "正在解鎖雲端同步目錄",
"188": "鎖定雲端同步目錄失敗,請稍後再試",
- "189": "雲端同步目錄還在被其他設備鎖定,請稍後再試"
+ "189": "雲端同步目錄還在被其他設備鎖定,請稍後再試",
+ "190": "校驗索引時發現一個問題,已經自動修復"
}
}
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index ed653cc7b2..75f1221fe7 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -1087,6 +1087,7 @@
"186": "正在锁定云端同步目录",
"187": "正在解锁云端同步目录",
"188": "锁定云端同步目录失败,请稍后再试",
- "189": "云端同步目录还在被其他设备锁定,请稍后再试"
+ "189": "云端同步目录还在被其他设备锁定,请稍后再试",
+ "190": "校验索引时发现一个问题,已经自动修复"
}
}
diff --git a/kernel/model/index_fix.go b/kernel/model/index_fix.go
index 7c5b5d1363..8898ebf34e 100644
--- a/kernel/model/index_fix.go
+++ b/kernel/model/index_fix.go
@@ -113,6 +113,7 @@ func resetDuplicateBlocksOnFileSys() {
boxes := Conf.GetBoxes()
luteEngine := lute.New()
blockIDs := map[string]bool{}
+ needRefreshUI := false
for _, box := range boxes {
boxPath := filepath.Join(util.DataDir, box.ID)
filepath.Walk(boxPath, func(path string, info os.FileInfo, err error) error {
@@ -158,6 +159,7 @@ func resetDuplicateBlocksOnFileSys() {
// 如果是文档根节点,则直接重置这颗树
logging.LogWarnf("exist more than one tree with the same id [%s], reset it", box.ID+p)
recreateTree(tree, path)
+ needRefreshUI = true
return ast.WalkStop
}
@@ -165,6 +167,7 @@ func resetDuplicateBlocksOnFileSys() {
needOverwrite = true
n.ID = ast.NewNodeID()
n.SetIALAttr("id", n.ID)
+ needRefreshUI = true
return ast.WalkContinue
})
@@ -177,6 +180,14 @@ func resetDuplicateBlocksOnFileSys() {
return nil
})
}
+
+ if needRefreshUI {
+ util.ReloadUI()
+ go func() {
+ time.Sleep(time.Second * 3)
+ util.PushMsg(Conf.Language(190), 5000)
+ }()
+ }
}
func recreateTree(tree *parse.Tree, absPath string) {