Skip to content

Conversation

@yujin9907
Copy link
Contributor

PR 제목

[Feat/Fix/Refactor/Docs/Chore 등]: 간결하게 변경 내용을 요약해주세요. (예: Feat: 사용자 로그인 기능 구현)

리포트 정상 생성 완료 후 업데이트 요약 생성

✨ 변경 유형 (하나 이상 선택)

  • Feat: 새로운 기능 추가
  • Fix: 버그 수정
  • Refactor: 코드 리팩토링 (기능 변경 없음)
  • Docs: 문서 업데이트 (주석, README 등)
  • Chore: 기타 변경 (빌드 설정, 라이브러리 업데이트 등)
  • Test: 테스트 코드 추가/수정

📚 변경 내용

구체적으로 어떤 변경 사항이 있는지, 왜 이러한 변경이 필요한지 설명해주세요.
(예: 사용자 회원가입 시 이메일 중복 확인 로직 추가. 기존 로직에서 누락된 부분 발견하여 수정.)

  1. 리포트 로그 테이블 추가
  2. 업데이트 요약 생성 요청 (llm) 추가
  3. 리포트 '업데이트 요약'(update_summary) 컬럼 추가 및 생성된 요약 저장

⚙️ 주요 작업 (선택 사항)

  • 새로운 API 추가 (API 명세서 링크 또는 간단한 정보)
  • 데이터베이스 스키마 변경 (변경 내용 명시)
  • 외부 라이브러리 추가/제거 (라이브러리 명시)

✅ 체크리스트

  • 코드 컨벤션을 준수했습니다.
  • 변경 사항에 대한 문서 업데이트가 필요한 경우 반영했습니다.

🔗 관련 이슈 (선택 사항)

