From 454c3daf99663017501c1e4c5224ce3eac0b702d Mon Sep 17 00:00:00 2001 From: Robert Bo Davis Date: Tue, 12 Mar 2024 18:57:57 -0400 Subject: [PATCH] chore: improve tool messsage in remix --- remix/app/components/chat/ChatMessage.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/remix/app/components/chat/ChatMessage.tsx b/remix/app/components/chat/ChatMessage.tsx index 208675a..3a450e7 100644 --- a/remix/app/components/chat/ChatMessage.tsx +++ b/remix/app/components/chat/ChatMessage.tsx @@ -1,19 +1,22 @@ import type { AgentHistoryItem } from '@codellm/core'; -const chatBubbleCommonClassNames = 'whitespace-pre-wrap p-6 chat-bubble'; +const chatBubbleCommonClassNames = 'whitespace-pre-wrap p-6'; const chatBubbleClassNames = { - assistant: `${chatBubbleCommonClassNames} chat-bubble-primary`, - error: `${chatBubbleCommonClassNames} chat-bubble-error`, - tool: `${chatBubbleCommonClassNames} chat-bubble-accent`, - user: `${chatBubbleCommonClassNames}`, + assistant: `${chatBubbleCommonClassNames} chat-bubble chat-bubble-primary`, + error: `${chatBubbleCommonClassNames} chat-bubble chat-bubble-error`, + tool: `${chatBubbleCommonClassNames} card-body rounded-md chat-bubble-accent`, + user: `${chatBubbleCommonClassNames} chat-bubble`, }; export const ChatMessage = ({ message }: { message: AgentHistoryItem }) => { const role = message.role; - const wrapperClassNames = - role === 'user' ? 'chat chat-start' : 'chat chat-end'; + const getWrapperClasses = () => { + if (role === 'user') return 'chat chat-start'; + if (role === 'tool') return 'card items-center m-1'; + return 'chat chat-end'; + }; const Content = () => { if (role === 'error') { @@ -37,7 +40,7 @@ export const ChatMessage = ({ message }: { message: AgentHistoryItem }) => { }; return ( -
+