Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 2 additions & 0 deletions packages/twenty-front/src/generated-metadata/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ export enum ConfigVariablesGroup {
BILLING_CONFIG = 'BILLING_CONFIG',
CAPTCHA_CONFIG = 'CAPTCHA_CONFIG',
CLOUDFLARE_CONFIG = 'CLOUDFLARE_CONFIG',
CODE_INTERPRETER_CONFIG = 'CODE_INTERPRETER_CONFIG',
EMAIL_SETTINGS = 'EMAIL_SETTINGS',
EXCEPTION_HANDLER = 'EXCEPTION_HANDLER',
GOOGLE_AUTH = 'GOOGLE_AUTH',
Expand Down Expand Up @@ -3151,6 +3152,7 @@ export enum PermissionFlagType {
API_KEYS_AND_WEBHOOKS = 'API_KEYS_AND_WEBHOOKS',
APPLICATIONS = 'APPLICATIONS',
BILLING = 'BILLING',
CODE_INTERPRETER_TOOL = 'CODE_INTERPRETER_TOOL',
CONNECTED_ACCOUNTS = 'CONNECTED_ACCOUNTS',
DATA_MODEL = 'DATA_MODEL',
DOWNLOAD_FILE = 'DOWNLOAD_FILE',
Expand Down
2 changes: 2 additions & 0 deletions packages/twenty-front/src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ export enum ConfigVariablesGroup {
BILLING_CONFIG = 'BILLING_CONFIG',
CAPTCHA_CONFIG = 'CAPTCHA_CONFIG',
CLOUDFLARE_CONFIG = 'CLOUDFLARE_CONFIG',
CODE_INTERPRETER_CONFIG = 'CODE_INTERPRETER_CONFIG',
EMAIL_SETTINGS = 'EMAIL_SETTINGS',
EXCEPTION_HANDLER = 'EXCEPTION_HANDLER',
GOOGLE_AUTH = 'GOOGLE_AUTH',
Expand Down Expand Up @@ -3072,6 +3073,7 @@ export enum PermissionFlagType {
API_KEYS_AND_WEBHOOKS = 'API_KEYS_AND_WEBHOOKS',
APPLICATIONS = 'APPLICATIONS',
BILLING = 'BILLING',
CODE_INTERPRETER_TOOL = 'CODE_INTERPRETER_TOOL',
CONNECTED_ACCOUNTS = 'CONNECTED_ACCOUNTS',
DATA_MODEL = 'DATA_MODEL',
DOWNLOAD_FILE = 'DOWNLOAD_FILE',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CodeExecutionDisplay } from '@/ai/components/CodeExecutionDisplay';
import { ReasoningSummaryDisplay } from '@/ai/components/ReasoningSummaryDisplay';
import { RoutingStatusDisplay } from '@/ai/components/RoutingStatusDisplay';
import { IconDotsVertical } from 'twenty-ui/display';
Expand Down Expand Up @@ -65,6 +66,15 @@ export const AIChatAssistantMessageRenderer = ({
isLastMessageStreaming: boolean;
hasError?: boolean;
}) => {
// Filter out data-code-execution parts when tool-code_interpreter exists
// (the tool part contains the final result, data-code-execution is for streaming updates)
const hasCodeInterpreterTool = messageParts.some(
(part) => part.type === 'tool-code_interpreter',
);
const filteredParts = hasCodeInterpreterTool
? messageParts.filter((part) => part.type !== 'data-code-execution')
: messageParts;

const renderMessagePart = (part: ExtendedUIMessagePart, index: number) => {
switch (part.type) {
case 'reasoning':
Expand All @@ -79,6 +89,20 @@ export const AIChatAssistantMessageRenderer = ({
return <LazyMarkdownRenderer key={index} text={part.text} />;
case 'data-routing-status':
return <RoutingStatusDisplay data={part.data} key={index} />;
case 'data-code-execution':
return (
<CodeExecutionDisplay
key={index}
code={part.data.code}
stdout={part.data.stdout}
stderr={part.data.stderr}
exitCode={part.data.exitCode}
files={part.data.files}
isRunning={
part.data.state === 'running' || part.data.state === 'pending'
}
/>
);
default:
{
if (isToolUIPart(part)) {
Expand All @@ -89,14 +113,14 @@ export const AIChatAssistantMessageRenderer = ({
}
};

if (!messageParts.length && !hasError) {
if (!filteredParts.length && !hasError) {
return <InitialLoadingIndicator />;
}

return (
<div>
<StyledMessagePartsContainer>
{messageParts.map(renderMessagePart)}
{filteredParts.map(renderMessagePart)}
</StyledMessagePartsContainer>
{isLastMessageStreaming && !hasError && <StyledStreamingIndicator />}
</div>
Expand Down
Loading
Loading