From f79bf06e386d8875d2484154a4eaabceb39cd0f7 Mon Sep 17 00:00:00 2001 From: KevIsDev Date: Fri, 30 May 2025 14:45:05 +0100 Subject: [PATCH] refactor: modify markdown append message content structure to use array format Change the message content from a plain string to an array of objects with type and text fields to support future extensibility of message formats --- app/components/chat/Markdown.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/components/chat/Markdown.tsx b/app/components/chat/Markdown.tsx index 89ecf8ab..2d65c1b6 100644 --- a/app/components/chat/Markdown.tsx +++ b/app/components/chat/Markdown.tsx @@ -110,7 +110,12 @@ export const Markdown = memo( } else if (type === 'message' && append) { append({ id: `quick-action-message-${Date.now()}`, - content: `[Model: ${model}]\n\n[Provider: ${provider?.name}]\n\n${message}`, + content: [ + { + type: 'text', + text: `[Model: ${model}]\n\n[Provider: ${provider?.name}]\n\n${message}`, + }, + ] as any, role: 'user', }); console.log('Message appended:', message); @@ -118,7 +123,12 @@ export const Markdown = memo( setChatMode('build'); append({ id: `quick-action-implement-${Date.now()}`, - content: `[Model: ${model}]\n\n[Provider: ${provider?.name}]\n\n${message}`, + content: [ + { + type: 'text', + text: `[Model: ${model}]\n\n[Provider: ${provider?.name}]\n\n${message}`, + }, + ] as any, role: 'user', }); } else if (type === 'link' && typeof href === 'string') {