From 7458bbdc208e2c80fff5573a0d7414632fff8e4c Mon Sep 17 00:00:00 2001 From: Siddharth Ganesan Date: Mon, 9 Feb 2026 13:59:28 -0800 Subject: [PATCH] Fix dead messages array --- apps/sim/lib/copilot/chat-payload.ts | 45 ---------------------------- 1 file changed, 45 deletions(-) diff --git a/apps/sim/lib/copilot/chat-payload.ts b/apps/sim/lib/copilot/chat-payload.ts index 951e5134c..54763ee02 100644 --- a/apps/sim/lib/copilot/chat-payload.ts +++ b/apps/sim/lib/copilot/chat-payload.ts @@ -46,13 +46,6 @@ interface CredentialsPayload { } } -type MessageContent = string | Array<{ type: string; text?: string; [key: string]: unknown }> - -interface ConversationMessage { - role: string - content: MessageContent -} - function buildProviderConfig(selectedModel: string): CopilotProviderConfig | undefined { const defaults = getCopilotModel('chat') const envModel = env.COPILOT_MODEL || defaults.model @@ -113,12 +106,10 @@ export async function buildCopilotRequestPayload( userId, userMessageId, mode, - conversationHistory = [], contexts, fileAttachments, commands, chatId, - implicitFeedback, } = params const selectedModel = options.selectedModel @@ -129,42 +120,6 @@ export async function buildCopilotRequestPayload( const processedFileContents = await processFileAttachments(fileAttachments ?? [], userId) - const messages: ConversationMessage[] = [] - for (const msg of conversationHistory as Array>) { - const msgAttachments = msg.fileAttachments as Array> | undefined - if (Array.isArray(msgAttachments) && msgAttachments.length > 0) { - const content: Array<{ type: string; text?: string; [key: string]: unknown }> = [ - { type: 'text', text: msg.content as string }, - ] - const processedHistoricalAttachments = await processFileAttachments( - (msgAttachments as BuildPayloadParams['fileAttachments']) ?? [], - userId - ) - for (const fileContent of processedHistoricalAttachments) { - content.push(fileContent) - } - messages.push({ role: msg.role as string, content }) - } else { - messages.push({ role: msg.role as string, content: msg.content as string }) - } - } - - if (implicitFeedback) { - messages.push({ role: 'system', content: implicitFeedback }) - } - - if (processedFileContents.length > 0) { - const content: Array<{ type: string; text?: string; [key: string]: unknown }> = [ - { type: 'text', text: message }, - ] - for (const fileContent of processedFileContents) { - content.push(fileContent) - } - messages.push({ role: 'user', content }) - } else { - messages.push({ role: 'user', content: message }) - } - const integrationTools: ToolSchema[] = [] let credentials: CredentialsPayload | null = null