@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
96 lines (95 loc) • 3.4 kB
TypeScript
/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
/**
* @module ai/aichat/aichat
* @publicApi
*/
import { type Context, ContextPlugin, type Editor } from '@ckeditor/ckeditor5-core';
import { AIChatController } from './aichatcontroller.js';
import { AIEditing } from '../aicore/aiediting.js';
import { AIChatUI } from './aichatui.js';
import { type AIChatContextConfig } from './model/aichatcontext.js';
import { AIChatHistory } from '../aichathistory/aichathistory.js';
/**
* The AI Chat feature. It brings a conversational AI that can be used to aid content creation and editing. It introduces a dynamic chat
* interface designed to facilitate rich, multi-turn interactions between users and an AI Assistant.
*
* You can configure the feature by setting the {@link module:ai/aichat/aichat~AIChatConfig} property.
*
* See {@link module:ai/aichat/aichatcontroller~AIChatController} to learn about the public API available for this feature.
*
* Learn more about AI features in CKEditor in the {@glink features/ai/ckeditor-ai-overview AI Overview} documentation.
*/
export declare class AIChat extends ContextPlugin {
/**
* @inheritDoc
*/
static get requires(): readonly [typeof AIChatController, typeof AIEditing, typeof AIChatUI, typeof AIChatHistory];
/**
* @inheritDoc
*/
static get pluginName(): "AIChat";
/**
* @inheritDoc
*/
static get isOfficialPlugin(): true;
/**
* @inheritDoc
*/
static get isPremiumPlugin(): true;
constructor(context: Context | Editor);
}
/**
* The configuration of the {@link module:ai/aichat/aichat~AIChat AI Chat feature}.
*
* The properties defined in this config are set in the `config.ai.chat` namespace.
*
* ```ts
* ClassicEditor
* .create( {
* ai: {
* chat: {
* // AI Chat configuration.
* }
* }
* } )
* .then( ... )
* .catch( ... );
* ```
*
* See {@link module:ai/aiconfig~AIConfig the full AI configuration}.
*
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
*/
export interface AIChatConfig {
/**
* The configuration of the AI Chat context.
*
* Read more in {@link module:ai/aichat/model/aichatcontext~AIChatContextConfig}.
*/
context: AIChatContextConfig;
/**
* Decides which conversation will be loaded after the feature has initialized.
*
* Possible values are:
*
* * `'new'` - a new conversation is started (default),
* * `'lastCreated'` - the most recently created conversation will be loaded,
* * conversation ID - the conversation with given ID will be loaded.
*
* If `'lastCreated'` is set while the conversation history is empty, a new conversation will be started instead.
*
* If the conversation with the specified ID is not found, an error will be thrown.
*
* @default 'new'
*/
initialConversation?: string;
/**
* The welcome message to be displayed when the AI chat is initialized. When not set, the default welcome message will be used.
*
* @default 'Hi! I can help you draft, rewrite, and improve your text, explore ideas, research topics, and solve problems. How can I help right now?'
*/
welcomeMessage?: string;
}