Skip to content
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: 답변 피드백 기능 추가 및 AI 기반 피드백 통합 #1639

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

jaeyeonling
Copy link
Contributor

이 풀 리퀘스트는 백엔드 서비스에 중요한 변경 사항을 도입하며, 답변에 대한 피드백 기능 추가, AI 기반 피드백 통합, 그리고 이를 지원하기 위한 데이터베이스 스키마 업데이트에 중점을 두고 있습니다. 주요 변경 사항으로는 새로운 서비스 및 도메인 클래스 추가, 이벤트를 처리하기 위한 기존 서비스 수정, 그리고 구성 및 데이터베이스 파일 업데이트가 포함됩니다.


🔹 새로운 서비스 및 도메인 클래스 추가

  • AnswerFeedbackService 추가 (backend/src/main/java/wooteco/prolog/session/application/AnswerFeedbackService.java)

    • 답변에 대한 피드백을 처리하고 저장하는 서비스
  • AnswerFeedback 엔티티 추가 (backend/src/main/java/wooteco/prolog/session/domain/AnswerFeedback.java)

    • 피드백 데이터를 저장하기 위한 엔티티
  • AnswerUpdatedEvent 추가 (backend/src/main/java/wooteco/prolog/session/domain/AnswerUpdatedEvent.java)

    • 답변이 업데이트될 때 피드백 처리를 트리거하는 이벤트
  • QnaFeedbackProvider 인터페이스 정의 (backend/src/main/java/wooteco/prolog/session/domain/QnaFeedbackProvider.java)

    • 피드백을 생성하는 인터페이스
  • AzureOpenAiFeedbackProvider 구현 (backend/src/main/java/wooteco/prolog/session/infrastructure/AzureOpenAiFeedbackProvider.java)

    • Azure OpenAI를 활용하여 AI 기반 피드백을 생성하는 구현체

🔹 기존 서비스 수정

  • AnswerService 수정 (backend/src/main/java/wooteco/prolog/session/application/AnswerService.java)

    • 답변이 저장되거나 업데이트될 때 AnswerUpdatedEvent를 발행하도록 변경
  • Answer 수정 (backend/src/main/java/wooteco/prolog/session/domain/Answer.java)

    • updateContent 메서드가 콘텐츠 변경 여부를 반환하도록 수정하여 이벤트가 조건부로 트리거되도록 변경

🔹 구성 파일 업데이트

  • build.gradle 수정 (backend/build.gradle)

    • Spring AI 관련 의존성 추가 및 저장소 업데이트
  • application.yml 수정 (backend/src/main/resources/application.yml)

    • Azure OpenAI 통합을 위한 설정 추가
  • application-local.yml, application-test.yml 수정

    • 로컬 및 테스트 프로필에서 Azure OpenAI 자동 설정 제외

🔹 데이터베이스 스키마 업데이트

  • answer_feedback 테이블 생성 (backend/src/main/resources/db/migration/prod/V13__create_table_answer_feedback.sql)
    • mission, answer 테이블에 새로운 필드 추가

🏆 변경 사항 요약

이 변경 사항을 통해 백엔드 서비스는 답변에 대한 피드백을 효과적으로 제공할 수 있도록 강화되었으며, 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.

Hello @jaeyeonling, 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!

Summary of Changes

This pull request introduces a new answer feedback feature to the backend service, integrating AI-based feedback and updating the database schema to support it. It includes the addition of new services and domain classes, modification of existing services to handle events, and updates to configuration and database files.

Highlights

  • New Services and Domain Classes: Introduces AnswerFeedbackService to handle and store feedback, AnswerFeedback entity to store feedback data, AnswerUpdatedEvent to trigger feedback processing, QnaFeedbackProvider interface to generate feedback, and AzureOpenAiFeedbackProvider to generate AI-based feedback using Azure OpenAI.
  • Existing Service Modifications: Modifies AnswerService to publish AnswerUpdatedEvent when an answer is saved or updated, and modifies Answer to return whether the content has changed, so that the event is only triggered when the content is actually updated.
  • Configuration File Updates: Updates build.gradle to add Spring AI related dependencies and repository, updates application.yml to add settings for Azure OpenAI integration, and updates application-local.yml and application-test.yml to exclude automatic Azure OpenAI settings in local and test profiles.
  • Database Schema Updates: Creates answer_feedback table and adds a new goal column to the mission table, and modifies the content column of the answer table.

