fixing parsing node -- hold tight
This commit is contained in:
@@ -545,7 +545,7 @@ KIE Parse Prompt Grid JSON (1..9)
|
||||
Parse LLM JSON containing up to 9 prompts and return each prompt as a separate string output.
|
||||
|
||||
Inputs:
|
||||
- json_text: Raw JSON from an LLM (list or object)
|
||||
- json_text: Raw JSON from an LLM (list or object), wired STRING input
|
||||
- default_prompt: Fallback prompt if parsing yields no prompts
|
||||
- max_items: Cap the number of prompts (1..9)
|
||||
- strict: Raise errors when parsing fails or yields no prompts
|
||||
@@ -560,7 +560,7 @@ Outputs:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"json_text": ("STRING", {"multiline": True, "default": ""}),
|
||||
"json_text": ("STRING", {"forceInput": True}),
|
||||
},
|
||||
"optional": {
|
||||
"default_prompt": ("STRING", {"default": ""}),
|
||||
@@ -608,6 +608,8 @@ Outputs:
|
||||
debug: bool = False,
|
||||
):
|
||||
fallback = (default_prompt or "").strip()
|
||||
if not (json_text or "").strip() and fallback:
|
||||
json_text = fallback
|
||||
|
||||
try:
|
||||
prompts = parse_prompts_json(json_text, max_items=max_items, strict=strict, debug=debug)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Parse LLM JSON containing up to 9 prompts and expose each prompt as a separate string output.
|
||||
|
||||
This node requires a wired STRING input for `json_text`. It does not provide a manual JSON textbox.
|
||||
|
||||
---
|
||||
|
||||
## Example JSON inputs
|
||||
@@ -46,7 +48,7 @@ Object format (underscore keys):
|
||||
|
||||
## Outputs
|
||||
|
||||
- **p1..p9**
|
||||
- **prompt 1..prompt 9**
|
||||
Each prompt as a separate STRING output. Missing entries are empty strings.
|
||||
|
||||
- **count**
|
||||
@@ -59,8 +61,8 @@ Object format (underscore keys):
|
||||
|
||||
## Grid wiring tips
|
||||
|
||||
- **2x2 grid**: Use p1..p4.
|
||||
- **3x3 grid**: Use p1..p9.
|
||||
- **2x2 grid**: Use prompt 1..prompt 4.
|
||||
- **3x3 grid**: Use prompt 1..prompt 9.
|
||||
|
||||
Feed each prompt into the corresponding downstream node inputs.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user