AI API Explorer hardcodes forms that require undeclared dependencies

Created on 16 October 2024, 2 months ago

Problem/Motivation

The AI API Explorer module provides forms like the VectorDbGenerationForm that provide no functionality if the AI Search module is not enabled, which may cause confusion for users.

Proposed resolution

If we refactor the module to provide a custom Interface and base form for providing test forms, we could create the routes and related menu items conditionally based on any modules the extend the base form. This will improve discoverability of new forms, reduce duplication and prevent confusion for site builder users.

🐛 Bug report
Status

Active

Version

1.0

Component

Other Submodules

Created by

🇬🇧United Kingdom MrDaleSmith

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

Merge Requests

Comments & Activities

  • Issue created by @MrDaleSmith
  • 🇬🇧United Kingdom scott_euser

    That makes a ton of sense! Are you also envisioning having the forms in their own respective modules? Eg ai search housing the vector db one but also third party modules being allowing to add and have them auto found?

  • 🇬🇧United Kingdom MrDaleSmith

    Yeah I'm doing a general refactor, but currently the core AI module is providing the route for the collection of forms and I want to move that into this sub module and have it look across the site's codebase for any class implementing the new Interface and then generate a route automatically for them. That way ones that only work if a certain module is enabled won't appear in the list until the module gets turned on.

    I'm also adding an isActive() call that will let each form return a FALSE if something (usually a Provider) isn't set up that it needs.

  • 🇬🇧United Kingdom scott_euser

    Very sensible approach sounds like!

  • Pipeline finished with Failed
    2 months ago
    Total: 170s
    #316104
  • Pipeline finished with Failed
    2 months ago
    Total: 177s
    #316131
  • Pipeline finished with Failed
    2 months ago
    Total: 174s
    #316961
  • Pipeline finished with Failed
    2 months ago
    Total: 160s
    #316967
  • Pipeline finished with Failed
    2 months ago
    Total: 265s
    #316979
  • Pipeline finished with Failed
    2 months ago
    Total: 158s
    #316993
  • Pipeline finished with Success
    2 months ago
    Total: 274s
    #317019
  • Pipeline finished with Failed
    2 months ago
    Total: 318s
    #317218
  • Pipeline finished with Failed
    2 months ago
    Total: 220s
    #317245
  • Pipeline finished with Failed
    2 months ago
    Total: 832s
    #317250
  • Pipeline finished with Failed
    2 months ago
    Total: 169s
    #317280
  • Pipeline finished with Success
    2 months ago
    Total: 163s
    #317292
  • 🇬🇧United Kingdom MrDaleSmith

    OK, I think this is ready for review. The main thing to be considered is that I've added roave/better-reflection to assist with discovering Forms across the Drupal codebase: if this isn't wanted, we can do something similar to the basic Reflection used in the processor system; if it is, there may be follow up work to use it in the providers as well.

  • Pipeline finished with Failed
    about 2 months ago
    #331170
  • Pipeline finished with Success
    about 2 months ago
    #331185
  • 🇬🇧United Kingdom MrDaleSmith

    @Marcus_Johansson I've made the requested changes, but between now and then I've realised this would be better to implement as more plugins: at the very least then we'd be able to remove the added roave/better-reflection depen dency that I needed to "discover" the forms. What do you think?

  • 🇩🇪Germany marcus_johansson

    Since the AI core module goes into the Drupal CMS, in general if we can get rid of or not add dependencies, that is a good thing, since they need to be approved by more people then the AI Core team. Especially for modules that are development modules, rather then production modules.

    So if you can set the route without using dependencies, via plugins or some other way of discoverability that exists in Drupal's core libraries that would be great.

  • Pipeline finished with Running
    about 1 month ago
    #331879
  • Pipeline finished with Failed
    about 1 month ago
    Total: 188s
    #332878
  • Pipeline finished with Failed
    about 1 month ago
    Total: 264s
    #332958
  • Pipeline finished with Failed
    about 1 month ago
    Total: 193s
    #332967
  • Pipeline finished with Failed
    about 1 month ago
    Total: 190s
    #332990
  • Pipeline finished with Failed
    about 1 month ago
    Total: 150s
    #333005
  • 🇬🇧United Kingdom MrDaleSmith

    OK @Marcus_Johansson I've refactored all of this as plugins. These's a final PHPCS error in the Annotation but I cannot fix it: there are no examples in Core or the AI module of setting the properties of an Annotation in the constructor so I'm wary of breaking things. If someone else knows how I'll let them demonstrate.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 163s
    #339563
  • Pipeline finished with Failed
    about 1 month ago
    Total: 156s
    #339707
  • Pipeline finished with Canceled
    about 1 month ago
    #339713
  • Pipeline finished with Failed
    about 1 month ago
    Total: 155s
    #339715
  • Pipeline finished with Success
    about 1 month ago
    #339733
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 376s
    #341951
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 259s
    #341953
  • Pipeline finished with Success
    about 1 month ago
    Total: 260s
    #341957
  • Pipeline finished with Success
    about 1 month ago
    Total: 230s
    #342147
  • 🇬🇧United Kingdom MrDaleSmith

    Additional issues resolved. Ready for review again.

  • Pipeline finished with Success
    20 days ago
    Total: 156s
    #356299
  • 🇩🇪Germany marcus_johansson

    Getting merged!

  • Issue was unassigned.
  • Status changed to Fixed 6 days ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024