diff --git a/src/main/java/com/project/oof/storage/service/ChatHistoryService.java b/src/main/java/com/project/oof/storage/service/ChatHistoryService.java new file mode 100644 index 0000000..f7d3991 --- /dev/null +++ b/src/main/java/com/project/oof/storage/service/ChatHistoryService.java @@ -0,0 +1,26 @@ +package com.project.oof.storage.service; + +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Service +public class ChatHistoryService { + + private final List> chatHistory = new ArrayList<>(); + + public void addMessage(String role, String content) { + chatHistory.add(Map.of("role", role, "content", content)); + } + + public List> getChatHistory() { + return new ArrayList<>(chatHistory); // 복사본 반환 + } + + // 대화 기록 초기화 (옵션) + public void clearChatHistory() { + chatHistory.clear(); + } +}