fix(wiki): clear stale citation chunks on deletion

This commit is contained in:
langcaiye
2026-06-11 19:29:29 +08:00
committed by lyingbug
parent 903b014992
commit a0786b6fe7
4 changed files with 85 additions and 29 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ package middleware
import (
"context"
stderrors "errors"
"strings"
apprepo "github.com/Tencent/WeKnora/internal/application/repository"
"github.com/Tencent/WeKnora/internal/config"
@@ -190,7 +191,8 @@ func KBIDFromChunkIDParam(param string, chunkService ChunkLookup) KBIDResolver {
// before this refactor is useful.
func isResourceNotFound(err error) bool {
return stderrors.Is(err, apprepo.ErrKnowledgeBaseNotFound) ||
stderrors.Is(err, ErrResourceNotFound)
stderrors.Is(err, ErrResourceNotFound) ||
strings.TrimSpace(err.Error()) == "chunk not found"
}
// RequireKBAccess returns a gin.HandlerFunc that resolves KB access