@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
130 lines (129 loc) • 4.44 kB
TypeScript
/**
* @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/aichat/ui/aichatcontrolsview
*/
import type { Locale } from '@ckeditor/ckeditor5-utils';
import { View, type BodyCollection } from '@ckeditor/ckeditor5-ui';
import { type AIAddContextOptionsState, type AIContextProvider, type AIContextResourceState } from '../model/aichatcontext.js';
import { type AIContextItem } from '../../aicore/model/aicontext.js';
import { type AIModelData } from '../../aicore/aiconnector.js';
import '../../../theme/aichat/aichat-controls.css';
import '../../../theme/aichat/aichat-controls/prompt-input.css';
import '../../../theme/aichat/aichat-controls/prompt-capabilities.css';
import '../../../theme/aichat/aichat-controls/model-unavailable-message.css';
import '../../../theme/aichat/aichat-controls/aichat-context-controls.css';
import '../../../theme/aichat/aichat-controls/aichat-context-chip.css';
import '../../../theme/aichat/aichat-controls/aichat-controls-button.css';
import '../../../theme/aichat/aichat-controls/aichat-controls-loader.css';
import '../../../theme/aichat/aichat-controls/aichat-context-controls-balloon-panels.css';
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<AIModelData>, hideModels: boolean): void;
/**
* Sets the selected model in the model list dropdown.
*/
setModel(model: AIModelData | 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(useHighlight?: boolean): void;
/**
* Sets the value of the prompt input.
*/
setPromptInputValue(value: string): void;
}