Skip to content

Commit

Permalink
Merge pull request #179 from boostcampwm2023/hotfix/sentiment-save-error
Browse files Browse the repository at this point in the history
[Hotfix] 감정 분석 결과 저장 오류 수정
  • Loading branch information
JoonSoo-Kim authored Nov 30, 2023
2 parents f659250 + b252422 commit 073163d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion BE/src/diaries/diaries.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class DiariesRepository {
const positiveRatio = sentimentResult.positiveRatio;
const negativeRatio = sentimentResult.negativeRatio;
const neutralRatio = sentimentResult.neutralRatio;
const sentiment = sentimentStatus[sentimentResult.sentiment];
const sentiment = sentimentResult.sentiment;

const newDiary = Diary.create({
title,
Expand Down
12 changes: 7 additions & 5 deletions BE/src/diaries/diaries.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ export class DiariesService {
const shape = await this.shapesRepository.getShapeByUuid(shapeUuid);
const encryptedContent = this.getEncryptedContent(content);
const tagEntities = await this.getTags(tags);
const sentimentResult = await this.getSentiment(content);
const sentimentResult: SentimentDto = await this.getSentiment(content);

console.log(sentimentResult);
const diary = await this.diariesRepository.createDiary(
createDiaryDto,
encryptedContent,
Expand Down Expand Up @@ -167,11 +168,12 @@ export class DiariesService {
const sentiment = (await sentimentResponse).data.document.sentiment;

const result: SentimentDto = {
positiveRatio,
neutralRatio,
negativeRatio,
sentiment,
positiveRatio: positiveRatio,
neutralRatio: neutralRatio,
negativeRatio: negativeRatio,
sentiment: sentimentStatus[sentiment.toUpperCase()],
};

return result;
}

Expand Down

0 comments on commit 073163d

Please sign in to comment.