Skip to content

feat: AI Chat panel with multi-provider support and tool calling#2195

Merged
GermanBluefox merged 2 commits intoioBroker:masterfrom
Eistee82:feat/ai-chat
Apr 11, 2026
Merged

feat: AI Chat panel with multi-provider support and tool calling#2195
GermanBluefox merged 2 commits intoioBroker:masterfrom
Eistee82:feat/ai-chat

Conversation

@Eistee82
Copy link
Copy Markdown
Contributor

Summary

  • Replaces the old OpenAI code generator dialog with a new AI Chat panel integrated into the script editor
  • Supports multiple AI providers: OpenAI, Anthropic, Gemini, DeepSeek, and custom OpenAI-compatible endpoints (e.g. Ollama)
  • Adds tool calling for smart home context: datapoint search, state reading, object info, script analysis
  • Inline completions for Monaco editor with configurable provider
  • Smart-apply for Blockly: AI-generated blocks are matched and replaced, with full undo/redo support
  • Undo/redo toolbar buttons for both Blockly and text editors

Changes

New: AI Chat (src-editor/src/AiChat/)

  • AiChatPanel.tsx — Main chat panel UI with provider/model selector
  • AiChatInput.tsx — Chat input with @-mention autocomplete for scripts and devices
  • AiChatMessage.tsx — Message rendering with syntax-highlighted code blocks
  • AiChatService.ts — API config loading, model discovery, chat completion via sendTo
  • AiToolExecutor.ts — Tool call execution (search datapoints, read states, analyze scripts)
  • AiScriptAnalyzer.ts — Cross-script analysis and datapoint usage detection
  • AiDatapointProvider.ts — Monaco autocomplete for ioBroker datapoint IDs
  • AiInlineProvider.ts — AI inline completions for Monaco (with config caching)
  • AiDiffView.tsx — Diff view for AI-suggested code changes
  • useAiChat.ts — React hook managing chat state, message history, and tool loop

Modified

  • src-editor/src/Editor.tsx — Integrates chat panel via split view, adds undo/redo buttons
  • src-editor/src/Components/ScriptEditorVanillaMonaco.tsx — Registers inline + datapoint providers
  • src/main.ts — Backend chatCompletion and testApiConnection message handlers with multi-provider HTTP routing

Removed

  • src-editor/src/OpenAi/OpenAiDialog.tsx — Old code generator dialog (replaced by AI Chat)
  • src-editor/src/OpenAi/OpenAiPrompt.tsx — Old prompt builder (replaced by AI Chat)

Other

  • Added vitest for unit testing (src-editor/vitest.config.ts)
  • 22 unit tests for AiChatService and AiScriptAnalyzer
  • i18n translations for all 11 supported languages
  • styled-components, jsdom, vitest added as dependencies in src-editor/package.json

Test plan

  • Adapter starts without errors
  • AI Chat panel opens in script editor (JS, TS, Blockly)
  • Chat works with OpenAI, Gemini, DeepSeek providers
  • @-mentions resolve scripts and devices correctly
  • Tool calling executes (datapoint search, state reading) in agent mode
  • Inline completions appear in Monaco editor
  • Undo/redo buttons work in Blockly and text editors
  • Smart-apply replaces matched Blockly blocks correctly
  • npm run build passes
  • npm run test passes (41 integration tests)
  • npm run lint passes
  • Vitest passes (22 unit tests)

🤖 Generated with Claude Code

…-provider support

Adds a new AI Chat panel to the script editor with support for OpenAI,
Anthropic, Gemini, DeepSeek and custom API providers. Features include
tool calling for datapoint/script analysis, inline completions,
smart-apply with undo/redo, and Blockly code generation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@GermanBluefox GermanBluefox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@GermanBluefox GermanBluefox merged commit 03883a9 into ioBroker:master Apr 11, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants