chore: updates

This commit is contained in:
Tristan Yang
2023-09-26 18:02:15 +08:00
parent 3045f3add3
commit 531b021133
5 changed files with 18 additions and 8 deletions
+1
View File
@@ -461,6 +461,7 @@ export default function useStreaming() {
// 超过1天或者已断线,强制重连
if (canReconnect) {
// 设置重连状态
toast.dismiss();
toast.loading("Reconnecting...");
dispatch(updateSSEStatus("reconnecting"));
if (SSE) {
+1 -1
View File
@@ -61,7 +61,7 @@ const Session: FC<IProps> = ({ id, mid }) => {
<span
className={clsx(
`flex items-center gap-2 font-semibold text-sm text-gray-500 dark:text-white truncate`,
previewMsg.created_at && "max-w-[190px]"
previewMsg.created_at ? "max-w-[120px]" : "max-w-[190px]"
)}
>
{name}
+11 -2
View File
@@ -55,7 +55,7 @@ const SessionList: FC<Props> = ({ 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<Props> = ({ 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,