feat: add message compaction for AI chats (#19205)

This commit is contained in:
Abdul Rahman
2026-04-02 20:43:11 +05:30
committed by GitHub
parent c1e4756f9c
commit 7f2b853ae1
11 changed files with 146 additions and 15 deletions
@@ -1,3 +1,4 @@
import { AIChatCompactionIndicator } from '@/ai/components/AIChatCompactionIndicator';
import { CodeExecutionDisplay } from '@/ai/components/CodeExecutionDisplay';
import { RoutingStatusDisplay } from '@/ai/components/RoutingStatusDisplay';
import { ThinkingStepsDisplay } from '@/ai/components/ThinkingStepsDisplay';
@@ -58,6 +59,8 @@ const MessagePartRenderer = ({
return <LazyMarkdownRenderer text={part.text} />;
case 'data-routing-status':
return <RoutingStatusDisplay data={part.data} />;
case 'data-compaction':
return <AIChatCompactionIndicator />;
case 'data-code-execution':
return (
<CodeExecutionDisplay
@@ -0,0 +1,30 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { IconTransform } from 'twenty-ui/display';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledIndicatorContainer = styled.div`
align-items: center;
color: ${themeCssVariables.font.color.tertiary};
display: flex;
gap: ${themeCssVariables.spacing[1]};
`;
const StyledIconTextContainer = styled.div`
align-items: center;
display: flex;
gap: ${themeCssVariables.spacing[1]};
`;
export const AIChatCompactionIndicator = () => {
const { theme } = useContext(ThemeContext);
return (
<StyledIndicatorContainer>
<StyledIconTextContainer>
<IconTransform size={theme.icon.size.sm} />
<div>The conversation has been compacted</div>
</StyledIconTextContainer>
</StyledIndicatorContainer>
);
};
@@ -51,7 +51,7 @@ export const mapDBPartToUIMessagePart = (
};
case 'step-start':
return {
type: 'step-start',
type: part.type,
};
case 'data-routing-status':
return {