@grafana/assistant
Version:
Type definitions and helper functions for Grafana Assistant
22 lines (21 loc) • 1.24 kB
TypeScript
import { ChatContextItem } from './context/types';
export type OpenAssistantProps = {
origin: string;
prompt?: string;
context?: ChatContextItem[];
autoSend?: boolean;
};
/**
* Open the Grafana Assistant sidebar with a given initial prompt.
*
* @param props - The props to pass to the assistant.
* @param props.origin - The origin of the request that opened the assistant. This is used to track the source of the request. Should be a structured string using forward slashes, with the first part as a namespace. Examples: 'grafana-datasources/prometheus/query-builder', 'grafana-slo-app/slo-editor-overview', 'grafana/trace-view-analyzer`.
* @param props.prompt - The initial prompt to display in the assistant.
* @param props.context - The initial context to display in the assistant. Created with `createContext`.
* @param props.autoSend - Whether to automatically send the initial prompt. When true, opens a chat and sends the initial prompt right away. When false, opens chat and updates user message without sending it. Defaults to true.
*/
export declare function openAssistant(props: OpenAssistantProps): void;
/**
* Close the Grafana Assistant sidebar.
*/
export declare function closeAssistant(): void;