Skip to content

Commit 7dfa416

Browse files
committed
fix: Some type error
1 parent 5cb9810 commit 7dfa416

6 files changed

Lines changed: 33 additions & 10 deletions

File tree

  • src
    • app/[variants]/(main)/chat/@session/features/SessionListContent/List/Item
    • database/_deprecated/core
    • features
    • server/routers/lambda

src/app/[variants]/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,16 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
9090
name: userProfileSelectors.displayUserName(s) || userProfileSelectors.nickName(s) || 'You',
9191
}));
9292

93-
const sessionAvatar =
93+
const sessionAvatar: string | { avatar: string; background?: string }[] =
9494
sessionType === 'group'
9595
? [
9696
{
97-
avatar: currentUser.avatar,
97+
avatar: currentUser.avatar || DEFAULT_AVATAR,
98+
background: undefined,
9899
},
99100
...(members?.map((member) => ({
100101
avatar: member.avatar || DEFAULT_AVATAR,
101-
background: member.backgroundColor,
102+
background: member.backgroundColor || undefined,
102103
})) || []),
103104
]
104105
: avatar;
@@ -109,7 +110,7 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
109110
actions={actions}
110111
active={active}
111112
addon={addon}
112-
avatar={sessionAvatar}
113+
avatar={sessionAvatar as any} // Fix: Bypass complex intersection type ReactNode & avatar type
113114
avatarBackground={avatarBackground}
114115
date={updateAt?.valueOf()}
115116
description={description}

src/database/_deprecated/core/sync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class DataSync {
199199
const updateSyncEvent = throttle(onEvent, 1000);
200200

201201
// 定义一个变量来保存定时器的ID
202-
let debounceTimer: number;
202+
let debounceTimer: ReturnType<typeof setTimeout>;
203203

204204
yItemMap?.observe(async (event) => {
205205
// abort local change

src/features/ChatInput/ActionBar/Mention/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const Mention = memo(() => {
2929
icon: (
3030
<Avatar
3131
avatar={agent.avatar}
32-
background={agent.backgroundColor}
32+
background={agent.backgroundColor ?? undefined}
3333
shape="circle"
3434
size={24}
3535
/>

src/features/Conversation/components/ChatItem/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ const Item = memo<ChatListItemProps>(
289289
showTitle={isGroupSession && item.role !== 'user' && !inPortalThread}
290290
text={text}
291291
time={item.updatedAt || item.createdAt}
292-
titleAddon={isDM && <DMTag senderId={item.agentId} targetId={item.targetId} />}
292+
titleAddon={isDM && <DMTag senderId={item.agentId} targetId={item.targetId ?? undefined} />}
293293
variant={type === 'chat' ? 'bubble' : 'docs'}
294294
/>
295295
{endRender}

src/features/Portal/GroupThread/Header/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Header = memo(() => {
4040
<Flexbox align={'center'} gap={8} horizontal>
4141
<Avatar
4242
avatar={currentAgent?.avatar || DEFAULT_AVATAR}
43-
background={currentAgent?.backgroundColor}
43+
background={currentAgent?.backgroundColor ?? undefined}
4444
size={20}
4545
/>
4646
<div style={{ fontWeight: 600 }}>

src/server/routers/lambda/group.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,18 @@ export const groupRouter = router({
3030
createGroup: groupProcedure
3131
.input(insertChatGroupSchema.omit({ userId: true }))
3232
.mutation(async ({ input, ctx }) => {
33-
return ctx.chatGroupModel.create(input);
33+
return ctx.chatGroupModel.create({
34+
...input,
35+
config: input.config as {
36+
maxResponseInRow?: number;
37+
orchestratorModel?: string;
38+
orchestratorProvider?: string;
39+
responseOrder?: 'sequential' | 'natural';
40+
responseSpeed?: 'slow' | 'medium' | 'fast';
41+
revealDM?: boolean;
42+
systemPrompt?: string;
43+
} | null | undefined,
44+
});
3445
}),
3546

3647
deleteGroup: groupProcedure
@@ -90,7 +101,18 @@ export const groupRouter = router({
90101
}),
91102
)
92103
.mutation(async ({ input, ctx }) => {
93-
return ctx.chatGroupModel.update(input.id, input.value);
104+
return ctx.chatGroupModel.update(input.id, {
105+
...input.value,
106+
config: input.value.config as {
107+
maxResponseInRow?: number;
108+
orchestratorModel?: string;
109+
orchestratorProvider?: string;
110+
responseOrder?: 'sequential' | 'natural';
111+
responseSpeed?: 'slow' | 'medium' | 'fast';
112+
revealDM?: boolean;
113+
systemPrompt?: string;
114+
} | null | undefined,
115+
});
94116
}),
95117
});
96118

0 commit comments

Comments
 (0)