I have ying/yang relationship with the AI component. Occasionally it does what I want it to do using common sense prompts. but MOST of the time it just does whatever it feels like and seems to believe its improvisation is valuable.
I take the position that when there’s a problem its at least 51% my fault so I am seeking tips on how to avoid beating my head against the AI component wall.
For example - have a AI component that creates a menu with 6 buttons. each button has hover states that work. all good.
Now In the component I simply want to DEFINE a new action. just define it.
when i update the the action in the prompt I ask it to not change anything in the html structure - just create the action.
But the AI has its own ideas. It removes all my buttons, and instead adds its own set of random button choices and the action cannot be referenced from any of the now removed buttons.
I ask it to restore the the buttons which it kinda does but then the action is gone. I lather, rinse, repeat this for hours and as you can tell get frustrated.
If there is some magical prompt text and order of operations I will buy a big cup of coffee to ideas that can break thru my log jam.
The Ai Component is not work now, Do not give long instructions, give instructions for each change you need, it takes a lot of time but it is the only way you will achieve something similar to what you are imagining.
Yes - I do this. but in this case I am not asking the AI to do anything except create an action. I tell it - just update the action. don’t change anything in the structure of the component. but alas it goes rogue.
Federico - your idea got me thinking. I believe what is going on with whacko AI components is - the more I provide prompts to a component that is misbehaving the less capable the component is at making sensible updates.
I started with a fresh component and its not going rogue so far.
Don’t do it this way. If the last prompt breaks something, delete the last prompt and try again. Otherwise, like you said, it can get in a weird state.
I’m stuck again. I need a simple choice component that saves the selected item to a user specific field. it was doing this fine on other components but i am starting from scratch with a clean component and it refused to write to the column that other ai components are using. ideas welcom - here’s my promt
create a selection list using the item field from allitems json structure, selected value will be written to protein field
the prompt generates a drop down list but selecting an item from the UI does not save any value to the protein column. i asked it why and it ignores the prompt.
I try write selected item to protein and this does not help
I think Thinh’s comment is gold and would deserve an explanation in Glide Docs why it, or a similar prompt, is important.
As I understand it, the AI in the AI component only looks at the latest state. State of what, of the code I presume. So “keep everything else as is” instructs the AI to not change the rest of the existing code (which presumably is already working well), and “comment your own code for version control” adds context to the code for future iterations.
Yeah, I think it works that way. It would be nice to have the full history, but I think it’s too costly for them to do it.
Learned the “comment your code” thing from @MaximeBaker . The “keep everything else as is” works most of the times for me, but when I need complex changes, somehow it goes against me a few times.
I think this somewhat makes sense. If s is the current state of the code and s+1 is the next iteration, then prompt p (that will look at s) can, I’m guessing, do one of 3 things:
Keep the existing code s and add some more code (addition)
Keep part of the existing code and remove some of it (subtraction)
Alter the existing code and possibly add, though I would count this add as part of the alteration (alteration)
So the “keep everything else as is” places us in situation 1., where we assume we’ve gotten to a state we like, so let’s not break it. It prevents you from being in situation 3., which is where you would need to be for complex changes.
I’m making a ton of assumptions here, but the mental modal I’m making for myself is helping me understand how the AI component works.
At one point I read from Thinh, Jeff or Maxime that the custom AI component is based off of Alpine and Tailwind javascript. And Thinh I think you shared a post with the list of functions that we can reference in our prompts. I find it very useful to know that our prompts are “translated” into this code. I don’t use the custom AI component enough, but if I did, I imagine that I would tailor my prompts to the code.