refactor: use backend chat sessions
This commit is contained in:
@@ -60,7 +60,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
const {
|
||||
messages,
|
||||
chatSessions,
|
||||
activeStorageSessionId,
|
||||
activeSessionId,
|
||||
branchGroups,
|
||||
branchTransition,
|
||||
isHydrating,
|
||||
@@ -129,33 +129,33 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
}, []);
|
||||
|
||||
const handleSelectSession = useCallback(
|
||||
(storageSessionId: string) => {
|
||||
(sessionId: string) => {
|
||||
composerRef.current?.clear();
|
||||
void switchSession(storageSessionId);
|
||||
void switchSession(sessionId);
|
||||
},
|
||||
[switchSession],
|
||||
);
|
||||
|
||||
const handleDeleteSession = useCallback(
|
||||
(storageSessionId: string) => {
|
||||
void removeSession(storageSessionId);
|
||||
(sessionId: string) => {
|
||||
void removeSession(sessionId);
|
||||
},
|
||||
[removeSession],
|
||||
);
|
||||
|
||||
const handleRenameSession = useCallback(
|
||||
(storageSessionId: string, title: string) => {
|
||||
void renameSession(storageSessionId, title);
|
||||
(sessionId: string, title: string) => {
|
||||
void renameSession(sessionId, title);
|
||||
},
|
||||
[renameSession],
|
||||
);
|
||||
|
||||
const handleRenameActiveSession = useCallback(
|
||||
(title: string) => {
|
||||
if (!activeStorageSessionId) return;
|
||||
void renameSession(activeStorageSessionId, title);
|
||||
if (!activeSessionId) return;
|
||||
void renameSession(activeSessionId, title);
|
||||
},
|
||||
[activeStorageSessionId, renameSession],
|
||||
[activeSessionId, renameSession],
|
||||
);
|
||||
|
||||
const handleMouseDown = useCallback((event: React.MouseEvent) => {
|
||||
@@ -255,7 +255,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
|
||||
<AgentHeader
|
||||
sessionTitle={sessionTitle}
|
||||
canRenameSessionTitle={Boolean(activeStorageSessionId)}
|
||||
canRenameSessionTitle={Boolean(activeSessionId)}
|
||||
isHydrating={isHydrating}
|
||||
isStreaming={isStreaming}
|
||||
isHistoryOpen={isHistoryOpen}
|
||||
@@ -294,7 +294,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
>
|
||||
<AgentHistoryPanel
|
||||
sessions={chatSessions}
|
||||
activeSessionId={activeStorageSessionId}
|
||||
activeSessionId={activeSessionId}
|
||||
isHydrating={isHydrating}
|
||||
onNewSession={() => {
|
||||
handleNewConversation();
|
||||
|
||||
Reference in New Issue
Block a user