MCPcopy Create free account
hub / github.com/TanStack/ai / TextPart

Function TextPart

packages/ai-solid-ui/src/text-part.tsx:43–71  ·  view source on GitHub ↗
(props: TextPartProps)

Source from the content-addressed store, hash-verified

41 * ```
42 */
43export function TextPart(props: TextPartProps) {
44 const roleClass = () =>
45 props.role === 'user'
46 ? (props.userClass ?? '')
47 : props.role === 'assistant'
48 ? (props.assistantClass ?? '')
49 : ''
50 const combinedClass = () =>
51 [props.class ?? '', roleClass()].filter(Boolean).join(' ')
52
53 const resolved = () =>
54 resolveMarkdownPlugins({
55 remarkPlugins: props.remarkPlugins,
56 rehypePlugins: props.rehypePlugins,
57 disableDefaultPlugins: props.disableDefaultPlugins,
58 })
59
60 return (
61 <div class={combinedClass() || undefined}>
62 <SolidMarkdown
63 remarkPlugins={resolved().remarkPlugins}
64 rehypePlugins={resolved().rehypePlugins}
65 components={props.components}
66 >
67 {props.content}
68 </SolidMarkdown>
69 </div>
70 )
71}

Callers

nothing calls this directly

Calls 2

resolvedFunction · 0.85
combinedClassFunction · 0.70

Tested by

no test coverage detected