Skip to content

Commit

Permalink
Merge pull request #72 from Capstone-Richam/feat/mailtest
Browse files Browse the repository at this point in the history
[chore] : windyflo url 변경
  • Loading branch information
qogustj authored Jul 9, 2024
2 parents 25148f4 + 14ca36e commit 474024f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public EmailResDto createMail(WindyfloReq windyfloReq) throws IOException {
EmailResDto emailResDto = new EmailResDto("", "", "");
while (emailResDto.template().isEmpty() || emailResDto.header().isEmpty() || emailResDto.body().isEmpty()) {
// ConversationQARes result = windyfloMailClient.findMailInVectorDB(windyfloReq.prompt());
//// emailResDto = extractEmailTemplate(result.getText());
// emailResDto = extractEmailTemplate(result.getText());
// if (result.getText().equals("Hmm, I'm not sure")) {
emailResDto = extractEmailTemplate(windyfloMailClient.createMail(windyfloReq.prompt()));
//// }
// }
// else
// emailResDto = extractEmailTemplate(result.getText());
//// System.out.println(result.getText());

}
return emailResDto;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private String validateImap(ValidateRequestDto validateRequestDto) throws Messag
Store store = createStore(prop);
store.connect(host, id, password);
return "성공";
} catch (AuthenticationFailedException e) {
} catch (Exception e) {
String errorMessage = e.getMessage();
if (errorMessage.contains("Please check your username, password")) {
// Handle username or password error
Expand All @@ -86,6 +86,9 @@ private String validateImap(ValidateRequestDto validateRequestDto) throws Messag
if (errorMessage.contains("IMAP access")) {
throw new InvalidValueException(IMAP_ERROR);
}
if (errorMessage.contains("Couldn't connect to host")) {
throw new InvalidValueException(IMAP_ERROR);
}
}
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/Nunbody/external/WindyfloMailClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
@Service
@RequiredArgsConstructor
public class WindyfloMailClient {
private final String FIND_MAIL_URL = "https://windyflo.com/api/v1/prediction/2eb15033-681a-410b-8577-2b69d8e309d4";
private final String CREATE_MAIL_URL = "https://windyflo.com/api/v1/prediction/f66b8ade-2393-4a1a-ae48-a23c258b460a";
private final String FIND_MAIL_URL = "https://windyflo.com/api/v1/prediction/05d769b1-0a34-49c5-83d3-6b92c1d650f8";
private final String CREATE_MAIL_URL = "https://windyflo.com/api/v1/prediction/fd835f04-0889-4f19-8d97-508901854a76";
private final RestTemplate restTemplate;

public ConversationQARes findMailInVectorDB(String question) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/Nunbody/global/error/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum ErrorCode {
BAD_REQUEST(HttpStatus.BAD_REQUEST, "잘못된 요청입니다."),
INTERNAL_SERVER_ERROR(HttpStatus.BAD_REQUEST, "서버 내부에서 문제가 발생했습니다."),
INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "서버 내부에서 문제가 발생했습니다."),
NOT_FOUND(HttpStatus.BAD_REQUEST, "해당 로그인 정보는 존재하지 않습니다."),
UNAUTHORIZED(HttpStatus.BAD_REQUEST, "권한이 없습니다."),
// Success
Expand Down

0 comments on commit 474024f

Please sign in to comment.