@@ -19,10 +19,9 @@ interface SessionItemProps {
1919 active ?: boolean ;
2020 id : string ;
2121 loading ?: boolean ;
22- pin ?: boolean ;
2322}
2423
25- const SessionItem : FC < SessionItemProps > = memo ( ( { id, active = true , loading, pin } ) => {
24+ const SessionItem : FC < SessionItemProps > = memo ( ( { id, active = true , loading } ) => {
2625 const ref = useRef ( null ) ;
2726 const isHovering = useHover ( ref ) ;
2827
@@ -33,6 +32,7 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading, pi
3332 const [ defaultModel ] = useSettings ( ( s ) => [ s . settings . model ] , shallow ) ;
3433
3534 const [
35+ pin ,
3636 title ,
3737 description ,
3838 systemRole ,
@@ -42,11 +42,13 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading, pi
4242 model ,
4343 chatLength ,
4444 removeSession ,
45+ pinSession ,
4546 ] = useSessionStore ( ( s ) => {
4647 const session = sessionSelectors . getSessionById ( id ) ( s ) ;
4748 const meta = session . meta ;
4849 const systemRole = session . config . systemRole ;
4950 return [
51+ session . pinned ,
5052 agentSelectors . getTitle ( meta ) ,
5153 meta . description ,
5254 systemRole ,
@@ -56,6 +58,7 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading, pi
5658 session . config . model ,
5759 chatSelectors . currentChats ( s ) . length ,
5860 s . removeSession ,
61+ s . pinSession ,
5962 ] ;
6063 } , shallow ) ;
6164
@@ -66,8 +69,9 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading, pi
6669 icon : < Icon icon = { pin ? PinOff : Pin } /> ,
6770 key : 'pin' ,
6871 label : t ( pin ? 'pinOff' : 'pin' ) ,
69- // TODO: 动作绑定
70- onClick : ( ) => { } ,
72+ onClick : ( ) => {
73+ pinSession ( id , ! pin ) ;
74+ } ,
7175 } ,
7276 {
7377 children : [
@@ -154,7 +158,16 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading, pi
154158 style = { { color : theme . colorText } }
155159 title = { title }
156160 />
157- < Dropdown arrow = { false } menu = { { items } } trigger = { [ 'click' ] } >
161+ < Dropdown
162+ arrow = { false }
163+ menu = { {
164+ items,
165+ onClick : ( { domEvent } ) => {
166+ domEvent . stopPropagation ( ) ;
167+ } ,
168+ } }
169+ trigger = { [ 'click' ] }
170+ >
158171 < ActionIcon
159172 className = "session-remove"
160173 icon = { MoreVertical }
0 commit comments