mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-08-03 14:28:40 +00:00
Compare commits
1 Commits
479b1cf9aa
...
8213b02595
Author | SHA1 | Date | |
---|---|---|---|
8213b02595 |
@ -19,8 +19,6 @@ class LineOutputParser extends BaseOutputParser<string> {
|
|||||||
lc_namespace = ['langchain', 'output_parsers', 'line_output_parser'];
|
lc_namespace = ['langchain', 'output_parsers', 'line_output_parser'];
|
||||||
|
|
||||||
async parse(text: string): Promise<string> {
|
async parse(text: string): Promise<string> {
|
||||||
text = text.trim() || '';
|
|
||||||
|
|
||||||
const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/;
|
const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/;
|
||||||
const startKeyIndex = text.indexOf(`<${this.key}>`);
|
const startKeyIndex = text.indexOf(`<${this.key}>`);
|
||||||
const endKeyIndex = text.indexOf(`</${this.key}>`);
|
const endKeyIndex = text.indexOf(`</${this.key}>`);
|
||||||
|
@ -19,13 +19,11 @@ class LineListOutputParser extends BaseOutputParser<string[]> {
|
|||||||
lc_namespace = ['langchain', 'output_parsers', 'line_list_output_parser'];
|
lc_namespace = ['langchain', 'output_parsers', 'line_list_output_parser'];
|
||||||
|
|
||||||
async parse(text: string): Promise<string[]> {
|
async parse(text: string): Promise<string[]> {
|
||||||
text = text.trim() || '';
|
|
||||||
|
|
||||||
const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/;
|
const regex = /^(\s*(-|\*|\d+\.\s|\d+\)\s|\u2022)\s*)+/;
|
||||||
const startKeyIndex = text.indexOf(`<${this.key}>`);
|
const startKeyIndex = text.indexOf(`<${this.key}>`);
|
||||||
const endKeyIndex = text.indexOf(`</${this.key}>`);
|
const endKeyIndex = text.indexOf(`</${this.key}>`);
|
||||||
|
|
||||||
if (startKeyIndex === -1 || endKeyIndex === -1) {
|
if (startKeyIndex === -1 && endKeyIndex === -1) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user