UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

86 lines (85 loc) 3.42 kB
/** * @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/aicore/ui/suggestioncontainer/aisuggestionbodyview */ import { type Locale } from '@ckeditor/ckeditor5-utils'; import { type BodyCollection, View } from '@ckeditor/ckeditor5-ui'; import { AISuggestionBodyViewContentPartView } from './aisuggestioncontentpartview.js'; import { type AISuggestionContentPartDefinition } from '../../utils/getsuggestionpartsfromreply.js'; import { type AISuggestionActionName } from '../../../aichat/ui/feed/aichatfeedsuggestionitemactionsview.js'; import { type AIReplyChangeGroupState } from '../../model/aireply.js'; import { type AISource } from '../../aiconnector.js'; /** * The inner view of the suggestion container that displays the content of the suggestion (or multiple parts of it). */ export declare class AISuggestionBodyView extends View<HTMLDivElement> { /** * Observable property that indicates whether the suggestion body has pending parts. * * This flag affects the interactivity of the {@link #actionsView} buttons. */ hasPendingParts: boolean; /** * Observable property that indicates whether the track changes are on. */ isTrackChangesOn: boolean; constructor(locale: Locale, options: { areActionsDisabled: boolean; showUnchangedParts: boolean; availableActions: Array<AISuggestionActionName>; bodyCollection: BodyCollection; }); /** * @inheritDoc */ destroy(): void; /** * Gets the number of content parts in the suggestion. */ get partsCount(): number; /** * Updates the content parts of the suggestion. */ updateContentParts({ parts, abortSignal, skipLoadingEffects }: { parts: Array<AISuggestionContentPartDefinition>; abortSignal?: AbortSignal; /** * When `true`, all loading-state UI (skeleton, debounce timers) is bypassed and content * parts are inserted immediately. Use for content that is already complete and should * appear without any progressive-reveal delay (e.g. conversation history replays). */ skipLoadingEffects?: boolean; }): Promise<void>; /** * Updates the state of a content part by its index. */ updatePartState(index: number, state: AIReplyChangeGroupState): void; /** * Sets the part active or not (active parts are those currently previewed in a dialog by the user). * * Passing `false` as the first argument deactivates all parts. */ setPartActive(isActive: false): void; setPartActive(index: number, isActive: boolean): void; /** * Displays and updates the web sources of the suggestion. */ updateSources(sources: Array<AISource>): void; /** * Gets the view of a content part by its index. */ getPartView(index: number): AISuggestionBodyViewContentPartView | null; /** * Marks the body view as done. * * Updates the visibility of the empty parts warning that will show up if some parts in the suggestion are empty. */ markAsDone(): void; /** * Specifies whether among the displayed parts there are any that have any content that can be browsed or accepted. */ get hasNonEmptyParts(): boolean; }