Skip to content

Commit 506b8f2

Browse files
fix: Fix intent-node execution details not displaying user input
1 parent 36502be commit 506b8f2

7 files changed

Lines changed: 27 additions & 24 deletions

File tree

apps/application/flow/common.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
from models_provider.tools import get_model_credential
2020
from tools.models.tool import Tool
2121

22-
end_nodes = ['ai-chat-node', 'reply-node', 'function-node', 'function-lib-node', 'application-node',
23-
'image-understand-node', 'speech-to-text-node', 'text-to-speech-node', 'image-generate-node',
24-
'variable-assign-node']
22+
END_NODES = frozenset([
23+
'ai-chat-node', 'reply-node', 'function-node', 'function-lib-node', 'application-node',
24+
'image-understand-node', 'speech-to-text-node', 'text-to-speech-node', 'image-generate-node',
25+
'variable-assign-node'
26+
])
2527

2628

2729
class Answer:
@@ -226,7 +228,7 @@ def is_valid_node(self, node: Node):
226228

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

apps/application/flow/compare/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from .start_with import StartWithCompare
3131
from .wildcard_compare import WildcardCompare
3232

33+
from common.utils.logger import maxkb_logger
34+
3335
_compare_handler_dict = {
3436
'is_null': IsNullCompare(),
3537
'is_not_null': IsNotNullCompare(),
@@ -65,13 +67,13 @@ def _compare(source_value, compare, target_value):
6567
def _assertion(workflow_manage, field_list: List[str], compare: str, value):
6668
try:
6769
value = workflow_manage.generate_prompt(value)
68-
except Exception:
69-
pass
70+
except Exception as e:
71+
maxkb_logger.debug(f"Failed to generate field value for comparison: {e}")
7072
field_value = None
7173
try:
7274
field_value = workflow_manage.get_reference_field(field_list[0], field_list[1:])
73-
except Exception:
74-
pass
75+
except Exception as e:
76+
maxkb_logger.debug(f"Failed to get reference field for comparison: {e}")
7577
return _compare(field_value, compare, value)
7678

7779

apps/chat/serializers/chat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ def get_chat_record(chat_info, chat_record_id):
385385
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id, chat_id=chat_info.chat_id).first()
386386
if chat_record is None:
387387
raise ChatException(500, _("Conversation record does not exist"))
388-
389388
return chat_record
390389
chat_record = QuerySet(ChatRecord).filter(id=chat_record_id).first()
391390
return chat_record

ui/src/components/execution-detail-card/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@
312312
{{ $t('aiChat.executionDetails.currentChat') }}
313313
</h5>
314314
<div class="p-8-12 border-t-dashed lighter pre-wrap">
315-
{{ data.question || '-' }}
315+
{{ data.question || data.user_input || '-' }}
316316
</div>
317317
</div>
318318
<div class="card-never border-r-6 mt-8">

ui/src/locales/lang/en-US/workflow.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ export default {
215215
systemDefault: `#Role
216216
You are a master of problem optimization, adept at accurately inferring user intentions based on context and optimizing the questions raised by users.
217217
218-
##Skills
219-
###Skill 1: Optimizing Problems
220-
2. Receive user input questions.
221-
3. Carefully analyze the meaning of the problem based on the context.
222-
4. Output optimized problems.
218+
## Skills
219+
### Skill 1: Optimizing Problems
220+
1. Receive user input questions.
221+
2. Carefully analyze the meaning of the problem based on the context.
222+
3. Output optimized problems.
223223
224-
##Limitations:
225-
-Only return the optimized problem without any additional explanation or clarification.
226-
-Ensure that the optimized problem accurately reflects the original problem intent and does not alter the original intention.`,
224+
## Limitations:
225+
- Only return the optimized problem without any additional explanation or clarification.
226+
- Ensure that the optimized problem accurately reflects the original problem intent and does not alter the original intention.`,
227227
},
228228
conditionNode: {
229229
label: 'Conditional Branch',

ui/src/locales/lang/zh-CN/workflow.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ export default {
217217
218218
## 技能
219219
### 技能 1: 优化问题
220-
2. 接收用户输入的问题。
221-
3. 依据上下文仔细分析问题含义。
222-
4. 输出优化后的问题。
220+
1. 接收用户输入的问题。
221+
2. 依据上下文仔细分析问题含义。
222+
3. 输出优化后的问题。
223223
224224
## 限制:
225225
- 仅返回优化后的问题,不进行额外解释或说明。

ui/src/locales/lang/zh-Hant/workflow.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ export default {
217217
218218
## 技能
219219
### 技能 1: 優化問題
220-
2. 接收用戶輸入的問題。
221-
3. 依據上下文仔細分析問題含義。
222-
4. 輸出優化後的問題。
220+
1. 接收用戶輸入的問題。
221+
2. 依據上下文仔細分析問題含義。
222+
3. 輸出優化後的問題。
223223
224224
## 限制:
225225
- 僅返回優化後的問題,不進行額外解釋或說明。

0 commit comments

Comments
 (0)