revert: restore batched chat history loading
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
This commit is contained in:
@@ -131,7 +131,10 @@ import type {
|
|||||||
ImageViewerItem,
|
ImageViewerItem,
|
||||||
Message,
|
Message,
|
||||||
} from "./ChatTimeline";
|
} from "./ChatTimeline";
|
||||||
import type { ChatScrollSnapshot } from "./ChatHistoryPane";
|
import {
|
||||||
|
messageRenderBatchSize,
|
||||||
|
type ChatScrollSnapshot,
|
||||||
|
} from "./ChatHistoryPane";
|
||||||
import { usePaneOrder } from "./pane-order";
|
import { usePaneOrder } from "./pane-order";
|
||||||
import { getConversationDisplayTitle, isUnusedConversation, type Conversation } from "./chat-conversation";
|
import { getConversationDisplayTitle, isUnusedConversation, type Conversation } from "./chat-conversation";
|
||||||
import {
|
import {
|
||||||
@@ -1803,6 +1806,9 @@ function App(): React.JSX.Element {
|
|||||||
),
|
),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
const [visibleMessageCounts, setVisibleMessageCounts] = useState<
|
||||||
|
Record<string, number>
|
||||||
|
>({});
|
||||||
const sidebarRef = useRef<HTMLElement>(null);
|
const sidebarRef = useRef<HTMLElement>(null);
|
||||||
const sidebarToggleRef = useRef<HTMLButtonElement>(null);
|
const sidebarToggleRef = useRef<HTMLButtonElement>(null);
|
||||||
const livePrimarySidebarWidthRef = useRef(primarySidebarWidth);
|
const livePrimarySidebarWidthRef = useRef(primarySidebarWidth);
|
||||||
@@ -1857,6 +1863,15 @@ function App(): React.JSX.Element {
|
|||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
const handleVisibleMessageCountChange = useCallback(
|
||||||
|
(conversationId: string, count: number): void => {
|
||||||
|
setVisibleMessageCounts((current) => ({
|
||||||
|
...current,
|
||||||
|
[conversationId]: count,
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
const closeNarrowSidebar = useCallback((): void => {
|
const closeNarrowSidebar = useCallback((): void => {
|
||||||
setSidebarOpen(false);
|
setSidebarOpen(false);
|
||||||
requestAnimationFrame(() => sidebarToggleRef.current?.focus());
|
requestAnimationFrame(() => sidebarToggleRef.current?.focus());
|
||||||
@@ -4565,6 +4580,11 @@ function App(): React.JSX.Element {
|
|||||||
delete next[conversationId];
|
delete next[conversationId];
|
||||||
return next;
|
return next;
|
||||||
});
|
});
|
||||||
|
setVisibleMessageCounts((current) => {
|
||||||
|
const next = { ...current };
|
||||||
|
delete next[conversationId];
|
||||||
|
return next;
|
||||||
|
});
|
||||||
setConversationActivity(conversationId, false);
|
setConversationActivity(conversationId, false);
|
||||||
const remaining = conversationStore.getState().filter(
|
const remaining = conversationStore.getState().filter(
|
||||||
(conversation) => conversation.id !== conversationId,
|
(conversation) => conversation.id !== conversationId,
|
||||||
@@ -5921,6 +5941,7 @@ function App(): React.JSX.Element {
|
|||||||
const index = conversation.messages.findIndex(item => item.id === targetId);
|
const index = conversation.messages.findIndex(item => item.id === targetId);
|
||||||
if (index < 0 || !snapshot.messages.some(message => message.id === targetId)) notify({ tone: 'info', message: t('magicNotes:capture.missingMessage') });
|
if (index < 0 || !snapshot.messages.some(message => message.id === targetId)) notify({ tone: 'info', message: t('magicNotes:capture.missingMessage') });
|
||||||
else {
|
else {
|
||||||
|
setVisibleMessageCounts(current => ({ ...current, [source.conversationId]: Math.max(current[source.conversationId] ?? messageRenderBatchSize, conversation.messages.length - index) }));
|
||||||
setNoteMessageNavigation({ conversationId: source.conversationId, messageId: targetId, requestId: Date.now() });
|
setNoteMessageNavigation({ conversationId: source.conversationId, messageId: targetId, requestId: Date.now() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7060,12 +7081,19 @@ function App(): React.JSX.Element {
|
|||||||
onSelectTask={setSelectedAssistantTaskId}
|
onSelectTask={setSelectedAssistantTaskId}
|
||||||
onSetInput={setQuickActionInput}
|
onSetInput={setQuickActionInput}
|
||||||
onSetScheduleEnabled={setAssistantScheduleEnabled}
|
onSetScheduleEnabled={setAssistantScheduleEnabled}
|
||||||
|
onVisibleMessageCountChange={
|
||||||
|
handleVisibleMessageCountChange
|
||||||
|
}
|
||||||
quickActions={quickActions}
|
quickActions={quickActions}
|
||||||
schedules={assistantSchedules}
|
schedules={assistantSchedules}
|
||||||
scrollSnapshot={chatScrollSnapshots[conversationId]}
|
scrollSnapshot={chatScrollSnapshots[conversationId]}
|
||||||
selectedAssistantTaskId={selectedAssistantTaskId}
|
selectedAssistantTaskId={selectedAssistantTaskId}
|
||||||
store={conversationStore}
|
store={conversationStore}
|
||||||
tasks={tasksByConversation.get(conversationId) ?? emptyConversationTasks}
|
tasks={tasksByConversation.get(conversationId) ?? emptyConversationTasks}
|
||||||
|
visibleMessageCount={
|
||||||
|
visibleMessageCounts[conversationId] ??
|
||||||
|
messageRenderBatchSize
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{activeProject?.kind === "channel" &&
|
{activeProject?.kind === "channel" &&
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ function ConversationHistoryLoader({ conversationId, active, load }: {
|
|||||||
</section>;
|
</section>;
|
||||||
}
|
}
|
||||||
|
|
||||||
type PaneProps = Omit<ComponentProps<typeof ChatHistoryPane>, "conversation" | "taskStrip" | "artifactById" | "onVisibleMessageCountChange" | "visibleMessageCount">;
|
type PaneProps = Omit<ComponentProps<typeof ChatHistoryPane>, "conversation" | "taskStrip" | "artifactById">;
|
||||||
|
|
||||||
const ignoreVisibleMessageCountChange = (): void => undefined;
|
|
||||||
|
|
||||||
export type ConversationHistorySlotProps = PaneProps & {
|
export type ConversationHistorySlotProps = PaneProps & {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
@@ -112,12 +110,5 @@ export const ConversationHistorySlot = memo(function ConversationHistorySlot({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return <ChatHistoryPane
|
return <ChatHistoryPane {...paneProps} artifactById={artifactById} conversation={conversation} taskStrip={taskStrip} />;
|
||||||
{...paneProps}
|
|
||||||
artifactById={artifactById}
|
|
||||||
conversation={conversation}
|
|
||||||
onVisibleMessageCountChange={ignoreVisibleMessageCountChange}
|
|
||||||
taskStrip={taskStrip}
|
|
||||||
visibleMessageCount={conversation.messages.length}
|
|
||||||
/>;
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user