Skip to content

Commit

Permalink
Merge pull request #127 from studio-recoding/fix-chat-realation
Browse files Browse the repository at this point in the history
[🚀feat] 메타데이터 필드 생성
  • Loading branch information
JeonHaeseung authored Jul 6, 2024
2 parents 046261b + 5a6c718 commit b10fde4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/Ness/Backend/domain/chat/ChatService.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public GetChatListDto getOneWeekUserChat(Long memberId){
.text(chat.getText())
.caseNumber(chat.getCaseNumber())
.chatType(chat.getChatType().toString())
.metadata(chat.getMetadata())
.build())
.toList();
return new GetChatListDto(getChatDtos);
Expand Down Expand Up @@ -87,6 +88,7 @@ public GetChatListDto postNewUserChat(Long memberId, PostUserChatDto postUserCha
.text(AiDto.getAnswer())
.chatType(ChatType.AI)
.caseNumber(AiDto.getCaseNumber()) //AI는 받아온 값으로 저장
.metadata(AiDto.getMetadata())
.member(memberEntity)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ public class GetChatDto {
@Schema(description = "채팅 내용", example = "오늘 내가 공부한 내역을 보여줘.")
private String text;

@Schema(description = "채팅 메타데이터", example = "일정에 대한 JSON 구조")
private String metadata;

@Schema(description = "발화자 구분", example = "AI")
private String chatType;

@JsonProperty("case")
private int caseNumber;

@Builder
public GetChatDto(Long id, String createdDate, String text, String chatType, int caseNumber){
public GetChatDto(Long id, String createdDate, String text, String chatType, int caseNumber, String metadata){
this.id = id;
this.createdDate = createdDate;
this.text = text;
this.chatType = chatType;
this.caseNumber = caseNumber;
this.metadata = metadata;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ public class PostFastApiAiChatDto {

@JsonProperty("case")
private int caseNumber;

@JsonProperty("metadata")
private String metadata;
}
5 changes: 4 additions & 1 deletion src/main/java/Ness/Backend/domain/chat/entity/Chat.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class Chat {

private String text;

private String metadata;

private int caseNumber;

//AI 발화인지, USER 발화인지 구분해주는 타입 값
Expand All @@ -39,12 +41,13 @@ public class Chat {

@Builder
public Chat(Long id, ZonedDateTime createdDate, String text, ChatType chatType,
int caseNumber, Member member) {
int caseNumber, Member member, String metadata) {
this.id = id;
this.createdDate = createdDate;
this.text = text;
this.chatType = chatType;
this.caseNumber = caseNumber;
this.member = member;
this.metadata = metadata;
}
}

0 comments on commit b10fde4

Please sign in to comment.