Skip to content

Commit

Permalink
feat: gpt 프롬프트 반환
Browse files Browse the repository at this point in the history
  • Loading branch information
osoohynn committed Nov 28, 2024
1 parent 165cfe2 commit 4e545e1
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<Map<String, String>> chatHistory = new ArrayList<>();

public void addMessage(String role, String content) {
chatHistory.add(Map.of("role", role, "content", content));
}

public List<Map<String, String>> getChatHistory() {
return new ArrayList<>(chatHistory); // 복사본 반환
}

// 대화 기록 초기화 (옵션)
public void clearChatHistory() {
chatHistory.clear();
}
}

0 comments on commit 4e545e1

Please sign in to comment.