diff --git a/src/workspaces/officerdev/src/apps/ChatHistory/SessionList.tsx b/src/workspaces/officerdev/src/apps/ChatHistory/SessionList.tsx
index 8f860178..9a6fa1b6 100644
--- a/src/workspaces/officerdev/src/apps/ChatHistory/SessionList.tsx
+++ b/src/workspaces/officerdev/src/apps/ChatHistory/SessionList.tsx
@@ -1,5 +1,5 @@
import { useState, useRef, useCallback } from 'react';
-import { useNavigate } from 'react-router';
+import { useNavigate, useLocation } from 'react-router';
import { Plus, MessageSquare, Loader2 } from 'lucide-react';
import { usePanelChannel } from 'hooks/usePanelChannel';
import { useSavedSessions, messagesToTranscript, type RawMessage } from 'state/useSavedSessions';
@@ -9,6 +9,8 @@ import { SessionContextMenu } from './SessionContextMenu';
export const SessionList = () => {
const navigate = useNavigate();
+ const location = useLocation();
+ const isOnChatPage = location.pathname.startsWith('/chat');
const { sessions, deleteSavedSession, resumeSession } = useSavedSessions();
const [selected, setSelected] = usePanelChannel
('chat:selected-session', null);
const [isResuming, setIsResuming] = useState(null);
@@ -22,6 +24,10 @@ export const SessionList = () => {
}, []);
const handleSelect = async (session: (typeof sessions)[number]) => {
+ if (isOnChatPage) {
+ navigate(`/chat/saved/${session.id}`);
+ return;
+ }
setIsResuming(session.id);
try {
const result = await resumeSession(session.id);
@@ -43,12 +49,11 @@ export const SessionList = () => {
});
const transcript = messagesToTranscript(rawMessages);
setSelected({
- id: `resume:${session.id}`,
+ id: `saved:${session.id}`,
model: result.model,
resumeSummary: transcript,
initialMessages: chatMessages,
});
- navigate(`/chat/new`, { replace: true });
} catch {
// Failed to resume
} finally {
@@ -57,9 +62,9 @@ export const SessionList = () => {
};
const handleDelete = async (id: number) => {
- if (selected?.id === `resume:${id}`) {
+ if (selected?.id === `saved:${id}`) {
setSelected(null);
- navigate('/chat', { replace: true });
+ if (isOnChatPage) navigate('/chat', { replace: true });
}
await deleteSavedSession(id);
};
@@ -90,7 +95,7 @@ export const SessionList = () => {
)}
{sessions.map((session) => {
- const isActive = selected?.id === `resume:${session.id}`;
+ const isActive = selected?.id === `saved:${session.id}`;
return (