import { Provide } from '@midwayjs/core';
import { CheerioWebBaseLoader } from '@langchain/community/document_loaders/web/cheerio';

/**
 * 链接加载器
 */
@Provide()
export class KnowCheerioLoader {
  /**
   * 加载链接
   * @param link
   * @returns
   */
  async loadLink(link: string) {
    const loader = new CheerioWebBaseLoader(link);
    const docs = await loader.load();
    return docs;
  }
}
