The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Flatten AI tool call output structure (#19524)
Félix Malfaitdf1d0d877d30
diff --git a/packages/twenty-front/src/modules/ai/hooks/useProcessUIToolCallMessage.ts b/packages/twenty-front/src/modules/ai/hooks/useProcessUIToolCallMessage.tsindex c21d4ebd749..403945c7cfe 100644--- a/packages/twenty-front/src/modules/ai/hooks/useProcessUIToolCallMessage.ts+++ b/packages/twenty-front/src/modules/ai/hooks/useProcessUIToolCallMessage.ts@@ -42,7 +42,7 @@ export const useProcessUIToolCallMessage = () => {continue;}- if (toolExecutionPart.output.result.success !== true) {+ if (toolExecutionPart.output.success !== true) {continue;}@@ -51,7 +51,11 @@ export const useProcessUIToolCallMessage = () => {toolExecutionPart.toolCallId,]);- const navigateAppOutput = toolExecutionPart.output.result.result;+ const navigateAppOutput = toolExecutionPart.output.result;++ if (!isDefined(navigateAppOutput)) {+ continue;+ }switch (navigateAppOutput.action) {case 'navigateToObject': {diff --git a/packages/twenty-front/src/modules/ai/types/AgentChatMessageUIToolCallPart.ts b/packages/twenty-front/src/modules/ai/types/AgentChatMessageUIToolCallPart.tsindex 9e6aa1c06dc..92878fbcc83 100644--- a/packages/twenty-front/src/modules/ai/types/AgentChatMessageUIToolCallPart.ts+++ b/packages/twenty-front/src/modules/ai/types/AgentChatMessageUIToolCallPart.ts@@ -5,11 +5,9 @@ export type AgentChatMessageUIToolCallPart = {toolCallId: string;state: string;output: {- toolName: string;- result: {- message: string;- result: NavigateAppToolOutput;- success: boolean;- };+ success: boolean;+ message: string;+ error?: string;+ result?: NavigateAppToolOutput;};};