Skip to content

Conversation

@GulSauce
Copy link
Member

No description provided.

* [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] 로직변경완료

---------

Co-authored-by: 이찬우 <105221020+ChanJinYeon@users.noreply.github.com>
Co-authored-by: Adansonia <lcw061145@gmail.com>
Co-authored-by: lhoju0158 <lhoju0158@gmail.com>
Copilot AI review requested due to automatic review settings November 14, 2025 17:05
@GulSauce GulSauce merged commit 7aae312 into develop Nov 14, 2025
1 check passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces version 1.3.3 which adds chunk splitting functionality to ensure each chunk has exactly one quiz, along with minor code formatting improvements.

  • Implements chunk splitting logic to divide chunks with quiz_count > 1 into multiple chunks with quiz_count = 1
  • Adds deepcopy import to support independent chunk duplication
  • Applies PEP 8 formatting improvements for parameter indentation and slice spacing

Reviewed Changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.

File Description
app/service/generate_service.py Adds chunk splitting logic to divide multi-quiz chunks into single-quiz chunks before processing; imports deepcopy for chunk duplication
app/adapter/request_generate_quiz_to_bedrock.py Minor formatting improvements: fixes parameter indentation and adds consistent spacing around slice operators

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +157 to 176
i = 0
while i < len(chunks):
chunk = chunks[i]

while chunk.quiz_count > 1:
# 기존 chunk 복제
new_chunk = deepcopy(chunk)
new_chunk.quiz_count = 1 # 복제된 chunk는 1회만 필요하다면 이렇게 설정

# 현재 인덱스 i 앞에 삽입
chunks.insert(i, new_chunk)

# 원본 chunk의 count 감소
chunk.quiz_count -= 1

i += 1 # 삽입된 만큼 한 칸 이동

i += 1

for chunk in chunks:
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chunk splitting logic uses repeated list.insert() operations at the current index, which is inefficient. Each insertion is O(n) as it requires shifting all subsequent elements. For a chunk with quiz_count = k, this results in k-1 insertions, leading to O(k²) complexity for splitting a single chunk.

Consider building a new list instead:

split_chunks = []
for chunk in chunks:
    for _ in range(chunk.quiz_count):
        new_chunk = deepcopy(chunk)
        new_chunk.quiz_count = 1
        split_chunks.append(new_chunk)
chunks = split_chunks

This would be O(n) where n is the total number of resulting chunks.

Suggested change
i = 0
while i < len(chunks):
chunk = chunks[i]
while chunk.quiz_count > 1:
# 기존 chunk 복제
new_chunk = deepcopy(chunk)
new_chunk.quiz_count = 1 # 복제된 chunk는 1회만 필요하다면 이렇게 설정
# 현재 인덱스 i 앞에 삽입
chunks.insert(i, new_chunk)
# 원본 chunk의 count 감소
chunk.quiz_count -= 1
i += 1 # 삽입된 만큼 한 칸 이동
i += 1
for chunk in chunks:
# Efficient chunk splitting: build a new list
split_chunks = []
for chunk in chunks:
if chunk.quiz_count > 1:
for _ in range(chunk.quiz_count):
new_chunk = deepcopy(chunk)
new_chunk.quiz_count = 1
split_chunks.append(new_chunk)
else:
split_chunks.append(chunk)
chunks = split_chunks
for chunk in chunks:

Copilot uses AI. Check for mistakes.
while chunk.quiz_count > 1:
# 기존 chunk 복제
new_chunk = deepcopy(chunk)
new_chunk.quiz_count = 1 # 복제된 chunk는 1회만 필요하다면 이렇게 설정
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment "복제된 chunk는 1회만 필요하다면 이렇게 설정" (translated: "If the copied chunk only needs 1, set it like this") is misleading. The code unconditionally sets quiz_count = 1 for all copied chunks as part of the splitting algorithm, not conditionally based on some requirement. Consider clarifying the comment to reflect the actual behavior, such as: "각 복제된 chunk는 quiz_count를 1로 설정" (Each copied chunk has quiz_count set to 1).

Suggested change
new_chunk.quiz_count = 1 # 복제된 chunk는 1회만 필요하다면 이렇게 설정
new_chunk.quiz_count = 1 # 복제된 chunk는 quiz_count를 1로 설정

Copilot uses AI. Check for mistakes.

while chunk.quiz_count > 1:
# 기존 chunk 복제
new_chunk = deepcopy(chunk)
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Since ChunkInfo is a Pydantic v1 BaseModel (imported from pydantic.v1), consider using Pydantic's built-in copy() method instead of deepcopy():

new_chunk = chunk.copy(deep=True)

This is more idiomatic for Pydantic models and doesn't require importing deepcopy from the copy module.

Copilot uses AI. Check for mistakes.
Comment on lines +166 to +167
# 현재 인덱스 i 앞에 삽입
chunks.insert(i, new_chunk)
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment "현재 인덱스 i 앞에 삽입" (Insert before current index i) is accurate, but the overall splitting logic could be clearer. The algorithm inserts new chunks before the current position and increments the index, which is counterintuitive. Consider adding a higher-level comment explaining the purpose:

# quiz_count > 1인 chunk를 quiz_count=1인 여러 chunk로 분할
# (Split chunks with quiz_count > 1 into multiple chunks with quiz_count = 1)

Copilot uses AI. Check for mistakes.
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.

2 participants