remove unnecessary async/await

This commit is contained in:
German Swan 2024-03-21 12:23:08 +02:00
parent 43448b1853
commit f6c8fbec3b
2 changed files with 7 additions and 6 deletions

View file

@ -2,7 +2,8 @@ import { Readability } from "@mozilla/readability";
import { Chunk } from "../..";
import { MAX_CHUNK_SIZE } from "../../llm/constants";
import { cleanFragment, cleanHeader } from "../chunk/markdown";
import { PageData } from "./crawl"
import { PageData } from "./crawl";
import type jsdom from "jsdom";
export type ArticleComponent = {
title: string;
@ -138,8 +139,8 @@ export function stringToArticle(
return undefined;
}
let article_components = await extractTitlesAndBodies(article.content);
let article_components = extractTitlesAndBodies(article.content);
return {
url,
subpath,
@ -152,9 +153,9 @@ export function stringToArticle(
}
}
export async function pageToArticle(
export function pageToArticle(
page: PageData
): Promise<Article | undefined> {
): Article | undefined {
try {
return stringToArticle(page.url, page.html, page.path);
} catch (err) {

View file

@ -29,7 +29,7 @@ export async function* indexDocs(
const articles: Article[] = [];
for await (const page of crawlPage(baseUrl)) {
const article = await pageToArticle(page);
const article = pageToArticle(page);
if (!article) continue;
articles.push(article);