해당 PR이 해결하는 이슈 또는 관련 있는 이슈가 있다면 링크를 걸어주세요.
(예: #123, ABC-456)

💬 기타 (선택 사항)

리뷰어에게 전달하고 싶은 추가 정보나 궁금한 점이 있다면 작성해주세요.

wlswnsdn and others added 21 commits October 27, 2025 22:10
* [REFACTOR] Mysql -> Postgres 변경 (#136)

* [REFACTOR] MySQL 데이터베이스 지원 제거

MySQL 관련 설정, 연결 및 세션 관리 코드를 모두 삭제.
데이터베이스 상호작용을 PostgreSQL로 일원화하여 코드베이스 간소화.
더 이상 사용되지 않는 MySQL 통합 기능 제거.

* [REFACTOR] MySQL 의존성 제거

* [REFACTOR] MySQL 세션 로직을 PostgreSQL로 변경

모든 데이터베이스 세션 연결을 MySQL에서 PostgreSQL로 전환
`MySQLSessionLocal` 사용처를 `PGSessionLocal`로 일괄 업데이트하여 PostgreSQL 환경에 맞게 데이터베이스 연동 로직을 수정

* [REFACTOR] MySQL 참조를 PostgreSQL로 업데이트

코드 내 MySQL 관련 주석 및 로그 메시지를 PostgreSQL로 변경

* [REFACTOR] CD 워크플로우에서 MySQL 환경 변수 제거

MySQL 데이터베이스 사용 중단에 따라 CD 파이프라인에서 불필요한 MySQL 관련 환경 변수를 제거

* [DOCS] README 데이터베이스 아키텍처 수정

MySQL 제거 내용 README에 반영

* [FEAT] CI/CD 파이프라인을 AWS ASG 기반 배포로 전환 (#139)

기존 CD 파이프라인을 제거하고 CI 워크플로우에 배포 로직 통합
AWS Auto Scaling Group 인스턴스 리프레시를 활용한 배포 방식으로 변경

* [HOTFIX] CD.yml 삭제
* [HOTFIX] langchain 버전 지정, ssl 필수 옵션 선택으로 변경
트랜드 키워드 API 추가
아이디어, 트렌드 키워드
v 1.3.8
v 1.3.8
@yujin9907 yujin9907 linked an issue Dec 17, 2025 that may be closed by this pull request
@gemini-code-assist
Copy link

Summary of Changes

Hello @yujin9907, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 Pull Request는 리포트 생성 과정에 중요한 개선 사항을 도입합니다. 이제 사용자는 리포트가 업데이트될 때마다 이전 데이터와의 비교를 통해 핵심적인 변화를 한눈에 파악할 수 있는 요약 정보를 제공받게 됩니다. 이는 LLM의 자연어 처리 능력을 활용하여 데이터의 변화를 분석하고, 사용자에게 더욱 유용하고 통찰력 있는 정보를 전달하는 것을 목표로 합니다.

Highlights

  • 업데이트 요약 기능 추가: 리포트가 정상적으로 생성된 후, 이전 리포트 로그와 현재 리포트 데이터를 비교하여 변경 사항을 요약하는 기능이 추가되었습니다. 이 요약은 LLM(대규모 언어 모델)을 통해 생성됩니다.
  • 리포트 로그 테이블 및 관련 엔티티 추가: 이전 리포트 데이터를 저장하고 조회하기 위한 ReportLog 테이블과 DeleteType 열거형이 새로 추가되었습니다. ReportLog는 기존 리포트의 상세 지표와 상태 정보를 기록합니다.
  • 기존 리포트 모델 확장: 기존 Report 모델에 LLM이 생성한 업데이트 요약을 저장할 update_summary 컬럼이 추가되었습니다.
  • LLM 프롬프트 템플릿 정의: 이전 및 현재 리포트 데이터를 비교하고, 의미 있는 변화를 중심으로 3~4문장으로 요약하도록 지시하는 새로운 LLM 프롬프트 템플릿(summarize_update_changes)이 PromptTemplateManager에 추가되었습니다.
  • 리포트 처리 워크플로우 개선: 리포트의 개요(overview) 및 분석(analysis) 작업이 모두 완료되면, 새로 추가된 summarize_update_changes 서비스 로직이 자동으로 호출되어 업데이트 요약을 생성하고 저장하도록 워크플로우가 업데이트되었습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

🤖 Gemini AI 코드 리뷰

❌ Gemini API 호출 실패: 최대 재시도 횟수 초과


이 리뷰는 Gemini AI가 자동으로 생성했습니다. 참고용으로만 활용해주세요.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new feature for generating update summaries for reports, comparing current report data with previous logged reports. Key changes include adding a ReportLog model and its repository to store historical report data, and extending the Report model with an update_summary field. A new summarize_update_changes method was added to ReportService to orchestrate the summary generation, which involves fetching current and previous report data and calling rag_service.create_update_summary. The rag_service_impl now includes the implementation for create_update_summary, which formats report data into a detailed prompt for the LLM using a new prompt template in prompt_template_manager.py. Report processing in report_consumer_impl_v2 was updated to trigger this summary generation after both overview and analysis tasks are completed, and to include the report ID in Redis messages. Additionally, the get_popular_ideas endpoint in idea_controller.py was modified to handle requests for all video categories, with a review comment suggesting parallel execution using asyncio.gather for performance improvement and another comment recommending a more appropriate success message when no specific category is provided. Other minor changes include refining the text format for popular video storage in the Vector DB, casting source_id to int in rag_service_impl, and fixing a duplicate source_type definition in content_chunk.py.

Comment on lines +407 to +439
return f"""
# Role
당신은 유튜브 채널 성장 전문가이자 데이터 분석가입니다.
사용자의 지난 리포트와 새로 업데이트된 리포트 데이터를 비교하여, 성과 변화를 한 문단으로 요약하는 것이 당신의 임무입니다.
# Task
제공된 [이전 데이터]와 [현재 데이터]를 비교 분석하여 **업데이트 요약 리포트**를 작성하세요.
# Input Data
## 1. 영상 기본 정보
- 제목: {data.get('title')}
## 2. 이전 데이터 (Past)
- 조회수: {data.get('prev_view')}회 (채널평균 대비: {data.get('prev_view_diff')})
- 좋아요: {data.get('prev_like')}
- 댓글 수: 전체 {data.get('prev_comment')} (긍정 {data.get('prev_pos')} / 부정 {data.get('prev_neg')})
- 성과 지표(점수): 컨셉 {data.get('prev_concept')}, SEO {data.get('prev_seo')}, 재방문 {data.get('prev_revisit')}
- 이탈 분석 요약: {data.get('prev_leave')}
## 3. 현재 데이터 (Current)
- 조회수: {data.get('curr_view')}회 (채널평균 대비: {data.get('curr_view_diff')})
- 좋아요: {data.get('curr_like')}
- 댓글 수: 전체 {data.get('curr_comment')} (긍정 {data.get('curr_pos')} / 부정 {data.get('curr_neg')})
- 성과 지표(점수): 컨셉 {data.get('curr_concept')}, SEO {data.get('curr_seo')}, 재방문 {data.get('curr_revisit')}
- 이탈 분석 요약: {data.get('curr_leave')}
# Guidelines
1. **변화 중심 서술**: 단순히 수치를 나열하지 말고, 의미 있는 변화(예: 조회수 급증, 긍정 반응 비율 상승 등)를 중심으로 해석하세요.
2. **성과 강조**: 지표가 하락했더라도, 개선점이나 긍정적인 부분(예: 재방문 점수 유지 등)을 함께 언급하여 격려하세요.
3. **분석 내용 반영**: '이탈 분석' 내용이 변경되었다면, 시청자 반응 패턴이 달라졌음을 언급하세요.
4. **톤앤매너**: 전문적이지만 친절하고 격려하는 "해요체"를 사용하세요.
5. **분량**: 핵심 내용만 담아 3~4문장 내외의 한 문단으로 작성하세요.
"""

Choose a reason for hiding this comment

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

medium

summarize_update_changes 메서드에서 반환하는 f-string에 .strip()이 적용되지 않았습니다. 이 클래스의 다른 프롬프트 생성 메서드들은 일관성을 위해 .strip()을 사용하여 불필요한 앞뒤 공백을 제거하고 있습니다. 코드의 일관성을 유지하고 예기치 않은 공백 문자가 LLM 프롬프트에 영향을 주는 것을 방지하기 위해 .strip()을 추가하는 것이 좋습니다.

        return f"""
# Role
당신은 유튜브 채널 성장 전문가이자 데이터 분석가입니다. 
사용자의 지난 리포트와 새로 업데이트된 리포트 데이터를 비교하여, 성과 변화를 한 문단으로 요약하는 것이 당신의 임무입니다.

# Task
제공된 [이전 데이터]와 [현재 데이터]를 비교 분석하여 **업데이트 요약 리포트**를 작성하세요.

# Input Data
## 1. 영상 기본 정보
- 제목: {data.get('title')}

## 2. 이전 데이터 (Past)
- 조회수: {data.get('prev_view')}회 (채널평균 대비: {data.get('prev_view_diff')})
- 좋아요: {data.get('prev_like')}
- 댓글 수: 전체 {data.get('prev_comment')} (긍정 {data.get('prev_pos')} / 부정 {data.get('prev_neg')})
- 성과 지표(점수): 컨셉 {data.get('prev_concept')}, SEO {data.get('prev_seo')}, 재방문 {data.get('prev_revisit')}
- 이탈 분석 요약: {data.get('prev_leave')}

## 3. 현재 데이터 (Current)
- 조회수: {data.get('curr_view')}회 (채널평균 대비: {data.get('curr_view_diff')})
- 좋아요: {data.get('curr_like')}
- 댓글 수: 전체 {data.get('curr_comment')} (긍정 {data.get('curr_pos')} / 부정 {data.get('curr_neg')})
- 성과 지표(점수): 컨셉 {data.get('curr_concept')}, SEO {data.get('curr_seo')}, 재방문 {data.get('curr_revisit')}
- 이탈 분석 요약: {data.get('curr_leave')}

# Guidelines
1. **변화 중심 서술**: 단순히 수치를 나열하지 말고, 의미 있는 변화(예: 조회수 급증, 긍정 반응 비율 상승 등)를 중심으로 해석하세요.
2. **성과 강조**: 지표가 하락했더라도, 개선점이나 긍정적인 부분(예: 재방문 점수 유지 등)을 함께 언급하여 격려하세요.
3. **분석 내용 반영**: '이탈 분석' 내용이 변경되었다면, 시청자 반응 패턴이 달라졌음을 언급하세요.
4. **톤앤매너**: 전문적이지만 친절하고 격려하는 "해요체"를 사용하세요.
5. **분량**: 핵심 내용만 담아 3~4문장 내외의 한 문단으로 작성하세요.
        """.strip()

Comment on lines +37 to +39
if not req.category:
for v in VideoCategory:
await rag_service.get_popular_videos(v)

Choose a reason for hiding this comment

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

medium

req.category가 없을 때 모든 VideoCategory에 대해 rag_service.get_popular_videos(v)를 순차적으로 호출하고 있습니다. 각 카테고리별 작업은 서로 독립적이므로 asyncio.gather를 사용하여 병렬로 실행하면 API 응답 시간을 크게 단축할 수 있습니다. 이 변경을 적용하려면 파일 상단에 import asyncio를 추가해야 합니다.

Suggested change
if not req.category:
for v in VideoCategory:
await rag_service.get_popular_videos(v)
if not req.category:
tasks = [rag_service.get_popular_videos(v) for v in VideoCategory]
await asyncio.gather(*tasks)

raise

return ApiResponse.on_success(SuccessStatus._OK, "인기 영상 호출 성공")
return ApiResponse.on_success(SuccessStatus._OK, f"{req.category} 인기 영상 10개 호출 성공")

Choose a reason for hiding this comment

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

medium

req.category가 제공되지 않은 경우, 모든 카테고리에 대해 작업이 수행됩니다. 하지만 현재 성공 메시지는 f"{req.category} 인기 영상 10개 호출 성공"으로 되어 있어, req.categoryNone일 때 "None 인기 영상 10개 호출 성공"과 같이 어색한 메시지가 반환될 수 있습니다. req.category 유무에 따라 적절한 메시지를 반환하도록 수정하는 것이 좋겠습니다.

Suggested change
return ApiResponse.on_success(SuccessStatus._OK, f"{req.category} 인기 영상 10개 호출 성공")
return ApiResponse.on_success(SuccessStatus._OK, "모든 카테고리의 인기 영상 호출 성공" if not req.category else f"{req.category} 인기 영상 10개 호출 성공")

@yujin9907 yujin9907 merged commit 3c980e1 into develop Dec 21, 2025
1 check passed
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.

[FEAT]: 업데이트 요약

4 participants