yuduki / dialogue_engine.py
rusinopp's picture
Upload 9 files
e9da344 verified
raw
history blame contribute delete
452 Bytes
import random
import json
class DialogueEngine:
def __init__(self, persona, templates):
self.persona = persona
self.templates = templates
self.history = []
def respond(self, user_input):
self.history.append(user_input)
response = random.choice(self.templates["poetic"]) + "。"
support = random.choice(self.templates["support"])
return f"{self.persona['name']}{response} {support}"