Updates to ai_chat.c