Update ai.js

Current intermediate