-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(playground): make chat messages match style in traces (#4931)
* feat(playground): make chat messages match style in traces * small fixes * WIP
- Loading branch information
1 parent
784606a
commit ed6e05e
Showing
6 changed files
with
112 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { useMemo } from "react"; | ||
|
||
import { ViewStyleProps } from "@arizeai/components"; | ||
|
||
export function useChatMessageStyles( | ||
role: string | ||
): Pick<ViewStyleProps, "backgroundColor" | "borderColor"> { | ||
return useMemo<ViewStyleProps>(() => { | ||
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]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters