San Francisco has spent the past few years trying to convince the world it was not finished. Now artificial intelligence has brought fresh money, fresh attention, and a new wave of optimism back to a city that has always reinvented itself through technology.