Commit a01e2c6
feat: enhanced AI code generator with multi-provider support and optimized prompts (#2146)
Multi-provider API support:
- Per-provider test buttons in config (OpenAI, Anthropic, Gemini, DeepSeek, Custom)
- Optional API key for custom base URL (Ollama, LM Studio)
- Provider icons in config and code generator
- Human-readable HTTP error messages with API response details
- Disable reasoning/thinking for local models (reasoning_effort: none)
Two-step plan-then-code generation:
- Step 1: Model analyzes task and creates implementation plan with device IDs
- Step 2: Model generates code based on plan + API examples
- Collapsible plan view in UI for debugging
- Status display ("Planning..." / "Generating code...")
- 600s timeout for local models
Optimized prompts for small local models (tested with qwen2.5-coder:14b):
- Concrete code examples showing correct on(), setState(), getState() syntax
- WRONG/CORRECT pairs for common mistakes (adapter.set, console.log, etc.)
- Compact function signature list covering all 80+ API functions
- FORBIDDEN list preventing wrong patterns
- Task placed after device list (recency bias)
- TODO_DEVICE_ID placeholder for missing devices
Build fixes:
- Node 25 compatibility: rmSync instead of rmdirSync({recursive:true})
- admin/img/ preserved during clean builds
- Flexible result area height (flex:1 instead of fixed calc)
New documentation files:
- docs-compact.md: full API in 12.5KB (used for code generation)
- docs-essential.md: core functions with examples in 2.6KB
- Original docs.md preserved for reference
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Bluefox <dogafox@gmail.com>1 parent 4c80892 commit a01e2c6
File tree
50 files changed
+2560
-4375
lines changed- admin
- assets
- i18n
- img
- build
- lib
- docs
- de
- en
- src-editor
- src
- OpenAi
- i18n
- src
- lib
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
50 files changed
+2560
-4375
lines changedThis file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
30 | 44 | | |
31 | 45 | | |
32 | 46 | | |
| |||
0 commit comments