mirror of
				https://github.com/ItzCrazyKns/Perplexica.git
				synced 2025-11-03 20:28:14 +00:00 
			
		
		
		
	feat(listLineOutputParser): handle invalid keys
This commit is contained in:
		@@ -22,6 +22,11 @@ class LineListOutputParser extends BaseOutputParser<string[]> {
 | 
			
		||||
    const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/;
 | 
			
		||||
    const startKeyIndex = text.indexOf(`<${this.key}>`);
 | 
			
		||||
    const endKeyIndex = text.indexOf(`</${this.key}>`);
 | 
			
		||||
 | 
			
		||||
    if (startKeyIndex === -1 || endKeyIndex === -1) {
 | 
			
		||||
      return [];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const questionsStartIndex =
 | 
			
		||||
      startKeyIndex === -1 ? 0 : startKeyIndex + `<${this.key}>`.length;
 | 
			
		||||
    const questionsEndIndex = endKeyIndex === -1 ? text.length : endKeyIndex;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user