Full disclosure, the phrasing below comes from interacting with ChatGPT. Full conversation in the link at the bottom.
I just watched Daniel Nabil’s PloneConf 2024 presentation on his GSoC project, which integrates Google Gemini Flash to generate alt text for images in Volto. The project is interesting and addresses a real accessibility need. However, it also raises a broader question: how do we ensure that GSoC projects align with Plone’s core architectural principles?
Daniel’s implementation hooks into Plone-Volto and modifies the image block UI to add title
and alt
attributes during upload (code here). While this works for Volto users, it bypasses Plone’s Python-based core and doesn’t integrate with content behaviors, which are the standard way to add metadata (extend content types) in Plone. This means Classic UI and API users don’t benefit from the feature, and it sets a precedent for frontend-only solutions that could fragment functionality in the future.
A better approach would be to follow an architectural pattern similar to how we integrate external services in Plone.
- Backend-first API integration:
- A REST client (e.g.,
requests
) is initialized in Plone to communicate with Google Gemini, handling authentication (OAuth) and requests. - This ensures Plone, not just Volto, can access and process AI-generated metadata.
- Presentation via viewlets and behaviors:
- This could be done via a REST API connector, a viewlet queries the API and displays the response in a ZPT template within a theming/policy package.
- For Gemini, a similar approach could store AI-generated attributes in Plone’s Dublin Core metadata via behaviors.
- Zope event hooks for persistence:
- If AI-generated metadata needs to be stored permanently, it can be hooked into Zope’s event machinery, ensuring that descriptions are saved with the image object.
- Volto as a pure presentation layer:
- Since "Image" is a standard Plone content type, Volto would not need any customizations—the backend would already provide the enriched metadata via REST API.
By structuring the project this way, we get a unified Plone-wide feature rather than one that only works in Volto.
This brings me to the bigger question: Should we establish guidelines to ensure GSoC projects follow Plone’s architectural principles? Some ideas:
- Backend-first design: New functionality should integrate with Plone’s core rather than being Volto-only.
- Extensibility via behaviors: Features should be Plone-native, not hardcoded UI modifications.
- Long-term maintainability: Plone’s APIs should be the primary access point, so functionality remains accessible to all frontends.
Thoughts?
Norbert