17 Commits
Author SHA1 Message Date
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
darth-veitcher b08fafbbe2 refactor: clean up repository and remove legacy code
- Remove ARCHITECTURE.md and TESTING.md (outdated/duplicate docs)
- Simplify README.md to focus on current 4-node architecture
- Update CHANGELOG.md to reflect v1.0.0 release
- Update web/README.md to match current implementation
- Remove legacy _OLLAMA_MODELS global from state.py
- Remove logs/ directory from repo, add to .gitignore
- All 29 tests still passing
2025-11-02 12:50:54 +00:00
darth-veitcher 1ba201a4c4 style: remove trailing whitespace in ollama_widgets.js 2025-11-02 12:37:05 +00:00
darth-veitcher 579462af42 fix: remove JavaScript fetch calls to avoid CORS errors
- Removed all fetch() calls to Ollama API from JavaScript

- JavaScript cannot call Ollama due to CORS restrictions

- Models must be fetched by Python backend via workflow execution

- User must set refresh=true and execute workflow to fetch models

- Simplified JavaScript to only update dropdowns from execution results

- All 29 tests passing
2025-11-02 12:33:38 +00:00
darth-veitcher 4e93e60e0d fix: JavaScript syntax error preventing module load
- Moved console.log after import statements (ES6 modules requirement)

- Changed arrow function + bind to async function with self variable

- This fixes 'SyntaxError: missing ) after argument list'

- JavaScript should now load properly in ComfyUI

- All tests passing
2025-11-02 12:26:51 +00:00
darth-veitcher d70320a98a fix: add IS_CHANGED and JavaScript load detection
- Added IS_CHANGED method to OllamaModelSelector

- Forces re-evaluation when refresh=true or cache changes

- Returns hash of cached models to detect changes

- Added console logs at top of JS file to verify it loads

- This should help ComfyUI know when to update the node

- All 12 tests passing
2025-11-02 12:22:03 +00:00
darth-veitcher 447cf4a456 debug: add comprehensive onExecuted logging
- Log when onExecuted is called

- Log all message keys and full message JSON

- Log models_json value and parsed models

- Log dropdown update result

- Warn if models_json is missing or models failed to parse

- This will help diagnose why dropdown isn't updating after execution
2025-11-02 12:18:05 +00:00
darth-veitcher 0e8cdb6246 fix: auto-fetch models on workflow load and node creation
- Added checkAndFetchModels() helper that checks for existing connections

- Hook into onNodeCreated to check after node is added

- Hook into onConfigure to check when workflow is loaded

- Hook into onAdded to check when node added to graph

- This fixes issue where connections made during workflow load don't trigger events

- All 12 tests passing
2025-11-02 12:13:47 +00:00
darth-veitcher fcb823ac87 style: clean up whitespace in ollama_widgets.js 2025-11-02 12:09:39 +00:00
darth-veitcher b81c5acf0b debug: add extensive logging and onConnectInput hook
- Added detailed console logging throughout connection flow

- Hook into onConnectInput as backup to onConnectionsChange

- Log all connection events (type, index, connected, link_info)

- Log widget states, endpoint values, and API responses

- This will help diagnose why dropdown isn't updating
2025-11-02 12:08:05 +00:00
darth-veitcher 8d03023b3d fix: dropdown visibility and size issues
- Changed default placeholder from empty string to '<connect client to fetch>'

- Enhanced updateModelDropdown with detailed logging

- Force widget type to 'combo' to ensure proper display

- Added multiple UI refresh calls (setDirtyCanvas, graph.change)

- Force widget size recalculation with computeSize and onResize

- All 29 tests passing
2025-11-02 12:03:45 +00:00
darth-veitcher af6ab6fc59 feat: auto-fetch models when client connected
- OllamaModelSelector auto-fetches models on client connection

- Direct Ollama API call from JavaScript (fetch to /api/tags)

- Instant dropdown update without workflow execution

- Auto-updates downstream Load/Unload nodes

- All 29 tests passing
2025-11-02 11:58:23 +00:00
darth-veitcher f6432c8891 fix: model dropdown now displays immediately as COMBO
Changes:
- Changed OllamaModelSelector model input from STRING to COMBO
- Model dropdown now populates with cached models on node creation
- Updated JavaScript to work with native COMBO widgets
- Added graph.change() trigger for immediate UI updates
- Added CHANGELOG.md to track changes

The dropdown now:
1. Displays as a dropdown from the start (no STRING conversion)
2. Shows cached models if available
3. Updates when executed with refresh=true
4. Propagates to downstream Load/Unload nodes

Fixes issue where users had to execute the node before seeing
the dropdown appear. Now it's visible immediately upon connecting
the client node.

All 29 tests passing.
2025-11-02 11:54:48 +00:00
darth-veitcher 80efcff441 refactor: remove legacy nodes and simplify architecture
- Remove OllamaRefreshModelList and OllamaSelectModel legacy nodes
- Simplify to 4 core nodes: Client, ModelSelector, Load, Unload
- Update OllamaModelSelector to properly output models_json for dropdowns
- Add per-endpoint model caching to state management
- Clean up JavaScript to remove legacy node handlers
- Remove legacy node tests (now 29 tests total, all passing)
- Update documentation to reflect simplified architecture
- Add ARCHITECTURE.md and TESTING.md for comprehensive docs
2025-11-02 11:47:41 +00:00
darth-veitcher 917ac74d4c Add dynamic dropdown for Load/Unload nodes from models_json
- Parse models_json input and convert model field to dropdown
- Automatically populate dropdown when connected to Refresh node
- Convert STRING input to COMBO widget dynamically
- Revert to text input when disconnected
- Hook into onConnectionsChange, onExecuted, and onConfigure
- Restore dropdown state when loading saved workflows
- Works for both OllamaLoadSelectedModel and OllamaUnloadSelectedModel
- All 29 tests passing

Features:
- Connect models_json from Refresh → Load/Unload
- Model field becomes dropdown with available models
- Auto-updates when Refresh node executes
- Manual text entry still available when not connected
- Cleaner UX than typing model names manually
2025-11-02 10:20:25 +00:00
darth-veitcher 6e85d1d508 Fix widget initialization error in onNodeCreated
- Add null check for inputEl before setting properties
- Prevents 'Cannot set properties of undefined' error
- Widget might not be fully initialized when onNodeCreated runs
- Fixes workflow loading error in ComfyUI
2025-11-02 10:15:51 +00:00
darth-veitcher a0318490ae Implement custom JavaScript widget for model display
- Remove models_display STRING output (no longer needed)
- Create custom ComfyUI JavaScript extension (web/ollama_widgets.js)
- Widget displays models directly on OllamaRefreshModelList node
- Custom styling: dark theme, monospace font, scrollable
- Add WEB_DIRECTORY to __init__.py for ComfyUI integration
- Widget created dynamically when node executes
- Shows formatted model list with count and separators
- Add web/README.md documenting the custom widget
- Update tests for new ui data structure
- All 29 tests passing

Features:
- No extra nodes needed for visualization
- Read-only display widget
- Auto-sizing based on content
- Persistent across workflow saves
- Custom CSS styling with dark theme
2025-11-02 10:10:06 +00:00