Repository navigation
[WIP] GH-485: Add Drupal AI with MIRAI as the default chat provider - #486
Open
hkirsman-mearra wants to merge 2 commits into
Open
hkirsman-mearra wants to merge 2 commits into
hkirsman-mearra wants to merge 2 commits into
Conversation
Installs the Drupal AI module and connects it to MIRAI, the internal Open WebUI service, through the OpenAI-compatible provider, so the site has a working chat model for the AI demo. Reason: MIRAI exposes an OpenAI-compatible API (/api/models, /api/chat/completions) and its Gemini models are approved for client data, so the generic openai_compatible provider is enough and no custom provider is needed. This repository is public, so neither the MIRAI host nor the API key may end up in config/sync. The provider config exports a placeholder endpoint that settings.php replaces at runtime from MIRAI_API_URL (config overrides are not exported by drush cex), and the Key entity uses the env provider to read MIRAI_API_KEY. These variables live in .ddev/.env.web rather than the project .env, because load.environment.php only fills $_ENV/$_SERVER while the Key module reads getenv(). The setup is packaged as a recipe so it can be repeated on a fresh install or with another model via --input. - add drupal/ai and drupal/ai_provider_openai_compatible - add ai_mirai recipe enabling key, ai, ai_api_explorer and the OpenAI-compatible provider, with a configurable chat model input - export AI config: placeholder MIRAI endpoint, mirai_api_key Key entity reading MIRAI_API_KEY, google_genai.gemini-2.5-flash as default chat model - override the MIRAI endpoint from MIRAI_API_URL in settings.php - add AI research notes and the step-by-step implementation plan - add scripts/ai-endpoint-check.sh to diagnose OpenAI-compatible endpoints without printing the key - ignore .ddev/.env.web and document fresh install from existing config in README - re-export user view displays (key order only) Follow-up: Silta environments need MIRAI_API_URL and MIRAI_API_KEY (the key as a secret) and network access to MIRAI; without them the site deploys but AI requests fail. Next step is the CKEditor AI assistant. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
🔵 Needs a closer look
Four unresolved moderate findings and one nit require fixes before approval.
0 open findings
What changed in this PR
Adds Drupal AI with MIRAI as the default OpenAI-compatible chat provider, including configuration, setup documentation, and diagnostics.
Changes:
- Adds Drupal AI dependencies, modules, and exported configuration.
- Adds the MIRAI setup recipe and endpoint diagnostic script.
- Documents installation, research, implementation, and environment setup.
- Normalizes user display configuration and ignores local secrets.
| File | Reviewed changes and findings |
|---|---|
scripts/ai-endpoint-check.sh |
Adds MIRAI endpoint diagnostics. Moderate: API keys are exposed in the curl process arguments. |
recipes/ai_mirai/recipe.yml |
Defines MIRAI setup and the default chat model. |
README.md |
Documents configuration-based installation. Moderate: The fresh-install path omits required MIRAI environment setup. |
docs/02-ai-implementation-plan.md |
Documents implementation and validation. Moderate: The documented model override uses the wrong input name. Nit: Validation guidance recommends GitHub Models instead of MIRAI. |
docs/01-ai-research.md |
Adds AI ecosystem research. |
config/sync/key.key.mirai_api_key.yml |
Configures the MIRAI API key. Moderate: A single personal key is shared across all users. |
config/sync/core.extension.yml |
Enables the required modules. |
config/sync/core.entity_view_display.user.user.default.yml |
Updates the default user display configuration. |
config/sync/core.entity_view_display.user.user.compact.yml |
Updates the compact user display configuration. |
config/sync/ai.settings.yml |
Adds Drupal AI settings. |
config/sync/ai.html_to_markdown.settings.yml |
Adds HTML-to-Markdown settings. |
config/sync/ai.external_moderation.yml |
Adds external moderation settings. |
config/sync/ai_provider_openai_compatible.settings.yml |
Configures the OpenAI-compatible provider for MIRAI. |
composer.json |
Adds Drupal AI dependencies. |
.gitignore |
Ignores local DDEV secrets. |
Files excluded by content exclusion policy (1)
- web/sites/default/settings.php
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Adds the AI Assistant button and the text selection menu to CKEditor, so editors can generate, rewrite, summarize, fix spelling, change tone and translate text with the MIRAI chat model. Reason: this is step 2 of the AI implementation plan and the first AI feature editors use directly. The setup is a recipe, like step 1, so it can be repeated on other environments. The tools have no model of their own and use the default chat provider from ai.settings, so switching models stays a single setting. The recipe must import ai_ckeditor's default config explicitly: recipes install modules in syncing mode, which skips module config entities, so without the import the ai.ai_prompt.ai_ckeditor_* prompts are missing and every tool sends an empty prompt (the model then answers with unrelated text). The bundled ai_ckeditor submodule is deprecated in favour of drupal/ai_ckeditor, but that project has no stable 1.5 release and AI 1.5.1 does not require it; machine name and config are identical, so switching later is only a composer require. - add ai_ckeditor recipe: enables ai_ckeditor and taxonomy, adds the aickeditor and ai_balloon_menu toolbar items to basic_html and full_html, enables all eight AI tools and imports the module prompts - add "Tone of voice" and "Translation languages" vocabularies with starter terms as recipe content; tone descriptions guide the rewrite - grant content_editor the "use ai ckeditor" permission - export the resulting config (prompts, prompt types, ai_ckeditor settings, vocabularies, editors, role, core.extension) - document step 2 in the implementation plan, and how to reset the MIRAI endpoint to the placeholder before exporting config Follow-up: tone and language terms are content, so drush cim on Silta creates empty vocabularies; apply the recipe there or add terms by hand. Run composer require drupal/ai_ckeditor before upgrading to AI 1.6. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Installs the Drupal AI module and connects it to MIRAI.
You need to set .ddev/.env.web:
Then simplest is to install from config:
Screenshots