openai_ckeditor js uses wrong api base path

Created on 17 February 2023, over 1 year ago
Updated 22 February 2023, over 1 year ago

Problem/Motivation

in the openai_ckeditor frontend js code the api base path "/" is hardcoded in the fetch calls.
this will only work for drupal sites running in the root path of a domain, not when using a subpath like /drual-site (multi site setup).

relevant code:

openai/modules/openai_ckeditor/js/build/openai_completion.js:
fetch("/api/openai-ckeditor/generate-completion"

openai/modules/openai_ckeditor/js/ckeditor5_plugins/openai_completion/src/ui.js:
fetch('/api/openai-ckeditor/generate-completion'

Steps to reproduce

try to use the ckeditor feature with a drupal site on a sub path ( like /drupal-site/ )

Proposed resolution

use the drupal framework/api to get the correct api base path

πŸ› Bug report
Status

Fixed

Version

1.0

Component

OpenAI CKEditor

Created by

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

Comments & Activities

Production build 0.71.5 2024