Commit fb6be9fc by John Chen Committed by GitHub

fix(workflow): 修复插件节点合并时 selectedTypeIndex 与 renderTypeList 错配导致输入框消失 (#7378)

* fix:修复升级到 V4.15.x 后,部分早期创建的插件节点(节点级 version 为空)在工作流编辑器中输入框完全消失

* test(app): update workflow detail reference type expectation

---------

Co-authored-by: Finley Ge <finleyge@fastgpt.io>
parent 14b55f5a
...@@ -203,7 +203,9 @@ export async function rewriteAppWorkflowToDetail({ ...@@ -203,7 +203,9 @@ export async function rewriteAppWorkflowToDetail({
const selectedRenderType = const selectedRenderType =
input?.renderTypeList?.[input?.selectedTypeIndex ?? 0] ?? item.renderTypeList?.[0]; input?.renderTypeList?.[input?.selectedTypeIndex ?? 0] ?? item.renderTypeList?.[0];
const selectedTypeIndex = selectedRenderType const selectedTypeIndex = selectedRenderType
? item.renderTypeList.findIndex((renderType) => renderType === selectedRenderType) ? (input?.renderTypeList ?? item.renderTypeList).findIndex(
(renderType) => renderType === selectedRenderType
)
: -1; : -1;
return { return {
......
...@@ -123,7 +123,7 @@ describe('rewriteAppWorkflowToDetail - agent skills', () => { ...@@ -123,7 +123,7 @@ describe('rewriteAppWorkflowToDetail - agent skills', () => {
]); ]);
}); });
it('刷新最新工具节点时使用新 renderTypeList,并保留旧节点选中的引用类型', async () => { it('刷新最新工具节点时保留旧节点选中的引用类型', async () => {
getClientToolPreviewNodeMock.mockResolvedValue({ getClientToolPreviewNodeMock.mockResolvedValue({
id: 'mcp-app-1/tool', id: 'mcp-app-1/tool',
flowNodeType: FlowNodeTypeEnum.tool, flowNodeType: FlowNodeTypeEnum.tool,
...@@ -168,8 +168,8 @@ describe('rewriteAppWorkflowToDetail - agent skills', () => { ...@@ -168,8 +168,8 @@ describe('rewriteAppWorkflowToDetail - agent skills', () => {
label: 'Size', label: 'Size',
valueType: WorkflowIOValueTypeEnum.number, valueType: WorkflowIOValueTypeEnum.number,
value: ['start', 'amount'], value: ['start', 'amount'],
selectedTypeIndex: 1, selectedTypeIndex: 0,
renderTypeList: [FlowNodeInputTypeEnum.select, FlowNodeInputTypeEnum.reference] renderTypeList: [FlowNodeInputTypeEnum.reference]
} }
], ],
outputs: [] outputs: []
...@@ -186,8 +186,8 @@ describe('rewriteAppWorkflowToDetail - agent skills', () => { ...@@ -186,8 +186,8 @@ describe('rewriteAppWorkflowToDetail - agent skills', () => {
expect(nodes[0].inputs[0]).toMatchObject({ expect(nodes[0].inputs[0]).toMatchObject({
key: 'size', key: 'size',
value: ['start', 'amount'], value: ['start', 'amount'],
selectedTypeIndex: 1, selectedTypeIndex: 0,
renderTypeList: [FlowNodeInputTypeEnum.select, FlowNodeInputTypeEnum.reference], renderTypeList: [FlowNodeInputTypeEnum.reference],
list: [ list: [
{ label: '1', value: '1' }, { label: '1', value: '1' },
{ label: '2', value: '2' } { label: '2', value: '2' }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment