@ -80,7 +80,6 @@ from extensions.ext_database import db
from models . model import Conversation
from models . model import Conversation
from models . provider import Provider , ProviderType
from models . provider import Provider , ProviderType
from models . workflow import WorkflowNodeExecutionStatus
from models . workflow import WorkflowNodeExecutionStatus
from . entities import (
from . entities import (
LLMNodeChatModelMessage ,
LLMNodeChatModelMessage ,
LLMNodeCompletionModelPromptTemplate ,
LLMNodeCompletionModelPromptTemplate ,
@ -1234,17 +1233,20 @@ class LLMNode(BaseNode[LLMNodeData]):
self ,
self ,
contents : str | list [ PromptMessageContentUnionTypes ] | None ,
contents : str | list [ PromptMessageContentUnionTypes ] | None ,
) - > Generator [ str , None , None ] :
) - > Generator [ str , None , None ] :
""" Convert intermediate prompt messages to strings, and yield i t to the caller.
""" Convert intermediate prompt messages in to strings and yield them to the caller.
If there are contents other than ` TextPromptMessageContent ` , it will be saved and
If the messages contain non - textual content ( e . g . , multimedia like images or videos ) ,
correspond markdown content will be yielded to the caller .
it will be saved separately , and the corresponding Markdown representation will
be yielded to the caller .
"""
"""
# NOTE(QuantumGhost): This function should yield to the caller as soon as there is new
# NOTE(QuantumGhost): This function should yield results to the caller immediately
# content or new content part available. It should avoid intermediate buffering.
# whenever new content or partial content is available. Avoid any intermediate buffering
# It also should avoid yield empty string. (Yield from an empty list instead.)
# of results. Additionally, do not yield empty strings; instead, yield from an empty list
# if necessary.
if contents is None :
if contents is None :
yield from [ ]
yield from [ ]
return
if isinstance ( contents , str ) :
if isinstance ( contents , str ) :
yield contents
yield contents
elif isinstance ( contents , list ) :
elif isinstance ( contents , list ) :