update pi
This commit is contained in:
@@ -42,9 +42,10 @@ export async function extractPDFToMarkdown(
|
||||
|
||||
const pdf = await getDocumentProxy(new Uint8Array(buffer));
|
||||
const metadata = await pdf.getMetadata();
|
||||
const info = (metadata.info ?? {}) as Record<string, unknown>;
|
||||
|
||||
// Extract title from metadata or URL
|
||||
const metaTitle = metadata.info?.Title as string | undefined;
|
||||
const metaTitle = typeof info.Title === "string" ? info.Title : undefined;
|
||||
const urlTitle = extractTitleFromURL(url);
|
||||
const title = metaTitle?.trim() || urlTitle;
|
||||
|
||||
@@ -79,8 +80,9 @@ export async function extractPDFToMarkdown(
|
||||
lines.push("");
|
||||
lines.push(`> Source: ${url}`);
|
||||
lines.push(`> Pages: ${pdf.numPages}${truncated ? ` (extracted first ${pagesToExtract})` : ""}`);
|
||||
if (metadata.info?.Author) {
|
||||
lines.push(`> Author: ${metadata.info.Author}`);
|
||||
const author = typeof info.Author === "string" ? info.Author : undefined;
|
||||
if (author) {
|
||||
lines.push(`> Author: ${author}`);
|
||||
}
|
||||
lines.push("");
|
||||
lines.push("---");
|
||||
|
||||
Reference in New Issue
Block a user