18 Commits
Author SHA1 Message Date
Av007 45af51b413 docs: condense CONFLUENCE.md to essentials (137 -> 39 lines)
Made-with: Cursor
2026-04-17 12:43:23 +03:00
Av007 ca66f6d342 chore: cleanup nodes.py, fix root WEB_DIRECTORY, docs and pyproject
nodes.py:
- move json/urllib/logging imports to module top
- replace inline imports inside _get_balance with module-level log
- extract endpoint/key constants instead of inline literals
- add from __future__ import annotations for cleaner typing
- document the error-path padding to 4-tuple matching RETURN_TYPES

Root __init__.py:
- expose WEB_DIRECTORY pointing at custom_nodes/credit_tracker/js so the
  live-update extension loads when the repo is installed as custom_fns/

pyproject.toml:
- fix invalid build-backend (was setuptools.backends.legacy:build)
- bump to 0.2.0, add author/homepage fields

README + CONFLUENCE:
- document balance check, block_if_insufficient, and optional wired inputs
- update sample output to include Balance / After run / Status lines
- drop stale "no API calls" line and inaccurate "41 models total" claim
- mention JS pricing mirror must be updated alongside Python PRICING

Made-with: Cursor
2026-04-17 12:42:41 +03:00
Av007 439889ec16 refactor: replace custom AspectCrop with built-in ImageScale (crop=center)
Switch to comfy-core ImageScale node which combines center-cropping and
resizing in a single built-in step (bilinear, 854x480, center). AspectCrop
class removed from the package since it is no longer needed in the
reference workflow.

Trade-off: changing aspect_ratio on the PrimitiveNode no longer auto-adjusts
the crop dims. The two ImageScale width/height widgets must be updated
manually (e.g. 1080x1920 for 9:16, 480x480 for 1:1 at 480p).

Made-with: Cursor
2026-04-17 12:32:32 +03:00
Av007 fbd2b980ce feat: AspectCrop node + seedance workflow uses it for first/last frames
AspectCrop takes IMAGE + aspect_ratio (+ optional target resolution) and
center-crops the image in pure PyTorch. Seedance workflow inserts two
AspectCrop nodes (first frame and last frame) between LoadImage and
ByteDance, all driven by the same PrimitiveNode, so switching 16:9 →
9:16 → 1:1 reshapes both input frames and the ByteDance output in one go.

Made-with: Cursor
2026-04-17 12:28:29 +03:00
Av007 2d38ac32f4 feat: aspect_ratio_in and resolution_in optional wired inputs on CreditDisplay
Allows a PrimitiveNode (or any COMBO source) to drive aspect_ratio and
resolution for CreditDisplay directly, taking priority over the widget
dropdown. The Python calculate() uses the wired value when present.

Made-with: Cursor
2026-04-17 12:24:02 +03:00
Av007 37a6dcedf6 fix: intercept widget.value setter instead of wrapping callback
ComfyUI combo/dropdown widgets often set widget.value directly without
calling widget.callback, so the previous approach missed changes.
Object.defineProperty on the value property catches every write regardless
of how LiteGraph or ComfyUI triggers it, firing refresh via queueMicrotask.

Made-with: Cursor
2026-04-17 12:16:25 +03:00
Av007 fbff644b44 fix: improve balance fetch — more endpoints, nested JSON, and server logging
- Try 4 endpoint patterns: /api/credits, /internal/credits, /api/user/credits,
  /comfyui-credits
- Handle raw float response, flat key lookup, and nested data/user/account wrappers
- Log every attempt (DEBUG) and failures (WARNING) with [credit_tracker] prefix
  so the ComfyUI server console shows exactly what is happening
- Improve the "balance unavailable" message to point users to the server log

Made-with: Cursor
2026-04-17 12:14:35 +03:00
Av007 c9099e2c52 fix: reliably sync resolution/aspect/duration from upstream node on load and change
- patchSourceNode() is called lazily inside refresh() so it runs whether
  the wire exists at creation time or is added later
- WeakSet prevents double-wrapping source widget callbacks
- setTimeout(refresh, 500) handles workflow-load case where links are
  fully resolved only after graph configuration completes
- onConnectionsChange now triggers refresh via queueMicrotask (not a
  separate patch loop) so new wires are picked up in one step

Made-with: Cursor
2026-04-17 11:59:47 +03:00
Av007 ec370fc17b feat: auto-sync resolution/aspect_ratio/duration from upstream trigger node
When ByteDance (or any node) is wired to the trigger input, the JS extension
reads its resolution, aspect_ratio and duration_s widgets by name (with positional
fallback at indices 2/3/4) and mirrors them into CreditDisplay automatically.
Widget callbacks on the upstream node are patched on connection so any change
to ByteDance settings immediately recalculates the cost display.

Made-with: Cursor
2026-04-17 11:52:55 +03:00
Av007 f273ee135e fix: accept any type on trigger input so VIDEO can connect
Change trigger from STRING to * (universal) so ByteDance VIDEO output
can wire directly to CreditDisplay without a type mismatch.

Made-with: Cursor
2026-04-17 11:46:52 +03:00
Av007 ced575b9d5 feat: live balance check, status line, and optional run-blocking
- _get_balance() calls /api/credits or /internal/credits via urllib (no deps)
- _format_output() gains Balance / After run / Status lines when balance available
- CreditDisplay gains check_balance (BOOLEAN) and block_if_insufficient (BOOLEAN)
- block_if_insufficient=True raises RuntimeError before the model runs if funds are low
- New output slot: balance_after (FLOAT)
- JS updated to show balance placeholder and read check_balance widget

Made-with: Cursor
2026-04-17 11:02:21 +03:00
Av007 5c00a6cc10 docs: add Confluence documentation for non-technical users
Made-with: Cursor
2026-04-16 14:03:06 +03:00
Av007 88e6ce9bb5 feat: live credit recalculation on widget change via JS extension
Made-with: Cursor
2026-04-16 14:01:18 +03:00
Av007 d5bbd0e821 fix: robust sys.path-based import in root __init__.py; update README file structure
Made-with: Cursor
2026-04-16 13:52:29 +03:00
Av007 bca29fd4ff chore: add .gitignore to exclude __pycache__
Made-with: Cursor
2026-04-16 13:44:54 +03:00
Av007 c86c52e155 fix: add root __init__.py so ComfyUI discovers CreditDisplay when repo is cloned into custom_nodes/
Made-with: Cursor
2026-04-16 13:44:17 +03:00
Av007 6680503fef adding docs 2026-04-16 13:18:29 +03:00
Av007 7dacbd4501 init 2026-04-16 12:50:18 +03:00