diff --git a/package.json b/package.json index 6bf0105f..0e6218ac 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "@types/emoji-mart": "^3.0.10", "@types/masonry-layout": "^4.2.5", "@types/node": "^20.7.0", - "@types/react": "^18.2.22", + "@types/react": "18.2.21", "@types/react-dom": "^18.2.7", "@types/react-helmet": "^6.1.6", "@types/react-syntax-highlighter": "^15.5.7", diff --git a/src/hooks/useStreaming/index.ts b/src/hooks/useStreaming/index.ts index 09d2725d..3fd05040 100644 --- a/src/hooks/useStreaming/index.ts +++ b/src/hooks/useStreaming/index.ts @@ -461,6 +461,7 @@ export default function useStreaming() { // 超过1天或者已断线,强制重连 if (canReconnect) { // 设置重连状态 + toast.dismiss(); toast.loading("Reconnecting..."); dispatch(updateSSEStatus("reconnecting")); if (SSE) { diff --git a/src/routes/chat/GuestSessionList/Session.tsx b/src/routes/chat/GuestSessionList/Session.tsx index eb011586..439d4167 100644 --- a/src/routes/chat/GuestSessionList/Session.tsx +++ b/src/routes/chat/GuestSessionList/Session.tsx @@ -61,7 +61,7 @@ const Session: FC = ({ id, mid }) => { {name} diff --git a/src/routes/chat/SessionList/index.tsx b/src/routes/chat/SessionList/index.tsx index 57bc6963..1b269fcc 100644 --- a/src/routes/chat/SessionList/index.tsx +++ b/src/routes/chat/SessionList/index.tsx @@ -55,7 +55,7 @@ const SessionList: FC = ({ tempSession }) => { } return null; }) - .filter((p) => !!p); + .filter((p) => !!p) as ChatSession[]; const channelPinIds = pins .map((p) => { if (p.target.gid) { @@ -94,7 +94,16 @@ const SessionList: FC = ({ tempSession }) => { // console.log("before qqqq", temps); const newSessions = tempSession ? [tempSession, ...temps] : temps; // console.log("qqqq", newSessions); - setSessions(newSessions); + // 去重 + setSessions( + newSessions.filter((s, idx) => { + const { id, type } = s; + const index = newSessions.findIndex((s) => { + return s.id == id && s.type == type; + }); + return index === idx; + }) + ); setPinSessions(pinTmps); }, [ channelIDs, diff --git a/yarn.lock b/yarn.lock index ecd93cac..7ed8a4ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2569,10 +2569,10 @@ "@types/scheduler" "*" csstype "^3.0.2" -"@types/react@^18.2.22": - version "18.2.22" - resolved "https://mirrors.cloud.tencent.com/npm/@types/react/-/react-18.2.22.tgz#abe778a1c95a07fa70df40a52d7300a40b949ccb" - integrity sha512-60fLTOLqzarLED2O3UQImc/lsNRgG0jE/a1mPW9KjMemY0LMITWEsbS4VvZ4p6rorEHd5YKxxmMKSDK505GHpA== +"@types/react@18.2.21": + version "18.2.21" + resolved "https://mirrors.cloud.tencent.com/npm/@types/react/-/react-18.2.21.tgz#774c37fd01b522d0b91aed04811b58e4e0514ed9" + integrity sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA== dependencies: "@types/prop-types" "*" "@types/scheduler" "*"