Revert "Standardize Session Name Attribute" (#5250)

This commit is contained in:
Michael Neale
2025-10-19 03:44:30 +11:00
committed by GitHub
parent 9b4c8726f1
commit 890393bb68
29 changed files with 237 additions and 1193 deletions
+2 -2
View File
@@ -94,7 +94,7 @@ function BaseChatContent({
// todo: set to null instead and handle that in other places
const emptyChat: ChatType = {
sessionId: resumeSessionId,
name: 'Loading...',
title: 'Loading...',
messageHistoryIndex: 0,
messages: [],
recipe: null,
@@ -107,7 +107,7 @@ function BaseChatContent({
const conversation = session.conversation || [];
const loadedChat: ChatType = {
sessionId: session.id,
name: session.name || 'Untitled Chat',
title: session.description || 'Untitled Chat',
messageHistoryIndex: 0,
messages: conversation,
recipe: null,
@@ -116,16 +116,16 @@ const AppSidebar: React.FC<SidebarProps> = ({ currentPath }) => {
if (
currentPath === '/pair' &&
chatContext?.chat?.name &&
chatContext.chat.name !== DEFAULT_CHAT_TITLE
chatContext?.chat?.title &&
chatContext.chat.title !== DEFAULT_CHAT_TITLE
) {
titleBits.push(chatContext.chat.name);
titleBits.push(chatContext.chat.title);
} else if (currentPath !== '/' && currentItem) {
titleBits.push(currentItem.label);
}
document.title = titleBits.join(' - ');
}, [currentPath, chatContext?.chat?.name]);
}, [currentPath, chatContext?.chat?.title]);
const isActivePath = (path: string) => {
return currentPath === path;
@@ -10,8 +10,7 @@ const default_message: Message = {
},
id: '1',
role: 'assistant',
created: 1000,
content: [],
created: 1000,content: []
};
describe('CompactionMarker', () => {
@@ -185,7 +185,7 @@ const SessionHistoryView: React.FC<SessionHistoryViewProps> = ({
config.baseUrl,
session.working_dir,
messages,
session.name || 'Shared Session',
session.description || 'Shared Session',
session.total_tokens || 0
);
@@ -270,7 +270,7 @@ const SessionHistoryView: React.FC<SessionHistoryViewProps> = ({
<div className="flex-1 flex flex-col min-h-0 px-8">
<SessionHeader
onBack={onBack}
title={session.name}
title={session.description || 'Session Details'}
actionButtons={!isLoading ? actionButtons : null}
>
<div className="flex flex-col">
@@ -12,7 +12,7 @@ const SessionItem: React.FC<SessionItemProps> = ({ session, extraActions }) => {
return (
<Card className="p-4 mb-2 hover:bg-accent/50 cursor-pointer flex justify-between items-center">
<div>
<div className="font-medium">{session.name}</div>
<div className="font-medium">{session.description || `Session ${session.id}`}</div>
<div className="text-sm text-muted-foreground">
{formatDate(session.updated_at)} {session.message_count} messages
</div>
@@ -27,7 +27,7 @@ import {
importSession,
listSessions,
Session,
updateSessionName,
updateSessionDescription,
} from '../../api';
interface EditSessionModalProps {
@@ -45,7 +45,7 @@ const EditSessionModal = React.memo<EditSessionModalProps>(
useEffect(() => {
if (session && isOpen) {
setDescription(session.name);
setDescription(session.description || session.id);
} else if (!isOpen) {
// Reset state when modal closes
setDescription('');
@@ -57,16 +57,16 @@ const EditSessionModal = React.memo<EditSessionModalProps>(
if (!session || disabled) return;
const trimmedDescription = description.trim();
if (trimmedDescription === session.name) {
if (trimmedDescription === session.description) {
onClose();
return;
}
setIsUpdating(true);
try {
await updateSessionName({
await updateSessionDescription({
path: { session_id: session.id },
body: { name: trimmedDescription },
body: { description: trimmedDescription },
throwOnError: true,
});
await onSave(session.id, trimmedDescription);
@@ -80,7 +80,7 @@ const EditSessionModal = React.memo<EditSessionModalProps>(
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
console.error('Failed to update session description:', errorMessage);
toast.error(`Failed to update session description: ${errorMessage}`);
setDescription(session.name);
setDescription(session.description || session.id);
} finally {
setIsUpdating(false);
}
@@ -333,7 +333,7 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
startTransition(() => {
const searchTerm = caseSensitive ? debouncedSearchTerm : debouncedSearchTerm.toLowerCase();
const filtered = sessions.filter((session) => {
const description = session.name;
const description = session.description || session.id;
const workingDir = session.working_dir;
const sessionId = session.id;
@@ -397,7 +397,7 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
const handleModalSave = useCallback(async (sessionId: string, newDescription: string) => {
// Update state immediately for optimistic UI
setSessions((prevSessions) =>
prevSessions.map((s) => (s.id === sessionId ? { ...s, name: newDescription } : s))
prevSessions.map((s) => (s.id === sessionId ? { ...s, description: newDescription } : s))
);
}, []);
@@ -416,7 +416,7 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
setShowDeleteConfirmation(false);
const sessionToDeleteId = sessionToDelete.id;
const sessionName = sessionToDelete.name;
const sessionName = sessionToDelete.description || sessionToDelete.id;
setSessionToDelete(null);
try {
@@ -451,7 +451,7 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `${session.name}.json`;
a.download = `${session.description || session.id}.json`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
@@ -557,7 +557,9 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
</div>
<div className="flex-1">
<h3 className="text-base mb-1 pr-16 break-words">{session.name}</h3>
<h3 className="text-base mb-1 pr-16 break-words">
{session.description || session.id}
</h3>
<div className="flex items-center text-text-muted text-xs mb-1">
<Calendar className="w-3 h-3 mr-1 flex-shrink-0" />
@@ -804,7 +806,7 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
<ConfirmationModal
isOpen={showDeleteConfirmation}
title="Delete Session"
message={`Are you sure you want to delete the session "${sessionToDelete?.name}"? This action cannot be undone.`}
message={`Are you sure you want to delete the session "${sessionToDelete?.description || sessionToDelete?.id}"? This action cannot be undone.`}
confirmLabel="Delete Session"
cancelLabel="Cancel"
confirmVariant="destructive"
@@ -334,7 +334,9 @@ export function SessionInsights() {
>
<div className="flex items-center space-x-2">
<ChatSmart className="h-4 w-4 text-text-muted" />
<span className="truncate max-w-[300px]">{session.name}</span>
<span className="truncate max-w-[300px]">
{session.description || session.id}
</span>
</div>
<span className="text-text-muted font-mono font-light">
{formatDateOnly(session.updated_at)}
@@ -70,14 +70,13 @@ const SessionsView: React.FC = () => {
selectedSession || {
id: initialSessionId || '',
conversation: [],
name: 'Loading...',
description: 'Loading...',
working_dir: '',
message_count: 0,
total_tokens: 0,
created_at: '',
updated_at: '',
extension_data: {},
user_set_name: false,
}
}
isLoading={isLoadingSession}