Skip to content

Commit 11a5a93

Browse files
committed
fix: Loop node embedding sub application error
1 parent 52f420d commit 11a5a93

File tree

8 files changed

+19
-9
lines changed

8 files changed

+19
-9
lines changed

apps/application/flow/step_node/application_node/impl/base_application_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ def write_context_stream(node_variable: Dict, workflow_variable: Dict, node: INo
5555
# 先把流转成字符串
5656
response_content = chunk.decode('utf-8')[6:]
5757
response_content = json.loads(response_content)
58-
content = response_content.get('content', '')
58+
content = (response_content.get('content', '') or '')
5959
runtime_node_id = response_content.get('runtime_node_id', '')
6060
chat_record_id = response_content.get('chat_record_id', '')
6161
child_node = response_content.get('child_node')
6262
view_type = response_content.get('view_type')
6363
node_type = response_content.get('node_type')
6464
real_node_id = response_content.get('real_node_id')
6565
node_is_end = response_content.get('node_is_end', False)
66-
_reasoning_content = response_content.get('reasoning_content', '')
66+
_reasoning_content = (response_content.get('reasoning_content', '') or '')
6767
if node_type == 'form-node':
6868
is_interrupt_exec = True
6969
answer += content

apps/application/flow/step_node/loop_node/impl/base_loop_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def loop(workflow_manage_new_instance, node: INode, generate_loop):
159159
'runtime_node_id': runtime_node_id,
160160
'chat_record_id': chat_record_id,
161161
'child_node': child_node}
162-
content_chunk = chunk.get('content', '')
163-
reasoning_content_chunk = chunk.get('reasoning_content', '')
162+
content_chunk = (chunk.get('content', '') or '')
163+
reasoning_content_chunk = (chunk.get('reasoning_content', '') or '')
164164
reasoning_content += reasoning_content_chunk
165165
answer += content_chunk
166166
yield chunk

apps/application/flow/workflow_manage.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ def hand_event_node_result(self, current_node, node_result_future):
381381
child_node = {}
382382
node_is_end = False
383383
view_type = current_node.view_type
384+
node_type = current_node.type
384385
if isinstance(r, dict):
385386
content = r.get('content')
386387
child_node = {'runtime_node_id': r.get('runtime_node_id'),
@@ -390,14 +391,16 @@ def hand_event_node_result(self, current_node, node_result_future):
390391
real_node_id = r.get('real_node_id')
391392
if r.__contains__('node_is_end'):
392393
node_is_end = r.get('node_is_end')
394+
if r.__contains__('node_type'):
395+
node_type = r.get("node_type")
393396
view_type = r.get('view_type')
394397
reasoning_content = r.get('reasoning_content')
395398
chunk = self.base_to_response.to_stream_chunk_response(self.params['chat_id'],
396399
self.params['chat_record_id'],
397400
current_node.id,
398401
current_node.up_node_id_list,
399402
content, False, 0, 0,
400-
{'node_type': current_node.type,
403+
{'node_type': node_type,
401404
'runtime_node_id': runtime_node_id,
402405
'view_type': view_type,
403406
'child_node': child_node,

ui/src/workflow/common/app-node.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ class AppNodeModel extends HtmlResize.model {
383383
this.sourceRules.push({
384384
message: t('views.applicationWorkflow.tip.notRecyclable'),
385385
validate: (sourceNode: any, targetNode: any, sourceAnchor: any, targetAnchor: any) => {
386+
if (targetNode.id == sourceNode.id) {
387+
return false
388+
}
386389
const up_node_list = this.graphModel.getNodeIncomingNode(targetNode.id)
387390
const is_c = up_node_list.find((up_node) => up_node.id == sourceNode.id)
388391
return !is_c && !isLoop(sourceNode.id, targetNode.id)

ui/src/workflow/common/data.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,9 @@ export const loopBodyNode = {
466466
type: WorkflowType.LoopBodyNode,
467467
text: t('views.applicationWorkflow.nodes.loopBodyNode.text', '循环体'),
468468
label: t('views.applicationWorkflow.nodes.loopBodyNode.label', '循环体'),
469-
height: 600,
469+
height: 1080,
470470
properties: {
471-
width: 1800,
471+
width: 1920,
472472
stepName: t('views.applicationWorkflow.nodes.loopBodyNode.label', '循环体'),
473473
config: {
474474
fields: [],
@@ -550,11 +550,14 @@ export const applicationLoopMenuNodes = [
550550
label: t('views.applicationWorkflow.nodes.classify.aiCapability'),
551551
list: [
552552
aiChatNode,
553+
intentNode,
553554
questionNode,
554555
imageGenerateNode,
555556
imageUnderstandNode,
556557
textToSpeechNode,
557558
speechToTextNode,
559+
textToVideoNode,
560+
imageToVideoNode,
558561
],
559562
},
560563
{ label: t('views.knowledge.title'), list: [searchKnowledgeNode, rerankerNode] },

ui/src/workflow/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const renderGraphData = (data?: any) => {
8585
AppEdge,
8686
loopEdge,
8787
])
88+
8889
lf.value.setDefaultEdgeType('app-edge')
8990
9091
lf.value.render(data ? data : {})

ui/src/workflow/nodes/loop-body-node/LoopBodyContainer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
>
88
<div v-resize="resizeStepContainer">
99
<div class="flex-between">
10-
<div class="flex align-center" style="width: 600px">
10+
<div class="flex align-center">
1111
<component
1212
:is="iconComponent(`${nodeModel.type}-icon`)"
1313
class="mr-8"

ui/src/workflow/nodes/loop-body-node/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<LoopBodyContainer :nodeModel="nodeModel">
3-
<div ref="containerRef" @wheel.stop style="height: 550px"></div>
3+
<div ref="containerRef" @wheel.stop style="height: 600px"></div>
44
</LoopBodyContainer>
55
</template>
66
<script setup lang="ts">

0 commit comments

Comments
 (0)