UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

25 lines (20 loc) 689 B
import { Document } from "../types"; import { BaseDocumentLoader } from "./base"; export class TextDocumentLoader extends BaseDocumentLoader { supportedExtensions = ["txt", "md", "markdown"]; async load(filePath: string, content: Buffer): Promise<Document> { try { const text = content.toString("utf-8"); const cleanedText = this.cleanText(text); const metadata = this.createBaseMetadata(filePath, content.length); return { id: this.generateDocumentId(filePath), content: cleanedText, metadata, source: filePath, }; } catch (error) { throw new Error(`Failed to load text document: ${error}`); } } }