Chat history js syntax error