UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

117 lines (116 loc) 3.66 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/aichatcontrolsview */ import type { Locale } from 'ckeditor5/src/utils.js'; import { View, type BodyCollection } from 'ckeditor5/src/ui.js'; import { type AIAddContextOptionsState, type AIContextProvider, type AIContextResourceState } from '../model/aichatcontext.js'; import { type AIContextItem } from '../../aicore/model/aicontext.js'; import { type AIChatModel } from '../model/aichatmodels.js'; export declare class AIChatControlsView extends View { /** * The loading state of the controls. * * @observable */ isLoading: boolean; /** * The disabled state of the controls. * * @observable */ isDisabled: boolean; /** * Indicates if the active model is available. * * @observable */ isModelAvailable: boolean; constructor(locale: Locale, options: { bodyCollection: BodyCollection; contextResourcesSearchInputVisibleFrom?: number; }); /** * Adds an item chip to the current context list. */ addContextItem(contextItem: AIContextItem, isLoading: boolean): void; /** * Removes an item from the context as chip. */ removeContextItem(id: string): void; /** * Sets the loading state of an item chip in the current context list. */ setContextItemLoading(uiId: string, isLoading: boolean): void; /** * Sets the upload in progress state. */ setIsUploadInProgress(isUploadInProgress: boolean): void; /** * Sets the conversation context chips. */ setConversationContext(contextItems: Array<AIContextItem>): void; /** * Clears the pending context UI. */ clearPendingContextUI(): void; /** * Clears the conversation context UI. */ clearConversationContextUI(): void; /** * Updates the state of a specific resource in the balloon views. */ updateResourceState(sourceId: string, resourceId: string, isInContext: boolean): void; /** * Sets the web search state. */ setWebSearch(isWebSearchEnabled: boolean): void; /** * Sets the reasoning state. */ setReasoning(isReasoningEnabled: boolean): void; /** * Resets the message input. */ resetMessageInput(): void; /** * Sets the add context options. */ setAddContextOptions(options: AIAddContextOptionsState): void; /** * Sets the placeholder text for the prompt input. */ setInputPlaceholder(placeholder: string): void; /** * Sets model list dropdown. */ setModelList(models: Array<AIChatModel>, hideIfSingleModel: boolean): void; /** * Sets the selected model in the model list dropdown. */ setModel(model: AIChatModel | null): void; /** * Enables the model selector in the prompt capabilities view. */ enableModelSelector(): void; /** * Disables the model selector in the prompt capabilities view. */ disableModelSelector(hideSelector: boolean): void; /** * Populates a source resource balloon with loaded resources. */ populateSourceResourceBalloon(sourceId: string, source: AIContextProvider, resources: Array<AIContextResourceState>, uid: string): void; /** * Closes the source resource balloon and cleans up its state. */ closeSourceResourceBalloon(sourceId: string): void; /** * Focuses the prompt input. */ focusPromptInput(): void; }