- Issue created by @wouters_f
- π§πͺBelgium wouters_f Leuven
I've made a version that uses
The AI core module (this allows you to switch AI generating models on a global level).
it's not yet finished.
the ckeditor plugin is still present, in the config you can choose the
- default text_to_image provider
- or choose one (explicitely)then when you enter a prompt we'll pass this data on to the AI module
but I'm not yet sure how to render the image.
this is what I have now:This code does not work.
Since the use Drupal\ai\Enum\Bundles; can not be found. Work in progress.if($provider_name == '000-AI-IMAGE-DEFAULT') { $ai_config = \Drupal::service('config.factory')->get('ai.settings'); $default_providers = $ai_config->get('default_providers') ?? []; $ai_provider = $service->createInstance($default_providers['text_to_image']['provider_id']); $default_model = $default_providers['text_to_image']['model_id']; }else{ $ai_provider = $service->createInstance($provider_name); // TODO if no $default_model how to define this? via the ckeditor admin? } $config = [ "n" => 1, "response_format" => "b64_json", "size" => "1792x1024", "quality" => "standard", "style" => "vivid", ]; $tags = ["tag_1", "tag_2"]; $ai_provider->setConfiguration($config); $response = $ai_provider->invokeModelResponse(Bundles::TextToImage, $default_model, $prompt, $tags, TRUE); dd($response);
- π§πͺBelgium wouters_f Leuven
The description should also be adapted.
STEPS:
- Install ai module (dependency)
- Choose default text_to_image model (in ai settings) for example openai or aonther image rendeinr provider.
- enable ai_image (this) module
- Add ckeditor plugin to toolbar
- use the toolbar, and its ckeditor button to generate images with prompt.
- Status changed to Needs review
5 months ago 5:47pm 12 July 2024 - π§πͺBelgium wouters_f Leuven
Would be great if someone could test the module and approve it. Thanks!
- First commit to issue fork.
- Status changed to RTBC
5 months ago 1:11pm 26 July 2024 - πΊπ¦Ukraine quadrexdev Lutsk
+1 to RTBC, I just tested it and it worked pretty well!
-
eliasbrat β
committed fd5aa733 on 1.0.x authored by
wouters_f β
Resolve #3460663 "Should use the ai module"
-
eliasbrat β
committed fd5aa733 on 1.0.x authored by
wouters_f β
- Status changed to Fixed
6 days ago 10:07am 18 December 2024