chat template loading, add handlers to template elements