UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

84 lines (83 loc) 2.91 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/ui/feed/aichatfeedsuggestionitemview */ import { type Locale } from 'ckeditor5/src/utils.js'; import { AIChatFeedItemView, type AIChatItemViewOptions } from './aichatfeeditemview.js'; import { type AISuggestionContentPartDefinition } from '../../../aicore/utils/getsuggestionpartsfromreply.js'; import { type AISuggestionActionName } from './aichatfeedsuggestionitemactionsview.js'; import { type AIReplyChangeGroupState, type AIReplySource } from '../../../aicore/model/aireply.js'; import { type AISuggestionBodyViewContentPartView, type AIContentRenderingStrategy } from '../../../aicore/ui/suggestioncontainer/aisuggestioncontentpartview.js'; /** * A view for an AI suggestion item in the AI chat feed. * * It hosts a suggestion container and a suggestion actions view. * * It allows for displaying suggestion content and its preview. */ export declare class AIChatFeedSuggestionItemView extends AIChatFeedItemView { /** * @inheritDoc */ options: AIChatFeedSuggestionItemViewOptions; /** * @observable */ isTrackChangesOn: boolean; /** * @inheritDoc */ constructor(locale: Locale, options: AIChatFeedSuggestionItemViewOptions); /** * Updates the suggestion content. */ updateContent(options: { parts: Array<AISuggestionContentPartDefinition>; renderingStrategy: AIContentRenderingStrategy; abortSignal: AbortSignal; }): Promise<void>; updatePartState(index: number, state: AIReplyChangeGroupState): void; updateSources(sources: Array<AIReplySource>): void; getPartView(index: number): AISuggestionBodyViewContentPartView | null; /** * Marks the suggestion as done and additionally updates the visibility of the actions view * depending if any suggestion parts are actionable. */ markAsDone(): void; } export type AIReplyLikeEvent = { name: 'like'; args: [{ replyId: string; }]; }; export type AIReplyDislikeEvent = { name: 'dislike'; args: [{ replyId: string; }]; }; export type AIToggleSuggestionDisplayModeEvent = { name: 'toggleSuggestionDisplayMode'; args: [{ replyId: string; showDiff: boolean; }]; }; export interface AIChatFeedSuggestionItemViewOptions extends AIChatItemViewOptions { /** * A flag indicating whether the item actions should be disabled. */ areActionsDisabled: boolean; /** * A flag indicating whether the suggestion should show the diff or final suggestion. */ showDiff: boolean; /** * The configuration of the advanced reply dropdown in the AI chat feed. */ availableActions: Array<AISuggestionActionName>; }