- Issue created by @marcus_johansson
- 🇩🇪Germany marcus_johansson
html2canvas tested with a manual button against the Experience Builder iframe and the results are not 1-to-1, so its not a solution that is viable.
vs
Its also stated in the documentation
Why doesn't CSS property X render correctly or only partially?
As each CSS property needs to be manually coded to render correctly, html2canvas will never have full CSS support. The library tries to support the most commonly used CSS properties to the extent that it can. If some CSS property is missing or incomplete and you feel that it should be part of the library, create test cases for it and a new issue for it.I will do the headless chrome tool, because that is needed for other reasons anyway, the question then is how it can access the component via localhost. Will try to figure this out.
- Merge request !1199Draft: Resolve #3532296 "Iteration agent on" → (Open) created by marcus_johansson
- 🇬🇧United Kingdom yautja_cetanu
Follow up
- Need to turn it into a proper agent now file upload hasn't happened.
- Make it so we can swap out the back-end service for looking at the images.
- Make it so we can configure the number of loops
- 🇩🇪Germany marcus_johansson
So, the current setup for anyone taking over:
There are three components to this agent:
1. The preview controller.
This is a controller that can preview the latest version of a JS component rendered within the frontend theme. This takes parameters that can be set with width and height in percentage or pixels. The reasoning is so you can request the component rendered with the frontend theme with the exact same measurements, so it can compare.2. The Rate XB Components tool.
Currently it takes the file id and the component id, and uses Chromium to visit the controller above and take a screenshot and then it asks inside the tool to rate this from 1 to 10 how similar they are and what improvements can be made and returns these.Pre-requirements:
This solution needs chromium installed can chrome-php.What is missing:
On the controller we should add a possibility to have one off permissions. This means that the agent should be able to request and get a authentication code that is one-use only. Let me see if I can fix this.The tool should be possible to move into a tool that a sub-agent is using instead now that we can use images.
The last part is to reiterate on the agent over and over until you get a result that is over N within A amount of loops. Rating 6 is something that worked quite well with the prompt above. I had that working in long timeout format, but with the iteration issue this should be possible to see over and over.
- 🇮🇳India Akhil Babu Chengannur
Currently, the code component creation agent returns the component data (id, js, css etc) in JSON format and based on that, the actual component is created from the UI.
But to review the component on the fly before sending the final output, the component must exist. Means, we should create it directly from the backend. - 🇮🇳India Akhil Babu Chengannur
akhil babu → changed the visibility of the branch 1.x to hidden.
- 🇮🇳India Akhil Babu Chengannur
As mentioned in #12, component creation is currently happening from the UI. For the review to work, the component must be created from the backend. However, in that case, the CSS and JS will not be compiled properly, since the compilation happens in the frontend and the compiled CSS and JS are then sent to the backend. Because of this, the component will not be rendered in the preview controller.
Also, when Chromium is used, the component is rendered as seen by an anonymous user. XB does not apply styles for anonymous users. The Create/Edit XB page content permission is required for this. Even if the permission is granted, the issue described above still prevents the component from being previewed.
- 🇬🇧United Kingdom yautja_cetanu
For people not into AI basically we need to find a way that we automatically generate an accurate screenshot of a componenet.
- The componenet is built in react by typing javascript, css etc.
- We need some way we can take the componenet we see rendered and automatically take a screenshot without the user having to press screenshot screens.
- We need to send that screenshot to a server side API for processing (in this case an AI agent looking at it) whilst thinking carefully of any security implications.