(re)Standardize Session Name Attribute (#5279)
This commit is contained in:
+62
-59
@@ -1794,57 +1794,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/description": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"Session Management"
|
||||
],
|
||||
"operationId": "update_session_description",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "session_id",
|
||||
"in": "path",
|
||||
"description": "Unique identifier for the session",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UpdateSessionDescriptionRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Session description updated successfully"
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request - Description too long (max 200 characters)"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized - Invalid or missing API key"
|
||||
},
|
||||
"404": {
|
||||
"description": "Session not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/export": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -1890,6 +1839,57 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/name": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"Session Management"
|
||||
],
|
||||
"operationId": "update_session_name",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "session_id",
|
||||
"in": "path",
|
||||
"description": "Unique identifier for the session",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UpdateSessionNameRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Session name updated successfully"
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request - Name too long (max 200 characters)"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized - Invalid or missing API key"
|
||||
},
|
||||
"404": {
|
||||
"description": "Session not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/sessions/{session_id}/user_recipe_values": {
|
||||
"put": {
|
||||
"tags": [
|
||||
@@ -3898,7 +3898,7 @@
|
||||
"required": [
|
||||
"id",
|
||||
"working_dir",
|
||||
"description",
|
||||
"name",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"extension_data",
|
||||
@@ -3932,9 +3932,6 @@
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"extension_data": {
|
||||
"$ref": "#/components/schemas/ExtensionData"
|
||||
},
|
||||
@@ -3950,6 +3947,9 @@
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"output_tokens": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
@@ -3983,6 +3983,9 @@
|
||||
},
|
||||
"nullable": true
|
||||
},
|
||||
"user_set_name": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"working_dir": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -4518,15 +4521,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"UpdateSessionDescriptionRequest": {
|
||||
"UpdateSessionNameRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"description"
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"description": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Updated description (name) for the session (max 200 characters)"
|
||||
"description": "Updated name for the session (max 200 characters)"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -120,7 +120,7 @@ vi.mock('./contexts/ChatContext', () => ({
|
||||
useChatContext: () => ({
|
||||
chat: {
|
||||
id: 'test-id',
|
||||
title: 'Test Chat',
|
||||
name: 'Test Chat',
|
||||
messages: [],
|
||||
messageHistoryIndex: 0,
|
||||
recipe: null,
|
||||
|
||||
@@ -316,7 +316,7 @@ export function AppInner() {
|
||||
|
||||
const [chat, setChat] = useState<ChatType>({
|
||||
sessionId: '',
|
||||
title: 'Pair Chat',
|
||||
name: 'Pair Chat',
|
||||
messages: [],
|
||||
messageHistoryIndex: 0,
|
||||
recipe: null,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import type { Client, Options as Options2, TDataShape } from './client';
|
||||
import { client } from './client.gen';
|
||||
import type { AddExtensionData, AddExtensionErrors, AddExtensionResponses, BackupConfigData, BackupConfigErrors, BackupConfigResponses, ConfirmPermissionData, ConfirmPermissionErrors, ConfirmPermissionResponses, CreateCustomProviderData, CreateCustomProviderErrors, CreateCustomProviderResponses, CreateRecipeData, CreateRecipeErrors, CreateRecipeResponses, CreateScheduleData, CreateScheduleErrors, CreateScheduleResponses, DecodeRecipeData, DecodeRecipeErrors, DecodeRecipeResponses, DeleteRecipeData, DeleteRecipeErrors, DeleteRecipeResponses, DeleteScheduleData, DeleteScheduleErrors, DeleteScheduleResponses, DeleteSessionData, DeleteSessionErrors, DeleteSessionResponses, DiagnosticsData, DiagnosticsErrors, DiagnosticsResponses, EncodeRecipeData, EncodeRecipeErrors, EncodeRecipeResponses, ExportSessionData, ExportSessionErrors, ExportSessionResponses, GetCustomProviderData, GetCustomProviderErrors, GetCustomProviderResponses, GetExtensionsData, GetExtensionsErrors, GetExtensionsResponses, GetProviderModelsData, GetProviderModelsErrors, GetProviderModelsResponses, GetSessionData, GetSessionErrors, GetSessionInsightsData, GetSessionInsightsErrors, GetSessionInsightsResponses, GetSessionResponses, GetToolsData, GetToolsErrors, GetToolsResponses, ImportSessionData, ImportSessionErrors, ImportSessionResponses, InitConfigData, InitConfigErrors, InitConfigResponses, InspectRunningJobData, InspectRunningJobErrors, InspectRunningJobResponses, KillRunningJobData, KillRunningJobResponses, ListRecipesData, ListRecipesErrors, ListRecipesResponses, ListSchedulesData, ListSchedulesErrors, ListSchedulesResponses, ListSessionsData, ListSessionsErrors, ListSessionsResponses, ParseRecipeData, ParseRecipeErrors, ParseRecipeResponses, PauseScheduleData, PauseScheduleErrors, PauseScheduleResponses, ProvidersData, ProvidersResponses, ReadAllConfigData, ReadAllConfigResponses, ReadConfigData, ReadConfigErrors, ReadConfigResponses, RecoverConfigData, RecoverConfigErrors, RecoverConfigResponses, RemoveConfigData, RemoveConfigErrors, RemoveConfigResponses, RemoveCustomProviderData, RemoveCustomProviderErrors, RemoveCustomProviderResponses, RemoveExtensionData, RemoveExtensionErrors, RemoveExtensionResponses, ReplyData, ReplyErrors, ReplyResponses, ResumeAgentData, ResumeAgentErrors, ResumeAgentResponses, RunNowHandlerData, RunNowHandlerErrors, RunNowHandlerResponses, SaveRecipeData, SaveRecipeErrors, SaveRecipeResponses, ScanRecipeData, ScanRecipeResponses, SessionsHandlerData, SessionsHandlerErrors, SessionsHandlerResponses, StartAgentData, StartAgentErrors, StartAgentResponses, StartOpenrouterSetupData, StartOpenrouterSetupResponses, StartTetrateSetupData, StartTetrateSetupResponses, StatusData, StatusResponses, UnpauseScheduleData, UnpauseScheduleErrors, UnpauseScheduleResponses, UpdateAgentProviderData, UpdateAgentProviderErrors, UpdateAgentProviderResponses, UpdateCustomProviderData, UpdateCustomProviderErrors, UpdateCustomProviderResponses, UpdateFromSessionData, UpdateFromSessionErrors, UpdateFromSessionResponses, UpdateRouterToolSelectorData, UpdateRouterToolSelectorErrors, UpdateRouterToolSelectorResponses, UpdateScheduleData, UpdateScheduleErrors, UpdateScheduleResponses, UpdateSessionDescriptionData, UpdateSessionDescriptionErrors, UpdateSessionDescriptionResponses, UpdateSessionUserRecipeValuesData, UpdateSessionUserRecipeValuesErrors, UpdateSessionUserRecipeValuesResponses, UpsertConfigData, UpsertConfigErrors, UpsertConfigResponses, UpsertPermissionsData, UpsertPermissionsErrors, UpsertPermissionsResponses, ValidateConfigData, ValidateConfigErrors, ValidateConfigResponses } from './types.gen';
|
||||
import type { AddExtensionData, AddExtensionErrors, AddExtensionResponses, BackupConfigData, BackupConfigErrors, BackupConfigResponses, ConfirmPermissionData, ConfirmPermissionErrors, ConfirmPermissionResponses, CreateCustomProviderData, CreateCustomProviderErrors, CreateCustomProviderResponses, CreateRecipeData, CreateRecipeErrors, CreateRecipeResponses, CreateScheduleData, CreateScheduleErrors, CreateScheduleResponses, DecodeRecipeData, DecodeRecipeErrors, DecodeRecipeResponses, DeleteRecipeData, DeleteRecipeErrors, DeleteRecipeResponses, DeleteScheduleData, DeleteScheduleErrors, DeleteScheduleResponses, DeleteSessionData, DeleteSessionErrors, DeleteSessionResponses, DiagnosticsData, DiagnosticsErrors, DiagnosticsResponses, EncodeRecipeData, EncodeRecipeErrors, EncodeRecipeResponses, ExportSessionData, ExportSessionErrors, ExportSessionResponses, GetCustomProviderData, GetCustomProviderErrors, GetCustomProviderResponses, GetExtensionsData, GetExtensionsErrors, GetExtensionsResponses, GetProviderModelsData, GetProviderModelsErrors, GetProviderModelsResponses, GetSessionData, GetSessionErrors, GetSessionInsightsData, GetSessionInsightsErrors, GetSessionInsightsResponses, GetSessionResponses, GetToolsData, GetToolsErrors, GetToolsResponses, ImportSessionData, ImportSessionErrors, ImportSessionResponses, InitConfigData, InitConfigErrors, InitConfigResponses, InspectRunningJobData, InspectRunningJobErrors, InspectRunningJobResponses, KillRunningJobData, KillRunningJobResponses, ListRecipesData, ListRecipesErrors, ListRecipesResponses, ListSchedulesData, ListSchedulesErrors, ListSchedulesResponses, ListSessionsData, ListSessionsErrors, ListSessionsResponses, ParseRecipeData, ParseRecipeErrors, ParseRecipeResponses, PauseScheduleData, PauseScheduleErrors, PauseScheduleResponses, ProvidersData, ProvidersResponses, ReadAllConfigData, ReadAllConfigResponses, ReadConfigData, ReadConfigErrors, ReadConfigResponses, RecoverConfigData, RecoverConfigErrors, RecoverConfigResponses, RemoveConfigData, RemoveConfigErrors, RemoveConfigResponses, RemoveCustomProviderData, RemoveCustomProviderErrors, RemoveCustomProviderResponses, RemoveExtensionData, RemoveExtensionErrors, RemoveExtensionResponses, ReplyData, ReplyErrors, ReplyResponses, ResumeAgentData, ResumeAgentErrors, ResumeAgentResponses, RunNowHandlerData, RunNowHandlerErrors, RunNowHandlerResponses, SaveRecipeData, SaveRecipeErrors, SaveRecipeResponses, ScanRecipeData, ScanRecipeResponses, SessionsHandlerData, SessionsHandlerErrors, SessionsHandlerResponses, StartAgentData, StartAgentErrors, StartAgentResponses, StartOpenrouterSetupData, StartOpenrouterSetupResponses, StartTetrateSetupData, StartTetrateSetupResponses, StatusData, StatusResponses, UnpauseScheduleData, UnpauseScheduleErrors, UnpauseScheduleResponses, UpdateAgentProviderData, UpdateAgentProviderErrors, UpdateAgentProviderResponses, UpdateCustomProviderData, UpdateCustomProviderErrors, UpdateCustomProviderResponses, UpdateFromSessionData, UpdateFromSessionErrors, UpdateFromSessionResponses, UpdateRouterToolSelectorData, UpdateRouterToolSelectorErrors, UpdateRouterToolSelectorResponses, UpdateScheduleData, UpdateScheduleErrors, UpdateScheduleResponses, UpdateSessionNameData, UpdateSessionNameErrors, UpdateSessionNameResponses, UpdateSessionUserRecipeValuesData, UpdateSessionUserRecipeValuesErrors, UpdateSessionUserRecipeValuesResponses, UpsertConfigData, UpsertConfigErrors, UpsertConfigResponses, UpsertPermissionsData, UpsertPermissionsErrors, UpsertPermissionsResponses, ValidateConfigData, ValidateConfigErrors, ValidateConfigResponses } from './types.gen';
|
||||
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
||||
/**
|
||||
@@ -478,9 +478,16 @@ export const getSession = <ThrowOnError extends boolean = false>(options: Option
|
||||
});
|
||||
};
|
||||
|
||||
export const updateSessionDescription = <ThrowOnError extends boolean = false>(options: Options<UpdateSessionDescriptionData, ThrowOnError>) => {
|
||||
return (options.client ?? client).put<UpdateSessionDescriptionResponses, UpdateSessionDescriptionErrors, ThrowOnError>({
|
||||
url: '/sessions/{session_id}/description',
|
||||
export const exportSession = <ThrowOnError extends boolean = false>(options: Options<ExportSessionData, ThrowOnError>) => {
|
||||
return (options.client ?? client).get<ExportSessionResponses, ExportSessionErrors, ThrowOnError>({
|
||||
url: '/sessions/{session_id}/export',
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
export const updateSessionName = <ThrowOnError extends boolean = false>(options: Options<UpdateSessionNameData, ThrowOnError>) => {
|
||||
return (options.client ?? client).put<UpdateSessionNameResponses, UpdateSessionNameErrors, ThrowOnError>({
|
||||
url: '/sessions/{session_id}/name',
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -489,13 +496,6 @@ export const updateSessionDescription = <ThrowOnError extends boolean = false>(o
|
||||
});
|
||||
};
|
||||
|
||||
export const exportSession = <ThrowOnError extends boolean = false>(options: Options<ExportSessionData, ThrowOnError>) => {
|
||||
return (options.client ?? client).get<ExportSessionResponses, ExportSessionErrors, ThrowOnError>({
|
||||
url: '/sessions/{session_id}/export',
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
export const updateSessionUserRecipeValues = <ThrowOnError extends boolean = false>(options: Options<UpdateSessionUserRecipeValuesData, ThrowOnError>) => {
|
||||
return (options.client ?? client).put<UpdateSessionUserRecipeValuesResponses, UpdateSessionUserRecipeValuesErrors, ThrowOnError>({
|
||||
url: '/sessions/{session_id}/user_recipe_values',
|
||||
|
||||
@@ -644,11 +644,11 @@ export type Session = {
|
||||
accumulated_total_tokens?: number | null;
|
||||
conversation?: Conversation | null;
|
||||
created_at: string;
|
||||
description: string;
|
||||
extension_data: ExtensionData;
|
||||
id: string;
|
||||
input_tokens?: number | null;
|
||||
message_count: number;
|
||||
name: string;
|
||||
output_tokens?: number | null;
|
||||
recipe?: Recipe | null;
|
||||
schedule_id?: string | null;
|
||||
@@ -657,6 +657,7 @@ export type Session = {
|
||||
user_recipe_values?: {
|
||||
[key: string]: string;
|
||||
} | null;
|
||||
user_set_name?: boolean;
|
||||
working_dir: string;
|
||||
};
|
||||
|
||||
@@ -839,11 +840,11 @@ export type UpdateScheduleRequest = {
|
||||
cron: string;
|
||||
};
|
||||
|
||||
export type UpdateSessionDescriptionRequest = {
|
||||
export type UpdateSessionNameRequest = {
|
||||
/**
|
||||
* Updated description (name) for the session (max 200 characters)
|
||||
* Updated name for the session (max 200 characters)
|
||||
*/
|
||||
description: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type UpdateSessionUserRecipeValuesRequest = {
|
||||
@@ -2282,44 +2283,6 @@ export type GetSessionResponses = {
|
||||
|
||||
export type GetSessionResponse = GetSessionResponses[keyof GetSessionResponses];
|
||||
|
||||
export type UpdateSessionDescriptionData = {
|
||||
body: UpdateSessionDescriptionRequest;
|
||||
path: {
|
||||
/**
|
||||
* Unique identifier for the session
|
||||
*/
|
||||
session_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/sessions/{session_id}/description';
|
||||
};
|
||||
|
||||
export type UpdateSessionDescriptionErrors = {
|
||||
/**
|
||||
* Bad request - Description too long (max 200 characters)
|
||||
*/
|
||||
400: unknown;
|
||||
/**
|
||||
* Unauthorized - Invalid or missing API key
|
||||
*/
|
||||
401: unknown;
|
||||
/**
|
||||
* Session not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Internal server error
|
||||
*/
|
||||
500: unknown;
|
||||
};
|
||||
|
||||
export type UpdateSessionDescriptionResponses = {
|
||||
/**
|
||||
* Session description updated successfully
|
||||
*/
|
||||
200: unknown;
|
||||
};
|
||||
|
||||
export type ExportSessionData = {
|
||||
body?: never;
|
||||
path: {
|
||||
@@ -2356,6 +2319,44 @@ export type ExportSessionResponses = {
|
||||
|
||||
export type ExportSessionResponse = ExportSessionResponses[keyof ExportSessionResponses];
|
||||
|
||||
export type UpdateSessionNameData = {
|
||||
body: UpdateSessionNameRequest;
|
||||
path: {
|
||||
/**
|
||||
* Unique identifier for the session
|
||||
*/
|
||||
session_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/sessions/{session_id}/name';
|
||||
};
|
||||
|
||||
export type UpdateSessionNameErrors = {
|
||||
/**
|
||||
* Bad request - Name too long (max 200 characters)
|
||||
*/
|
||||
400: unknown;
|
||||
/**
|
||||
* Unauthorized - Invalid or missing API key
|
||||
*/
|
||||
401: unknown;
|
||||
/**
|
||||
* Session not found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Internal server error
|
||||
*/
|
||||
500: unknown;
|
||||
};
|
||||
|
||||
export type UpdateSessionNameResponses = {
|
||||
/**
|
||||
* Session name updated successfully
|
||||
*/
|
||||
200: unknown;
|
||||
};
|
||||
|
||||
export type UpdateSessionUserRecipeValuesData = {
|
||||
body: UpdateSessionUserRecipeValuesRequest;
|
||||
path: {
|
||||
|
||||
@@ -174,7 +174,7 @@ function BaseChatContent({
|
||||
messages,
|
||||
recipe,
|
||||
sessionId,
|
||||
title: session?.description || 'No Session',
|
||||
name: session?.name || 'No Session',
|
||||
};
|
||||
|
||||
const initialPrompt = messages.length == 0 && recipe?.prompt ? recipe.prompt : '';
|
||||
|
||||
@@ -116,16 +116,16 @@ const AppSidebar: React.FC<SidebarProps> = ({ currentPath }) => {
|
||||
|
||||
if (
|
||||
currentPath === '/pair' &&
|
||||
chatContext?.chat?.title &&
|
||||
chatContext.chat.title !== DEFAULT_CHAT_TITLE
|
||||
chatContext?.chat?.name &&
|
||||
chatContext.chat.name !== DEFAULT_CHAT_TITLE
|
||||
) {
|
||||
titleBits.push(chatContext.chat.title);
|
||||
titleBits.push(chatContext.chat.name);
|
||||
} else if (currentPath !== '/' && currentItem) {
|
||||
titleBits.push(currentItem.label);
|
||||
}
|
||||
|
||||
document.title = titleBits.join(' - ');
|
||||
}, [currentPath, chatContext?.chat?.title]);
|
||||
}, [currentPath, chatContext?.chat?.name]);
|
||||
|
||||
const isActivePath = (path: string) => {
|
||||
return currentPath === path;
|
||||
|
||||
@@ -182,7 +182,7 @@ const SessionHistoryView: React.FC<SessionHistoryViewProps> = ({
|
||||
config.baseUrl,
|
||||
session.working_dir,
|
||||
messages,
|
||||
session.description || 'Shared Session',
|
||||
session.name || 'Shared Session',
|
||||
session.total_tokens || 0
|
||||
);
|
||||
|
||||
@@ -267,7 +267,7 @@ const SessionHistoryView: React.FC<SessionHistoryViewProps> = ({
|
||||
<div className="flex-1 flex flex-col min-h-0 px-8">
|
||||
<SessionHeader
|
||||
onBack={onBack}
|
||||
title={session.description || 'Session Details'}
|
||||
title={session.name}
|
||||
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.description || `Session ${session.id}`}</div>
|
||||
<div className="font-medium">{session.name}</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,
|
||||
updateSessionDescription,
|
||||
updateSessionName,
|
||||
} from '../../api';
|
||||
|
||||
interface EditSessionModalProps {
|
||||
@@ -45,7 +45,7 @@ const EditSessionModal = React.memo<EditSessionModalProps>(
|
||||
|
||||
useEffect(() => {
|
||||
if (session && isOpen) {
|
||||
setDescription(session.description || session.id);
|
||||
setDescription(session.name);
|
||||
} 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.description) {
|
||||
if (trimmedDescription === session.name) {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
setIsUpdating(true);
|
||||
try {
|
||||
await updateSessionDescription({
|
||||
await updateSessionName({
|
||||
path: { session_id: session.id },
|
||||
body: { description: trimmedDescription },
|
||||
body: { name: 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.description || session.id);
|
||||
setDescription(session.name);
|
||||
} 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.description || session.id;
|
||||
const description = session.name;
|
||||
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, description: newDescription } : s))
|
||||
prevSessions.map((s) => (s.id === sessionId ? { ...s, name: newDescription } : s))
|
||||
);
|
||||
}, []);
|
||||
|
||||
@@ -416,7 +416,7 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
|
||||
|
||||
setShowDeleteConfirmation(false);
|
||||
const sessionToDeleteId = sessionToDelete.id;
|
||||
const sessionName = sessionToDelete.description || sessionToDelete.id;
|
||||
const sessionName = sessionToDelete.name;
|
||||
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.description || session.id}.json`;
|
||||
a.download = `${session.name}.json`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
@@ -557,9 +557,7 @@ const SessionListView: React.FC<SessionListViewProps> = React.memo(
|
||||
</div>
|
||||
|
||||
<div className="flex-1">
|
||||
<h3 className="text-base mb-1 pr-16 break-words">
|
||||
{session.description || session.id}
|
||||
</h3>
|
||||
<h3 className="text-base mb-1 pr-16 break-words">{session.name}</h3>
|
||||
|
||||
<div className="flex items-center text-text-muted text-xs mb-1">
|
||||
<Calendar className="w-3 h-3 mr-1 flex-shrink-0" />
|
||||
@@ -806,7 +804,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?.description || sessionToDelete?.id}"? This action cannot be undone.`}
|
||||
message={`Are you sure you want to delete the session "${sessionToDelete?.name}"? This action cannot be undone.`}
|
||||
confirmLabel="Delete Session"
|
||||
cancelLabel="Cancel"
|
||||
confirmVariant="destructive"
|
||||
|
||||
@@ -334,9 +334,7 @@ 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.description || session.id}
|
||||
</span>
|
||||
<span className="truncate max-w-[300px]">{session.name}</span>
|
||||
</div>
|
||||
<span className="text-text-muted font-mono font-light">
|
||||
{formatDateOnly(session.updated_at)}
|
||||
|
||||
@@ -82,13 +82,14 @@ const SessionsView: React.FC = () => {
|
||||
selectedSession || {
|
||||
id: initialSessionId || '',
|
||||
conversation: [],
|
||||
description: 'Loading...',
|
||||
name: 'Loading...',
|
||||
working_dir: '',
|
||||
message_count: 0,
|
||||
total_tokens: 0,
|
||||
created_at: '',
|
||||
updated_at: '',
|
||||
extension_data: {},
|
||||
user_set_name: false,
|
||||
}
|
||||
}
|
||||
isLoading={isLoadingSession}
|
||||
|
||||
@@ -55,7 +55,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
||||
const resetChat = () => {
|
||||
setChat({
|
||||
sessionId: '',
|
||||
title: DEFAULT_CHAT_TITLE,
|
||||
name: DEFAULT_CHAT_TITLE,
|
||||
messages: [],
|
||||
messageHistoryIndex: 0,
|
||||
recipe: null,
|
||||
|
||||
@@ -82,7 +82,7 @@ export function useAgent(): UseAgentReturn {
|
||||
const messages = agentSession.conversation || [];
|
||||
return {
|
||||
sessionId: agentSession.id,
|
||||
title: agentSession.recipe?.title || agentSession.description,
|
||||
name: agentSession.recipe?.title || agentSession.name,
|
||||
messageHistoryIndex: 0,
|
||||
messages,
|
||||
recipe: agentSession.recipe,
|
||||
@@ -184,7 +184,7 @@ export function useAgent(): UseAgentReturn {
|
||||
const messages = initContext.recipe && !initContext.resumeSessionId ? [] : conversation;
|
||||
let initChat: ChatType = {
|
||||
sessionId: agentSession.id,
|
||||
title: agentSession.recipe?.title || agentSession.description,
|
||||
name: agentSession.recipe?.title || agentSession.name,
|
||||
messageHistoryIndex: 0,
|
||||
messages: messages,
|
||||
recipe: recipe,
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('useChatEngine', () => {
|
||||
const mockChat: ChatType = {
|
||||
sessionId: 'test-chat',
|
||||
messages: initialMessages,
|
||||
title: 'Test Chat',
|
||||
name: 'Test Chat',
|
||||
messageHistoryIndex: 0,
|
||||
};
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ export function useChatStream({
|
||||
const session = response.data;
|
||||
log.session('loaded', sessionId, {
|
||||
messageCount: session?.conversation?.length || 0,
|
||||
description: session?.description,
|
||||
name: session?.name,
|
||||
});
|
||||
|
||||
setSession(session);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Message } from '../api';
|
||||
|
||||
export interface ChatType {
|
||||
sessionId: string;
|
||||
title: string;
|
||||
name: string;
|
||||
messageHistoryIndex: number;
|
||||
messages: Message[];
|
||||
recipe?: Recipe | null; // Add recipe configuration to chat state
|
||||
|
||||
Reference in New Issue
Block a user