ai_chatblock
No security coverage
AI Chatblock adds a floating chat widget to any page on your Drupal site, powered by the AI module's assistant framework. Functionally similar to the ai_chatbot module from the AI ecosystem, but with a frontend that is 100% Drupal-native, and thus with a more flexible and familiar theming workflow.
Features
- Streaming responses via Server-Sent Events (SSE), so replies appear progressively as they are generated.
- Server-side session history — conversation threads are tracked per session, giving the AI context from earlier messages.
- Suggested questions — clickable starter questions shown before the first message.
- Introduction text — optional HTML displayed above the suggested questions.
- Markdown rendering — assistant responses rendered as formatted HTML when
league/commonmarkis available. - Optional history restore on reload — reopens the chat with history intact after a page reload via
localStorage. - In-browser test runner — fire test questions against the assistant directly from the block configuration form.
- CLI test runner — a Drush script for automated testing from the terminal, with support for multi-turn conversation simulation.
- SDC example component — a Single Directory Component starter that can be copied into any theme as a customisation base.
Post-Installation
- Configure an AI Assistant at Administration → AI → Assistants.
- Place the block at Structure → Block layout — search for AI Chatblock.
- Configure the block: go to the block's configuration form, select the AI Assistant you just created, and set other values as needed.
- Test the assistant — expand Test Questions in the block config form, enter a few questions then save the form. Then click Run Tests to verify responses.
- Theming (optional) — copy
templates/ai-chatblock.html.twigto your theme and/or copyexample-data/chatbot-sdc/to your theme'scomponents/directory. Disable the module's default CSS in your theme's.info.yml:
libraries-override: ai_chatblock/chatbot: css: theme: css/ai-chatblock.css: false
Additional Requirements
- Drupal 10 or 11
drupal/ai— core AI integration framework, including theai_assistant_apisub-module.- At least one configured AI Assistant entity at Administration → AI → Assistants.
- An LLM provider module — e.g.
drupal/ai_provider_openaiwith a valid API key.
Recommended modules/libraries
league/commonmark— converts assistant responses from Markdown to formatted HTML. Install viacomposer require league/commonmark. Without it, responses are plain text.drupal/ai_agents— adds agentic capabilities (tool use, multi-step reasoning) to AI Assistants.- A vector database provider (e.g.
drupal/ai_vdb_provider_milvus) — enables retrieval-augmented generation (RAG) so the assistant can answer questions grounded in your site's content.
Similar projects
drupal/ai- submoduleai_chatbot— the official AI ecosystem chatbot module. The difference is thatai_chatbot's preferred frontend uses an external js chatbot API (Deepchat), whileai_chatblock's frontend is all Drupal.
Supporting this Module
Developed and maintained by LOOM — https://loom.de
CLI test runner:
ddev drush php:script web/modules/custom/ai_chatblock/tests/drush/test-questions.phpSet $shared_thread = TRUE in the script to simulate a continuous multi-turn conversation.