Skip to content

Commit cdbfdb9

Browse files
knoxnoeulivz
andauthored
fix(agent-tars): implicitly chat session (#494)
Co-authored-by: ULIVZ <chenhaoli@bytedance.com>
1 parent 6aa3ba6 commit cdbfdb9

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

apps/agent-tars/src/renderer/src/components/ChatUI/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ export function OpenAgentChatUI() {
9090
init();
9191
}, [currentSessionId]);
9292

93+
if (!currentSessionId) {
94+
return <WelcomeScreen />;
95+
}
96+
9397
return (
9498
<>
9599
<BaseChatUI

apps/agent-tars/src/renderer/src/components/LeftSidebar/SessionItem.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface SessionItemProps {
1515
};
1616
isActive: boolean;
1717
isEditing: boolean;
18+
removable: boolean;
1819
editingName: string;
1920
onEditingNameChange: (value: string) => void;
2021
onKeyDown: (e: React.KeyboardEvent, sessionId: string) => void;
@@ -28,6 +29,7 @@ export function SessionItem({
2829
session,
2930
isActive,
3031
isEditing,
32+
removable,
3133
editingName,
3234
onEditingNameChange,
3335
onKeyDown,
@@ -75,15 +77,19 @@ export function SessionItem({
7577
</DropdownTrigger>
7678
<DropdownMenu
7779
aria-label="Session actions"
80+
disabledKeys={removable ? [] : ['delete']}
7881
onAction={(key) => {
7982
if (key === 'edit') {
8083
onEditSession(
8184
session.id,
8285
session.name,
83-
new MouseEvent('click') as any,
86+
new MouseEvent('click') as unknown as React.MouseEvent,
8487
);
8588
} else if (key === 'delete') {
86-
onDeleteSession(session.id, new MouseEvent('click') as any);
89+
onDeleteSession(
90+
session.id,
91+
new MouseEvent('click') as unknown as React.MouseEvent,
92+
);
8793
}
8894
}}
8995
>

apps/agent-tars/src/renderer/src/components/LeftSidebar/SessionList/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export function SessionList({
106106
session={session}
107107
isActive={session.id === currentSessionId}
108108
isEditing={session.id === editingSessionId}
109+
removable={sessions.length > 1}
109110
editingName={editingName}
110111
onEditingNameChange={onEditingNameChange}
111112
onKeyDown={onKeyDown}

0 commit comments

Comments
 (0)