Changelog

Click here to see the changelog
  • backend/build.gradle
    • Added Spring AI dependencies and repository.
    • Removed baselineVersion from flyway task.
  • backend/src/main/java/wooteco/prolog/session/application/AnswerFeedbackService.java
    • Added new service to handle answer feedback using AI.
    • Implements an event listener for AnswerUpdatedEvent to process feedback.
  • backend/src/main/java/wooteco/prolog/session/application/AnswerService.java
    • Modified to publish AnswerUpdatedEvent when answers are saved or updated.
    • Modified to conditionally publish AnswerUpdatedEvent only when content is updated.
  • backend/src/main/java/wooteco/prolog/session/domain/Answer.java
    • Modified updateContent method to return a boolean indicating whether the content was actually changed.
  • backend/src/main/java/wooteco/prolog/session/domain/AnswerFeedback.java
    • Added new entity to store answer feedback data.
  • backend/src/main/java/wooteco/prolog/session/domain/AnswerUpdatedEvent.java
    • Added new event to trigger feedback processing when an answer is updated.
  • backend/src/main/java/wooteco/prolog/session/domain/Mission.java
    • Added goal field to Mission entity.
  • backend/src/main/java/wooteco/prolog/session/domain/QnaFeedbackContents.java
    • Added record for QnA feedback contents.
  • backend/src/main/java/wooteco/prolog/session/domain/QnaFeedbackProvider.java
    • Added interface for QnA feedback providers.
  • backend/src/main/java/wooteco/prolog/session/domain/QnaFeedbackRequest.java
    • Added record for QnA feedback requests.
  • backend/src/main/java/wooteco/prolog/session/domain/repository/AnswerFeedbackRepository.java
    • Added repository for AnswerFeedback entity.
  • backend/src/main/java/wooteco/prolog/session/domain/repository/AnswerRepository.java
    • Updated imports.
  • backend/src/main/java/wooteco/prolog/session/infrastructure/AzureOpenAiFeedbackProvider.java
    • Added implementation for QnaFeedbackProvider using Azure OpenAI.
    • Uses a prompt template to generate feedback based on the question and answer.
  • backend/src/main/java/wooteco/prolog/session/infrastructure/FakeFeedbackProvider.java
    • Added fake implementation for local and test environments.
  • backend/src/main/resources/application-local.yml
    • Excluded Azure OpenAI auto-configuration in local profile.
  • backend/src/main/resources/application-test.yml
    • Excluded Azure OpenAI auto-configuration in test profile.
  • backend/src/main/resources/application.yml
    • Added Azure OpenAI configuration.
  • backend/src/main/resources/db/migration/prod/V13.__create_table_answer_feedback.sql
    • Created answer_feedback table and added goal column to mission table.
  • backend/src/main/resources/prompts/qna-feedback.st
    • Added prompt template for QnA feedback.
  • backend/src/test/java/wooteco/prolog/session/infrastructure/AzureOpenAiFeedbackProviderTest.java
    • Added test case for AzureOpenAiFeedbackProvider.
  • backend/src/test/java/wooteco/prolog/studylog/application/StudylogServiceTest.java
    • Added organizationService mock.
    • Added AnswerRequest to StudylogRequest in insertStudylog test.
    • Added organizationService mock in insertStudylog_existStudyLogTemp and insertStudylog_notExistStudyLogTemp tests.
    • Added goal parameter to Mission constructor in findScrapIds test.
    • Added organizationService mock in insertStudyLogs test.
    • Fixed typo in updateStudylogMission test.
  • backend/src/test/java/wooteco/prolog/studylog/application/TagServiceTest.java
    • Added goal parameter to Mission constructor.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.


Did you know?

The first version of Java was released in 1995 by Sun Microsystems.

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.

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 answer feedback feature using AI, which is a great enhancement to the backend service. The changes include new services, domain classes, modifications to existing services, and database schema updates. Overall, the code is well-structured and addresses the requirements outlined in the pull request description. However, there are a few areas that could be improved for better maintainability and clarity.

Summary of Findings

Merge Readiness

The pull request is almost ready for merging. I recommend addressing the comments to improve code clarity and maintainability. I am unable to directly approve this pull request, so please ensure that other reviewers also examine the changes before merging. Once the feedback is addressed, the pull request should be in good shape to be merged.

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