GodSaveMoney / core /context_manager.py
Jeong-hun Kim
add "start with localhost", code refactored
aab927d
raw
history blame
745 Bytes
class ContextManager:
# ์ „์—ญ ์ƒ์ˆ˜ ์„ค์ •
USER_NAME = "User"
BOT_NAME = "Tanjiro"
def __init__(self):
self.user_name = self.USER_NAME
self.bot_name = self.BOT_NAME
self.history = []
def getUserName(self) -> str:
return self.user_name
def getBotName(self) -> str:
return self.bot_name
def getHistory(self) -> str:
return self.history
def setHistory(self, new_history: list):
self.history = new_history
# ๋Œ€ํ™” ๊ธฐ๋ก์„ history์— ์ถ”๊ฐ€
def addHistory(self, role: str, text: str):
self.history.append({"role": role, "text": text})
# ๋Œ€ํ™” ๊ธฐ๋ก ์ดˆ๊ธฐํ™”
def clearHistory(self):
self.history = []