diff --git a/app/src/hooks/useChatMessageStyles.ts b/app/src/hooks/useChatMessageStyles.ts new file mode 100644 index 0000000000..3ccfb43b54 --- /dev/null +++ b/app/src/hooks/useChatMessageStyles.ts @@ -0,0 +1,35 @@ +import { useMemo } from "react"; + +import { ViewStyleProps } from "@arizeai/components"; + +export function useChatMessageStyles( + role: string +): Pick { + return useMemo(() => { + if (role === "user" || role === "human") { + return { + backgroundColor: "grey-100", + borderColor: "grey-500", + }; + } else if (role === "assistant" || role === "ai") { + return { + backgroundColor: "blue-100", + borderColor: "blue-700", + }; + } else if (role === "system") { + return { + backgroundColor: "indigo-100", + borderColor: "indigo-700", + }; + } else if (["function", "tool"].includes(role)) { + return { + backgroundColor: "yellow-100", + borderColor: "yellow-700", + }; + } + return { + backgroundColor: "grey-100", + borderColor: "grey-700", + }; + }, [role]); +} diff --git a/app/src/pages/playground/Playground.tsx b/app/src/pages/playground/Playground.tsx index 0b45b1cd1e..2cd0dd93a0 100644 --- a/app/src/pages/playground/Playground.tsx +++ b/app/src/pages/playground/Playground.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { Fragment } from "react"; import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels"; import { Button, Flex, Heading, View } from "@arizeai/components"; @@ -48,12 +48,12 @@ function PlaygroundInstances() { {instances.map((instance, i) => ( - <> + {i !== 0 && } - + ))} diff --git a/app/src/pages/playground/PlaygroundChatTemplate.tsx b/app/src/pages/playground/PlaygroundChatTemplate.tsx index 7263eb7b47..021d3f9516 100644 --- a/app/src/pages/playground/PlaygroundChatTemplate.tsx +++ b/app/src/pages/playground/PlaygroundChatTemplate.tsx @@ -1,9 +1,10 @@ -import React from "react"; +import React, { PropsWithChildren } from "react"; import { css } from "@emotion/react"; -import { Card, TextArea } from "@arizeai/components"; +import { Card, CardProps, TextArea } from "@arizeai/components"; import { usePlaygroundContext } from "@phoenix/contexts/PlaygroundContext"; +import { useChatMessageStyles } from "@phoenix/hooks/useChatMessageStyles"; import { MessageRolePicker } from "./MessageRolePicker"; import { PlaygroundInstanceProps } from "./types"; @@ -35,7 +36,8 @@ export function PlaygroundChatTemplate(props: PlaygroundChatTemplateProps) { {template.messages.map((message, index) => { return (
  • - } - variant="compact" - backgroundColor="light" - borderColor="light" > -