Typedef

RequestHeaders (ai/adapters)

@ckeditor/ckeditor5-ai/src/adapters/aitextadapter

typedefRecord<string, string> | ( string ) => Promise<Record<string, string>>

Object with headers to set in the request to the AI service.

If the provided value is an object, it is simply used as provided.

If the provided value is a function, it should be a function that returns a Promise which resolves with the headers object. This way, you can perform an authorization request to your application and receive the authorization token (and also implement any custom logic on the back-end side). The headers object is then used to make the actual call to the AI service.

The function is passed actionId parameter to make it possible to further customize the headers.

If the function fails for any reason, the promise should be rejected. In this case, a feature that made the request should display an error notification.

Filtering