Anyone using AI to refine or create scripts for ignition?
I have been playing with it and while I am not sure if it would work well for making scripts in first place, putting a script I have already working into the AI and asking it to improve format, readability, comments seems to do alright.
if you are using AI for scripting with ignition do you have a method so it doesn't try to change syntax or style into Python 3.5+. What I have done so far is to state. Assume any provided syntax is correct and do not edit syntax.
Would be nice (or let me know where I can find if it already exists) if the AI was trained on ignition scripting in particular with all the ignition built in functions.
You can explain in your prompt that you are using Python 2.7, or even tell it you're using Jython, which is Python 2.7 but with access to JDK 17 libraries, and that you want it to ensure any code it suggests uses Python 2.7 syntax.
Yeah too soon for that. They've probably ingested the forums (at some snapshot in time) and maybe even the user manuals, but it's not enough to trust the output.
I've used it sparingly to bounce ideas off for both Ignition and Grafana (and VBA before that), but I don't take its response as gospel. Occasionally it will point you in the right direction, but in all cases where I've used it, the answer is almost never quite right.
What I did was put in some scripts that I created through a lot of testing and I was NOT great about maintaining format , naming conventions, commenting etc But it works and does what I need it to do.
Put it into chat gpt and told it... Assume all syntax is correct and not to be edited but edit this script to improve format, standardize naming convention, add functions for any repeated code and improve readability.
took the resultant code and put it back into ignition and nothing broke and ended up with something that was a lot more readable a lot faster then if I had done it myself.
Its funny. Chat GPT at least really really really doesn't want to stop using f-strings. Even if I start with "using Python 2.7" and tell it explicitly don't use f-strings given enough prompt and response even in the same chat it will eventually revert to f-strings. I get a bit snarky and say what in the f-string are you doing? It will reply oops we can't do that let me fix it..