Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions apps/application/flow/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
from models_provider.tools import get_model_credential
from tools.models.tool import Tool

end_nodes = ['ai-chat-node', 'reply-node', 'function-node', 'function-lib-node', 'application-node',
'image-understand-node', 'speech-to-text-node', 'text-to-speech-node', 'image-generate-node',
'variable-assign-node']
END_NODES = frozenset([
'ai-chat-node', 'reply-node', 'function-node', 'function-lib-node', 'application-node',
'image-understand-node', 'speech-to-text-node', 'text-to-speech-node', 'image-generate-node',
'variable-assign-node'
])


class Answer:
Expand Down Expand Up @@ -219,14 +221,14 @@ def is_valid_node(self, node: Node):
for branch in branch_list:
source_anchor_id = f"{node.id}_{branch.get('id')}_right"
edge_list = [edge for edge in self.edges if edge.sourceAnchorId == source_anchor_id]
if len(edge_list) == 0:
if not edge_list:
raise AppApiException(500,
_('The branch {branch} of the {node} node needs to be connected').format(
node=node.properties.get("stepName"), branch=branch.get("type")))

else:
edge_list = [edge for edge in self.edges if edge.sourceNodeId == node.id]
if len(edge_list) == 0 and not end_nodes.__contains__(node.type):
if not edge_list and node.type not in END_NODES:
raise AppApiException(500, _("{node} Nodes cannot be considered as end nodes").format(
node=node.properties.get("stepName")))

Expand Down
10 changes: 6 additions & 4 deletions apps/application/flow/compare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from .start_with import StartWithCompare
from .wildcard_compare import WildcardCompare

from common.utils.logger import maxkb_logger

_compare_handler_dict = {
'is_null': IsNullCompare(),
'is_not_null': IsNotNullCompare(),
Expand Down Expand Up @@ -65,13 +67,13 @@ def _compare(source_value, compare, target_value):
def _assertion(workflow_manage, field_list: List[str], compare: str, value):
try:
value = workflow_manage.generate_prompt(value)
except Exception:
pass
except Exception as e:
maxkb_logger.debug(f"Failed to generate field value for comparison: {e}")
field_value = None
try:
field_value = workflow_manage.get_reference_field(field_list[0], field_list[1:])
except Exception:
pass
except Exception as e:
maxkb_logger.debug(f"Failed to get reference field for comparison: {e}")
return _compare(field_value, compare, value)


Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/execution-detail-card/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
{{ $t('aiChat.executionDetails.currentChat') }}
</h5>
<div class="p-8-12 border-t-dashed lighter pre-wrap">
{{ data.question || '-' }}
{{ data.question || data.user_input || '-' }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

意图识别 节点的用户输入为 data.user_input,不是 data.question

</div>
</div>
<div class="card-never border-r-6 mt-8">
Expand Down
Loading