Merged
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis change refactors the request batching layer to use a new Responses API text extraction flow, restructures chunk generation to work with page counts instead of page lists with embedded text, and enhances the service layer with PDF fetching, page selection, and embedded PDF context in GPT prompts. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client/Service
participant Adapter as Request Adapter
participant OpenAI as OpenAI API
participant Parser as Response Parser
Client->>Adapter: request_responses_batch(requests, timeout)
Adapter->>Adapter: Start async batch with wait_for
loop For each request
Adapter->>OpenAI: Submit GPT request
OpenAI-->>Adapter: Return Responses object
Adapter->>Parser: request_responses_output_text(response)
Parser->>Parser: Try resp.output_text
alt Found output_text
Parser-->>Adapter: Return extracted text
else Search resp.output list
Parser->>Parser: Find dict with type="message"
Parser->>Parser: Extract from text/output_text/value keys
Parser-->>Adapter: Return first non-empty string or empty
end
end
Adapter->>Adapter: Collect results (completed + cancelled tasks)
Adapter-->>Client: Return List[Optional[str]]
sequenceDiagram
participant Service as Generate Service
participant PDF as PDF Fetcher
participant Chunks as Chunk Creator
participant Cache as PDF Cache
participant Adapter as Request Adapter
participant GPT as OpenAI API
Service->>PDF: Fetch PDF from URL
PDF-->>Service: PDF content + page_count
Service->>Chunks: create_page_chunks(page_count, quiz_count, max_chunks)
Chunks-->>Service: List[ChunkInfo] with referenced_pages
Service->>Service: Expand chunks (ensure ≤2 quizzes per chunk)
loop For each chunk
Service->>Cache: Check if pages cached
alt Not cached
Service->>PDF: Extract base64 for referenced_pages
PDF-->>Cache: Store extracted PDF
else Cached
Cache-->>Service: Return cached PDF
end
Service->>Service: Build prompt with embedded PDF + page hints
Service->>Adapter: Add to batch request with PDF context
end
Service->>Adapter: request_responses_batch(all_requests, timeout)
Adapter->>GPT: Submit batch with PDF-embedded prompts
GPT-->>Adapter: Return responses
Adapter->>Service: Return extracted text results
Service->>Service: Parse JSON and map to chunks
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing touches
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. Comment |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 설명
해당 Pull Request에 대해 간략하게 설명해주세요!
✅ 체크 리스트
Summary by CodeRabbit
Release Notes
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.