Skip to content

Commit

Permalink
perf: published check
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Jul 4, 2024
1 parent 9daa3cf commit a740bde
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
3 changes: 1 addition & 2 deletions projects/app/src/service/core/dataset/data/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export async function insertData2Dataset({
session?: ClientSession;
}) {
if (!q || !datasetId || !collectionId || !model) {
console.log(q, a, datasetId, collectionId, model);
return Promise.reject('q, datasetId, collectionId, model is required');
}
if (String(teamId) === String(tmbId)) {
Expand Down Expand Up @@ -140,7 +139,7 @@ export async function updateData2Dataset({
formatIndexes.unshift(defaultIndex ? defaultIndex : getDefaultIndex({ q, a }));
}
formatIndexes = formatIndexes.slice(0, 6);
console.log(formatIndexes);

// patch indexes, create, update, delete
const patchResult: PatchIndexesProps[] = [];

Expand Down
69 changes: 37 additions & 32 deletions projects/app/src/web/core/workflow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,41 +441,46 @@ export const compareWorkflow = (workflow1: WorkflowType, workflow2: WorkflowType
return false;
}

const node1 = clone1.nodes.filter(Boolean).map((node) => ({
flowNodeType: node.flowNodeType,
inputs: node.inputs.map((input) => ({
...input,
value: input.value ?? undefined
})),
outputs: node.outputs.map((input) => ({
...input,
value: input.value ?? undefined
})),
name: node.name,
intro: node.intro,
avatar: node.avatar,
version: node.version,
position: node.position
}));
const node2 = clone2.nodes.filter(Boolean).map((node) => ({
flowNodeType: node.flowNodeType,
inputs: node.inputs.map((input) => ({
...input,
value: input.value ?? undefined
})),
outputs: node.outputs.map((input) => ({
...input,
value: input.value ?? undefined
})),
name: node.name,
intro: node.intro,
avatar: node.avatar,
version: node.version,
position: node.position
}));
const formatNodes = (nodes: StoreNodeItemType[]) => {
return nodes
.filter((node) => {
if (!node) return;
if ([FlowNodeTypeEnum.systemConfig].includes(node.flowNodeType)) return;

return true;
})
.map((node) => ({
flowNodeType: node.flowNodeType,
inputs: node.inputs.map((input) => ({
key: input.key,
selectedTypeIndex: input.selectedTypeIndex ?? 0,
renderTypeLis: input.renderTypeList,
valueType: input.valueType,
value: input.value ?? undefined
})),
outputs: node.outputs.map((item) => ({
key: item.key,
type: item.type,
value: item.value ?? undefined
})),
name: node.name,
intro: node.intro,
avatar: node.avatar,
version: node.version,
position: node.position
}));
};
const node1 = formatNodes(clone1.nodes);
const node2 = formatNodes(clone2.nodes);

// console.log(node1);
// console.log(node2);

node1.forEach((node, i) => {
if (!isEqual(node, node2[i])) {
console.log('node not equal');
}
});

return isEqual(node1, node2);
};

0 comments on commit a740bde

Please sign in to comment.