Add lucide-react package and remove unused icons

This commit is contained in:
n4ze3m
2024-02-25 18:44:47 +05:30
parent 06b32176a9
commit 43f3727369
37 changed files with 610 additions and 574 deletions

View File

@@ -3,12 +3,6 @@ import { Document } from "@langchain/core/documents"
import { compile } from "html-to-text"
import { chromeRunTime } from "~libs/runtime"
const isPDFFetch = async (url: string) => {
await chromeRunTime(url)
const response = await fetch(url)
const blob = await response.blob()
return blob.type === "application/pdf"
}
export interface WebLoaderParams {
html: string
url: string
@@ -16,8 +10,7 @@ export interface WebLoaderParams {
export class PageAssistHtmlLoader
extends BaseDocumentLoader
implements WebLoaderParams
{
implements WebLoaderParams {
html: string
url: string
@@ -35,4 +28,20 @@ export class PageAssistHtmlLoader
const metadata = { source: this.url }
return [new Document({ pageContent: text, metadata })]
}
async loadByURL(): Promise<Document<Record<string, any>>[]> {
await chromeRunTime(this.url)
const fetchHTML = await fetch(this.url)
const html = await fetchHTML.text()
const htmlCompiler = compile({
wordwrap: false,
selectors: [
{ selector: "img", format: "skip" },
{ selector: "script", format: "skip" }
]
})
const text = htmlCompiler(html)
const metadata = { source: this.url }
return [new Document({ pageContent: text, metadata })]
}
}