Skip to content

Commit 1f7ae78

Browse files
committed
feat: Execution details support loading status
1 parent 757cff4 commit 1f7ae78

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

apps/application/flow/knowledge_workflow_manage.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,23 @@ def _run(self):
5454
pass
5555
self.work_flow_post_handler.handler(self)
5656

57+
@staticmethod
58+
def get_node_details(current_node, node, index):
59+
if current_node == node:
60+
return {
61+
'name': node.node.properties.get('stepName'),
62+
"index": index,
63+
'run_time': 0,
64+
'type': node.type,
65+
'status': 202,
66+
'err_message': ""
67+
}
68+
69+
return node.get_details(index)
70+
5771
def run_chain(self, current_node, node_result_future=None):
72+
QuerySet(KnowledgeAction).filter(id=self.params.get('knowledge_action_id')).update(
73+
details=self.get_runtime_details(lambda node, index: self.get_node_details(current_node, node, index)))
5874
if node_result_future is None:
5975
node_result_future = self.run_node_future(current_node)
6076
try:

apps/application/flow/workflow_manage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ def has_next_node(self, node_result: NodeResult | None):
544544
return self._has_next_node(self.get_start_node() if self.current_node is None else self.current_node,
545545
node_result)
546546

547-
def get_runtime_details(self):
547+
def get_runtime_details(self, get_details=lambda n, index: n.get_details(index)):
548548
details_result = {}
549549
for index in range(len(self.node_context)):
550550
node = self.node_context[index]
@@ -553,7 +553,7 @@ def get_runtime_details(self):
553553
if details is not None and self.start_node.runtime_node_id != node.runtime_node_id:
554554
details_result[node.runtime_node_id] = details
555555
continue
556-
details = node.get_details(index)
556+
details = get_details(node, index)
557557
details['node_id'] = node.id
558558
details['up_node_id_list'] = node.up_node_id_list
559559
details['runtime_node_id'] = node.runtime_node_id

ui/src/components/ai-chat/component/knowledge-source-component/ExecutionDetailCard.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@
2727
"
2828
>{{ data?.message_tokens + data?.answer_tokens }} tokens</span
2929
>
30-
<span class="mr-16 color-secondary">{{ data?.run_time?.toFixed(2) || 0.0 }} s</span>
30+
<span class="mr-16 color-secondary" v-if="data.status != 202"
31+
>{{ data?.run_time?.toFixed(2) || 0.0 }} s</span
32+
>
3133
<el-icon class="color-success" :size="16" v-if="data.status === 200">
3234
<CircleCheck />
3335
</el-icon>
36+
<el-icon class="is-loading" :size="16" v-else-if="data.status === 202">
37+
<Loading />
38+
</el-icon>
3439
<el-icon class="color-danger" :size="16" v-else>
3540
<CircleClose />
3641
</el-icon>
@@ -896,11 +901,12 @@
896901
:key="groupI"
897902
>
898903
<h5 class="p-8-12">
899-
{{ group.label+ ' '+ $t('common.param.inputParam') }}
904+
{{ group.label + ' ' + $t('common.param.inputParam') }}
900905
</h5>
901906
<div class="p-8-12 border-t-dashed lighter">
902907
<div v-for="(f, i) in group.variable_list" :key="i" class="mb-8">
903-
<span class="color-secondary">{{ `${f.node_name}.${f.field}` }}:</span> {{ f.value }}
908+
<span class="color-secondary">{{ `${f.node_name}.${f.field}` }}:</span>
909+
{{ f.value }}
904910
</div>
905911
</div>
906912
</div>

0 commit comments

Comments
 (0)