소스 검색

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