Update documentation and version for 1.3.2
This commit is contained in:
+13
-4
@@ -5,10 +5,19 @@ All notable changes to ComfyUI-ScriptFlow will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- `MultiOutputScript (Jev)` prints `[ComfyUI-ScriptFlow] Jev requests: N, responses: M` to the console after each run, including runs that end with an error
|
||||
- Requests are API requests or local model evaluations; questions answered from the run's cache are not counted
|
||||
- Set the `httpx` and `typesafe_sdk` loggers to WARNING when `typesafe-sdk` is installed, removing two INFO lines per TypeSafe API request
|
||||
- The `httpx` logger is shared, so its INFO lines from other custom nodes are hidden as well
|
||||
|
||||
## [1.3.2] - 2026-10-03
|
||||
|
||||
- `MultiOutputScript (Jev)` batches questions without script changes
|
||||
- Questions are queued while the script runs; the run stops when the script first uses an answer's value, the queued questions are sent, and the script reruns from the start with the answers
|
||||
- Questions about the same `state` are sent in one request (one TypeSafe `system_one` call with several questions); requests for different states are sent in parallel with the TypeSafe API and one after another with a local model
|
||||
- Storing an answer, passing it to a user-defined function, or calling `float()` on it does not stop the run
|
||||
- Scripts ask the same questions and produce the same outputs as before; each rerun starts from the same `random` state and time
|
||||
- Changed `max_jev_calls` to limit requests instead of questions; a run stops with an error before sending requests that would exceed it
|
||||
- `MultiOutputScript (Jev)` prints `[ComfyUI-ScriptFlow] Jev requests: N, states: S, questions: Q, responses: M` to the console after each run, including runs that end with an error
|
||||
- Questions answered from the run's cache are not counted
|
||||
- Set the `httpx2` and `typesafe_sdk` loggers to WARNING when `typesafe-sdk` is installed, removing two INFO lines per TypeSafe API request
|
||||
- `datetime.datetime.now()` and `datetime.date.today()` return the time the run started in both script nodes, so repeated calls in one script return the same value
|
||||
|
||||
|
||||
## [1.3.1] - 2026-09-29
|
||||
|
||||
+39
-14
@@ -3,7 +3,7 @@
|
||||
|
||||
---
|
||||
|
||||
**Version:** 1.3.1
|
||||
**Version:** 1.3.2
|
||||
**License:** GPL-3.0
|
||||
|
||||
System One の判断モデルを使える、安全な Python 風スクリプトノードです。
|
||||
@@ -129,7 +129,7 @@ ov1, ov2 = (512, 384) if w >= h else (384, 512)
|
||||
|
||||
追加の入力:
|
||||
- `model`:`TypeSafe API`、またはローカルの GGUF モデル(`mmproj-*` ファイルは表示されません)。
|
||||
- `max_jev_calls`(INT、初期値 8):1 回の実行での API リクエストまたはモデル評価の上限です。同じ実行の中で同じ質問は 1 回しか問い合わせません。
|
||||
- `max_jev_calls`(INT、初期値 8):1 回の実行での Jev リクエストの上限です。同じ `state` についての質問は 1 回のリクエストにまとめて送るため([質問のまとめ送り](#質問のまとめ送り)を参照)、質問数ではなくリクエスト数を制限します。上限を超えるリクエストは送る前にエラーで止まります。同じ実行の中で同じ質問は 1 回しか問い合わせません。
|
||||
|
||||
関数(`state` は文字列・辞書・リスト。テキストのみ):
|
||||
- `jev.yes(state, question[, threshold])` → `bool`(Yes の確率が `threshold` 以上か。初期値 `0.5`)
|
||||
@@ -154,7 +154,7 @@ ot1 = f"{kind} (portrait: {probs['portrait']:.3f}, landscape: {probs['landscape'
|
||||
|
||||
ノードの初期スクリプトは、`it1` のプロンプトに合う 8 種類のアスペクト比から 1 つを選び、`in_value_1` のメガピクセル数(未接続時は `1.0`。幅と高さは 64 の倍数に丸め)に合わせてサイズを決めます。幅と高さを `out_value_1` / `out_value_2` に、各比率の確率を `out_text_1` に出力します。
|
||||
|
||||
各関数は 1 つの質問をします。TypeSafe API を使う場合、[TypeSafe Python SDK](https://pypi.org/project/typesafe-sdk/) の `system_one` リクエスト 1 回に対応します。
|
||||
各関数は 1 つの質問をします。[TypeSafe Python SDK](https://pypi.org/project/typesafe-sdk/) で書いた場合のコードとの対応を示します。
|
||||
|
||||
| ScriptFlow | TypeSafe SDK |
|
||||
| --- | --- |
|
||||
@@ -166,12 +166,39 @@ ot1 = f"{kind} (portrait: {probs['portrait']:.3f}, landscape: {probs['landscape'
|
||||
|
||||
リストで渡した `options` は `criteria={label: None, ...}` として送られます。`confidence`、Score の段階ごとの確率、Noul の `criteria` は利用できません。
|
||||
|
||||
#### 質問のまとめ送り
|
||||
|
||||
質問は可能な範囲でまとめて送られます。
|
||||
|
||||
1. スクリプトの実行中、`jev` の質問はその場では送らず、順に溜めておきます。
|
||||
2. 答えを変数やリストに入れる、自分で定義した関数に渡す、`float()` を通す、といった使い方なら実行を続けます。`if` の条件、比較、計算、f 文字列、`sorted`、`join`、出力などで答えの値を初めて使ったところで、実行を止めます。
|
||||
3. 溜めた質問を `state` ごとに 1 回のリクエストで送り、スクリプトを最初から実行し直します。答えが分かった質問はその値を返し、新しい質問は同じように溜めます。
|
||||
|
||||
`state` が違うリクエストは、TypeSafe API では同時に送り、ローカルモデルでは順に処理します。質問を 1 つずつ問い合わせる場合と同じ質問をし、同じ結果を出力します。1 回の実行の中では、実行し直すたびに `random` の状態と `datetime.datetime.now()` の時刻が同じところから始まるので、実行し直しても質問は変わりません。
|
||||
|
||||
次の例では、`a` は `if` まで使われないので、`q1` と `q2` は 1 回のリクエストで送られます。`q3` は `a` が分かってから 2 回目のリクエストで送られます。
|
||||
|
||||
```python
|
||||
a = jev.noul(it1, "q1")
|
||||
b = jev.noul(it1, "q2")
|
||||
if a > 0.5:
|
||||
c = jev.noul(it1, "q3")
|
||||
```
|
||||
|
||||
多くの質問を 1 回のリクエストで送るには、`state` を同じにして、質問ごとに違う内容は質問文に入れてください。
|
||||
|
||||
TypeSafe API では、1 回のリクエストが [TypeSafe Python SDK](https://pypi.org/project/typesafe-sdk/) の `system_one` 呼び出し 1 回にあたります。上の例の 1 回目のリクエストは次のとおりです。
|
||||
|
||||
```python
|
||||
client.system_one(state=it1, questions={"q0": Noul(instructions="q1"), "q1": Noul(instructions="q2")})
|
||||
```
|
||||
|
||||
注意:
|
||||
- TypeSafe API は `state` と質問をインターネット経由で送信します。外部に出せないテキストには使わないでください。
|
||||
- ローカルモデルの質問は 1 回の順伝播で処理されます(GPU 上の 4B〜9B モデルで約 1〜1.5 秒)。モデルは実行ごとに最初の質問で読み込まれ(数秒)、実行が終わるとアンロードされて、ワークフローの残りのために VRAM を解放します。
|
||||
- ローカルモデルの確率は較正されておらず、モデルによって変わります。しきい値は実際の入力で試して決めてください。
|
||||
- 実行ごとにコンソールへ `[ComfyUI-ScriptFlow] Jev requests: N, responses: M` を出力します。返信数がリクエスト数より少なければ、途中のリクエストが失敗しています。同じ実行のキャッシュから答えた質問は数えません。
|
||||
- `typesafe-sdk` がインストールされていると、`httpx` と `typesafe_sdk` のロガーを WARNING に設定するため、リクエストごとの INFO ログは表示されません。`httpx` の設定はほかのカスタムノードにも適用されます。
|
||||
- 実行ごとにコンソールへ `[ComfyUI-ScriptFlow] Jev requests: N, states: S, questions: Q, responses: M` を出力します。送ったリクエスト数、異なる `state` の数、質問数、返信があったリクエスト数です。返信数がリクエスト数より少なければ、途中のリクエストが失敗しています。同じ実行のキャッシュから答えた質問は数えません。
|
||||
- `typesafe-sdk` がインストールされていると、`httpx2`(SDK が使う HTTP クライアント)と `typesafe_sdk` のロガーを WARNING に設定するため、リクエストごとの INFO ログは表示されません。
|
||||
- `MultiOutputScript` はモデルを読み込まず、ネットワークにもアクセスしません。`jev` は使えません。
|
||||
- このプロジェクトは独立したもので、TypeSafe AI とは関係ありません。
|
||||
|
||||
@@ -225,6 +252,7 @@ ot1 = f"{kind} (portrait: {probs['portrait']:.3f}, landscape: {probs['landscape'
|
||||
|
||||
### 実行時の注意
|
||||
- `random` や `datetime` を使うと、出力は毎回変わる可能性があります。
|
||||
- v1.3.2 以降では、`datetime.datetime.now()` と `datetime.date.today()` は実行を開始した時刻を返すため、1 つのスクリプトの中で何度呼んでも同じ値になります。
|
||||
- v1.2.0 以降では、`datetime.strftime(...)` でタイムスタンプを簡潔に整形できます。
|
||||
```python
|
||||
now = datetime.datetime.now()
|
||||
@@ -456,12 +484,9 @@ You should have received a copy of the GNU General Public License along with thi
|
||||
|
||||
詳しいバージョン履歴は [CHANGELOG.md](CHANGELOG.md) を参照してください。
|
||||
|
||||
### 現在のバージョン:1.3.1
|
||||
- ComfyUI Registry への公開を修正:ローカル Jev バックエンドが llama.cpp の API で直接推論するようにし、Registry の動的実行スキャンでの誤検知を回避
|
||||
- ComfyUI Registry に公開されなかった 1.3.0 の以下の変更を含む
|
||||
- テキストについての型付きの判断をスクリプトで使える `jev` 名前空間付きの `MultiOutputScript (Jev)` ノードを追加
|
||||
- `jev.yes`、`jev.noul`、`jev.choice`、`jev.probabilities`、`jev.score` を追加
|
||||
- `api_key.txt` から API キーを読み込む TypeSafe API バックエンドを追加
|
||||
- SemIf (OpenJev) をもとにした、llama-cpp-python によるローカル GGUF バックエンドを追加
|
||||
- 8 種類のアスペクト比から 1 つを選び、メガピクセル数からサイズを決める初期スクリプトを追加
|
||||
- `MultiOutputScript` と `centi` は変更なし
|
||||
### 現在のバージョン:1.3.2
|
||||
- `MultiOutputScript (Jev)` がスクリプトを変えずに質問をまとめて送るように:同じ `state` の質問は 1 回のリクエストで送り、`state` が違うリクエストは同時に送る
|
||||
- `max_jev_calls` が質問数ではなくリクエスト数を制限するように
|
||||
- 実行ごとに Jev のリクエスト数、`state` 数、質問数、返信数をコンソールに出力
|
||||
- TypeSafe SDK と HTTP クライアントのリクエストごとの INFO ログを非表示に
|
||||
- `datetime.datetime.now()` と `datetime.date.today()` が実行を開始した時刻を返すように
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# ComfyUI-ScriptFlow
|
||||
[en | [ja](README.ja.md)]
|
||||
|
||||
**Version:** 1.3.1
|
||||
**Version:** 1.3.2
|
||||
**License:** GPL-3.0
|
||||
|
||||
Safe Python-like script node for ComfyUI with a System One decision model.
|
||||
@@ -127,7 +127,7 @@ Scripts are the same for both. See [Installation](#installation) for the setup o
|
||||
|
||||
Extra inputs:
|
||||
- `model`: `TypeSafe API`, or a local GGUF model (`mmproj-*` files are hidden).
|
||||
- `max_jev_calls` (INT, default 8): maximum API requests or model evaluations per run. Identical questions within a run are asked only once.
|
||||
- `max_jev_calls` (INT, default 8): maximum Jev requests per run. Questions about the same `state` share one request (see [Batched questions](#batched-questions)), so this limits requests, not questions. A run stops with an error before sending requests that would exceed it. Identical questions within a run are asked only once.
|
||||
|
||||
Functions (`state` is a string, dict, or list; text only):
|
||||
- `jev.yes(state, question[, threshold])` → `bool` (yes-probability ≥ `threshold`, default `0.5`)
|
||||
@@ -152,7 +152,7 @@ ot1 = f"{kind} (portrait: {probs['portrait']:.3f}, landscape: {probs['landscape'
|
||||
|
||||
The node's default script picks one of eight aspect ratios for the prompt in `it1`, sizes it to the megapixels in `in_value_1` (default `1.0` when unconnected; width and height rounded to multiples of 64), outputs the width and height to `out_value_1` / `out_value_2`, and lists every ratio's probability in `out_text_1`.
|
||||
|
||||
Each function asks one question. With the TypeSafe API it maps to one `system_one` request of the [TypeSafe Python SDK](https://pypi.org/project/typesafe-sdk/):
|
||||
Each function asks one question. The table shows the equivalent code written with the [TypeSafe Python SDK](https://pypi.org/project/typesafe-sdk/):
|
||||
|
||||
| ScriptFlow | TypeSafe SDK |
|
||||
| --- | --- |
|
||||
@@ -164,12 +164,39 @@ Each function asks one question. With the TypeSafe API it maps to one `system_on
|
||||
|
||||
A list of `options` is sent as `criteria={label: None, ...}`. `confidence`, the Score level probabilities, and Noul `criteria` are not exposed.
|
||||
|
||||
#### Batched questions
|
||||
|
||||
Questions are sent in batches where possible:
|
||||
|
||||
1. While the script runs, each `jev` question is queued instead of being sent.
|
||||
2. Storing an answer in a variable or list, passing it to a function you defined, or calling `float()` on it keeps the run going. The run stops when the script first uses an answer's value: in an `if` condition, a comparison, arithmetic, an f-string, `sorted`, `join`, an output, and so on.
|
||||
3. The queued questions are sent, one request per `state`, and the script runs again from the start. Answered questions now return their values, and new questions are queued the same way.
|
||||
|
||||
Requests for different states are sent in parallel with the TypeSafe API, and one after another with a local model. A script asks the same questions and produces the same outputs as when each question is asked on its own. Within one run, every rerun starts from the same `random` state and `datetime.datetime.now()` time, so the questions do not change between reruns.
|
||||
|
||||
In this example, `q1` and `q2` go in one request because `a` is not used until the `if`. `q3` is sent in a second request after `a` is known:
|
||||
|
||||
```python
|
||||
a = jev.noul(it1, "q1")
|
||||
b = jev.noul(it1, "q2")
|
||||
if a > 0.5:
|
||||
c = jev.noul(it1, "q3")
|
||||
```
|
||||
|
||||
To ask many questions in one request, keep the `state` the same and put what differs between questions in the question text.
|
||||
|
||||
With the TypeSafe API, each request is one `system_one` call of the [TypeSafe Python SDK](https://pypi.org/project/typesafe-sdk/). The first request of the example above is:
|
||||
|
||||
```python
|
||||
client.system_one(state=it1, questions={"q0": Noul(instructions="q1"), "q1": Noul(instructions="q2")})
|
||||
```
|
||||
|
||||
Notes:
|
||||
- The TypeSafe API sends `state` and questions over the internet. Do not use it with text you cannot share externally.
|
||||
- A local question takes one forward pass (about 1–1.5 s with a 4B–9B model on GPU). The model is loaded on the first question of each run (several seconds) and unloaded when the run ends to free VRAM for the rest of the workflow.
|
||||
- Local probabilities are uncalibrated and depend on the model; test thresholds on your own inputs.
|
||||
- Each run prints `[ComfyUI-ScriptFlow] Jev requests: N, responses: M` to the console; fewer responses than requests means a request failed. Questions answered from the run's cache are not counted.
|
||||
- When `typesafe-sdk` is installed, the `httpx` and `typesafe_sdk` loggers are set to WARNING, so per-request INFO lines are not shown. The `httpx` setting also applies to other custom nodes.
|
||||
- Each run prints `[ComfyUI-ScriptFlow] Jev requests: N, states: S, questions: Q, responses: M` to the console: requests sent, distinct states, questions asked, and requests answered. Fewer responses than requests means a request failed. Questions answered from the run's cache are not counted.
|
||||
- When `typesafe-sdk` is installed, the `httpx2` (the SDK's HTTP client) and `typesafe_sdk` loggers are set to WARNING, so per-request INFO lines are not shown.
|
||||
- `MultiOutputScript` never loads a model or makes network requests; `jev` is not available there.
|
||||
- This project is independent and not affiliated with TypeSafe AI.
|
||||
|
||||
@@ -223,6 +250,7 @@ The script is parsed with Python AST and evaluated by ScriptFlow's safe interpre
|
||||
|
||||
### Execution Notes
|
||||
- Using `random` or `datetime` makes outputs non-deterministic.
|
||||
- In v1.3.2 or later, `datetime.datetime.now()` and `datetime.date.today()` return the time the run started, so repeated calls in one script return the same value.
|
||||
- `datetime.strftime(...)` is supported in v1.2.0 or later for concise timestamp formatting:
|
||||
```python
|
||||
now = datetime.datetime.now()
|
||||
@@ -454,12 +482,9 @@ You should have received a copy of the GNU General Public License along with thi
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
||||
|
||||
### Current Version: 1.3.1
|
||||
- Fixed ComfyUI Registry publishing: the local Jev backend now decodes through the llama.cpp API directly, avoiding a false positive in the Registry's dynamic-execution scan
|
||||
- Includes the 1.3.0 changes below, which were not published to the ComfyUI Registry
|
||||
- Added `MultiOutputScript (Jev)` node with a `jev` namespace for typed decisions in scripts
|
||||
- Added `jev.yes`, `jev.noul`, `jev.choice`, `jev.probabilities`, and `jev.score`
|
||||
- Added TypeSafe API backend with the API key read from `api_key.txt`
|
||||
- Added local GGUF backend through llama-cpp-python, adapted from SemIf (OpenJev)
|
||||
- Added a default script that picks one of eight aspect ratios and sizes it from megapixels
|
||||
- Kept `MultiOutputScript` and `centi` unchanged
|
||||
### Current Version: 1.3.2
|
||||
- `MultiOutputScript (Jev)` batches questions without script changes: questions about the same `state` are sent in one request, and requests for different states are sent in parallel
|
||||
- `max_jev_calls` now limits requests instead of questions
|
||||
- Added a console summary of Jev requests, states, questions, and responses after each run
|
||||
- Hid the per-request INFO log lines of the TypeSafe SDK and its HTTP client
|
||||
- `datetime.datetime.now()` and `datetime.date.today()` return the time the run started
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "ComfyUI-ScriptFlow"
|
||||
description = "Safe Python-like script node with a System One decision model: ask yes/no, choice, and score questions via TypeSafe AI's Jev API, with local GGUF LLMs as a fallback. Multiple inputs and outputs let one node handle math, logic, text editing, conditional routing, resolution selection, filename generation, and more."
|
||||
version = "1.3.1"
|
||||
version = "1.3.2"
|
||||
license = {file = "LICENSE"}
|
||||
# classifiers = [
|
||||
# # For OS-independent nodes (works on all operating systems)
|
||||
|
||||
Reference in New Issue
Block a user