Created on 6 August 2025, 2 months ago

Project Description

https://www.drupal.org/project/dify โ†’
Dify Integration for Drupal integrates the Dify AI platform with Drupal to provide AI-powered chatbots that answer questions based on site content.

Key Features:

  • Search API backend for indexing Drupal content to Dify knowledge base
  • Official Dify widget integration
  • Custom chatbot widget with streaming responses
  • AI-enhanced search results

What makes it different:

  • Official authorization from LangGenius Inc. (Dify creators)
  • Content-aware AI responses based on actual site content (not generic chatbot)
  • Multiple integration options (official widget + custom widget + search enhancement)

Security:

  • Credentials stored in Drupal state system (never exported)
  • Respects Drupal access control
  • Authentication restrictions available
  • Input sanitization for API calls

Who i am

Experience: 10+ years Drupal, Team Leader Drupal at Adimeo https://www.drupal.org/u/asterovim โ†’

๐Ÿ“Œ Task
Status

Needs review

Component

module

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance Asterovim Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Asterovim
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance Asterovim Paris
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect โ†’ for more details and Security advisory coverage application checklist โ†’ to understand what reviewers look for. Tips for ensuring a smooth review โ†’ gives some hints for a smoother review.

    The important notes are the following.

    • If you have not done it yet, enable GitLab CI for the project, and fix what reported from the phpcs job. This help to fix most of what reviewers would report.
    • For the time this application is open, only your commits are allowed. No other people, including other maintainers/co-maintainers can make commits.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application.
    • Nobody else will get the permission to opt projects into security advisory policy. If there are other maintainers/co-maintainers who will to get that permission, they need to apply with a different module.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications โ†’ , Application workflow โ†’ , What to cover in an application review โ†’ , and Tools to use for reviews โ†’ .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool โ†’ only once per application. The configuration used for these tools needs to be the same configuration used by GitLab CI, stored in the GitLab Templates repository.
    • It may be best to have the applicant fix things before further review.

    For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues โ†’ .

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    1. FILE: dify.info.yml

    core_version_requirement: ^9 || ^10 || ^11

    FILE: modules/dify_augmented_search/dify_augmented_search.info.yml

    core_version_requirement: ^9 || ^10 || ^11

    FILE: modules/dify_search_api/dify_search_api.info.yml

    core_version_requirement: ^9 || ^10 || ^11

    FILE: modules/dify_widget_official/dify_widget_official.info.yml

    core_version_requirement: ^9 || ^10 || ^11

    FILE: modules/dify_widget_vanilla/dify_widget_vanilla.info.yml

    core_version_requirement: ^9 || ^10 || ^11

    A new project should not declare itself compatible with a Drupal release that is no longer supported. No site should be using Drupal 8 nor Drupal 9, and people should not be encouraged to use those Drupal releases.

    2. FILE: dify.links.menu.yml

    File is empty and can be removed.

    FILE: dify.module,
    FILE: modules/dify_search_api/dify_search_api.module

    Only one hook is present in file but it is empty and can be removed.

    3. FILE: src/DifyClient.php

      /**
       * Creates a new Guzzle client.
       *
       * @param string $base_url
       *   The base URL of the Dify API.
       * @param string $authorization_token
       *   The authorization token to use for requests.
       */
      public function __construct(string $base_url, string $authorization_token) {

    The documentation comment for constructors is not mandatory anymore, If it is given, the description must be โ€œConstructs a new [class name] objectโ€, where [class name] includes the class namespace.

    4. FILE: modules/dify_augmented_search/dify_augmented_search.module

    /**
     * @file
     * Dify Augmented Search module hooks.
     */

    FILE: modules/dify_widget_official/dify_widget_official.module

    /**
     * @file
     * Dify official widget module hooks.
     */

    FILE: modules/dify_widget_vanilla/dify_widget_vanilla.module

    /**
     * @file
     * Dify Widget Vanilla module.
     *
     * Floating chatbot widget with direct Dify API integration.
     */

    The usual description for a .module file is โ€œHook implementations for the [module name] moduleโ€, where [module name] is the module name given in the .info.yml file.

    5. FILE: modules/dify_widget_vanilla/templates/dify-widget-vanilla.html.twig

    <style>
    :root {
      --dify-primary-color: {{ custom_colors['primary-color'] }};
      --dify-primary-hover: {{ custom_colors['primary-hover'] }};
      --dify-primary-light: {{ custom_colors['primary-light'] }};
      --dify-background-main: {{ custom_colors['background-main'] }};
      --dify-background-secondary: {{ custom_colors['background-secondary'] }};
      --dify-background-tertiary: {{ custom_colors['background-tertiary'] }};
      --dify-background-input: {{ custom_colors['background-input'] }};
      --dify-text-primary: {{ custom_colors['text-primary'] }};
      --dify-text-secondary: {{ custom_colors['text-secondary'] }};
      --dify-text-muted: {{ custom_colors['text-muted'] }};
      --dify-text-placeholder: {{ custom_colors['text-placeholder'] }};
      --dify-border-color: {{ custom_colors['border-color'] }};
      --dify-border-light: {{ custom_colors['border-light'] }};
      --dify-user-message-bg: {{ custom_colors['user-message-bg'] }};
      --dify-bot-message-bg: {{ custom_colors['bot-message-bg'] }};
      --dify-error-bg: {{ custom_colors['error-bg'] }};
      --dify-error-text: {{ custom_colors['error-text'] }};
      --dify-notification-color: {{ custom_colors['notification-color'] }};
      --dify-success-color: {{ custom_colors['success-color'] }};
      --dify-warning-color: {{ custom_colors['warning-color'] }};
    }
    </style>

    Move styles (CSS) into a library and attach them. See the process here โ†’ .

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance Asterovim Paris
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance Asterovim Paris
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    I will review the project in the next 24 hours, if nobody beats me.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
    • A specific point may just be an example and may apply in other places
    • A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
    • The single review points are not ordered, not even by importance

    modules/dify_augmented_search/src/Controller/MarkdownController.php

    Since that class does not use methods from the parent class, it does not need to use ControllerBase as parent class. Controllers do not need to have a parent class; as long as they implement \Drupal\Core\DependencyInjection\ContainerInjectionInterface, they are fine.

    modules/dify_widget_official/src/Form/DifyWidgetOfficialConfigForm.php

    The class does not use any method from the parent class, except $this->t(). It could just implement the required interface and use the trait that implements $this->t().

    modules/dify_widget_vanilla/src/Plugin/Block/DifyWidgetVanillaBlock.php

      /**
       * {@inheritdoc}
       */
      public function access(AccountInterface $account, $return_as_object = FALSE) {
        return $return_as_object ? AccessResult::allowed() : TRUE;
      }
    

    Since the class extends BlockBase, it needs to implement blockAccess().

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance Asterovim Paris

    Fixed with merge request: https://git.drupalcode.org/project/dify/-/merge_requests/8

    All identified issues have been addressed: removed unnecessary ControllerBase and FormBase inheritance, implemented proper blockAccess() method, and ensured compliance with Drupal coding standards. Thank you for the review avpaderno :)

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance Asterovim Paris
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    Thank you for your contribution and for your patience with the review process!

    I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.

    These are some recommended readings to help you with maintainership:

    You can find more contributors chatting on Slack โ†’ or IRC โ†’ in #drupal-contribute. So, come hang out and stay involved โ†’ !
    Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review โ†’ . I encourage you to learn more about that process and join the group of reviewers.

    I thank also all the reviewers for helping with these applications.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance Asterovim Paris

    Thank you so much avpaderno for this approval and for guiding me through the entire process!
    I'm truly honored to receive this validation and contribute to the Drupal ecosystem with the Dify module. I'll definitely go through all the recommended readings and resources you've shared.
    Special thanks to:
    * vishal.kadam for the thorough initial review and constructive feedback that really helped improve the code quality
    * avpaderno for the detailed technical review and patient guidance throughout the process
    All reviewers who helped make this module better

    This has been an incredibly valuable experience, and I'm excited to give back to the community. Looking forward to reviewing other pending projects and staying involved!
    Thanks again for this opportunity and all your work maintaining Drupal's security standards! ๐Ÿš€

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    We do not close fixed issues: They are automatically closed after 14 days.

Production build 0.71.5 2024