mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
fix: handle empty markdown string and footnote content
This commit is contained in:
parent
6c3ed9ba6d
commit
1d531ceffe
@ -164,6 +164,7 @@ ${formatReferences(references)}
|
|||||||
* It extracts existing footnote definitions and uses them as references
|
* It extracts existing footnote definitions and uses them as references
|
||||||
*/
|
*/
|
||||||
export function repairMarkdownFootnotesOuter(markdownString: string): string {
|
export function repairMarkdownFootnotesOuter(markdownString: string): string {
|
||||||
|
if (!markdownString) return '';
|
||||||
// First trim the string to handle any extra whitespace
|
// First trim the string to handle any extra whitespace
|
||||||
markdownString = markdownString.trim();
|
markdownString = markdownString.trim();
|
||||||
|
|
||||||
@ -203,6 +204,7 @@ export function repairMarkdownFootnotesOuter(markdownString: string): string {
|
|||||||
let footnoteMatch;
|
let footnoteMatch;
|
||||||
while ((footnoteMatch = footnoteDefRegex.exec(footnotesPart)) !== null) {
|
while ((footnoteMatch = footnoteDefRegex.exec(footnotesPart)) !== null) {
|
||||||
// The footnote content
|
// The footnote content
|
||||||
|
if (!footnoteMatch[2]) continue;
|
||||||
let content = footnoteMatch[2].trim();
|
let content = footnoteMatch[2].trim();
|
||||||
|
|
||||||
// Extract URL and title if present
|
// Extract URL and title if present
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user