UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

88 lines (87 loc) 2.97 kB
/** * @license Copyright (c) 2003-2025, 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 'ckeditor5/src/core.js'; import { AIChatController } from './aichatcontroller.js'; import { AIEditing } from '../aicore/aiediting.js'; import { AIChatUI } from './aichatui.js'; import { type AIChatContextConfig } from './model/aichatcontext.js'; import { type AIChatModelsConfig } from './model/aichatmodels.js'; import { AIChatHistory } from '../aichathistory/aichathistory.js'; import { type AIQuickActionRequestData } from '../aiquickactions/aiquickactions.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. * * 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); addSelectionToChatContext(): Promise<void>; startConversation(): Promise<void>; sendMessage({ message, quickActionData }: { message: string; quickActionData?: AIQuickActionRequestData; }): Promise<void>; removeSelectionFromChatContext(): void; focusPromptInput(): void; } /** * 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( editorElement, { * 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; /** * The configuration of the AI Chat models selection feature. * * Read more in {@link module:ai/aichat/model/aichatmodels~AIChatModelsConfig}. */ models?: AIChatModelsConfig; }