Skip to content

Commit

Permalink
Merge pull request #19 from siwonKH/main
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
siwonkh authored Jun 27, 2023
2 parents 8f3a025 + 30891d9 commit 4788d49
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/com/khpt/projectkim/controller/ChatController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.khpt.projectkim.entity.User;
import com.khpt.projectkim.model.ChatData;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -13,14 +13,17 @@
import java.util.List;

@Controller
@RequiredArgsConstructor
public class ChatController {
private final HttpSession httpSession;

@Value("${spring.datasource.url}")
private String debug;
@GetMapping("/chat")
public String chat(Model model) {
User user = (User) httpSession.getAttribute("user");
public String chat(HttpSession session, Model model) {
System.out.println("\n\n\n\nDEBUG!!" + debug + "\n\n\n");

User user = (User) session.getAttribute("user");
if (user == null){
model.addAttribute("image", "/icons/black.png");
return "chat";
}
model.addAttribute("name", user.getLogin());
Expand All @@ -30,7 +33,7 @@ public String chat(Model model) {
}

@PostMapping("/chat")
public ChatData sendChat(@RequestParam List<ChatData> chatDataList) {
public ChatData sendChat(HttpSession session, @RequestParam List<ChatData> chatDataList) {
// TODO API 요청으로 responseChat 가져오기
ChatData responseChat = new ChatData("assistant", "안녕하세요. 무엇을 도와드릴까요?");
return responseChat;
Expand Down

0 comments on commit 4788d49

Please sign in to comment.