增加会话标题重命名功能,优化历史面板交互
This commit is contained in:
@@ -70,6 +70,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
cycleBranch,
|
||||
abort,
|
||||
createSession,
|
||||
renameSession,
|
||||
removeSession,
|
||||
switchSession,
|
||||
} = useAgentChatSession({
|
||||
@@ -134,6 +135,21 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
[removeSession],
|
||||
);
|
||||
|
||||
const handleRenameSession = useCallback(
|
||||
(storageSessionId: string, title: string) => {
|
||||
void renameSession(storageSessionId, title);
|
||||
},
|
||||
[renameSession],
|
||||
);
|
||||
|
||||
const handleRenameActiveSession = useCallback(
|
||||
(title: string) => {
|
||||
if (!activeStorageSessionId) return;
|
||||
void renameSession(activeStorageSessionId, title);
|
||||
},
|
||||
[activeStorageSessionId, renameSession],
|
||||
);
|
||||
|
||||
const handleMouseDown = useCallback((event: React.MouseEvent) => {
|
||||
event.preventDefault();
|
||||
setIsResizing(true);
|
||||
@@ -231,9 +247,12 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
|
||||
<AgentHeader
|
||||
sessionTitle={sessionTitle}
|
||||
canRenameSessionTitle={Boolean(activeStorageSessionId)}
|
||||
isHydrating={isHydrating}
|
||||
isStreaming={isStreaming}
|
||||
isHistoryOpen={isHistoryOpen}
|
||||
onHistoryToggle={handleHistoryToggle}
|
||||
onRenameSessionTitle={handleRenameActiveSession}
|
||||
onNewConversation={handleNewConversation}
|
||||
onClose={onClose}
|
||||
/>
|
||||
@@ -277,6 +296,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
handleSelectSession(id);
|
||||
setIsHistoryOpen(false);
|
||||
}}
|
||||
onRenameSession={handleRenameSession}
|
||||
onDeleteSession={handleDeleteSession}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user