Files
twenty/packages/twenty-front/src/modules/ai/components/AIChatStandaloneError.tsx
T
Lucas Bordeau 2a82df7073 AI tools to create a demo workspace (#18236)
This PR adds the necessary tool to create a demo workspace with :
relevant custom objects and fields, mock data and a real dashboard with
graph widgets.

It is still a bit under-optimized and slow but it works.

This PR also adds an AI tool that allows to see what happens in real
time, it navigates the app and waits when necessary.

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2026-03-05 11:39:31 +01:00

40 lines
1.3 KiB
TypeScript

import { styled } from '@linaria/react';
import { AIChatErrorRenderer } from '@/ai/components/AIChatErrorRenderer';
import { agentChatErrorState } from '@/ai/states/agentChatErrorState';
import { agentChatHasMessageComponentSelector } from '@/ai/states/agentChatHasMessageComponentSelector';
import { agentChatIsLoadingState } from '@/ai/states/agentChatIsLoadingState';
import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { isDefined } from 'twenty-shared/utils';
const StyledErrorContainer = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
width: 100%;
`;
export const AIChatStandaloneError = () => {
const agentChatIsLoading = useAtomStateValue(agentChatIsLoadingState);
const agentChatError = useAtomStateValue(agentChatErrorState);
const hasMessages = useAtomComponentSelectorValue(
agentChatHasMessageComponentSelector,
);
const shouldRender =
!hasMessages && isDefined(agentChatError) && !agentChatIsLoading;
if (!shouldRender) {
return null;
}
return (
<StyledErrorContainer>
<AIChatErrorRenderer error={agentChatError} />
</StyledErrorContainer>
);
};