docs: publish chat history navigation workflow
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
Deploy website to GitHub Pages / Deploy static website (push) Canceled after 0s

This commit is contained in:
mesalogo
2026-10-08 16:34:25 +08:00
parent 670b598530
commit e2a5f83666
11 changed files with 180 additions and 40 deletions
+1 -29
View File
@@ -131,10 +131,7 @@ import type {
ImageViewerItem,
Message,
} from "./ChatTimeline";
import {
messageRenderBatchSize,
type ChatScrollSnapshot,
} from "./ChatHistoryPane";
import type { ChatScrollSnapshot } from "./ChatHistoryPane";
import { usePaneOrder } from "./pane-order";
import { getConversationDisplayTitle, isUnusedConversation, type Conversation } from "./chat-conversation";
import {
@@ -1806,9 +1803,6 @@ function App(): React.JSX.Element {
),
[],
);
const [visibleMessageCounts, setVisibleMessageCounts] = useState<
Record<string, number>
>({});
const sidebarRef = useRef<HTMLElement>(null);
const sidebarToggleRef = useRef<HTMLButtonElement>(null);
const livePrimarySidebarWidthRef = useRef(primarySidebarWidth);
@@ -1863,15 +1857,6 @@ function App(): React.JSX.Element {
},
[],
);
const handleVisibleMessageCountChange = useCallback(
(conversationId: string, count: number): void => {
setVisibleMessageCounts((current) => ({
...current,
[conversationId]: count,
}));
},
[],
);
const closeNarrowSidebar = useCallback((): void => {
setSidebarOpen(false);
requestAnimationFrame(() => sidebarToggleRef.current?.focus());
@@ -4580,11 +4565,6 @@ function App(): React.JSX.Element {
delete next[conversationId];
return next;
});
setVisibleMessageCounts((current) => {
const next = { ...current };
delete next[conversationId];
return next;
});
setConversationActivity(conversationId, false);
const remaining = conversationStore.getState().filter(
(conversation) => conversation.id !== conversationId,
@@ -5941,7 +5921,6 @@ function App(): React.JSX.Element {
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') });
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() });
}
}
@@ -7081,19 +7060,12 @@ function App(): React.JSX.Element {
onSelectTask={setSelectedAssistantTaskId}
onSetInput={setQuickActionInput}
onSetScheduleEnabled={setAssistantScheduleEnabled}
onVisibleMessageCountChange={
handleVisibleMessageCountChange
}
quickActions={quickActions}
schedules={assistantSchedules}
scrollSnapshot={chatScrollSnapshots[conversationId]}
selectedAssistantTaskId={selectedAssistantTaskId}
store={conversationStore}
tasks={tasksByConversation.get(conversationId) ?? emptyConversationTasks}
visibleMessageCount={
visibleMessageCounts[conversationId] ??
messageRenderBatchSize
}
/>
))}
{activeProject?.kind === "channel" &&
+11 -2
View File
@@ -37,7 +37,9 @@ function ConversationHistoryLoader({ conversationId, active, load }: {
</section>;
}
type PaneProps = Omit<ComponentProps<typeof ChatHistoryPane>, "conversation" | "taskStrip" | "artifactById">;
type PaneProps = Omit<ComponentProps<typeof ChatHistoryPane>, "conversation" | "taskStrip" | "artifactById" | "onVisibleMessageCountChange" | "visibleMessageCount">;
const ignoreVisibleMessageCountChange = (): void => undefined;
export type ConversationHistorySlotProps = PaneProps & {
conversationId: string;
@@ -110,5 +112,12 @@ export const ConversationHistorySlot = memo(function ConversationHistorySlot({
/>
);
}
return <ChatHistoryPane {...paneProps} artifactById={artifactById} conversation={conversation} taskStrip={taskStrip} />;
return <ChatHistoryPane
{...paneProps}
artifactById={artifactById}
conversation={conversation}
onVisibleMessageCountChange={ignoreVisibleMessageCountChange}
taskStrip={taskStrip}
visibleMessageCount={conversation.messages.length}
/>;
});