MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / FormattedMessage

Function FormattedMessage

app/src/components/nodeEntries/FormattedMessage.tsx:24–55  ·  view source on GitHub ↗
({
  message,
  preferJson = false,
}: {
  message: ChatCompletionMessage;
  preferJson?: boolean;
})

Source from the content-addressed store, hash-verified

22};
23
24const FormattedMessage = ({
25 message,
26 preferJson = false,
27}: {
28 message: ChatCompletionMessage;
29 preferJson?: boolean;
30}) => {
31 if (message.tool_calls) {
32 return (
33 <VStack alignItems="flex-start" whiteSpace="pre-wrap" w="full">
34 <Text fontWeight="bold" color="gray.500">
35 tool_calls
36 </Text>
37 {message.tool_calls.map((toolCall, index) => {
38 const fn = toolCall.function;
39
40 return <HighlightedJson key={index} fnLabel={fn.name} json={fn.arguments} />;
41 })}
42 </VStack>
43 );
44 }
45
46 if (preferJson) {
47 return <HighlightedJson json={message.content ?? ""} />;
48 }
49
50 return (
51 <Text whiteSpace="pre-wrap" maxW="full">
52 {message.content}
53 </Text>
54 );
55};
56
57const HighlightedJson = (props: { json: string; fnLabel?: string }) => {
58 let formattedJson = props.json;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected