Commit Graph
274 Commits
Author SHA1 Message Date
Meisoftcoltd 4e49b99e2d fix: return primitives instead of single-item lists in AutoLoopCalculatorTTSBatch
The AutoLoopCalculatorTTSBatch node was returning its output variables
wrapped in single-item lists (e.g., `[current_chunk_text]`) instead of as
raw primitive values. This caused downstream nodes expecting raw types
(like standard string replacement or string concatenation nodes) to crash,
since Python lists do not have `.replace()` or `.join()` methods.

The brackets were removed from the `return` statement so the node now properly
outputs the exact primitive values.
2026-05-23 13:45:37 +00:00
Meisoft dc3f4c2c07 Merge pull request #129 from Meisoftcoltd/fix-tts-batch-output-unwrapping-5285393574070216027
Remove OUTPUT_IS_LIST from AutoLoopCalculatorTTSBatch to allow ComfyUI unwrap
2026-05-23 15:13:40 +02:00
Meisoftcoltd 35075fa357 fix(loop.py): Remove OUTPUT_IS_LIST to enable automatic unwrap in ComfyUI
The `OUTPUT_IS_LIST = (True, True, True, True, True)` assignment in `AutoLoopCalculatorTTSBatch` was preventing ComfyUI from automatically unwrapping 1-item lists, causing downstream nodes to crash with TypeErrors (expecting raw strings/integers but getting lists). By removing this attribute while keeping `INPUT_IS_LIST = True`, ComfyUI can now safely process inputs as batches while unwrapping and forwarding primitive values to the next nodes.
2026-05-23 13:13:27 +00:00
Meisoft 59f0be86ba Merge pull request #128 from Meisoftcoltd/fix-tts-batch-parallel-execution-5012071892428602725
Fix AutoLoopCalculatorTTSBatch parallel execution with list inputs
2026-05-23 14:28:54 +02:00
Meisoftcoltd f48f69ef43 Fix AutoLoopCalculatorTTSBatch parallel execution with list inputs
Restored INPUT_IS_LIST = True to prevent ComfyUI from mapping the node
in parallel when given multiple files, and added OUTPUT_IS_LIST with
five values to properly unpack outputs to the downstream nodes. Also
ensured that the return statement yields a tuple of lists.
2026-05-23 12:04:12 +00:00
Meisoft e449cdf0d1 Merge pull request #127 from Meisoftcoltd/feature/loop-calculator-tts-batch-update-15309557865844476534
Update AutoLoopCalculatorTTSBatch inputs and cleanup tests
2026-05-23 01:23:01 +02:00
Meisoftcoltd 5e2d368379 feat: update AutoLoopCalculatorTTSBatch to support multiple files
- Added `file_names` to INPUT_TYPES and `current_file_name` to RETURN_TYPES.
- Removed `INPUT_IS_LIST = True` to avoid double nesting in ComfyUI list processing.
- Cleaned up temp files (`test_loop_syntax.py`, test `.sh` scripts).
- Verified `BatchTextFileReader` does not exist in the repository.
2026-05-22 23:19:34 +00:00
Meisoft c1bc9b375a Merge pull request #126 from Meisoftcoltd/fix-import-loop-8733227099235388804
Fix absolute import in `loop.py`
2026-05-22 23:36:03 +02:00
Meisoftcoltd 1d9d3356fb Fix absolute import in loop.py 2026-05-22 21:34:27 +00:00
Meisoft 1bd0792655 Merge pull request #125 from Meisoftcoltd/fix-tts-batch-type-6614993364835646221
Fix AutoLoopCalculatorTTSBatch type bug
2026-05-22 22:57:09 +02:00
Meisoftcoltd fc547c5c18 Fix AutoLoopCalculatorTTSBatch data type bug for downstream TTS nodes
- Removed `INPUT_IS_LIST = True` to prevent ComfyUI from implicitly converting input values to lists and expecting lists as outputs.
- Refactored `calculate` to handle list inputs natively using `isinstance` while correctly interacting with the standard Text Reader's native Python lists.
- Changed the return signature to emit native primitive values (`str`, `int`) instead of wrapping them in lists, correctly accommodating downstream integration with TTS models (e.g. Fish Speech) that expect pure strings.
2026-05-22 20:45:25 +00:00
Meisoft 19c8d8ea51 Merge pull request #124 from Meisoftcoltd/fix-tts-double-wrapping-8736248982233625434
Fix: Unpack double-wrapped list in AutoLoopCalculatorTTSBatch
2026-05-22 21:31:47 +02:00
Meisoftcoltd 80a0ea3eb1 fix: handle double-wrapped list in AutoLoopCalculatorTTSBatch
ComfyUI's `INPUT_IS_LIST = True` behavior wraps incoming data in a list. When an upstream node (like `BatchTextFileReader`) already returns a list, ComfyUI wraps it again, creating a list of lists (e.g., `[["file1", "file2"]]`).

