fix: Improve line filtering in code completion

- Adjusted the condition to yield chunks only if not starting with certain characters
- Ensured that empty lines or lines starting with ), ], or } are excluded
- Optimized chunk filtering logic for better code completion accuracy
This commit is contained in:
bobo.yang 2024-04-16 09:40:54 +08:00
parent ff7d63539c
commit e3eff72c43

View File

@ -187,8 +187,7 @@ export class LLMStreamComplete {
if (index > 0 && preIndent === 0 && lineIndent === 0) {
break;
}
if (index > 0 && hasIndentBigger && lineIndent === this.curlineIndent && chunk.text.trim().length > 3) {
yield chunk;
if (index > 0 && hasIndentBigger && lineIndent === this.curlineIndent && chunk.text.trim().length > 0 && ![')',']', '}'].includes(chunk.text.trim()[0])) {
break;
}
if (lineIndent > this.curlineIndent) {