-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 업데이트 요약 생성 #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 업데이트 요약 생성 #157
Conversation
* [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 필수 옵션 선택으로 변경
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
🤖 Gemini AI 코드 리뷰❌ Gemini API 호출 실패: 최대 재시도 횟수 초과 이 리뷰는 Gemini AI가 자동으로 생성했습니다. 참고용으로만 활용해주세요. |
There was a problem hiding this 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.
| 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문장 내외의 한 문단으로 작성하세요. | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()| if not req.category: | ||
| for v in VideoCategory: | ||
| await rag_service.get_popular_videos(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req.category가 없을 때 모든 VideoCategory에 대해 rag_service.get_popular_videos(v)를 순차적으로 호출하고 있습니다. 각 카테고리별 작업은 서로 독립적이므로 asyncio.gather를 사용하여 병렬로 실행하면 API 응답 시간을 크게 단축할 수 있습니다. 이 변경을 적용하려면 파일 상단에 import asyncio를 추가해야 합니다.
| 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개 호출 성공") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
req.category가 제공되지 않은 경우, 모든 카테고리에 대해 작업이 수행됩니다. 하지만 현재 성공 메시지는 f"{req.category} 인기 영상 10개 호출 성공"으로 되어 있어, req.category가 None일 때 "None 인기 영상 10개 호출 성공"과 같이 어색한 메시지가 반환될 수 있습니다. req.category 유무에 따라 적절한 메시지를 반환하도록 수정하는 것이 좋겠습니다.
| 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개 호출 성공") |
PR 제목
[Feat/Fix/Refactor/Docs/Chore 등]: 간결하게 변경 내용을 요약해주세요. (예: Feat: 사용자 로그인 기능 구현)
리포트 정상 생성 완료 후 업데이트 요약 생성
✨ 변경 유형 (하나 이상 선택)
📚 변경 내용
구체적으로 어떤 변경 사항이 있는지, 왜 이러한 변경이 필요한지 설명해주세요.
(예: 사용자 회원가입 시 이메일 중복 확인 로직 추가. 기존 로직에서 누락된 부분 발견하여 수정.)
⚙️ 주요 작업 (선택 사항)
✅ 체크리스트
🔗 관련 이슈 (선택 사항)
해당 PR이 해결하는 이슈 또는 관련 있는 이슈가 있다면 링크를 걸어주세요.
(예: #123, ABC-456)
💬 기타 (선택 사항)
리뷰어에게 전달하고 싶은 추가 정보나 궁금한 점이 있다면 작성해주세요.