PHP Notice if no Actions configured in AI Assistant

Created on 14 October 2024, 3 months ago

Problem/Motivation

If the AI Chatbot module and its dependencies are enabled and configured, entering a prompt for the AI generates a PHP Notice error in the background.

Warning: Undefined array key "actions" in Drupal\ai_assistant_api\AiAssistantApiRunner->process() (line 395 of /var/www/html/web/modules/contrib/ai/modules/ai_assistant_api/src/AiAssistantApiRunner.php)

This is because the code currently expects at least one AiAssistantAction to be available on the site, or for the locked "Advanced" pre-action prompt to have been altered to allow the LLM to use another datasource.

πŸ› Bug report
Status

Active

Version

1.0

Component

AI Assistants API

Created by

πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

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

Comments & Activities

  • Issue created by @MrDaleSmith
  • @mrdalesmith opened merge request.
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Still relevant? Bump.

  • Issue was unassigned.
  • Status changed to Needs review 18 days ago
  • πŸ‡©πŸ‡ͺGermany jan kellermann

    jan kellermann β†’ made their first commit to this issue’s fork.

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    Updated the fork.

    RTBC to the commits on modules/ai_assistant_api/src/AiAssistantApiRunner.php.

    I dont know if the warning in modules/ai_assistant_api/src/Form/AiAssistantForm.php is neccessary.

  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    @jan kellerman - regarding the warning message, we always had the feeling that just having a provider and a prompt didn't really make sense without some underlying action plugin. But I think if I understand the AnythingLLM correct, that it can work as both an LLM, Agent, Scraper, context source/RAG etc. meaning that it by itself can be really useful?

    If so fixing the warning would make sense now or at a later stage.

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    @marcus_johansson I got stuck in communication here, sorry.

    Yes, AnythingLLM is a RAG out of the box and so no actions are needed in the module. So it would be good if the array was queried beforehand.

    I added this commit ("You may need..." instead of "You will need...").

    I have updated the fork.

    For me the patch works. Because I am not working with actions I did not set RTBC.

Production build 0.71.5 2024