- Add /ollama/models API route that proxies requests to Ollama - Auto-fetch models when client is connected (no workflow execution needed) - Update JavaScript to call ComfyUI API instead of Ollama directly - Eliminates CORS browser restrictions - Much better UX - models appear instantly on connection - Add api.py with setup_api_routes() function - Add tests for API module (31 tests passing) - Update README with auto-fetch feature and technical details
Custom Web Extensions for Ollama Model Manager
This directory contains JavaScript extensions that enhance the ComfyUI nodes with dynamic dropdowns.
Files
ollama_widgets.js
Implements dynamic model dropdown updates for Ollama nodes.
How It Works
- User connects nodes:
OllamaClient→OllamaModelSelector→OllamaLoadModel - User executes workflow: With
refresh=trueonOllamaModelSelector - Python backend: Fetches models from Ollama API (no CORS issues)
- JavaScript updates: Parses execution results and updates all model dropdowns
Features
- ✅ Dynamic dropdowns - Model lists update automatically after execution
- ✅ No CORS issues - All API calls through Python backend
- ✅ Downstream propagation - Load/Unload nodes get updated automatically
- ✅ Custom styling - Clean, readable dropdown display
- ✅ Cached models - Persists between workflow executions
Architecture
The JavaScript hooks into ComfyUI's execution lifecycle:
onExecuted: Updates dropdowns whenOllamaModelSelectorexecutesonConnectionsChange: Logs connection events for debuggingupdateModelDropdown: Helper function to refresh COMBO widgets
All model fetching happens in Python to avoid browser CORS restrictions.