From 0b92f02672098fc09dfe21e95ea47194ad7076bf Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 11 Jun 2024 11:58:49 +0800 Subject: [PATCH] feat: generate uuid with human-id #918 (#1111) ### What problem does this PR solve? feat: generate uuid with human-id #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/package-lock.json | 9 +++++++++ web/package.json | 1 + web/src/pages/flow/chat/drawer.tsx | 2 +- web/src/pages/flow/hooks.ts | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index b1e23daf9..8c68f4eeb 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -19,6 +19,7 @@ "dayjs": "^1.11.10", "elkjs": "^0.9.3", "eventsource-parser": "^1.1.2", + "human-id": "^4.1.1", "i18next": "^23.7.16", "i18next-browser-languagedetector": "^8.0.0", "js-base64": "^3.7.5", @@ -13379,6 +13380,14 @@ "node": ">= 6" } }, + "node_modules/human-id": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/human-id/-/human-id-4.1.1.tgz", + "integrity": "sha512-3gKm/gCSUipeLsRYZbbdA1BD83lBoWUkZ7G9VFrhWPAU76KwYo5KR8V28bpoPm/ygy0x5/GCbpRQdY7VLYCoIg==", + "bin": { + "human-id": "dist/cli.js" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/human-signals/-/human-signals-2.1.0.tgz", diff --git a/web/package.json b/web/package.json index ac594303c..e8d38dcc3 100644 --- a/web/package.json +++ b/web/package.json @@ -24,6 +24,7 @@ "dayjs": "^1.11.10", "elkjs": "^0.9.3", "eventsource-parser": "^1.1.2", + "human-id": "^4.1.1", "i18next": "^23.7.16", "i18next-browser-languagedetector": "^8.0.0", "js-base64": "^3.7.5", diff --git a/web/src/pages/flow/chat/drawer.tsx b/web/src/pages/flow/chat/drawer.tsx index 31923486d..599d7a311 100644 --- a/web/src/pages/flow/chat/drawer.tsx +++ b/web/src/pages/flow/chat/drawer.tsx @@ -11,7 +11,7 @@ const ChatDrawer = ({ visible, hideModal }: IModalProps) => { open={visible} getContainer={false} width={470} - zIndex={10000} + // zIndex={10000} > diff --git a/web/src/pages/flow/hooks.ts b/web/src/pages/flow/hooks.ts index 39e2f66c7..5cf023ca8 100644 --- a/web/src/pages/flow/hooks.ts +++ b/web/src/pages/flow/hooks.ts @@ -15,9 +15,9 @@ import React, { useState, } from 'react'; import { Node, Position, ReactFlowInstance } from 'reactflow'; -import { v4 as uuidv4 } from 'uuid'; // import { shallow } from 'zustand/shallow'; import { useDebounceEffect } from 'ahooks'; +import { humanId } from 'human-id'; import { useParams } from 'umi'; import useGraphStore, { RFState } from './store'; import { buildDslComponentsByGraph } from './utils'; @@ -79,7 +79,7 @@ export const useHandleDrop = () => { y: event.clientY, }); const newNode = { - id: uuidv4(), + id: `${type}:${humanId()}`, type: 'textUpdater', position: position || { x: 0,