Skip to content
RexmetaPublic

About

bitebi

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

AI 설정 (Gemini)

이 프로젝트의 AI 생성 경로는 Gemini API를 사용하도록 구성되어 있습니다.

1) 환경변수

로컬 개발(.env.local)과 Vercel 프로젝트 환경변수에 아래 값을 설정하세요.

GEMINI_API_KEY=your_google_ai_studio_key

GEMINI_MODEL=gemini-2.5-flash-lite
NEXT_PUBLIC_SITE_URL=https://your-domain.com
NEXT_PUBLIC_MANUAL_ADS=false
  • GEMINI_API_KEY는 필수입니다.
  • GEMINI_MODEL 미설정 시 기본값은 gemini-2.5-flash-lite입니다.
  • NEXT_PUBLIC_MANUAL_ADS=false이면 수동 광고 슬롯은 렌더링하지 않고(빈 공간 제거), 애드센스 자동 광고만 사용합니다.

2) Vercel에서 설정 방법

  1. Vercel Dashboard → 프로젝트 선택

  2. Settings → Environment Variables 이동

  3. 아래 키를 Production, Preview, Development에 추가

    • GEMINI_API_KEY
    • GEMINI_MODEL (선택)
    • NEXT_PUBLIC_SITE_URL
    • NEXT_PUBLIC_MANUAL_ADS (false 권장: 자동 광고만 사용)
  4. 저장 후 Redeploy

3) GitHub Actions 콘텐츠 자동화 설정

프로젝트는 GitHub Actions를 통해 AI 콘텐츠를 자동 생성합니다.

GitHub Repository Secrets 설정:

  1. GitHub 저장소 → Settings → Secrets and variables → Actions
  2. New repository secret 클릭
  3. 필수 Secret 추가:
    • GEMINI_API_KEY: Google AI Studio API 키
    • NEXT_PUBLIC_SITE_URL: 프로덕션 사이트 URL (선택)

자동화 워크플로우:

  • 일일 콘텐츠 (.github/workflows/generate-daily-content.yml)

    • 매일 오전 9시(KST) 실행
    • 일일 시장 리포트 + 플래시 브리핑 생성
    • 수동 실행: GitHub Actions 탭에서 "Generate Daily AI Content" → Run workflow
  • 주간 콘텐츠 (.github/workflows/generate-weekly-content.yml)

    • 매주 월요일 오전 9시(KST) 실행
    • 코인 분석, 토픽 기사, 용어 사전 생성
    • 수동 실행: GitHub Actions 탭에서 "Generate Weekly AI Content" → Run workflow

로컬에서 수동 생성:

# 환경 변수 설정
export GEMINI_API_KEY=your_api_key

# 일일 콘텐츠만 생성
npm run generate:daily

# 모든 콘텐츠 타입 생성
npm run generate:all

# 특정 타입만 생성
npm run generate -- --types=coins,topics

4) 뉴스 생성 경로 (단일화)

  • API 엔드포인트: /api/generate-news
  • 내부 흐름:
    1. lib/generateNews.ts의 fetchAndGenerateNews()가 시장/RSS 데이터를 수집
    2. 같은 파일의 generateAiNews()가 Gemini 배치 1회 호출로 제목/요약을 재작성
    3. app/api/generate-news/route.ts는 generateAiNews() 결과만 반환

즉, 뉴스 AI 생성 로직은 lib/generateNews.ts 한 경로로 통일됩니다.

5) 일일 시장 리포트 생성 구조

일일 리포트는 lib/contentGenerator.ts의 generateDailyReport(date)가 중심입니다.

  1. 데이터 수집 (병렬)
    • fetchCoinMarket()
    • fetchMarketGlobal()
    • fetchFearGreed()
    • fetchLatestNews(8)
  2. 파생 데이터 계산
    • BTC/ETH 스냅샷
    • 상승/하락 Top3
    • 시가총액/도미넌스/공포탐욕 지표
  3. Gemini 생성 (병렬)
    • BTC 분석
    • ETH 분석
    • 시장 전망
    • 핵심 이슈 5개
    • 3문장 요약
  4. 정규화/후처리
    • 핵심 이슈 번호 파싱
    • SEO 키워드 생성
  5. API 캐싱/저장
    • /api/daily-report에서 public/content/daily-reports/{date}.json 파일 캐시 사용
    • 캐시 없으면 생성 후 파일 저장

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

bitebi

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages