重构组件,优化性能并移除不必要的属性;撤销滚动条修改;
This commit is contained in:
@@ -85,7 +85,12 @@ const formatToolTitle = (item: ChatProgress) => {
|
||||
return item.title;
|
||||
};
|
||||
|
||||
export const AgentProgressTimeline = ({ progress, isAborted }: { progress: ChatProgress[], isAborted?: boolean }) => {
|
||||
type AgentProgressTimelineProps = {
|
||||
progress: ChatProgress[];
|
||||
isAborted?: boolean;
|
||||
};
|
||||
|
||||
const AgentProgressTimelineInner = ({ progress, isAborted }: AgentProgressTimelineProps) => {
|
||||
const theme = useTheme();
|
||||
const [nowMs, setNowMs] = useState(() => Date.now());
|
||||
|
||||
@@ -356,3 +361,12 @@ export const AgentProgressTimeline = ({ progress, isAborted }: { progress: ChatP
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export const AgentProgressTimeline = React.memo(
|
||||
AgentProgressTimelineInner,
|
||||
(prevProps, nextProps) =>
|
||||
prevProps.progress === nextProps.progress &&
|
||||
prevProps.isAborted === nextProps.isAborted,
|
||||
);
|
||||
|
||||
AgentProgressTimeline.displayName = "AgentProgressTimeline";
|
||||
|
||||
Reference in New Issue
Block a user