Major indexes have mostly been treading water for months, as investors’ exuberance for artificial intelligence wears off.