분류 전체보기 344

[SpringBoot/ChatGPT] ChatGPT API (3) 일반 대화 - 메세지 전송

SpringBoot 를 이용하는 백엔드 서버에서 ChatGPT 로 메세지를 전송해 봅시다 ~ 1. Configuration : ChatGPT 설정 정보 + 데이터 전송 시 필요한 데이터 세팅 2. Controller : 프론트 서버 요청 동작 처리 3. Service : 백엔드 → ChatGPT 메세지 데이터 전송 4. DTO : 프론트 → 백 & 백 → ChatGPT 서버로 전송할 메세지 데이터 세팅 [ Configuration ] 🤖 ChatGPT API 기종 선택 + 요청 시 필요한 데이터 정보 입력 1. 필요한 데이터 확인하기 🏠 https://platform.openai.com/docs/api-reference/chat/create 요청 예시 curl https://api.openai.com/v..

[SpringBoot/ChatGPT] ChatGPT API (2) 프로젝트 설정

스프링부트 프로젝트에서 ChatGPT API 를 사용할 수 있도록 설정 정보를 입력해 봅시다 ~ [ SpringBoot 프로젝트 설정하기 ] 0. ChatGPT API Key 발급 2024.02.21 - [Spring/[Project] AI 챗봇 기반 맞춤형 레시피 서비스] - [SpringBoot/ChatGPT] ChatGPT API (1) API Key 발급 [SpringBoot/ChatGPT] ChatGPT API (1) API Key 발급 ChatGPT API 를 사용하기 위해 API Key 를 발급받아 봅시다 ~ [ API Key 발급받기 ] 🏠 https://platform.openai.com/api-keys 1. 새로운 키 생성 2. 키 이름 작성 3. 생성된 키 복사 ✔️ 생성된 secre..

OpenWeatherMap API 로 매일 날씨 정보 가져오기

❄️눈이 오는 날만 알림 문구 생성❄️ ☃️ OpenWeatherMap Key 발급받는 법 1. https://home.openweathermap.org/ 홈페이지 접속 2. 로그인 후 My API keys 찾기 3. Create Key 로 새로운 키 생성하기 (API key name 작성 후 → Generate) ☃️ 프로젝트에 발급받은 Key 등록하기 · application.properties # openweathermap api api.key=[발급받은 api 키] ☃️ JSON 파싱을 위한 dependencies 등록하기 · build.gradle ... dependencies { ... // json parsing implementation group: 'com.googlecode.json-s..

게시글 삭제하기

게시글 데이터를 데이터베이스에서 삭제 ☃️ Controller @RestController @RequiredArgsConstructor @Slf4j @RequestMapping("/volunteers") public class VolunteerController { private final VolunteerService volunteerService; // 봉사활동 구인글 삭제 @DeleteMapping("/delete/{volunteerId}") public ResponseEntity deleteVolunteer(@PathVariable("volunteerId") Long volunteerId) { volunteerService.deleteVolunteer(volunteerId); return new ..

게시글 댓글 작성하기 (대댓글X)

클라이언트 서버에서 전송한 게시글 댓글 데이터를 DB 에 저장 ☃️ Controller @RestController @RequiredArgsConstructor @Slf4j @RequestMapping("/comments") public class CommentController { private final CommentService commentService; // 봉사활동글 댓글 추가 @PostMapping("/volunteer") public ResponseEntity addCommentVolunteer(CommentSaveRequest request) throws IOException { commentService.addCommentVolunteer(request); return new Respo..

게시글 작성하기

클라이언트 서버에서 전송한 게시글 데이터를 데이터베이스에 저장 ☃️ Controller @RestController @RequiredArgsConstructor @Slf4j @RequestMapping("/volunteers") public class VolunteerController { private final VolunteerService volunteerService; // 봉사활동 구인글 작성 @PostMapping("/new") public ResponseEntity addVolunteer(@Valid VolunteerSaveRequest request) throws IOException { Long volunteerId = volunteerService.addVolunteer(request)..

최신 게시글 3개 조회하기

메인 페이지에서 보여줄 최신 게시글 데이터 3개 반환 ☃️ Controller @RestController @RequiredArgsConstructor @Slf4j @RequestMapping("/volunteers") public class VolunteerController { private final VolunteerService volunteerService; // 봉사활동 구인글 최신 3개 조회 @GetMapping("/recent") public ResponseEntity getThreeVolunteers(@RequestParam(value = "userId", required = false, defaultValue = "0") Long userId) { List responses = volu..

게시글 상세 조회하기

게시글 상세 페이지에 필요한 데이터 반환 ☃️ Controller @RestController @RequiredArgsConstructor @Slf4j @RequestMapping("/volunteers") public class VolunteerController { private final VolunteerService volunteerService; // 봉사활동 구인글 상세 조회 @GetMapping("/{volunteerId}") public ResponseEntity getVolunteerById(@PathVariable("volunteerId") Long volunteerId, @RequestParam(value = "userId", required = false, defaultValue =..

게시글 전체 조회하기

게시글 목록 페이지에 필요한 게시글 데이터 리스트 반환 ☃️ Controller @RestController @RequiredArgsConstructor @Slf4j @RequestMapping("/volunteers") public class VolunteerController { private final VolunteerService volunteerService; // 봉사활동 구인글 전체 조회 @GetMapping() public ResponseEntity getAllVolunteers(@RequestParam(value = "userId", required = false, defaultValue = "0") Long userId) { List responses = volunteerService...

728x90