Add supported file types extensions for Speech-To-Text Generation Explorer

Created on 16 April 2025, about 2 months ago

Problem/Motivation

Need to add file type extension or supported formats as help text below the choose file option in Speech-To-Text Generation Explorer

Steps to reproduce

1) Enable ai_api_explorer module
2) Go to '/admin/config/ai/explorers/speech_to_text_generator'
3) Click on the choose file option
4) Upload any image file
5) Response showing file format error

The following screenshot is from the Speech-To-Text Generation explorer:

Proposed resolution

- Add help text or description below the choose file option
- Help text should be => Allowed or supported file formats : ['flac', 'm4a', 'mp3', 'mp4', 'mpeg', 'mpga', 'oga', 'ogg', 'wav', 'webm']

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.1

Component

Other Submodules

Created by

🇮🇳India Ishani Patel

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

Merge Requests

Comments & Activities

  • Issue created by @Ishani Patel
  • 🇬🇧United Kingdom MrDaleSmith
  • Pipeline finished with Success
    about 2 months ago
    Total: 199s
    #475879
  • 🇬🇧United Kingdom MrDaleSmith

    It looks like the explorers were using incorrect FAPI elements for the file upload that weren't correctly restricting file type uploads: the element should be restricted only to MP3 for compatibility across the widest range of AI Providers.

    I've updated all the explorers and added the help text to the descriptions.

  • 🇩🇪Germany marcus_johansson

    I tried it out and could still upload "faulty" files and reach the AI Providers error message. As per this link it looks like Drupal only does actual checks on managed_file form elements, which we don't want: https://drupal.stackexchange.com/a/287683

    The solution is probably that we add validation manually?

    Also the #accept element was wrong, but having accept attribute there is correct, so something like

    '#attributes' => [
      "accept" => ".jpg, .jpeg, .png",
    ],
    

    This will make sure that I only see those kind of files in my browser when clikcing on the "Choose File"

  • 🇮🇳India prabha1997

    I have just added the accept attribute to the file input field to restrict the selectable file types in the file dialog. This improves the user experience by showing only supported formats (.jpg, .jpeg, .png) when choosing a file.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 196s
    #489164
  • Pipeline finished with Success
    about 1 month ago
    Total: 389s
    #489836
  • 🇮🇳India Kanchan Bhogade

    Hi
    I have tried to reproduce this issue with the provided steps
    But I get another error instead of the unsupported file error.

    Attaching screenshot

  • 🇮🇳India prashant.c Dharamshala

    Reviewed the MR and left a feedback to be addressed.

    Additionally @kanchan bhogade tried to upload a PNG which we is not allowed and should have given a validation message. PNG is also a very common image extension, should we consider allowing it also?

  • 🇮🇳India prabha1997

    @Prashant
    There are two fields:
    File field – Only .mp3 files are allowed.
    Image field – Accepts .jpg, .jpeg, and .png formats.

  • Pipeline finished with Failed
    12 days ago
    Total: 167s
    #506419
  • Pipeline finished with Canceled
    12 days ago
    Total: 231s
    #506421
  • Pipeline finished with Success
    12 days ago
    Total: 316s
    #506426
  • Pipeline finished with Failed
    11 days ago
    Total: 553s
    #507168
  • Pipeline finished with Failed
    11 days ago
    Total: 402s
    #507177
  • Pipeline finished with Failed
    11 days ago
    Total: 273s
    #507179
  • 🇮🇳India prabha1997

    I’m currently unable to test the image_and_audio_to_video explorer, as I couldn’t find any provider listed for it in the documentation.

  • Pipeline finished with Success
    9 days ago
    Total: 438s
    #509027
Production build 0.71.5 2024