File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ export class TCVB
276276 const strFilePath : string = filePathNormalize ( arrFileMatch [ 1 ] ) ;
277277 const strOperationsBlock : string = arrFileMatch [ 2 ] ;
278278 // 支持操作类型中含有 "-" 符号(如 single-replace 等)
279- const regOperation : RegExp = / ^ # # O P E R A T I O N : ( [ \w - ] + ) \n ( [ \s \S ] * ?) (? = ^ # # O P E R A T I O N : ) / gm;
279+ const regOperation : RegExp = / ^ # # O P E R A T I O N : ( [ \w - ] + ) \n ( [ \s \S ] * ?) (? = ^ # # O P E R A T I O N : | (? ! [ \s \S ] ) ) / gm;
280280 let arrOpMatch : RegExpExecArray | null ;
281281 while ( ( arrOpMatch = regOperation . exec ( strOperationsBlock ) ) !== null )
282282 {
@@ -488,10 +488,9 @@ TCVB 格式规范:
488488[代码块:直接跟正文内容,表示新文件的全部内容]
489489
490490注意:
491- 1. 文件路径复用:同一文件下的多个操作共享 FILE 声明
492- 2. 混合操作:允许在文件块内任意顺序组合操作类型
493- 3. 锚点为连续的多行内容:使用至少3行唯一文本作为锚点,用来标定范围,防止混淆
494- 4. 代码块用 markdown 格式包裹
491+ 1. 文件路径复用:同一文件下## FILE ,可以有多个## OPERATION,不用每次重复相同的## FILE
492+ 2. 锚点为连续的多行内容:使用至少3行唯一文本作为锚点,用来标定范围,防止混淆
493+ 3. 代码块,(规则中的[代码块:...]) 用 markdown 格式包裹
495494` ;
496495 }
497496}
Original file line number Diff line number Diff line change @@ -170,7 +170,8 @@ async function uploadThisCvb(filePath: string) {
170170 }
171171 const workspacePath = workspaceFolders [ 0 ] . uri . fsPath ;
172172 const filepath = path . join ( workspacePath , "/prompt/testdata.txt" ) ;
173- const tcvbContent = fs . readFileSync ( filepath , 'utf-8' ) ;
173+ let tcvbContent = fs . readFileSync ( filepath , 'utf-8' ) ;
174+ tcvbContent = tcvbContent . replace ( / \r \n ? / g, "\n" ) ;
174175 const tcvb = new TCVB ( tcvbContent ) ;
175176 const cvbContent = fs . readFileSync ( filePath , 'utf-8' ) ;
176177 const oldCvb = new Cvb ( cvbContent ) ;
You can’t perform that action at this time.
0 commit comments