Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/renderer/components/copilot/CopilotPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,16 @@ export function CopilotPage() {
() => new Set(session?.supersededSuggestionIds || []),
[session],
);
// 每个 run 的排名复核摘要一次算好(O(runs × 快照) 只在 session/快照变化时发生);
// AI 流式逐 token 重渲染时只做 Map 查询,不再每次全量过滤快照。
const rankRunSummaries = useMemo(() => {
const snapshots = product?.rankSnapshots || [];
const map = new Map<string, string | null>();
for (const run of session?.actionRuns || []) {
map.set(run.id, completedRankRunSummary(run, snapshots));
}
return map;
}, [session?.actionRuns, product?.rankSnapshots]);
const orderedSuggestions = useMemo(() => [...(session?.suggestions || [])]
.map((item, index) => ({ item, index }))
.sort((a, b) => {
Expand Down Expand Up @@ -891,7 +901,7 @@ export function CopilotPage() {
</div>
)}
{actionRuns.map((run, runIndex) => {
const rankResult = completedRankRunSummary(run, product.rankSnapshots || []);
const rankResult = rankRunSummaries.get(run.id) ?? null;
return (
<div key={run.id} className={cn(
"mt-2 border-t pt-2 text-[11px]",
Expand Down
486 changes: 383 additions & 103 deletions src/renderer/components/keywords/KeywordsPage.tsx

Large diffs are not rendered by default.

Loading
Loading