This patch updates `AutoLoopCalculatorTTSBatch.calculate` to robustly detect and unpack this double-wrapping before extracting the target texts, preventing a downstream `AttributeError` during string manipulation.
2026-05-22 19:29:05 +00:00
Meisoft 1468c14e97 Merge pull request #123 from Meisoftcoltd/feat/tts-batch-processing-9692705988502475457
feat: Implement AutoLoopCalculatorTTSBatch for sequential batch processing
2026-05-21 21:44:30 +02:00
Meisoftcoltd cf6666885a feat: Implement AutoLoopCalculatorTTSBatch for sequential text file processing
- Added global tracking variables (`global_batch_index`, `global_has_more_batches`, `global_is_batch_advancing`) to `loop.py` to maintain batch state
- Updated `SequentialLoopStart` reset logic to prevent loop index reset on automatic batch advances
- Implemented the `AutoLoopCalculatorTTSBatch` node with `INPUT_IS_LIST = True` returning list-wrapped chunks to bypass native ComfyUI parallelization
- Updated `SequentialLoopTrigger` requeue logic to handle batch completion correctly using `reset_loop=True` with `loop_idx=0` when `has_more_batches` is truthy
2026-05-21 19:42:01 +00:00
Meisoft 4d9c0a0ad0 Merge pull request #122 from Meisoftcoltd/fix-seed-overflow-ollama-9437070014955011207
fix: prevent seed overflow crash in OllamaOptionsV2 by lowering max seed to 0x7fffffff
2026-05-20 21:38:16 +02:00
Meisoftcoltd b04cc4267e fix(loop): lower max random seed to 0x7fffffff to prevent OllamaOptionsV2 crash
The `SequentialLoopTrigger` node was mutating seeds with `0xffffffff`, which exceeded the maximum value for a signed 32-bit integer. This caused a validation error in strict nodes like `OllamaOptionsV2` during loop iterations. This commit lowers the maximum generated random seed value to `0x7fffffff` to remain within safe limits.
2026-05-20 19:37:52 +00:00
Meisoft af36417577 Merge pull request #121 from Meisoftcoltd/fix-comfyui-connection-retry-11397371798100148086
feat: add robust ComfyUI server connection retry in SequentialLoopStart
2026-05-19 23:05:22 +02:00
Meisoftcoltd 03a214b028 feat: add connection retry mechanism to SequentialLoopStart
Replaces the single `urlopen` call with a resilient retry loop (up to 3 attempts, 10s timeout, 1s delay) when checking the ComfyUI server status. Now raises a strict `RuntimeError` if all attempts fail, halting the execution queue and surfacing the error on the UI.
2026-05-19 20:46:41 +00:00
Meisoft 6b7432ad4e Merge pull request #115 from Meisoftcoltd/test-master-switch-11731836374353204067
🧪 Add tests for MasterSwitch route
2026-05-14 22:32:24 +02:00
Meisoft 1011e0ce01 Merge pull request #116 from Meisoftcoltd/fix/unused-import-os-2345010763044814460
🧹 Code Health Improvement: Remove unused import os
2026-05-14 22:31:27 +02:00
Meisoft 3d2805019a Merge pull request #119 from Meisoftcoltd/jules-security-ssrf-fix-6533768813890255424
🔒 Fix SSRF Vulnerability in Loop Trigger via Port Auto-Detection
2026-05-14 22:30:59 +02:00
Meisoft 791f394dd5 Merge pull request #118 from Meisoftcoltd/fix-insecure-deserialization-12125730200173000788
🔒 Fix insecure deserialization via torch.load
2026-05-14 22:29:15 +02:00
Meisoftcoltd 694c2cce2a 🔒 Fix SSRF vulnerability in SequentialLoopStart by securely auto-detecting the ComfyUI port from sys.argv instead of trusting the node's UI input port. 2026-05-14 20:29:08 +00:00
Meisoft 184407b1a2 Merge pull request #117 from Meisoftcoltd/fix-calculator-guards-9910739610236774791
🧪 Test: add safety guards and tests for video calculators
2026-05-14 22:26:39 +02:00
Meisoftcoltd 71534b968e Use safetensors instead of torch.save/load to fix insecure deserialization 2026-05-14 20:25:20 +00:00
Meisoftcoltd 3afcee2bef test: add safety guards and unit tests for video loop calculators
Added input validations (`source_frame_count <= 0` or `target_frames_per_loop <= 0`) to `AutoLoopCalculatorLTX` (in `loop.py`), and `AutoLoopCalculator`, `AutoLoopCalculatorWan` (in `video.py`). When conditions are met, a safe default is returned to prevent math domain errors. Also included a new comprehensive unit test suite in `tests/test_loop_calculator.py`.
2026-05-14 20:24:55 +00:00
Meisoftcoltd 5a295242e4 🧹 Remove unused import os from __init__.py 2026-05-14 20:22:39 +00:00
Meisoftcoltd cc17f2561e Add tests for MasterSwitch route
Addresses the missing tests for MasterSwitch node's route and check_lazy_status methods in switch_node.py. Tests verify branching functionality based on is_final_cycle parameter and include edge case checking for None values.
2026-05-14 20:15:45 +00:00
Meisoft bff976781c Merge pull request #113 from Meisoftcoltd/add-exception-check-to-padding-4025659044740554957
🧪 [Testing] Add exception check for non-tensor input in pad()
2026-05-14 22:14:58 +02:00
Meisoftcoltd 7bef683128 Add exception check for non-tensor input in VAESafeFramePadder.pad()
Modified `tools.py` to add an `isinstance` check and raise a `ValueError` when non-tensor input is passed. Also added `test_tools.py` to verify this behavior.
2026-05-14 20:03:57 +00:00
Meisoft 9df7a16940 Merge pull request #112 from Meisoftcoltd/feat/audio-duration-calculator-1774713163093024603
feat(tools): add AudioDurationCalculator node
2026-05-14 11:49:21 +02:00
Meisoftcoltd 0c280ec6f2 feat(tools): add AudioDurationCalculator node
Adds a new ComfyUI utility node `AudioDurationCalculator` to `tools.py` for
calculating the exact duration of an audio file in seconds. Includes robust
error handling to ensure the input is a valid dictionary and returns a
logging string output to maintain consistency with other tools.
2026-05-14 08:42:29 +00:00
Meisoft c44796d59b Merge pull request #111 from Meisoftcoltd/fix/unit-clash-tts-timeline-2852292516543970131
Fix: Resolve TTS timeline unit clash in SessionImageSender
2026-05-14 00:36:59 +02:00
Meisoftcoltd 6cd32fcfe9 Fix: Resolve Unit Clash between TTS chunks and video frames in Sequential Batcher
- Introduce `global_step_by_chunk` ghost variable initialized to `False` in `loop.py`
- Set `loop.global_step_by_chunk = True` in `AutoLoopCalculatorTTS` to indicate chunk mode
- Reset `loop.global_step_by_chunk = False` in video calculators (`AutoLoopCalculator`, `AutoLoopCalculatorWan`, `AutoLoopCalculatorLTX`) to ensure state resets
- Update `SessionImageSender.send_image` timeline management to branch logic, using `is_chunk_mode` to calculate progress differently for text chunks versus video frames
2026-05-13 22:34:58 +00:00
Meisoft db22f2ea3f Merge pull request #110 from Meisoftcoltd/improve-tts-auto-loop-calculator-2913379197447008085
feat(tts): add intelligent buffer to TTS sequence chunking
2026-05-11 23:57:48 +02:00
Meisoftcoltd 7b900c10cd feat(tts): implement intelligent text buffering for AutoLoopCalculatorTTS
This commit replaces the raw regex text-splitting logic in `AutoLoopCalculatorTTS` with an "intelligent buffer" approach. It first splits the text by sentence terminators as before, but now aggregates these smaller segments until they contain a minimum of 5 words.

