UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

50 lines (49 loc) 2.05 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 */ import { AIInteraction, type AIInteractionOptions } from '../../aicore/model/aiinteraction.js'; import { type AIActionsNames, type AIConnectorRequest } from '../../aicore/aiconnector.js'; import { type AIContextItem } from '../../aicore/model/aicontext.js'; import { AIActionsReply } from './aiactionsreply.js'; import { type AIActionDefinition } from '../aiactions.js'; export declare class AIActionsInteraction extends AIInteraction { /** * The content of the document for the command to refer to. */ readonly content: string; /** * The version of the document the content was extracted from. */ readonly version: number; /** * The name of the action to execute. Specified only for predefined actions. */ readonly actionName?: AIActionsNames; /** * The arguments to pass to the action. Specified only for predefined actions. */ readonly args?: Record<string, string>; /** * The user message that was sent to the AI endpoint. Specified only for custom actions. */ readonly userMessage?: string; /** * The model of the command. Specified only for custom actions. */ readonly model?: string; hasError: boolean; constructor(options: AIActionsInteractionOptions); sendRequest(): Promise<AIConnectorRequest>; getDocumentContext(): AIContextItem | undefined; /** * Override createReply to use the same content that was sent to AI for comparison. * This ensures we compare AI response against the selection, not the entire document. * Uses AIActionsReply for single suggestion without context. */ createReply(options: ConstructorParameters<typeof AIActionsReply>[0]): AIActionsReply; } export type AIActionsInteractionOptions = { content: string; version: number; } & AIActionDefinition & AIInteractionOptions;