Skip to content

Commit

Permalink
fix version
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk committed Sep 12, 2024
1 parent 93d744a commit 521863e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const AppCard = ({
isPublished: boolean;
}) => {
const { t } = useTranslation();
const { appT } = useI18n();
const { feConfigs } = useSystemStore();

const { appDetail, onOpenInfoEdit, onOpenTeamTagModal, onDelApp, currentTab } =
Expand All @@ -48,7 +47,7 @@ const AppCard = ({
children: [
{
icon: 'edit',
label: appT('edit_info'),
label: t('app:edit_info'),
onClick: onOpenInfoEdit
},
{
Expand All @@ -63,7 +62,7 @@ const AppCard = ({
{
children: [
{
label: appT('import_configs'),
label: t('app:import_configs'),
icon: 'common/importLight',
onClick: onOpenImport
},
Expand Down Expand Up @@ -117,7 +116,6 @@ const AppCard = ({
appDetail.name,
appDetail.permission.hasWritePer,
appDetail.permission.isOwner,
appT,
currentTab,
feConfigs?.show_team_chat,
historiesDefaultData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export const useWorkflow = () => {
return handleRemoveNode(change, changes, node);
}
} else if (change.type === 'select') {
return handleSelectNode(change);
return handleSelectNode(change, changes);
} else if (change.type === 'position') {
const node = nodes.find((n) => n.id === change.id);
if (node) {
Expand Down Expand Up @@ -434,9 +434,14 @@ export const useWorkflow = () => {
}
};

const handleSelectNode = (change: NodeSelectionChange) => {
const handleSelectNode = (change: NodeSelectionChange, changes: NodeChange[]) => {
if (change.selected === false && isDowningCtrl) {
change.selected = true;
} else {
return (() => {
customApplyNodeChanges(changes, nodes);
onNodesChange(changes);
})();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,13 @@ const WorkflowContextProvider = ({
return resetSnapshot(past[0]);
}

setNodes(e.nodes?.map((item) => storeNode2FlowNode({ item, t })) || []);
setNodes(
e.nodes?.map((item) =>
item.flowNodeType === FlowNodeTypeEnum.loop
? storeNode2FlowNode({ item, t, zIndex: -1001 })
: storeNode2FlowNode({ item, t })
) || []
);
setEdges(e.edges?.map((item) => storeEdgesRenderEdge({ edge: item })) || []);

const chatConfig = e.chatConfig;
Expand All @@ -583,7 +589,12 @@ const WorkflowContextProvider = ({
// If it is the initial data, save the initial snapshot
if (isInit) {
saveSnapshot({
pastNodes: e.nodes?.map((item) => storeNode2FlowNode({ item, t })) || [],
pastNodes:
e.nodes?.map((item) =>
item.flowNodeType === FlowNodeTypeEnum.loop
? storeNode2FlowNode({ item, t, zIndex: -1001 })
: storeNode2FlowNode({ item, t })
) || [],
pastEdges: e.edges?.map((item) => storeEdgesRenderEdge({ edge: item })) || [],
customTitle: t(`app:app.version_initial`),
chatConfig: appDetail.chatConfig,
Expand Down Expand Up @@ -612,7 +623,6 @@ const WorkflowContextProvider = ({

const flowData2StoreData = useMemoizedFn(() => {
const storeNodes = uiWorkflow2StoreWorkflow({ nodes, edges });

return storeNodes;
});

Expand Down Expand Up @@ -878,6 +888,7 @@ const WorkflowContextProvider = ({
);

if (isPastEqual) return false;
console.log(currentNodes);

setPast((past) => [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const uiWorkflow2StoreWorkflow = ({
version: item.data.version,
inputs: item.data.inputs,
outputs: item.data.outputs,
pluginId: item.data.pluginId
pluginId: item.data.pluginId,
parentNodeId: item.data.parentNodeId
}));

// get all handle
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/web/core/workflow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ export const storeNode2FlowNode = ({

// replace item data
const nodeItem: FlowNodeItemType = {
parentNodeId,
...template,
...storeNode,
avatar: template.avatar ?? storeNode.avatar,
version: storeNode.version ?? template.version ?? defaultNodeVersion,
parentNodeId,
/*
Inputs and outputs, New fields are added, not reduced
*/
Expand Down

0 comments on commit 521863e

Please sign in to comment.