This prevents TTS models from generating robotic, out-of-context micro-audios when encountering trailing ellipses (`...`) or extremely short phrases, leading to more natural intonation and pacing.

All existing loop and timeline injections are preserved.
2026-05-11 21:48:30 +00:00
Meisoft 48ce1b3826 Merge pull request #109 from Meisoftcoltd/feat/tts-regex-chunking-8529750223989142037
feat(tts): improve AutoLoopCalculatorTTS regex chunking
2026-05-09 19:54:48 +02:00
Meisoftcoltd d1d5f47562 feat(tts): implement regex-based robust chunking for AutoLoopCalculatorTTS
Replaced simple paragraph/sentence splitting with advanced regex
to gracefully handle split scenarios involving `.`, `?`, `!`,
quotes, ellipses, and `\n`. Punctuation is correctly retained on
the chunks to assure proper TTS intonation.

Moved `import re` to module level imports.
2026-05-09 17:46:49 +00:00
Meisoft 960acd7371 Merge pull request #108 from Meisoftcoltd/fix-graph-surgery-node-input-error-6346624600916527026
fix: remove destructive graph surgery causing NodeInputError
2026-05-09 13:37:07 +02:00
Meisoftcoltd 7f025b9a18 fix: remove destructive graph surgery in SequentialLoopTrigger
Replaced destructive `del inputs["on_true"]` and `del inputs["on_false"]` with simple state update `inputs["is_final_cycle"] = is_next_final` to rely on MasterSwitch's native lazy evaluation (`check_lazy_status`), fixing a `NodeInputError` bug during looping.
2026-05-09 11:27:29 +00:00
Meisoft eac81a4b14 Merge pull request #107 from Meisoftcoltd/fix-tts-chunk-calculation-6615407643540930151
Fix estimated chunk size for AutoLoopCalculatorTTS
2026-05-03 12:44:59 +02:00
Meisoftcoltd 1f64452691 Fix estimated chunk size calculation for AutoLoopCalculatorTTS
Update `SequentialLoopTrigger` in `loop.py` to correctly identify
`AutoLoopCalculatorTTS` and set `estimated_chunk` to 1 instead of falling
back to a default of 50. This prevents the trigger from incorrectly guessing
when the final loop occurs and mutating the graph prematurely, which caused
errors during sequential TTS tasks.
2026-05-03 10:41:15 +00:00
Meisoft 7375f9d478 Merge pull request #106 from Meisoftcoltd/fix/incremental-video-stitcher-inplace-error-9647683454534116380
Fix RuntimeError: Inplace update to inference tensor outside InferenceMode
2026-05-02 23:55:48 +02:00
Meisoftcoltd d6c2a4b012 Fix RuntimeError due to in-place tensor updates in InferenceMode
Refactors `IncrementalVideoStitcher.stitch` to eliminate in-place assignments
into a pre-allocated empty tensor when loading image frames in parallel, which
caused `RuntimeError: Inplace update to inference tensor outside InferenceMode
is not allowed.` in newer PyTorch versions.

