fix: skip trimming for active sessions to preserve anchor
This commit is contained in:
@@ -506,6 +506,11 @@ export const useSessionStore = create<SessionStore>()(
|
|||||||
getActiveTurnAnchor: (sessionId: string) => useMessageStore.getState().getActiveTurnAnchor(sessionId),
|
getActiveTurnAnchor: (sessionId: string) => useMessageStore.getState().getActiveTurnAnchor(sessionId),
|
||||||
trimToViewportWindow: (sessionId: string, targetSize?: number) => {
|
trimToViewportWindow: (sessionId: string, targetSize?: number) => {
|
||||||
const currentSessionId = useSessionManagementStore.getState().currentSessionId;
|
const currentSessionId = useSessionManagementStore.getState().currentSessionId;
|
||||||
|
// Skip trimming for sessions in active phase (busy/cooldown) to preserve anchor/spacer
|
||||||
|
const phase = get().sessionActivityPhase?.get(sessionId);
|
||||||
|
if (phase === 'busy' || phase === 'cooldown') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return useMessageStore.getState().trimToViewportWindow(sessionId, targetSize, currentSessionId || undefined);
|
return useMessageStore.getState().trimToViewportWindow(sessionId, targetSize, currentSessionId || undefined);
|
||||||
},
|
},
|
||||||
evictLeastRecentlyUsed: () => {
|
evictLeastRecentlyUsed: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user