223943550c
closes https://discord.com/channels/1130383047699738754/1480991390782455838 - Use data-code-execution as the streaming source of truth and hide duplicate code-interpreter tool parts (including tool-execute_tool wrappers). - Ensure wrapped execute_tool code-interpreter outputs still render correctly after refetch. - Gate code-interpreter server behavior by enablement state and keep assistant messages full-width to avoid streaming vs completed width shifts. Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
23 lines
505 B
TypeScript
23 lines
505 B
TypeScript
import { isToolUIPart } from 'ai';
|
|
import { type ExtendedUIMessagePart } from 'twenty-shared/ai';
|
|
|
|
export const isCodeInterpreterToolPart = (
|
|
part: ExtendedUIMessagePart,
|
|
): boolean => {
|
|
if (!isToolUIPart(part)) {
|
|
return false;
|
|
}
|
|
|
|
if (part.type === 'tool-code_interpreter') {
|
|
return true;
|
|
}
|
|
|
|
if (part.type === 'tool-execute_tool') {
|
|
const input = part.input as Record<string, unknown> | null | undefined;
|
|
|
|
return input?.toolName === 'code_interpreter';
|
|
}
|
|
|
|
return false;
|
|
};
|