remove unnecessary async/await
This commit is contained in:
parent
43448b1853
commit
f6c8fbec3b
2 changed files with 7 additions and 6 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue