Skip to content

Commit 0e4ec9b

Browse files
committed
sync changes
1 parent 1ef6a69 commit 0e4ec9b

File tree

4 files changed

+88
-2
lines changed

4 files changed

+88
-2
lines changed

app/(dashboard)/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Link from 'next/link';
55
import { Button } from '@/components/ui/button';
66
import { ArrowRight, CreditCard, Database, Calendar, User, Clock, Eye, Heart, ThumbsUp, Share2 } from 'lucide-react';
77

8-
import { Terminal } from './terminal';
8+
import { Terminal_Prompt } from './terminal_prompt';
99

1010
// Type definitions
1111
interface VisitorSession {
@@ -851,7 +851,7 @@ export default function HomePage() {
851851
</div> */}
852852
</div>
853853
<div className="mt-12 relative sm:max-w-lg sm:mx-auto lg:mt-0 lg:max-w-none lg:mx-0 lg:col-span-5 lg:flex lg:items-center">
854-
<Terminal />
854+
<Terminal_Prompt />
855855
</div>
856856
</div>
857857
</div>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
'use client';
2+
3+
import { useState, useEffect } from 'react';
4+
import { Copy, Check, RotateCcw } from 'lucide-react';
5+
6+
export function Terminal_Prompt() {
7+
const [terminalStep, setTerminalStep] = useState(0);
8+
const [copied, setCopied] = useState(false);
9+
const terminalSteps = [
10+
{ line: 'Generate 10 responses to the user query. Each response should be approximately 200 words.', showPrompt: true },
11+
{ line: '', showPrompt: false },
12+
{ line: 'Return the responses in JSON format with the key: "responses" (list of dicts). Each dictionary must include:', showPrompt: false },
13+
{ line: '- \'text\': the response string only (no explanation or extra text).', showPrompt: false },
14+
{ line: '- \'probability\': the estimated probability from 0.0 to 1.0 of this response given the input prompt (relative to the full distribution).', showPrompt: false },
15+
{ line: '', showPrompt: false },
16+
{ line: 'Randomly sample the responses from the full distribution. Return ONLY the JSON object, with no additional explanations or text.', showPrompt: false },
17+
{ line: '', showPrompt: false },
18+
{ line: '<user_query>Write a short story about a bear.</user_query>', showPrompt: true },
19+
];
20+
21+
const fullPrompt = terminalSteps.map(step => step.line).join('\n');
22+
23+
useEffect(() => {
24+
if (terminalStep < terminalSteps.length) {
25+
const timer = setTimeout(() => {
26+
setTerminalStep(prev => prev + 1);
27+
}, 800);
28+
return () => clearTimeout(timer);
29+
}
30+
}, [terminalStep, terminalSteps.length]);
31+
32+
const copyToClipboard = () => {
33+
navigator.clipboard.writeText(fullPrompt);
34+
setCopied(true);
35+
setTimeout(() => setCopied(false), 2000);
36+
};
37+
38+
const restartAnimation = () => {
39+
setTerminalStep(0);
40+
};
41+
42+
return (
43+
<div className="w-full rounded-lg shadow-lg overflow-hidden bg-gray-900 text-white font-mono text-sm relative min-h-[400px]">
44+
<div className="p-4">
45+
<div className="flex justify-between items-center mb-4">
46+
<div className="flex space-x-2">
47+
<div className="w-3 h-3 rounded-full bg-red-500"></div>
48+
<div className="w-3 h-3 rounded-full bg-yellow-500"></div>
49+
<div className="w-3 h-3 rounded-full bg-green-500"></div>
50+
</div>
51+
<div className="flex space-x-2">
52+
<button
53+
onClick={restartAnimation}
54+
className="text-gray-400 hover:text-white transition-colors"
55+
aria-label="Restart animation"
56+
>
57+
<RotateCcw className="h-5 w-5" />
58+
</button>
59+
<button
60+
onClick={copyToClipboard}
61+
className="text-gray-400 hover:text-white transition-colors"
62+
aria-label="Copy to clipboard"
63+
>
64+
{copied ? (
65+
<Check className="h-5 w-5" />
66+
) : (
67+
<Copy className="h-5 w-5" />
68+
)}
69+
</button>
70+
</div>
71+
</div>
72+
<div className="space-y-2">
73+
{terminalSteps.map((step, index) => (
74+
<div
75+
key={index}
76+
className={`${index > terminalStep ? 'opacity-0' : 'opacity-100'} transition-opacity duration-300`}
77+
>
78+
{step.showPrompt && <span className="text-green-400">$ </span>}
79+
{step.line}
80+
</div>
81+
))}
82+
</div>
83+
</div>
84+
</div>
85+
);
86+
}

0 commit comments

Comments
 (0)