Skip to content

계승: v1.6.1#105

Merged
GulSauce merged 2 commits intodevelopfrom
main
Jan 21, 2026
Merged

계승: v1.6.1#105
GulSauce merged 2 commits intodevelopfrom
main

Conversation

@GulSauce
Copy link
Member

@GulSauce GulSauce commented Jan 21, 2026

📢 설명

해당 Pull Request에 대해 간략하게 설명해주세요!

✅ 체크 리스트

  • 리뷰어가 체크할 내용을 작성해주세요!

Summary by CodeRabbit

  • Documentation

    • Enhanced README with detailed explanations of endpoint behavior
  • Bug Fixes

    • Removed PPTX file support
    • Updated PDF validation to enforce minimum content length requirements
  • Improvements

    • Rate limiting is now configurable via environment variables
    • Request timeout handling is now configurable via environment variables

✏️ Tip: You can customize this high-level summary in your review settings.

@GulSauce GulSauce merged commit 2440cbc into develop Jan 21, 2026
2 of 3 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The application's GPT request handling transitions from synchronous to asynchronous operations, replacing the blocking OpenAI client with AsyncOpenAI and removing thread-pool-based processing. Environment-based configuration is added for request timeouts and rate-limiting parameters. PDF parsing logic is refactored to remove PPTX support and enforce content length validation instead of page-count limits.

Changes

Cohort / File(s) Summary
Async Client & Batch Request Processing
app/adapter/request_batch.py, app/client/oepn_ai.py
Converts request_chat_completion_text to async and replaces synchronous to_thread pattern with coroutine-based batch processing. Switches OpenAI client from synchronous to AsyncOpenAI; updates type hints and singleton initialization. Introduces asyncio task management with timeout handling and explicit cancellation for timed-out requests.
Service Layer & Configuration
app/service/generate_service.py, app/util/rate_limiter.py
Integrates rate-limiter check before GPT batch processing and parameterizes timeout via GPT_REQUEST_TIMEOUT environment variable. Replaces hard-coded rate-limiter defaults with environment-driven configuration (RATE_LIMIT_WINDOW_SECONDS and RATE_LIMIT_MAX_REQUESTS); requires explicit environment variable reads at initialization.
File Parsing
app/util/parsing.py
Removes PPTX file handling and page-count validation; introduces content length validation for PDFs using MIN_TEXT_LENGTH environment variable. Returns HTTP 400 if text content is insufficient. Restructures page selection logic and modifies empty-page prefixing behavior.
Documentation
README.md
Adds detailed Korean explanation of FastAPI async vs. def endpoint behavior, including control flow differences, event loop usage, and implications of blocking operations on main vs. worker threads.

Sequence Diagram

sequenceDiagram
    participant Service as Generate Service
    participant RateLim as Rate Limiter
    participant Batch as Request Batch
    participant OpenAI as AsyncOpenAI Client
    
    Service->>RateLim: check_rate(quiz_count)
    alt Rate limit exceeded
        RateLim-->>Service: Raise error
    else Rate limit OK
        RateLim-->>Service: Allow
        Service->>Batch: request_text_batch(requests, timeout)
        Batch->>Batch: Create async tasks for each request
        loop Per request handler
            Batch->>OpenAI: await request_chat_completion_text(gpt_request)
            OpenAI-->>Batch: content response
        end
        Batch->>Batch: asyncio.wait(tasks, timeout=GPT_REQUEST_TIMEOUT)
        alt Timeout occurred
            Batch->>Batch: Cancel pending tasks
            Batch-->>Service: Return partial results
        else Completed within timeout
            Batch-->>Service: Return all results
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Async hops through the threadless night,
No blocking calls will slow my flight!
With AsyncOpenAI and env config,
Rate limits check before I knock.
PDFs measured by their words' delight,
The rabbit's code runs ever bright! 🚀

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot mentioned this pull request Jan 25, 2026
1 task
GulSauce added a commit that referenced this pull request Feb 1, 2026
* [ICC-25] 구성 완료

* [ICC-29] 구현 완료

* [ICC-29] 응답 구조 수정

* [ICC-30] 작성 완료

* [ICC-31] 레디스 구독 패턴 구현 완료

* [ICC-31] 레디스 클라이언트를 각 생성마다 생성되게함

* [ICC-31] 필요 없는 의존성 제거

* [ICC-31] requirements.txt 등록

* [ICC-31] 베드락에 요청하는 코드 분리

* [ICC-31] 타입아웃 설정

* [ICC-32] 첫번째 시도

* [ICC-32] 두번째 시도

* [ICC-32] 세번째 시도

* [ICC-32] 네번째 시도

* [ICC-32] 다섯번째 시도

* [ICC-32] 성공

* [ICC-32] 리모트환경에서는 바로 SQS를 보게함

* [ICC-32] 임시 수정

* [ICC-32] boto3 의존성 추가

* [ICC-32] 리전 추가

* [ICC-32] 반응 브랜치 변경

* [ICC-39] 구현 완료

