import { Show, createEffect, createSignal } from 'solid-js'
export interface ThinkingPartProps {
/** The thinking content to render */
content: string
/** Base class applied to thinking parts */
class?: string
/** Whether thinking is complete (has text content after) */
isComplete?: boolean
}
/**
* ThinkingPart component - renders thinking/reasoning content
*
* This component displays the model's internal reasoning process,
* typically shown in a collapsed or expandable format to distinguish
* it from the final response. It automatically collapses when thinking
* is complete.
*
* @example Standalone usage
* ```tsx
*
* ```
*
* @example Usage in partRenderers
* ```tsx
* (
*
* )
* }}
* />
* ```
*/
export function ThinkingPart(props: ThinkingPartProps) {
const [isCollapsed, setIsCollapsed] = createSignal(false)
// Auto-collapse when thinking completes
createEffect(() => {
if (props.isComplete) {
setIsCollapsed(true)
}
})
return (
{props.content}
)
}