-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paththinking-process-block.tsx
38 lines (34 loc) · 1.05 KB
/
thinking-process-block.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use client';
import React from 'react';
import { ChevronDown, ChevronRight } from 'lucide-react';
import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { Message } from '@/const/MessageType';
interface ThinkingProcessBlockProps {
thinking: Message;
}
export default function ThinkingProcessBlock({
thinking,
}: ThinkingProcessBlockProps) {
const [isExpanded, setIsExpanded] = React.useState(false);
return (
<>
<button
onClick={() => setIsExpanded(!isExpanded)}
className="flex items-center gap-1 text-xs text-muted-foreground hover:text-muted-foreground/80 transition-colors"
>
{isExpanded ? (
<ChevronDown className="h-3 w-3" />
) : (
<ChevronRight className="h-3 w-3" />
)}
Thinking Process
</button>
{isExpanded && (
<div className="mt-2 mb-4 pl-4 text-sm text-muted-foreground border-l-2 border-muted/20">
<Markdown remarkPlugins={[remarkGfm]}>{thinking.content}</Markdown>
</div>
)}
</>
);
}