Skip to content

Commit e85f78f

Browse files
committed
add prompt strings as output from all nodes, not just prompt additions
1 parent be04c77 commit e85f78f

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/prompt_companion_node.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ def INPUT_TYPES(cls) -> Dict[str, Any]:
5555
}
5656
}
5757

58-
RETURN_TYPES = ("PROMPT_ADDITION",)
58+
RETURN_TYPES = ("PROMPT_ADDITION", "STRING", "STRING")
59+
RETURN_NAMES = ("prompt_addition", "positive_prompt", "negative_prompt")
60+
OUTPUT_TOOLTIPS = ("Prompt addition data that can be connected to other nodes", "Positive prompt text", "Negative prompt text")
5961
FUNCTION = "create_prompt_addition"
6062
CATEGORY = "jfc"
6163

62-
def create_prompt_addition(self, combine_mode: str, positive_prompt_addition: str, negative_prompt_addition: str, prompt_addition: Optional['PromptAdditionInput'] = None) -> Tuple['PromptAdditionInput']:
64+
def create_prompt_addition(self, combine_mode: str, positive_prompt_addition: str, negative_prompt_addition: str, prompt_addition: Optional['PromptAdditionInput'] = None) -> Tuple['PromptAdditionInput', str, str]:
6365
# Get the input values
6466
input_positive = ""
6567
input_negative = ""
@@ -103,7 +105,7 @@ def create_prompt_addition(self, combine_mode: str, positive_prompt_addition: st
103105
elif input_negative:
104106
final_negative = input_negative
105107

106-
return (PromptAdditionInput(final_positive, final_negative),)
108+
return (PromptAdditionInput(final_positive, final_negative), final_positive, final_negative)
107109

108110

109111
class PromptCompanion:
@@ -528,9 +530,9 @@ class PromptCompanionSingleAddition:
528530
"""
529531

530532
# ComfyUI node metadata
531-
RETURN_TYPES = ("PROMPT_ADDITION",)
532-
RETURN_NAMES = ("prompt_addition",)
533-
OUTPUT_TOOLTIPS = ("Prompt addition data that can be connected to other nodes",)
533+
RETURN_TYPES = ("PROMPT_ADDITION", "STRING", "STRING")
534+
RETURN_NAMES = ("prompt_addition", "positive_prompt", "negative_prompt")
535+
OUTPUT_TOOLTIPS = ("Prompt addition data that can be connected to other nodes", "Positive prompt text", "Negative prompt text")
534536
FUNCTION = "apply_single_addition"
535537
CATEGORY = "jfc"
536538

@@ -570,7 +572,7 @@ def apply_single_addition(
570572
combine_mode: str,
571573
prompt_addition_name: str,
572574
prompt_addition: Optional[PromptAdditionInput] = None,
573-
) -> Tuple['PromptAdditionInput']:
575+
) -> Tuple['PromptAdditionInput', str, str]:
574576
"""Apply the selected prompt addition with optional input combination."""
575577

576578
# Get the selected addition
@@ -627,7 +629,7 @@ def apply_single_addition(
627629
elif input_negative:
628630
final_negative = input_negative
629631

630-
return (PromptAdditionInput(final_positive, final_negative),)
632+
return (PromptAdditionInput(final_positive, final_negative), final_positive, final_negative)
631633

632634

633635
class PromptCompanionPromptGroup:
@@ -638,9 +640,9 @@ class PromptCompanionPromptGroup:
638640
"""
639641

640642
# ComfyUI node metadata
641-
RETURN_TYPES = ("PROMPT_ADDITION",)
642-
RETURN_NAMES = ("prompt_addition",)
643-
OUTPUT_TOOLTIPS = ("Prompt addition data that can be connected to other nodes",)
643+
RETURN_TYPES = ("PROMPT_ADDITION", "STRING", "STRING")
644+
RETURN_NAMES = ("prompt_addition", "positive_prompt", "negative_prompt")
645+
OUTPUT_TOOLTIPS = ("Prompt addition data that can be connected to other nodes", "Positive prompt text", "Negative prompt text")
644646
FUNCTION = "apply_prompt_group"
645647
CATEGORY = "jfc"
646648

@@ -680,7 +682,7 @@ def apply_prompt_group(
680682
combine_mode: str,
681683
prompt_addition_group: str,
682684
prompt_addition: Optional[PromptAdditionInput] = None,
683-
) -> Tuple['PromptAdditionInput']:
685+
) -> Tuple['PromptAdditionInput', str, str]:
684686
"""Apply the selected prompt group with optional input combination."""
685687

686688
# Get the group additions
@@ -742,7 +744,7 @@ def apply_prompt_group(
742744
elif input_negative:
743745
final_negative = input_negative
744746

745-
return (PromptAdditionInput(final_positive, final_negative),)
747+
return (PromptAdditionInput(final_positive, final_negative), final_positive, final_negative)
746748

747749
def _collect_group_additions(self, groups) -> Tuple[List[str], List[str]]:
748750
"""Collect all prompt additions from the given groups."""
@@ -948,9 +950,9 @@ class PromptCompanionStringsToAddition:
948950
"""
949951

950952
# ComfyUI node metadata
951-
RETURN_TYPES = ("PROMPT_ADDITION",)
952-
RETURN_NAMES = ("prompt_addition",)
953-
OUTPUT_TOOLTIPS = ("Prompt addition created from the input strings",)
953+
RETURN_TYPES = ("PROMPT_ADDITION", "STRING", "STRING")
954+
RETURN_NAMES = ("prompt_addition", "positive_prompt", "negative_prompt")
955+
OUTPUT_TOOLTIPS = ("Prompt addition created from the input strings", "Positive prompt text", "Negative prompt text")
954956
FUNCTION = "strings_to_addition"
955957
CATEGORY = "jfc"
956958

@@ -982,9 +984,9 @@ def strings_to_addition(
982984
self,
983985
positive_prompt: str,
984986
negative_prompt: str,
985-
) -> Tuple['PromptAdditionInput']:
987+
) -> Tuple['PromptAdditionInput', str, str]:
986988
"""Convert positive and negative strings to a prompt addition."""
987-
return (PromptAdditionInput(positive_prompt, negative_prompt),)
989+
return (PromptAdditionInput(positive_prompt, negative_prompt), positive_prompt, negative_prompt)
988990

989991

990992
class PromptCompanionAdditionToStrings:

0 commit comments

Comments
 (0)