android-com-pl / wp-ai-alt-generator

WordPress plugin that leverages OpenAI's Vision API to automatically generate descriptive alt text for images, enhancing accessibility and SEO.
https://wordpress.org/plugins/alt-text-generator-gpt-vision/
GNU General Public License v3.0
12 stars 4 forks source link

Wish there was support for custom openai node. #7

Closed zjcboy closed 1 month ago

zjcboy commented 1 month ago

I hope you can plugin support custom openai interface, currently by modifying the code way to achieve, but each update is very inconvenient. Thanks for your help.

rafaucau commented 1 month ago

Do you mean a fine-tuned model?

currently by modifying the code way to achieve

Could you provide an example?

zjcboy commented 1 month ago

For example, through a third-party gpt interface, as this doesn't cost much. https://deepbricks.ai/docs

rafaucau commented 1 month ago

This link requires login. If your API request data structure is other than OpenAI, well, there will be no such option in this plugin, as there are probably many such APIs and it would be impossible to maintain support for all of them.

The only reasonable option would be to add a hook filter (apply_filters()) to the API request in this code, so you could then modify this in your code (add_filter()), which would allow you to update this plugin without overwriting your code every time.

https://github.com/android-com-pl/wp-ai-alt-generator/blob/d6b55df29104e8ab05eab15ba4c77af3c4937a14/includes/AltGenerator.php#L33-L82

zjcboy commented 1 month ago

It would be perfect if the plugin could provide a field where you can fill in and modify the api address.

rafaucau commented 1 month ago

I would prefer that such an option is not available to casual users, because some custom APIs may require a different structure for the data to be sent, which will raise unnecessary questions from users if something does not work for them.

That's why in #8 I create PHP filters that will allow more advanced users to change this URL and the structure of the request data.

When I release v2.5.1, you will be able to add such a line to functions.php of your theme or any other place in the code over which you have control:

add_filter('acpl/ai_alt_generator/api_url', fn() => 'https://your-url-here');
rafaucau commented 1 month ago

v2.5.1 released. Here is the documentation for other hooks: https://github.com/android-com-pl/wp-ai-alt-generator?tab=readme-ov-file#for-developers