@@ -7,57 +7,13 @@ import { Textarea } from "@/components/ui/textarea";
7
7
import { Input } from "@/components/ui/input" ;
8
8
import { Tabs , TabsContent , TabsList , TabsTrigger } from "@/components/ui/tabs" ;
9
9
import { Alert , AlertDescription } from "@/components/ui/alert" ;
10
- import { Loader2 , Plus , Trash2 , Code2 , Clock , Box , PlayCircle , Brain , Lightbulb , ExternalLink } from "lucide-react" ;
10
+ import { Loader2 , Plus , Trash2 , Code2 , Clock , Box , PlayCircle , Brain , Lightbulb , ExternalLink , Cpu } from "lucide-react" ;
11
11
import { motion , AnimatePresence } from "framer-motion" ;
12
12
import dynamic from 'next/dynamic' ;
13
13
import VisualizationTab from '@/components/MermaidRenderer' ;
14
14
15
15
const CodeEditor = dynamic ( ( ) => import ( '../components/Editor' ) , { ssr : false } ) ;
16
- const DEFAULT_SOLUTION_CODE = `/**
17
- * Solution for the DSA problem
18
- * @param {any} input - The input parameter(s) for the problem
19
- * @returns {any} - The result of the solution
20
- */
21
- function solution(input) {
22
- // Initialize variables
23
- let result;
24
-
25
- // Solution implementation
26
- try {
27
- // Your solution logic here
28
-
29
- // Example implementation
30
- if (Array.isArray(input)) {
31
- result = input.reduce((acc, curr) => acc + curr, 0);
32
- } else {
33
- result = input;
34
- }
35
- } catch (error) {
36
- console.error('Error in solution:', error);
37
- throw error;
38
- }
39
-
40
- return result;
41
- }
42
-
43
- // Example test cases
44
- const testCases = [
45
- { input: [1, 2, 3, 4, 5], expectedOutput: 15 },
46
- { input: [], expectedOutput: 0 },
47
- { input: [42], expectedOutput: 42 }
48
- ];
49
-
50
- // Run test cases
51
- testCases.forEach((testCase, index) => {
52
- const output = solution(testCase.input);
53
- console.log(\`Test case \${index + 1}:\`);
54
- console.log('Input:', testCase.input);
55
- console.log('Expected:', testCase.expectedOutput);
56
- console.log('Actual:', output);
57
- console.log('Pass:', output === testCase.expectedOutput);
58
- console.log('---');
59
- });
60
- ` ;
16
+ const DEFAULT_SOLUTION_CODE = `print("Hello, World!")` ;
61
17
62
18
63
19
const DSASolutionInterface = ( ) => {
@@ -170,7 +126,8 @@ const DSASolutionInterface = () => {
170
126
className = "mb-8"
171
127
>
172
128
< div className = "flex justify-between items-center mb-6" >
173
- < h1 className = "text-3xl font-bold text-gray-800 mt-5" > Self Study with Copilotkit</ h1 >
129
+ < h1 className = "text-3xl font-bold text-gray-800 mt-5" > Learn Coding with Copilotkit</ h1 >
130
+
174
131
< div className = "flex gap-2" >
175
132
{ steps . map ( ( step , index ) => (
176
133
< Button
@@ -291,6 +248,7 @@ const DSASolutionInterface = () => {
291
248
'Generate Solution'
292
249
) }
293
250
</ Button >
251
+
294
252
</ motion . div >
295
253
296
254
{ solution && (
@@ -324,13 +282,10 @@ const DSASolutionInterface = () => {
324
282
< TabsContent value = "code" >
325
283
< Card >
326
284
< CardHeader >
327
- < CardTitle > Code in Python [officially supported till now] </ CardTitle >
285
+ < CardTitle > Python Code </ CardTitle >
328
286
</ CardHeader >
329
287
< CardContent >
330
288
< div className = "space-y-4" >
331
- < div className = "prose max-w-none" >
332
- { solution . explanation }
333
- </ div >
334
289
< pre className = "bg-gray-50 p-4 rounded-lg overflow-x-auto" >
335
290
{ solution . code }
336
291
</ pre >
@@ -347,14 +302,14 @@ const DSASolutionInterface = () => {
347
302
< CardContent >
348
303
< div className = "grid grid-cols-2 gap-4" >
349
304
< Alert >
350
- < Clock className = "h-4 w-4 " />
351
- < AlertDescription >
305
+ < Clock className = "h-4" />
306
+ < AlertDescription className = 'h-4 mt-[5px]' >
352
307
Time Complexity: { timeComplexity || "Not specified" }
353
308
</ AlertDescription >
354
309
</ Alert >
355
310
< Alert >
356
- < Box className = "h-4 w-4 " />
357
- < AlertDescription >
311
+ < Box className = "h-4" />
312
+ < AlertDescription className = 'h-4 mt-[5px]' >
358
313
Space Complexity: { spaceComplexity || "Not specified" }
359
314
</ AlertDescription >
360
315
</ Alert >
@@ -381,35 +336,24 @@ const DSASolutionInterface = () => {
381
336
< TabsContent value = "explanation" >
382
337
< Card >
383
338
< CardHeader >
384
- < CardTitle > Test Cases </ CardTitle >
339
+ < CardTitle > Approach Explanation </ CardTitle >
385
340
</ CardHeader >
386
341
< CardContent >
387
342
< div className = "space-y-4" >
388
- { testCases . map ( ( testCase , index ) => (
389
- < div key = { index } className = "border p-4 rounded-lg" >
390
- < div className = "grid grid-cols-2 gap-4" >
391
- < div >
392
- < label className = "text-sm font-medium" > Input</ label >
393
- < pre className = "mt-1 p-2 bg-gray-50 rounded" >
394
- { testCase . input || "Not specified" }
395
- </ pre >
396
- </ div >
397
- < div >
398
- < label className = "text-sm font-medium" > Expected Output</ label >
399
- < pre className = "mt-1 p-2 bg-gray-50 rounded" >
400
- { testCase . output || "Not specified" }
401
- </ pre >
402
- </ div >
403
- </ div >
404
- </ div >
405
- ) ) }
343
+ < pre className = "bg-gray-50 p-4 rounded-lg overflow-x-auto" >
344
+ { solution . explanation }
345
+ </ pre >
406
346
</ div >
407
347
</ CardContent >
408
348
</ Card >
409
349
</ TabsContent >
410
350
</ Tabs >
411
351
</ >
412
352
) }
353
+ < Button className = "w-full bg-gradient-to-r from-purple-600 p-5 text-[17px] to-blue-500 hover:from-purple-700 hover:to-blue-600 text-white" >
354
+ < Cpu className = "h-5 w-5" />
355
+ Powered by CopilotKit CoAgents and Langgraphs
356
+ </ Button >
413
357
</ div >
414
358
</ div >
415
359
0 commit comments