import type { ComponentProps } from 'react' import { cn } from '@langgenius/dify-ui/cn' import { useTranslation } from 'react-i18next' type ThinkingDetailsProps = ComponentProps<'details'> & { isComplete: boolean elapsedTime: number } /** * Presentational collapsible "thinking" shell: the chevron summary with the * "Thinking…/Thought (Xs)" label and the bordered content body. Driver-agnostic * — callers compute `isComplete`/`elapsedTime` and pass the body as children. */ const ThinkingDetails = ({ isComplete, elapsedTime, className, open, children, ...rest }: ThinkingDetailsProps) => { const { t } = useTranslation() return (
{isComplete ? `${t(($) => $['chat.thought'], { ns: 'common' })}(${elapsedTime.toFixed(1)}s)` : `${t(($) => $['chat.thinking'], { ns: 'common' })}(${elapsedTime.toFixed(1)}s)`}
{children}
) } export default ThinkingDetails