Skip to content

Commit

Permalink
update: 프롬프트 개선 및 북마크 최신순 불러오기
Browse files Browse the repository at this point in the history
  • Loading branch information
YamYamee authored Aug 30, 2024
1 parent c36e027 commit fa59215
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public interface BookmarkRepository extends JpaRepository<Bookmark, Long> {
@Query("SELECT b.sentence FROM Bookmark b WHERE b.castPlaylist.playlist.id = :playlistId ORDER BY b.createdAt DESC ")
List<Sentence> findSentencesByPlaylistId(@Param("playlistId") Long playlistId);

Optional<Bookmark> findBookmarkBySentenceIdAndCastPlaylist_Playlist_Member_id(@Param("sentenceId") Long sentenceId, @Param("memberId") Long memberId);
Optional<Bookmark> findBookmarkBySentenceIdAndCastPlaylist_Playlist_Member_idOrderByCreatedAtDesc(@Param("sentenceId") Long sentenceId, @Param("memberId") Long memberId);

@Query("SELECT b FROM Bookmark b WHERE b.castPlaylist.cast.id = :castId AND b.castPlaylist.playlist.member = :member")
@Query("SELECT b FROM Bookmark b WHERE b.castPlaylist.cast.id = :castId AND b.castPlaylist.playlist.member = :member ORDER BY b.createdAt DESC ")
List<Bookmark> findBookmarksByCastPlaylist_Cast_Id(@Param("member") Member member, @Param("castId") Long castId);

@Query("SELECT b.sentence FROM Bookmark b WHERE b.id = :bookmarkId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public BookmarkSaveResultDTO saveBookmark(Member member, Long sentenceId) {

CastPlaylist castPlaylist = castPlaylistRepository.findBySentenceId(sentenceId, member.getId()).orElseThrow(() -> new UserHandler(ErrorCode.CAST_PLAYLIST_NOT_FOUND));

if (bookmarkRepository.findBookmarkBySentenceIdAndCastPlaylist_Playlist_Member_id(sentenceId, member.getId()).isPresent()) {
if (bookmarkRepository.findBookmarkBySentenceIdAndCastPlaylist_Playlist_Member_idOrderByCreatedAtDesc(sentenceId, member.getId()).isPresent()) {
throw new UserHandler(ErrorCode.BOOKMARK_ALREADY_EXIST);
}

Expand All @@ -143,7 +143,7 @@ public BookmarkSaveResultDTO saveBookmark(Member member, Long sentenceId) {
@Override
public BookmarkSaveResultDTO deleteBookmark(Member member, Long sentenceId) {

Bookmark bookmark = bookmarkRepository.findBookmarkBySentenceIdAndCastPlaylist_Playlist_Member_id(sentenceId, member.getId()).orElseThrow(() -> new UserHandler(ErrorCode.BOOKMARK_NOT_EXIST));
Bookmark bookmark = bookmarkRepository.findBookmarkBySentenceIdAndCastPlaylist_Playlist_Member_idOrderByCreatedAtDesc(sentenceId, member.getId()).orElseThrow(() -> new UserHandler(ErrorCode.BOOKMARK_NOT_EXIST));

bookmarkRepository.delete(bookmark);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,19 @@ public List<ChatMessage> createKeywordPromptMessage(String keyword1, String keyw
// 시스템 프롬프트
String system = ChatMessageRole.SYSTEM.value();
systemPrompts = List.of(
new ChatMessage(system, "Answer should only contain what you have to say (no markdowns or background musics)"),
new ChatMessage(system, "The words should not be too generic; instead, they should include specific terms, names of people, team names, specific events, or technical terms that many people like"),
new ChatMessage(system, "The words should be updated to reflect the latest trends and current prominent figures or events"),
new ChatMessage(system, "Provide 6 unique words related to each of the following keywords, ensuring that they are different from previously given words. Reflect current trends and popular terms or figures in each category: News, Food, Books, Drama/Movies, Art, Sports, Music. For example:"),
new ChatMessage(system, "For News: Use terms like 'AI breakthroughs,' 'Social media regulations,' 'Global warming debates,' 'Political scandals,' 'Tech company lawsuits,' 'Emerging economies.'"),
new ChatMessage(system, "For Food: Include trends such as 'Vegan cheese,' 'Craft cocktails,' 'Fusion cuisine,' 'Plant-based meat,' 'Sourdough starter,' 'Artisanal ice cream.'"),
new ChatMessage(system, "For Books: Use recent influential works or authors like 'The Invisible Life of Addie LaRue,' 'A Promised Land,' 'Educated,' 'The Tattooist of Auschwitz,' 'Circe,' 'Normal People.'"),
new ChatMessage(system, "For Drama/Movies: Include contemporary films or shows like 'Dune Part 2,' 'The Last of Us,' 'Spider-Man: Across the Spider-Verse,' 'Succession Season 4,' 'The Whale,' 'Avatar: The Way of Water.'"),
new ChatMessage(system, "For Art: Include recent art trends or notable figures like 'Beeple,' 'NFT art,' 'Yayoi Kusama,' 'Banksy's new works,' 'Virtual reality art,' 'Documenta 15.'"),
new ChatMessage(system, "For Sports: Use current trends or figures such as 'Live betting,' 'Esports tournaments,' 'Neymar Jr.,' 'Formula 1 regulations,' '2024 Olympics,' 'Team USA basketball.'"),
new ChatMessage(system, "For Music: Include popular or emerging artists and trends like 'Bad Bunny,' 'Lo-fi beats,' 'Music NFTs,' 'Adele's latest album,' 'Travis Scott collaborations,' 'Billboard Hot 100 hits.'"),
new ChatMessage(system, "The answer should be in " + language.toLowerCase()) // 언어 설정 (English, Spanish, Japanese, ...)
new ChatMessage(system, "The answer should only contain the information you need to convey (no markdowns or background music)."),
new ChatMessage(system, "Keywords should not be too generic; instead, they should include specific terms, names of people, team names, specific events, or technical terms that are currently popular."),
new ChatMessage(system, "Update the words to reflect the latest trends and current prominent figures or events."),
new ChatMessage(system, "Provide 6 unique words related to each of the following keywords, ensuring that they are relevant to the input keyword. Adapt to current trends and popular terms or figures in each category: News, Food, Books, Drama/Movies, Art, Sports, Music. For example:"),
new ChatMessage(system, "For News: Use terms like 'AI breakthroughs,' 'Social media regulations,' 'Global warming debates,' 'Political scandals,' 'Tech company lawsuits,' 'Emerging economies,' but ensure they relate to the input keyword."),
new ChatMessage(system, "For Food: Include trends such as 'Vegan cheese,' 'Craft cocktails,' 'Fusion cuisine,' 'Plant-based meat,' 'Sourdough starter,' 'Artisanal ice cream,' but ensure they relate to the input keyword."),
new ChatMessage(system, "For Books: Use recent influential works or authors like 'The Invisible Life of Addie LaRue,' 'A Promised Land,' 'Educated,' 'The Tattooist of Auschwitz,' 'Circe,' 'Normal People,' but ensure they relate to the input keyword."),
new ChatMessage(system, "For Drama/Movies: Include contemporary films or shows like 'Dune Part 2,' 'The Last of Us,' 'Spider-Man: Across the Spider-Verse,' 'Succession Season 4,' 'The Whale,' 'Avatar: The Way of Water,' but ensure they relate to the input keyword."),
new ChatMessage(system, "For Art: Include recent art trends or notable figures like 'Beeple,' 'NFT art,' 'Yayoi Kusama,' 'Banksy's new works,' 'Virtual reality art,' 'Documenta 15,' but ensure they relate to the input keyword."),
new ChatMessage(system, "For Sports: Use current trends or figures such as 'Live betting,' 'Esports tournaments,' 'Neymar Jr.,' 'Formula 1 regulations,' '2024 Olympics,' 'Team USA basketball,' but ensure they relate to the input keyword."),
new ChatMessage(system, "For Music: Include popular or emerging artists and trends like 'Bad Bunny,' 'Lo-fi beats,' 'Music NFTs,' 'Adele's latest album,' 'Travis Scott collaborations,' 'Billboard Hot 100 hits,' but ensure they relate to the input keyword."),
new ChatMessage(system, "Make sure that the 6 words provided are related to both the primary keyword and the specific category."),
new ChatMessage(system, "The answer should be in " + language.toLowerCase()) // Language setting (English, Spanish, Japanese, etc.)
);

// 채팅 메시지
Expand Down

0 comments on commit fa59215

Please sign in to comment.