import type { InlineAssistantResult } from './types'; import { type InlineAssistantConfig } from './inlineAssistant'; /** * React hook for inline assistant generation with streaming support. * * This hook enables generating content (like panel titles or descriptions) inline * without opening the assistant sidebar. Each hook instance creates its own chat * conversation, so all generations from the same instance are grouped together. * Generated content is ephemeral - it won't appear in the user's chat history * but will be tracked in the admin UI for analytics. * * Uses the full BaseMultiStepAgent infrastructure for tool execution and multi-step workflows. * * The implementation is lazy-loaded on first use to reduce initial bundle size. * * `config` sets how the agent runs (steps, model, reasoning, output tokens). It is read when the * first generation creates the conversation; later changes do not apply to it. * * @example * ```typescript * function PanelEditor() { * const { generate, isGenerating, content, error, reset } = useInlineAssistant(); * const [title, setTitle] = useState(''); * * const handleGenerate = () => { * generate({ * prompt: 'Generate a panel title for CPU metrics', * origin: 'grafana/panel-editor/title', * systemPrompt: 'Generate only the title text, no explanation', * onComplete: (text) => setTitle(text.trim()), * onError: (err) => console.error(err) * }); * }; * * return ( *