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
+59 -62
View File
@@ -1886,6 +1886,57 @@
]
}
},
"/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": [
@@ -1931,57 +1982,6 @@
]
}
},
"/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": [
@@ -4077,7 +4077,7 @@
"required": [
"id",
"working_dir",
"name",
"description",
"created_at",
"updated_at",
"extension_data",
@@ -4111,6 +4111,9 @@
"type": "string",
"format": "date-time"
},
"description": {
"type": "string"
},
"extension_data": {
"$ref": "#/components/schemas/ExtensionData"
},
@@ -4126,9 +4129,6 @@
"type": "integer",
"minimum": 0
},
"name": {
"type": "string"
},
"output_tokens": {
"type": "integer",
"format": "int32",
@@ -4162,9 +4162,6 @@
},
"nullable": true
},
"user_set_name": {
"type": "boolean"
},
"working_dir": {
"type": "string"
}
@@ -4688,15 +4685,15 @@
}
}
},
"UpdateSessionNameRequest": {
"UpdateSessionDescriptionRequest": {
"type": "object",
"required": [
"name"
"description"
],
"properties": {
"name": {
"description": {
"type": "string",
"description": "Updated name for the session (max 200 characters)"
"description": "Updated description (name) for the session (max 200 characters)"
}
}
},
+1 -1
View File
@@ -120,7 +120,7 @@ vi.mock('./contexts/ChatContext', () => ({
useChatContext: () => ({
chat: {
id: 'test-id',
name: 'Test Chat',
title: 'Test Chat',
messages: [],
messageHistoryIndex: 0,
recipe: null,
+1 -1
View File
@@ -302,7 +302,7 @@ export function AppInner() {
const [chat, setChat] = useState<ChatType>({
sessionId: '',
name: 'Pair Chat',
title: 'Pair Chat',
messages: [],
messageHistoryIndex: 0,
recipe: null,
+11 -11
View File
@@ -2,7 +2,7 @@
import type { Client, Options as Options2, TDataShape } from './client';
import { client } from './client.gen';
import type { AddExtensionData, AddExtensionErrors, AddExtensionResponses, AddSubRecipesData, AddSubRecipesErrors, AddSubRecipesResponses, 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, EncodeRecipeData, EncodeRecipeErrors, EncodeRecipeResponses, ExportSessionData, ExportSessionErrors, ExportSessionResponses, ExtendPromptData, ExtendPromptErrors, ExtendPromptResponses, 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, ManageContextData, ManageContextErrors, ManageContextResponses, 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, UpdateRouterToolSelectorData, UpdateRouterToolSelectorErrors, UpdateRouterToolSelectorResponses, UpdateScheduleData, UpdateScheduleErrors, UpdateScheduleResponses, UpdateSessionConfigData, UpdateSessionConfigErrors, UpdateSessionConfigResponses, UpdateSessionNameData, UpdateSessionNameErrors, UpdateSessionNameResponses, UpdateSessionUserRecipeValuesData, UpdateSessionUserRecipeValuesErrors, UpdateSessionUserRecipeValuesResponses, UpsertConfigData, UpsertConfigErrors, UpsertConfigResponses, UpsertPermissionsData, UpsertPermissionsErrors, UpsertPermissionsResponses, ValidateConfigData, ValidateConfigErrors, ValidateConfigResponses } from './types.gen';
import type { AddExtensionData, AddExtensionErrors, AddExtensionResponses, AddSubRecipesData, AddSubRecipesErrors, AddSubRecipesResponses, 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, EncodeRecipeData, EncodeRecipeErrors, EncodeRecipeResponses, ExportSessionData, ExportSessionErrors, ExportSessionResponses, ExtendPromptData, ExtendPromptErrors, ExtendPromptResponses, 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, ManageContextData, ManageContextErrors, ManageContextResponses, 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, UpdateRouterToolSelectorData, UpdateRouterToolSelectorErrors, UpdateRouterToolSelectorResponses, UpdateScheduleData, UpdateScheduleErrors, UpdateScheduleResponses, UpdateSessionConfigData, UpdateSessionConfigErrors, UpdateSessionConfigResponses, UpdateSessionDescriptionData, UpdateSessionDescriptionErrors, UpdateSessionDescriptionResponses, 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> & {
/**
@@ -504,16 +504,9 @@ export const getSession = <ThrowOnError extends boolean = false>(options: Option
});
};
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',
export const updateSessionDescription = <ThrowOnError extends boolean = false>(options: Options<UpdateSessionDescriptionData, ThrowOnError>) => {
return (options.client ?? client).put<UpdateSessionDescriptionResponses, UpdateSessionDescriptionErrors, ThrowOnError>({
url: '/sessions/{session_id}/description',
...options,
headers: {
'Content-Type': 'application/json',
@@ -522,6 +515,13 @@ export const updateSessionName = <ThrowOnError extends boolean = false>(options:
});
};
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',
+42 -43
View File
@@ -693,11 +693,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;
@@ -706,7 +706,6 @@ export type Session = {
user_recipe_values?: {
[key: string]: string;
} | null;
user_set_name?: boolean;
working_dir: string;
};
@@ -889,11 +888,11 @@ export type UpdateScheduleRequest = {
cron: string;
};
export type UpdateSessionNameRequest = {
export type UpdateSessionDescriptionRequest = {
/**
* Updated name for the session (max 200 characters)
* Updated description (name) for the session (max 200 characters)
*/
name: string;
description: string;
};
export type UpdateSessionUserRecipeValuesRequest = {
@@ -2394,6 +2393,44 @@ 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: {
@@ -2430,44 +2467,6 @@ 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: {
+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}
+1 -1
View File
@@ -55,7 +55,7 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
const resetChat = () => {
setChat({
sessionId: '',
name: DEFAULT_CHAT_TITLE,
title: DEFAULT_CHAT_TITLE,
messages: [],
messageHistoryIndex: 0,
recipe: null,
+2 -2
View File
@@ -81,7 +81,7 @@ export function useAgent(): UseAgentReturn {
const messages = agentSession.conversation || [];
return {
sessionId: agentSession.id,
name: agentSession.recipe?.title || agentSession.name,
title: agentSession.recipe?.title || agentSession.description,
messageHistoryIndex: 0,
messages,
recipe: agentSession.recipe,
@@ -182,7 +182,7 @@ export function useAgent(): UseAgentReturn {
const messages = initContext.recipe && !initContext.resumeSessionId ? [] : conversation;
let initChat: ChatType = {
sessionId: agentSession.id,
name: agentSession.recipe?.title || agentSession.name,
title: agentSession.recipe?.title || agentSession.description,
messageHistoryIndex: 0,
messages: messages,
recipe: recipe,
+1 -1
View File
@@ -131,7 +131,7 @@ describe('useChatEngine', () => {
const mockChat: ChatType = {
sessionId: 'test-chat',
messages: initialMessages,
name: 'Test Chat',
title: 'Test Chat',
messageHistoryIndex: 0,
};
+1 -1
View File
@@ -3,7 +3,7 @@ import { Message } from '../api';
export interface ChatType {
sessionId: string;
name: string;
title: string;
messageHistoryIndex: number;
messages: Message[];
recipe?: Recipe | null; // Add recipe configuration to chat state