From 1209b8d41acfa37c12683d4643a056aa939de7b1 Mon Sep 17 00:00:00 2001 From: nl_0 Date: Fri, 9 Aug 2024 17:30:19 +0200 Subject: [PATCH] distinct tool use styles --- .../app/components/Assistant/UI/Chat/Chat.tsx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/catalog/app/components/Assistant/UI/Chat/Chat.tsx b/catalog/app/components/Assistant/UI/Chat/Chat.tsx index cca9d532b1f..545fc6376a1 100644 --- a/catalog/app/components/Assistant/UI/Chat/Chat.tsx +++ b/catalog/app/components/Assistant/UI/Chat/Chat.tsx @@ -13,10 +13,12 @@ import Input from './Input' import backgroundPattern from './bg.svg' const USER_BG = M.colors.cyan[100] +const TOOL_BG = M.colors.amber[100] const useMessageContainerStyles = M.makeStyles((t) => ({ role_user: {}, role_assistant: {}, + role_tool: {}, messageContainer: { alignItems: 'flex-end', display: 'flex', @@ -25,7 +27,7 @@ const useMessageContainerStyles = M.makeStyles((t) => ({ alignSelf: 'flex-end', flexFlow: 'row-reverse', }, - '&$role_assistant': { + '&$role_assistant, &$role_tool': { alignSelf: 'flex-start', }, }, @@ -39,6 +41,9 @@ const useMessageContainerStyles = M.makeStyles((t) => ({ '$role_assistant &': { background: t.palette.background.paper, }, + '$role_tool &': { + background: TOOL_BG, + }, }, contentArea: { borderRadius: `${t.spacing(1)}px`, @@ -50,6 +55,10 @@ const useMessageContainerStyles = M.makeStyles((t) => ({ background: t.palette.background.paper, borderBottomLeftRadius: 0, }, + '$role_tool &': { + background: TOOL_BG, + borderBottomLeftRadius: 0, + }, }, contents: { ...t.typography.body2, @@ -78,8 +87,14 @@ const useMessageContainerStyles = M.makeStyles((t) => ({ }, })) +const ICONS = { + user: 'person', + assistant: 'assistant', + tool: 'build', +} + interface MessageContainerProps { - role: 'user' | 'assistant' + role: 'user' | 'assistant' | 'tool' children: React.ReactNode actions?: React.ReactNode timestamp?: Date @@ -90,7 +105,7 @@ function MessageContainer({ role, children, actions, timestamp }: MessageContain return (
- {role === 'user' ? 'person' : 'assistant'} + {ICONS[role]}
{children}
@@ -198,7 +213,7 @@ function ToolUseEvent({ ) return ( discard} > @@ -232,7 +247,7 @@ function ToolUseState({ timestamp, dispatch, calls }: ToolUseStateProps) { return ( abort} >