瀏覽代碼

filter prfix

nHigashiWeseek 1 年之前
父節點
當前提交
0189bf6c62
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      packages/markdown-splitter/src/services/markdown-token-splitter.ts

+ 1 - 1
packages/markdown-splitter/src/services/markdown-token-splitter.ts

@@ -27,7 +27,7 @@ function groupMarkdownFragments(
   // Process chunks so that the total token count per level doesn't exceed maxToken
   while (remainingPrefixes.length > 0) {
     const prefix = remainingPrefixes[0]; // Get the first prefix
-    const hasNextLevelPrefix = uniquePrefixes.some(p => p.startsWith(prefix));
+    const hasNextLevelPrefix = uniquePrefixes.some(p => p !== prefix && p.startsWith(prefix));
 
     if (!hasNextLevelPrefix) {
       // If there is no prefix that starts with the current prefix, group the chunks directly