Investors are showing little patience for lavish spending and meager returns on companies’ artificial intelligence bets. Share