Skip to content

Commit 3a4f0d1

Browse files
authored
Fix: The chat settings are not displayed correctly on the first page load. (#13855)
### What problem does this PR solve? Fix: The chat settings are not displayed correctly on the first page load. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
1 parent 620fe21 commit 3a4f0d1

File tree

2 files changed

+46
-42
lines changed

2 files changed

+46
-42
lines changed

web/src/components/ui/tree-view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { ChevronRight } from 'lucide-react';
77
import React from 'react';
88

99
const treeVariants = cva(
10-
'group hover:before:opacity-100 before:absolute before:rounded-lg before:left-0 px-2 before:w-full before:opacity-0 before:bg-accent/70 before:h-[2rem] before:-z-10',
10+
'group hover:before:opacity-100 before:absolute before:rounded-lg before:left-0 px-2 before:w-full before:opacity-0 before:bg-accent/70 before:h-[2rem] before:-z-10 text-text-secondary',
1111
);
1212

1313
const selectedTreeVariants = cva(
14-
'before:opacity-100 before:bg-[#4E74Fd]/70 text-accent-foreground',
14+
'before:opacity-100 before:bg-bg-card text-accent-foreground',
1515
);
1616

1717
export interface TreeDataItem {
@@ -355,4 +355,4 @@ const TreeActions = ({
355355
);
356356
};
357357

358-
export { TreeView, type TreeDataItem };
358+
export { TreeView };

web/src/pages/next-chats/chat/app-settings/chat-settings.tsx

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -120,54 +120,58 @@ export function ChatSettings({ hasSingleChatBox }: ChatSettingsProps) {
120120
<section
121121
data-testid="chat-detail-settings"
122122
className={cn(
123-
'transition-[width] ease-out duration-300 flex-shrink-0 flex flex-col',
123+
'transition-[width] ease-out duration-300 flex-shrink-0 flex flex-col overflow-hidden',
124124
settingVisible ? 'w-[440px]' : 'w-0',
125125
)}
126126
>
127-
<div className="p-5 pb-2 flex justify-between items-center text-base">
128-
{t('chat.chatSetting')}
127+
{settingVisible && (
128+
<>
129+
<div className="p-5 pb-2 flex justify-between items-center text-base">
130+
{t('chat.chatSetting')}
129131

130-
<Button
131-
variant="transparent"
132-
size="icon-sm"
133-
className="border-0"
134-
onClick={switchSettingVisible}
135-
data-testid="chat-detail-settings-close"
136-
>
137-
<LucidePanelRightClose
138-
className="size-4 cursor-pointer"
139-
onClick={switchSettingVisible}
140-
/>
141-
</Button>
142-
</div>
143-
144-
<Form {...form}>
145-
<form
146-
onSubmit={form.handleSubmit(onSubmit, onInvalid)}
147-
className="flex-1 flex flex-col min-h-0"
148-
>
149-
<ScrollArea>
150-
<section className="p-5 space-y-6 overflow-auto flex-1 min-h-0">
151-
<ChatBasicSetting></ChatBasicSetting>
152-
<Separator />
153-
<ChatPromptEngine></ChatPromptEngine>
154-
<Separator />
155-
<ChatModelSettings></ChatModelSettings>
156-
</section>
157-
</ScrollArea>
158-
159-
<div className="p-5 pt-4 space-x-5 text-right">
160132
<Button
161-
variant={'outline'}
133+
variant="transparent"
134+
size="icon-sm"
135+
className="border-0"
162136
onClick={switchSettingVisible}
163-
data-testid="chat-detail-settings-cancel"
137+
data-testid="chat-detail-settings-close"
164138
>
165-
{t('chat.cancel')}
139+
<LucidePanelRightClose
140+
className="size-4 cursor-pointer"
141+
onClick={switchSettingVisible}
142+
/>
166143
</Button>
167-
<SavingButton loading={loading}></SavingButton>
168144
</div>
169-
</form>
170-
</Form>
145+
146+
<Form {...form}>
147+
<form
148+
onSubmit={form.handleSubmit(onSubmit, onInvalid)}
149+
className="flex-1 flex flex-col min-h-0"
150+
>
151+
<ScrollArea>
152+
<section className="p-5 space-y-6 overflow-auto flex-1 min-h-0">
153+
<ChatBasicSetting></ChatBasicSetting>
154+
<Separator />
155+
<ChatPromptEngine></ChatPromptEngine>
156+
<Separator />
157+
<ChatModelSettings></ChatModelSettings>
158+
</section>
159+
</ScrollArea>
160+
161+
<div className="p-5 pt-4 space-x-5 text-right">
162+
<Button
163+
variant={'outline'}
164+
onClick={switchSettingVisible}
165+
data-testid="chat-detail-settings-cancel"
166+
>
167+
{t('chat.cancel')}
168+
</Button>
169+
<SavingButton loading={loading}></SavingButton>
170+
</div>
171+
</form>
172+
</Form>
173+
</>
174+
)}
171175
</section>
172176
</>
173177
);

0 commit comments

Comments
 (0)