Problem/Motivation

After choosing a different backend, api key options disappear

Steps to reproduce

1. Enable multiple backends.
2. Go to /admin/structure/aichat/manage/test
3. Change the backend
4. "OpenAI API key" element should display keys and there should be description, but key options and description disappear.

Proposed resolution

  1. Form element is controller by the Key module. While their issue queue does not contain ajax related issues except #2635252: Add original key to $form_state
  2. Maybe try fixing similar but different bug in the same form #3440802: After choosing a different backend, default form values could be retained
  3. $form_state->setRebuild();

Remaining tasks

User interface changes

API changes

Data model changes

Comments

mindaugasd created an issue. See original summary.

mindaugasd’s picture

Workaround:

  1. Change backend and save
  2. After page reload, keys can be chosen and saved
mindaugasd’s picture

Ajax changing backend there are errors

  • Warning: Undefined array key "#value" in template_preprocess_textarea() (line 394 of /web/core/includes/form.inc)
  • Warning: Undefined array key "#description_display" in template_preprocess_form_element() (line 487 of /web/core/includes/form.inc)
mindaugasd’s picture

Issue summary: View changes
mindaugasd’s picture

Issue summary: View changes
mindaugasd’s picture

Issue summary: View changes
mindaugasd’s picture

Issue summary: View changes
mindaugasd’s picture

Issue summary: View changes
mindaugasd’s picture

Issue summary: View changes