The refactored implementation uses a pure map function to return individual
tensors and concatenates them sequentially using `torch.cat`, remaining thread-safe
and compatible with PyTorch's `InferenceMode`. Security against deserialization
vulnerabilities is preserved by ensuring `weights_only=True` remains when loading
audio caches.
2026-05-02 21:55:05 +00:00
Meisoft b7e1fb6f89 Merge pull request #105 from Meisoftcoltd/test-video-audio-error-handling-369389381641730631
🧪 Add error handling and coverage tests for audio extraction
2026-05-02 22:46:31 +02:00
Meisoftcoltd ba6fc7b8fc 🧪 Add error handling and coverage tests for audio extraction
- Implemented unit tests for `extract_and_standardize_audio` in `video.py`.
- Added test case to verify exception handling when `torchaudio.load` fails.
- Expanded coverage to include resampling and channel standardization (mono/multichannel to stereo).
- Followed the repository's clean testing pattern for mocking dependencies and loading code under test.
2026-05-02 20:46:16 +00:00
Meisoft 41c2d7d34c Merge pull request #104 from Meisoftcoltd/performance-loop-optimization-4925127687414595231
⚡ Performance Optimization: Merge sequential loops in prompt iteration
2026-05-02 22:45:54 +02:00
Meisoftcoltd ecdda64169 ⚡ optimize: merge sequential loops in prompt iteration
Merged two sequential loops over `prompt.items()` in `SequentialLoopTrigger.trigger_next` into a single pass.
The first pass now simultaneously finds the `estimated_chunk` from `AutoLoopCalculator` and performs mutations for seeds and loop indices.
`MasterSwitch` mutations are deferred to a small secondary pass after `is_next_final` is calculated using the gathered chunk size.

This change reduces the overhead of iterating over large prompt dictionaries and yielded a ~26.8% performance improvement in synthetic benchmarks.
2026-05-02 20:45:27 +00:00
Meisoft 26428789ae Merge pull request #103 from Meisoftcoltd/fix-insecure-deserialization-torch-load-video-3886399146367191308
🔒 [security fix] Insecure Deserialization via torch.load() in video.py
2026-05-02 22:44:51 +02:00