Last translated: 13 Jun 2025

Translation Not Available Yet

This repository's README hasn't been translated yet. Once translated, it will be easier to read and understand in your native language (中文).

After translating, add the links to README so others can view it directly.

GPT 크롤러

하나 이상의 URL에서 나만의 맞춤형 GPT를 생성하기 위해 사이트를 크롤링하여 지식 파일을 생성합니다.

크롤링 실행을 보여주는 GIF

예시

Builder.io 문서 URL을 제공하기만 하면 Builder 사용 및 통합 방법에 대한 질문에 답변할 수 있도록 빠르게 만든 맞춤형 GPT입니다.

이 프로젝트는 문서를 크롤링하고 맞춤형 GPT의 기반으로 업로드한 파일을 생성했습니다.

Builder.io를 사이트에 통합하는 방법에 대해 질문하여 직접 사용해 보세요.

참고: 이 기능을 사용하려면 유료 ChatGPT 플랜이 필요할 수 있습니다.

시작하기

로컬에서 실행하기

저장소 복제

Node.js >= 16이 설치되어 있는지 확인하세요.

git clone https://github.com/builderio/gpt-crawler

의존성 설치

npm i

크롤러 구성

config.ts를 열고 urlselector 속성을 필요에 맞게 편집하세요.

예를 들어, 맞춤형 GPT를 만들기 위해 Builder.io 문서를 크롤링하려면 다음을 사용할 수 있습니다:

export const defaultConfig: Config = {
  url: "https://www.builder.io/c/docs/developers",
  match: "https://www.builder.io/c/docs/**",
  selector: `.docs-builder-container`,
  maxPagesToCrawl: 50,
  outputFileName: "output.json",
};

모든 사용 가능한 옵션은 config.ts를 참조하세요. 일반적인 구성 옵션의 샘플은 다음과 같습니다:

type Config = {
  /** URL to start the crawl, if sitemap is provided then it will be used instead and download all pages in the sitemap */
  url: string;
  /** Pattern to match against for links on a page to subsequently crawl */
  match: string;
  /** Selector to grab the inner text from */
  selector: string;
  /** Don't crawl more than this many pages */
  maxPagesToCrawl: number;
  /** File name for the finished data */
  outputFileName: string;
  /** Optional resources to exclude
   *
   * @example
   * ['png','jpg','jpeg','gif','svg','css','js','ico','woff','woff2','ttf','eot','otf','mp4','mp3','webm','ogg','wav','flac','aac','zip','tar','gz','rar','7z','exe','dmg','apk','csv','xls','xlsx','doc','docx','pdf','epub','iso','dmg','bin','ppt','pptx','odt','avi','mkv','xml','json','yml','yaml','rss','atom','swf','txt','dart','webp','bmp','tif','psd','ai','indd','eps','ps','zipx','srt','wasm','m4v','m4a','webp','weba','m4b','opus','ogv','ogm','oga','spx','ogx','flv','3gp','3g2','jxr','wdp','jng','hief','avif','apng','avifs','heif','heic','cur','ico','ani','jp2','jpm','jpx','mj2','wmv','wma','aac','tif','tiff','mpg','mpeg','mov','avi','wmv','flv','swf','mkv','m4v','m4p','m4b','m4r','m4a','mp3','wav','wma','ogg','oga','webm','3gp','3g2','flac','spx','amr','mid','midi','mka','dts','ac3','eac3','weba','m3u','m3u8','ts','wpl','pls','vob','ifo','bup','svcd','drc','dsm','dsv','dsa','dss','vivo','ivf','dvd','fli','flc','flic','flic','mng','asf','m2v','asx','ram','ra','rm','rpm','roq','smi','smil','wmf','wmz','wmd','wvx','wmx','movie','wri','ins','isp','acsm','djvu','fb2','xps','oxps','ps','eps','ai','prn','svg','dwg','dxf','ttf','fnt','fon','otf','cab']
   */
  resourceExclusions?: string[];
  /** Optional maximum file size in megabytes to include in the output file */
  maxFileSize?: number;
  /** Optional maximum number tokens to include in the output file */
  maxTokens?: number;
};

크롤러 실행

npm start

대체 방법

Docker로 컨테이너에서 실행하기

컨테이너화된 실행으로 output.json을 얻으려면 containerapp 디렉토리로 이동하여 위와 같이 config.ts를 수정하세요. output.json 파일은 data 폴더에 생성됩니다. 참고: containerapp 디렉토리의 config.ts 파일에 있는 outputFileName 속성은 컨테이너와 함께 작동하도록 구성되어 있습니다.

API로 실행하기

앱을 API 서버로 실행하려면 의존성을 설치하기 위해 npm install을 실행해야 합니다. 서버는 Express JS로 작성되었습니다.

서버를 실행하려면:

npm run start:server로 서버를 시작하세요. 서버는 기본적으로 3000 포트에서 실행됩니다.

크롤러를 실행하려면 /crawl 엔드포인트에 config json의 POST 요청 본문을 사용할 수 있습니다. API 문서는 /api-docs 엔드포인트에서 제공되며 swagger를 사용하여 제공됩니다.

환경을 수정하려면 .env.example.env로 복사하고 포트 등의 값을 설정하여 서버의 변수를 재정의할 수 있습니다.

OpenAI에 데이터 업로드

크롤링은 이 프로젝트의 루트에 output.json이라는 파일을 생성합니다. 이를 OpenAI에 업로드하여 맞춤형 어시스턴트 또는 맞춤형 GPT를 생성하세요.

맞춤형 GPT 생성

이 옵션은 생성된 지식에 대한 UI 액세스를 위해 사용되며 다른 사람들과 쉽게 공유할 수 있습니다.

참고: 현재 맞춤형 GPT를 생성하고 사용하려면 유료 ChatGPT 플랜이 필요할 수 있습니다.

  1. https://chat.openai.com/로 이동하세요.
  2. 왼쪽 하단에 있는 이름을 클릭하세요.
  3. 메뉴에서 "My GPTs"를 선택하세요.
  4. "Create a GPT"를 선택하세요.
  5. "Configure"를 선택하세요.
  6. "Knowledge"에서 "Upload a file"을 선택하고 생성한 파일을 업로드하세요.
  7. 파일이 너무 크다는 오류가 발생하면 config.ts 파일의 maxFileSize 옵션을 사용하여 파일을 여러 개로 분할하거나 maxTokens 옵션을 사용하여 파일 크기를 줄일 수 있습니다.

맞춤형 GPT 업로드 방법 GIF

맞춤형 어시스턴트 생성

이 옵션은 제품에 통합할 수 있는 생성된 지식에 대한 API 액세스를 위해 사용됩니다.

  1. https://platform.openai.com/assistants로 이동하세요.
  2. "+ Create"를 클릭하세요.
  3. "upload"를 선택하고 생성한 파일을 업로드하세요.

어시스턴트에 업로드하는 방법 GIF

기여하기

이 프로젝트를 개선할 방법을 알고 계신가요? PR을 보내주세요!



Made with love by Builder.io