Recipe: Mini-App With Custom AI Chat Interface
Short recommendation recipe for adding a custom AI chat interface to a script editor or mini-app.
Mini-App With Custom AI Chat Interface
| Field | Value |
|---|---|
| Complexity | Medium to High |
| Example | Script editor or EyePad-style mini-app with an embedded AI chat. |
| End Goal | Add a chat panel that can answer questions, inspect editor context, and call approved tools. |
| Key Technologies | AI runtime, AI chat UI, AI tools/plugins, Blazor |
Use When
- You are building a mini-app or editor and want an AI chat inside it.
- The chat should know what script, tab, error, or selection the user is looking at.
- The chat may call tools such as docs search, diagnostics, or safe editor actions.
Shape
- Put a chat panel next to the editor or in a tool window.
- Build the AI session from the editor context the user can actually see.
- Add tools one by one: read selected text, read diagnostics, search docs, then propose or apply edits if needed.
- Ask for approval before tools change files, scripts, or app state.
Choices
- Is this chat tied to one editor tab, one workspace, or the whole mini-app?
- Which context is included automatically?
- Which tools are read-only?
- Which tools need explicit approval?
- Does this assistant need docs search, or only local editor context?
APIs To Look Up
AiEngineIAiChatSessionIAiChatSessionHandleAiSessionOptionsAiChatViewModelAiChatComponentAiKernelPluginIAiPluginHostAiFunctionInvocationPolicyAiDocsKnowledgeBasePluginIBm25KnowledgeBase
Avoid
- Making documentation search mandatory for every AI chat.
- Tools that change files or app data without clear names and approval behavior.
- Letting the assistant guess hidden editor data.
- Assuming script-only globals exist in normal helper/plugin classes.
- Persisting active session ids or transient request data.
Related Maps
ml/ai-runtime.mdml/ai-kernel-plugins.mdscripting/runtime.mdwindows-subsystems/blazor-windows.md