Skip to content

[Feat] OpenAI API 기반 동화 생성 기능 구현#17

Open
nomellc wants to merge 8 commits intomainfrom
feat/story-generation
Open

[Feat] OpenAI API 기반 동화 생성 기능 구현#17
nomellc wants to merge 8 commits intomainfrom
feat/story-generation

Conversation

@nomellc
Copy link
Contributor

@nomellc nomellc commented Feb 27, 2026

🐣 작업 개요

구현한 기능을 요약하여 정리합니다.

  • OpenAI GPT API를 활용하여 동화 생성 기능을 구현했습니다.
  • 기존에 구현된 제약값(파라미터) 및 프롬프트 빌더와 연결하여 실제 동화 텍스트를 생성하도록 구성했습니다.
  • 동화 생성 퀄리티 향상을 위해 레벨 파라미터와 동화 생성용 프롬프트를 수정했습니다.
  • 기존에 사용하던 제약값, 프롬프트빌더 테스트용 라우터를 제거했습니다.

📍 변경 사항

Create: story_router, story_schema, story_generator, story_orchestrator
Update: main, level_consts, prompt_builder, .gitignore
Delete: constraint_router, refiner_router

🚧 구현 중 겪은 이슈 및 해결 방법

  • 문제: .env 파일이 존재함에도 'OPENAI API KEY 환경변수가 설정되지 않았습니다. .env 파일을 확인해주세요.' 라는 에러가 떴습니다.
    해결: story_router.py의 전역 인스턴스 생성 코드가 호출되는 시점이 .env 파일을 불러오는 시점보다 빨라서 발생한 문제였습니다. 전역 인스턴스를 삭제하고 get_orchestrator()에서 객체를 생성함으로써 문제를 해결했습니다.
  • 문제: 동화 내용이 반복적이고 기승전결이 없었습니다.
    해결: 레벨 파라미터와 동화 생성용 프롬프트를 구체화해서 해결했습니다.

🚀 사용 방법

Request로 STT 원본 텍스트, 아동 레벨, 최근 WCPM, 취약 발음을 입력받으면
스크린샷 2026-02-27 오후 9 37 41

Response로 아래와 같이 받을 수 있습니다.
스크린샷 2026-02-27 오후 9 39 10

🔍 참고 사항

✨ 관련 이슈

🔧 변경 유형

  • Bug Fix (fix)
  • New Features (feat)
  • Test (test)
  • Document modification (docs)
  • Refactoring (refactor)
  • Styling (style)
  • ETC, No production code change (chore)
  • Build task and Dependency management (build)

@nomellc nomellc requested a review from jettieb February 27, 2026 12:39
@nomellc nomellc self-assigned this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] OpenAI API 기반 동화 생성 서비스 구현

1 participant