UNPKG

@restnfeel/agentc-starter-kit

Version:

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

20 lines (18 loc) 752 B
import { WebpageSummarizer } from '../summarizer'; describe('WebpageSummarizer', () => { it('should chunk long content and call LLM for each chunk', async () => { // LLM 호출을 mock 처리 (실제 OpenAI 호출 X) const apiKey = 'test-key'; const summarizer = new WebpageSummarizer(apiKey, { maxChunkLength: 10, summaryLength: 5 }); // @ts-ignore summarizer['openai'].chat = { completions: { create: async () => ({ choices: [{ message: { content: '요약' } }] }), }, }; const content = '01234567890123456789'; // 20자, 10자씩 2청크 const result = await summarizer.summarize(content); expect(result.summary).toBe('요약\n요약'); expect(result.fullText).toBe(content); }); });