history code in new file & fillchat() in chat.js