Skip to content

Commit 6d5ef63

Browse files
committed
refactor: optimize HumanMessage content generation by simplifying prompt handling
1 parent 4f95022 commit 6d5ef63

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from common.exception.app_exception import AppApiException
1818
from common.utils.common import guess_image_format
19-
from common.utils.logger import maxkb_logger
2019
from common.utils.rsa_util import rsa_long_decrypt
2120
from common.utils.shared_resource_auth import filter_authorized_ids
2221
from common.utils.tool_code import ToolExecutor
@@ -512,9 +511,10 @@ def generate_prompt_question(self, prompt, model):
512511
images = self._process_images(image)
513512
if video and vision:
514513
videos = self._process_videos(video, model)
515-
return HumanMessage(
516-
content=[*videos, *images, {"type": "text", "text": self.workflow_manage.generate_prompt(prompt)}]
517-
)
514+
prompt = self.workflow_manage.generate_prompt(prompt)
515+
if images or videos:
516+
return HumanMessage(content=[*videos, *images, {"type": "text", "text": prompt}])
517+
return HumanMessage(content=prompt)
518518

519519
def is_vision(self):
520520
if "vision" in self.node_params_serializer.data:

0 commit comments

Comments
 (0)