Files
darth-veitcher 9e6faa0fdf feat: add ComfyUI API endpoint to eliminate CORS issues
- 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
2025-11-02 13:29:58 +00:00
..

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

  1. User connects nodes: OllamaClient → OllamaModelSelector → OllamaLoadModel
  2. User executes workflow: With refresh=true on OllamaModelSelector
  3. Python backend: Fetches models from Ollama API (no CORS issues)
  4. 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 when OllamaModelSelector executes
  • onConnectionsChange: Logs connection events for debugging
  • updateModelDropdown: Helper function to refresh COMBO widgets

All model fetching happens in Python to avoid browser CORS restrictions.