I had an interesting experience with AI yesterday.
I asked OpenAI GPT-4o to create a PHP script for me to build a compressed GZip file sitemap.xml.gz of a sitemap.xml file for my personal website.
I wanted the PHP script to step through a specified series of directories and build an XML sitemap file based on the last-modified dates and times of the .htm and .php files found in the directories.
Initially, the code generated worked, but it did not perform as expected. For example, I wanted the last modification date and time for the files in the <lastmod> field, but it kept only using the date.
I asked it to add a few specific .htm files in the base directory.
So far, so good.
Then I asked it to add a specific <urlset> statement. Well, that caused the AI to stop producing complete code. Hmmm!
No matter what I did, it continued to generate incomplete code.
I simplified my request by removing the specific <urlset> statement that confused the AI.
It then decided to produce incomplete code that, if I completed it, didn't work.
When I asked for the complete code, it would often add back in things I'd asked it not to include.
Obviously, it was very confused, as was I.
I then took the code from the last version that ran to completion and made some changes myself to include the date and time in <lastmod> instead of just the date.
Yippee, it worked!
I asked AI to take that code and add some refinements I wanted.
The AI reverted to producing incomplete code, which, if completed, would not work.
Ultimately, I made the necessary adjustments to my last working version and arrived at a solution I'm satisfied with.
All in all, it was an interesting, although at times frustrating, process.
