Adding Disable Option for AI Automators

Created on 25 February 2025, 5 months ago

Problem/Motivation

While working on the AI automator's i felt there is no way we could disable the automator configured on a field , rather than we have to go to edit the field and remove the automator checkbox in order to remove from the automator chain.
the drawback i see is admin's have to reconfigure the same set of changes again if they later on enable the same features.
Is it a good idea to add this feature and make sure admins can enable and disable the automator's by clicking on a disable button instead.

Steps to reproduce

Proposed resolution

TBD

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.1

Component

AI Automators

Created by

🇮🇳India vakulrai

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

Merge Requests

Comments & Activities

  • Issue created by @vakulrai
  • Pipeline finished with Failed
    5 months ago
    Total: 257s
    #440045
  • 🇮🇳India anjaliprasannan
    • Added a special "disable" row to the table
    • Modified the form rendering to check row positions relative to the disable row
    • Added logic to disable fields in rows below it
    • Split the form submission into two actions: "Resort" (current behavior) and "Save" (to persist disabled states)
    • Added a mechanism to track and persist the disabled state of configurations below the disable row
    • Modified the form to include two submit buttons
    • Updated the submit handler to handle both actions differently

  • Pipeline finished with Failed
    5 months ago
    Total: 216s
    #440070
  • 🇮🇳India anjaliprasannan
    • "Save" should persist the order and disable rows below the disable line
    • On page reload, disabled rows should maintain their state.
    • Ensure disabled rows maintain their state after submission
  • Pipeline finished with Failed
    5 months ago
    Total: 317s
    #440704
  • 🇮🇳India anjaliprasannan

    Screenshot retaining the position post save the disabled rows.

  • Pipeline finished with Failed
    5 months ago
    Total: 206s
    #440745
  • Pipeline finished with Failed
    5 months ago
    Total: 207s
    #440754
  • Pipeline finished with Failed
    5 months ago
    Total: 309s
    #440811
  • Pipeline finished with Success
    5 months ago
    Total: 206s
    #440823
  • Pipeline finished with Failed
    5 months ago
    Total: 396s
    #441055
  • Pipeline finished with Failed
    5 months ago
    Total: 213s
    #441066
  • Pipeline finished with Success
    5 months ago
    Total: 273s
    #441078
  • Pipeline finished with Failed
    5 months ago
    Total: 201s
    #441246
  • Pipeline finished with Failed
    5 months ago
    Total: 204s
    #441254
  • Pipeline finished with Failed
    5 months ago
    Total: 204s
    #441258
  • Pipeline finished with Success
    5 months ago
    Total: 337s
    #441267
  • 🇮🇳India anjaliprasannan

    The automator was not working when enabled the field once you disable it. Fix added for this issue.

    MR updated and pipeline passed.
    Please review.

  • 🇮🇳India annmarysruthy

    Left comments in MR

  • Pipeline finished with Success
    5 months ago
    Total: 204s
    #441569
  • Pipeline finished with Canceled
    5 months ago
    Total: 124s
    #441570
  • Pipeline finished with Success
    5 months ago
    Total: 214s
    #441575
  • 🇮🇳India annmarysruthy

    Reviewed MR !490. Tested the functionality and disable option is working fine.

    I have a concern about re-sort option. Once we disable a field in AI Automator Run Order, On clicking the re-sort the disabled field is enabled and sorted. Shouldn't we only consider enabled fields while re-sorting?

    Example scenario: If there is a large number of fields in 'AI Automator Run Order' , user disables one or more fields and needs to re-sort the enabled fields.

  • 🇮🇳India anjaliprasannan

    @annmarysruthy Yes the resort should not enable disabled fields and resort them. That should be fixed.
    Moving the ticket to Needs work.

  • Pipeline finished with Failed
    5 months ago
    Total: 237s
    #442537
  • Pipeline finished with Success
    5 months ago
    Total: 303s
    #442551
  • 🇮🇳India annmarysruthy

    Tested the changes and Changes look good. Moving to RTBC.

  • Pipeline finished with Success
    5 months ago
    Total: 202s
    #442628
  • 🇮🇳India prashant.c Dharamshala

    It would also be good to get some reviews from other community members. Changing status to NR.

  • 🇬🇧United Kingdom MrDaleSmith

    This applies cleanly as works as described. I'm in two minds about the two separate buttons, though: my gut feeling is that this is confusing UX and if I drag an automator into disabled and click resort instead of save I don't expect the automator I moved to jump back into the active area. However, I'm not sure what could be done about this, or that this expectation would be the same for everyone.

    as it stands, this is an improvement and works so possibly we should leave my questions for a future issue and mark this as RBTC again?

  • 🇮🇳India anjaliprasannan

    @mrdalesmith Can we modify the functionality so that clicking the "Re-sort" button first saves the current state (including enabling/disabling items based on their position relative to the disable row) and then resorts only the enabled items, we can combine the submitFormSave and submitFormResort logic into a single workflow triggered by the "Re-sort" button. This ensures that when you move an item below the disable row and click "Re-sort," the save operation happens first (updating the disabled/enabled states), followed by the re-sorting of enabled items.

  • 🇬🇧United Kingdom MrDaleSmith

    I'm not really the person to make the call, but I can see that we do need two separate buttons: some people may wish to reorder the providers, whilst others may want to save the position they have been manually put into by them. I don't think a single button could suit everybody (which maybe why there wasn't originally any functionality to enable/disable the providers from this listing).

  • Status changed to Needs review 3 months ago
  • 🇮🇳India anjaliprasannan

    Ok lets wait for input from maintainers.

  • 🇨🇦Canada bisonbleu

    @anjaliprasannan I'd like to test/review the MR but it has fallen quite a bit behind in 3 months…

    212 commits behind, 7 commits ahead of the upstream repository.

    Can you update the fork in GitLab ?

  • Pipeline finished with Failed
    21 days ago
    #548973
  • Pipeline finished with Failed
    21 days ago
    #548986
  • Pipeline finished with Failed
    21 days ago
    #548992
  • Pipeline finished with Failed
    21 days ago
    #549038
  • 🇮🇳India anjaliprasannan

    @bisonbleu you can review now

  • 🇩🇪Germany marcus_johansson

    Sorry about this - but could we update this to 1.2.x? Its a feature and can't go into 1.1.x.

    When you are done, could you ping me on Slack (marcus_johansson) so we get this in.

  • Pipeline finished with Failed
    19 days ago
    #551116
  • Pipeline finished with Failed
    19 days ago
    Total: 173s
    #551121
  • Pipeline finished with Failed
    19 days ago
    Total: 316s
    #551125
  • Pipeline finished with Failed
    19 days ago
    #551140
  • 🇮🇳India anjaliprasannan

    @marcus_johansson I have changed to 1.2.x.

  • 🇨🇦Canada bisonbleu

    Just tested the latest MR with an Article node where 2 fields are setup with Automators » Automator Worker: Direct

    • When the automators are disabled in the UI at admin/structure/types/manage/page/automator_chain, saving the node does NOT trigger them i.e. no call to the LLM are made;
    • When the automators are enabled in the UI, saving the node triggers both automators i.e. 2 calls are made to the LLM;

    NOTES:

    @anjaliprasannan, in #5 you write:

    Split the form submission into two actions: "Resort" (current behavior) and "Save" (to persist disabled states)

    I don't understand why I would want to «Resort» after just sorting the automators ? Resort suggests to sort again, which does not make sense in the context.

    Unless you mean to say «Reset»? Reset | Undo here would suggest resetting the current form to its original saved states, in other words «Cancelling the changes.» If this is your intentions here, then «Cancel» might be a better word. But… «Cancel» also suggests to «Go back».

    IMHO, there should be just one Save button i.e. the UX should exactly replicate what we see in Manage form display and Manage display tabs.

    So yes and «great work!» this works fine with Automator Worker: Direct.

    But unfortunately with the addition of Automator Worker: Field Widget disabling the Automators does not hide the field widget action buttons in the edit form and clicking the buttons will trigger calls to the LLM.

  • 🇩🇪Germany marcus_johansson

    Actually the last item @bisonbleu - I think we will create a follow up issue for. Its outside of the scop for this.

  • 🇨🇦Canada bisonbleu

    I agree, makes sense.

  • 🇨🇦Canada bisonbleu

    Setting to RTBC…

  • 🇨🇦Canada bisonbleu

    More feedback is required about what I wrote in #31, that there should only be a Save button i.e. the UX should exactly replicate what we see in Manage form display and Manage display tabs.

  • Pipeline finished with Failed
    15 days ago
    #553827
  • Pipeline finished with Failed
    15 days ago
    #553840
  • Pipeline finished with Failed
    15 days ago
    #553844
  • 🇮🇳India anjaliprasannan

    @bisonbleu Have moved the resort and save logic together.

  • Pipeline finished with Failed
    14 days ago
    Total: 247s
    #554636
  • 🇨🇦Canada bisonbleu

    The UI appears to work fine with just the Save button. But event when all automators are disabled, it is still possible to trigger a call to the LLM when clicking the action button.

    Drupal 11.2.2
    drupal/ai:1.2.x-dev
    drupal/ai_agents: 1.1.x-dev

    Also seeing this error, thought I'm not sure it is related:

    Warning: Undefined array key "button_label" in Drupal\field_widget_actions\FieldWidgetActionBase->getButtonLabel() (line 199 of /var/www/html/web/modules/contrib/ai/modules/field_widget_actions/src/FieldWidgetActionBase.php)

  • First commit to issue fork.
  • 🇮🇳India sijumpk

    When only one item is present and it is disabled, it cannot be re-enabled through the form. The warning message displayed is: "No enabled instructions to re-sort.". Attaching screen recording for the same. Added a fix to allow re-enabling the item in this edge case.

  • Pipeline finished with Failed
    13 days ago
    Total: 201s
    #555638
  • Pipeline finished with Failed
    13 days ago
    Total: 273s
    #555683
  • Pipeline finished with Success
    13 days ago
    Total: 242s
    #555702
Production build 0.71.5 2024