mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-05 11:50:41 +08:00
Update build-document.ts
This commit is contained in:
parent
67a2989874
commit
09dd5136b7
@ -4,14 +4,12 @@ export function buildDocument(document: Document): string {
|
|||||||
const metadata = document.metadata;
|
const metadata = document.metadata;
|
||||||
const markdown = document.markdown;
|
const markdown = document.markdown;
|
||||||
|
|
||||||
const documentMetadataString = `\nHere is the metadata for the document:\n${JSON.stringify(
|
// for each key in the metadata allow up to 250 characters
|
||||||
metadata,
|
const metadataString = Object.entries(metadata).map(([key, value]) => {
|
||||||
null,
|
return `${key}: ${value?.toString().slice(0, 250)}`;
|
||||||
2
|
}).join('\n');
|
||||||
)}`;
|
|
||||||
|
|
||||||
|
const documentMetadataString = `\n- - - - - Page metadata - - - - -\n${metadataString}`;
|
||||||
const documentString = `${markdown}${documentMetadataString}`;
|
const documentString = `${markdown}${documentMetadataString}`;
|
||||||
|
return documentString;
|
||||||
console.log("documentString", documentString);
|
|
||||||
return markdown ?? "";
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user