* [ICC-47] quiz parsing (#13)

* [ICC-35] Create 5 Quiz

* ICC-38 json 객체 테스트

* [ICC-47] Redis 주석 처리 해제

---------

Co-authored-by: Oh YoungJe <pine7420@naver.com>

* [ICC-49] Dependency 해결

* [ICC-50] API서버 연결 간 문제 해결 (#15)

* [ICC-50] generation으로 엔드포인트 변경

* [ICC-50] api와 연결간 오류 해결

* [ICC-53] 구현 완료

* [ICC-53] 로거, 전역 예외처리기 추가

* [ICC-53] 일부 수정

* [ICC-57] 구현 완료

* [ICC-67] 응답 구조 수정 완료

* [ICC-63] Webb's DOK

# Conflicts:
#	app/service/generate_service.py

* [ICC-63] 추가 코드 작성

* [ICC-70] api 수정

* [ICC-48] MCP 기능 구현  완료

* [ICC-48] MCP 리서치

* [ICC-48] 엔드포인트 분리

* [ICC-74] 요청 dto 변경

* [ICC-74] 페이지 일부만 가져오기 구현 완료

* [ICC-74] 파워포인트도 적용 완료

* [ICC-74] 불필요한 로그출력 제거

* [ICC-74] 페이지 선택 방식 변경

* [ICC-76] 발생한 문제 해결

* [ICC-76] 코드 수정

* [ICC-80] 프롬프트 추가

* [ICC-80] 프롬프트 추가

* [ICC-80] 롤백

* [ICC-80] 롤백

* [ICC-87] 최대 청크 개수 증가

* [ICC-87] 기본 구조 작성

* [ICC-87] 레디스 분산락 구현

* [ICC-87] 필요 없는  레디스 함수 제거:

* [ICC-87] 한번에 데이터를 넣게 함

* [ICC-99] generate dto 변경

* [ICC-99] 구현 완료

* [ICC-99] generate dto 변경

* [ICC-99] 구현 완료

* [ICC-94] specific explanation 서비스 추가

* [ICC-94] 구현완료

* ICC-112 OX 프롬프트 수정

* [ICC-112] 리팩터링 + BLANK 타입 추가

* [ICC-134] 필요한 프롬프트 추가

* [ICC-164] 작성 완료

* [ICC-167] 프롬프트 수정

* [ICC-167] 프롬프트 변경

* [ICC-167] 프롬프트 변경

* [ICC-167] 프롬프트 변경

* [ICC-167] 프롬프트 변경

* [ICC-167] 프롬프트 변경

* [ICC-167] 프롬프트 수정

* [ICC-167] 프롬프트 수정

* [ICC-167] 프롬프트 수정

* [ICC-167] 잘못된 프롬프트 반환 수정

* [ICC-167] 잘못된 프롬프트 반환 수정

* [ICC-167] 모델 변경

* [ICC-167] 리팩터링 완료

* [ICC-167] 코드 포맷팅

* [ICC-167] 제약사항 반영

* [ICC-167] 프롬프트 수정

* [ICC-167] 리팩터링

* [ICC-175] 도커 컴포즈 제거

* [ICC-175] 개발 깃허브 액션 스크립터 제거

* [ICC-180] 셔플 로직 추가

* [ICC-180] CD 브랜치명 올바르게 변경

* [ICC-189] 타임아웃시 전체 실패가 아닌 일부라도 반환하게함

* [ICC-192] 로직변경완료

* [ICC-194] 선지를 밝히지 말라는 문구 추가

* [ICC-196] 마이그레이션 완료

* [ICC-196] 프롬프트 롤백

* [ICC-196] min quiz size todo에 추가

* [ICC-196] 개행 문구 추가

* [ICC-200] 타입에 따라 셔플하도록 함

* Refactor quiz generation and explanation services; remove unused Bedrock adapter and integrate GPT for specific explanations. Update router to utilize new explanation service.

* [ICC-212] 커서를 통한 1차 리팩터링 완료

* [ICC-212] 어댑터 단순화

* [ICC-212] 블랙 포맷팅 적용

* [ICC-212] 기능 동작하게 수정 완료

* [ICC-212] 개행 프롬프트 추가

* [ICC-212] 구성 완료

* [ICC-215] 수정 완료

* [ICC-216] 구현 코드 작성 완료

* [ICC-216] 객관식 프롬프트 개선

* [ICC-220] 타임아웃 시 해당 문제만 실패하게 조정

* [ICC-221] env 중복참조 수정

* [ICC-220] 환경변수를 없애고 스레드 관점에서 타임아웃으로 조정

* [ICC-220] 불필요한 참조 제거

* [ICC-220] 불필요한 참조 제거

* v 1.5.5 (#97) (#98)

* [ICC-235] 비동기 클라이언트로 변경 완료 (#99)

* v 1.6.0 (#100) (#101)

* [ICC-229] 분리 완료 (#102)

* [ICC-233] 파일 텍스트 부족시 반환 (#103)

* [ICC-233] 구현 완료

* [ICC-230] 페이지 제한 환경변수화

* 계승: v1.6.1 (#105)

* v 1.6.0 (#100)

* v 1.6.1 (#104)

* [ICC-237] OCR로 변경 완료 (#106)

* [ICC-238]  수정 완료 (#108)

* [ICC-238] 수정 완료

* [ICC-241] 구현 완료

* [ICC-241] 최소 3개의 청크는 빨리 응답하도록 함

* [ICC-245] 응답구조 수정

* Hotfixgit add . import 누락 추가

---------

Co-authored-by: 이찬우 <105221020+ChanJinYeon@users.noreply.github.com>
Co-authored-by: Adansonia <lcw061145@gmail.com>
Co-authored-by: lhoju0158 <lhoju0158@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant