@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
109 lines (108 loc) • 3.56 kB
TypeScript
/**
* @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/controls/aichatcontextpanelview
*/
import { type Locale } from 'ckeditor5/src/utils.js';
import { type BodyCollection, ButtonView, IconView, View } from 'ckeditor5/src/ui.js';
import { type AIContextProvider, type AIContextResourceState, type AIAddContextOptionsState } from '../../../aichat/model/aichatcontext.js';
import { type AIContextItem } from '../../../aicore/model/aicontext.js';
export declare const CONTEXT_PANEL_VIEW_EVENT_NAMES: readonly ["addDocumentToContext", "addFileToContext", "addUrlToContext", "addResourceToContext", "removeContextItem", "loadSourceResources"];
/**
* Manages the context panel UI for AI chat, including pending contexts and conversation contexts.
*/
export declare class AIChatContextPanelView extends View {
/**
* Button view for adding a context.
*
* **Note**: It gets rendered in the `AIChatPromptInputView` due to positioning constraints.
*/
readonly addContextButtonView: ButtonView;
constructor(locale: Locale, options: {
bodyCollection: BodyCollection;
searchInputVisibleFrom?: number;
});
/**
* @inheritDoc
*/
render(): void;
/**
* @inheritDoc
*/
destroy(): void;
/**
* Adds a context item to the current contexts collection.
*/
addContextItem(contextItem: AIContextItem, isLoading: boolean): void;
/**
* Removes a context item by ID from the current contexts.
*/
removeContextItem(id: string): void;
/**
* Sets the loading state of a context item.
*/
setContextItemLoading(uiId: string, isLoading: boolean): void;
/**
* Sets the conversation context chips.
*/
setConversationContext(contextItems: Array<AIContextItem>): void;
/**
* Clears all current context items.
*/
clearCurrentContextItems(): void;
/**
* Clears all conversation context items.
*/
clearConversationContextItems(): void;
/**
* Updates the state of a specific resource in the balloon views.
*/
updateResourceState(sourceId: string, resourceId: string, isInContext: boolean): void;
/**
* Hides the add context balloon panel.
*/
hideAddContextBalloonPanel(): void;
/**
* Shows the add context balloon panel.
*/
showAddContextBalloonPanel(): void;
/**
* Hides the URL balloon panel.
*/
hideUrlBalloonPanel(): void;
/**
* Shows the URL balloon panel.
*/
showUrlBalloonPanel(): 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;
/**
* Sets the add context options.
*/
setAddContextOptions(options: AIAddContextOptionsState): void;
}
/**
* A balloon button view for sources. It includes an arrow.
*/
export declare class SourcesBalloonButtonView extends ButtonView {
/**
* An icon that displays an arrow to indicate it's a menu button.
*/
readonly arrowView: IconView;
/**
* @inheritDoc
*/
constructor(locale: Locale);
/**
* @inheritDoc
*/
render(): void;
}