store every phrase by itself and then store possible responses to that phrase. if you say something new, the ai will say something random. if you say something you've already said before, the ai will choose from its list of possible responses to that phrase.