Fix not found URL by adding the Complete Base Url for the link to `OpenAI settings configuration here` in the not provided an OpenAI API key yet error message

Created on 13 March 2024, 4 months ago
Updated 18 March 2024, 3 months ago

Problem/Motivation

Hitting Not Found
The requested URL was not found on this server.
on local development, and multilingual selection is using the URL

Steps to reproduce

Given that OpenAI was installed in a Drupal site
And the OpenAI API Key was not sat yet
And the following error message will show on all pages

Error message
You have not provided an OpenAI API key yet. This is required for its functionality to work. Please obtain an API key from your OpenAI account and add it to the OpenAI settings configuration here.

When I click on the "OpenAI settings configuration here" link in the message
And the site is on sub directory, or other default languages in the URL
Then the "Not Found - The requested URL was not found on this server."

Proposed resolution

  • In onKernelRequest: add $event->getRequest()->getSchemeAndHttpHost() . $event->getRequest()->getBaseUrl() . '/admin/config/openai/settings'
  • In openai_requirements: Add \Drupal::service('router.request_context')->getCompleteBaseUrl() . '/admin/config/openai/settings'

Remaining tasks

  • File an issue
  • Fix MR/Patch
  • Test
  • Review

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Rajab Natshah Jordan

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024