UNPKG

@grafana/assistant

Version:

Type definitions and helper functions for Grafana Assistant

31 lines (30 loc) 1.79 kB
import React from 'react'; import { ChatContextItem } from '../context/types'; import { OpenAssistantProps } from '../sidebar'; export interface OpenAssistantButtonProps { /** Prompt to pass to the openAssistant function. */ prompt: string; /** 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`. */ origin: string; /** Context to pass to the openAssistant function. Optional, defaults to undefined. Created with `createAssistantContextItem`. */ context?: ChatContextItem[]; /** Whether to automatically send the prompt. Optional, defaults to true. */ autoSend?: boolean; /** Text to display on the button. Optional, defaults to 'Analyze with Assistant' */ title?: string; /** Button size, defaults to sm */ size?: 'xs' | 'sm' | 'md' | 'lg'; /** If true, the button will be Assistant icon only with name as title. Defaults to false. */ iconOnlyButton?: boolean; } /** * A button component that opens the Grafana Assistant with configurable prompt and context. */ export declare function OpenAssistantButton(props: OpenAssistantButtonProps): React.JSX.Element | null; /** * Presentational component separated from OpenAssistantButton to avoid hook dependencies in Storybook. * It is not exported for users of the package. */ export declare function OpenAssistantButtonView({ prompt, origin, context, autoSend, title, size, iconOnlyButton, openAssistant, }: OpenAssistantButtonProps & { openAssistant: (props: OpenAssistantProps) => void; }): React.JSX.Element;