fix(chat): add history loading skeletons
This commit is contained in:
@@ -68,6 +68,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
chatSessions,
|
||||
activeSessionId,
|
||||
isHydrating,
|
||||
loadingSessionId,
|
||||
isStreaming,
|
||||
sessionTitle,
|
||||
sendPrompt,
|
||||
@@ -159,9 +160,9 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
}, []);
|
||||
|
||||
const handleSelectSession = useCallback(
|
||||
(sessionId: string) => {
|
||||
(sessionId: string, title: string) => {
|
||||
composerRef.current?.clear();
|
||||
void switchSession(sessionId);
|
||||
void switchSession(sessionId, title);
|
||||
},
|
||||
[switchSession],
|
||||
);
|
||||
@@ -326,12 +327,14 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
sessions={chatSessions}
|
||||
activeSessionId={activeSessionId}
|
||||
isHydrating={isHydrating}
|
||||
isLoadingSessions={isHydrating && chatSessions.length === 0}
|
||||
loadingSessionId={loadingSessionId}
|
||||
onNewSession={() => {
|
||||
handleNewConversation();
|
||||
setIsHistoryOpen(false);
|
||||
}}
|
||||
onSelectSession={(id) => {
|
||||
handleSelectSession(id);
|
||||
onSelectSession={(id, title) => {
|
||||
handleSelectSession(id, title);
|
||||
setIsHistoryOpen(false);
|
||||
}}
|
||||
onRenameSession={handleRenameSession}
|
||||
@@ -343,6 +346,7 @@ export const GlobalChatbox: React.FC<Props> = ({ open, onClose }) => {
|
||||
<AgentWorkspace
|
||||
messages={messages}
|
||||
isStreaming={isStreaming}
|
||||
isLoadingSession={Boolean(loadingSessionId)}
|
||||
bottomRef={bottomRef}
|
||||
speakingMessageId={speakingMessageId}
|
||||
speechState={speechState}
|
||||
|
||||
Reference in New Issue
Block a user