* implement backend of submitChat API