wu981526092 commited on
Commit
b786cf7
·
1 Parent(s): b40d2c7

Update Home page with industrial design and new feature showcase

Browse files

- Clean, professional layout with gradient hero section
- Real-time system statistics (models, assistants, templates)
- Updated quick actions for all 4 main features (Playground, Models, Assistants, Community)
- Core features highlight with modern icons
- Simplified getting started flow
- Remove outdated content and focus on essential functionality

Files changed (1) hide show
  1. frontend/src/pages/Home.tsx +210 -195
frontend/src/pages/Home.tsx CHANGED
@@ -1,230 +1,245 @@
1
- import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card'
 
2
  import { Button } from '@/components/ui/button'
3
-
4
  import {
5
- Brain,
6
  MessageSquare,
7
  BookOpen,
 
 
 
8
  Zap,
9
  Shield,
10
  Cpu,
11
- ArrowRight
12
  } from 'lucide-react'
13
- import { Link } from 'react-router-dom'
14
 
15
- const features = [
16
- {
17
- icon: Brain,
18
- title: "Local AI Models",
19
- description: "Run powerful language models locally on your machine with full privacy control.",
20
- color: "text-blue-500"
21
- },
22
- {
23
- icon: MessageSquare,
24
- title: "Interactive Chat",
25
- description: "Playground interface for testing prompts and exploring model capabilities.",
26
- color: "text-green-500"
27
- },
28
- {
29
- icon: Shield,
30
- title: "Privacy First",
31
- description: "Your data never leaves your machine. Complete privacy and security guaranteed.",
32
- color: "text-purple-500"
33
- },
34
- {
35
- icon: Zap,
36
- title: "High Performance",
37
- description: "Optimized for speed with model caching and efficient resource management.",
38
- color: "text-yellow-500"
39
  }
40
- ]
41
 
42
- const quickActions = [
43
- {
44
- title: "Start Chatting",
45
- description: "Jump into the playground and start experimenting",
46
- href: "/playground",
47
- icon: MessageSquare,
48
- primary: true
49
- },
50
- {
51
- title: "Browse Models",
52
- description: "Explore available models and their capabilities",
53
- href: "/models",
54
- icon: BookOpen,
55
- primary: false
56
- },
57
- {
58
- title: "View Settings",
59
- description: "Configure your application preferences",
60
- href: "/settings",
61
- icon: Cpu,
62
- primary: false
63
  }
64
- ]
65
 
66
- export function Home() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  return (
68
  <div className="min-h-screen bg-background">
69
- <div className="container mx-auto px-4 py-8">
70
- {/* Hero Section */}
71
- <div className="text-center mb-12">
72
- <div className="flex items-center justify-center mb-4">
73
- <div className="w-16 h-16 bg-primary rounded-2xl flex items-center justify-center">
74
- <Brain className="h-8 w-8 text-primary-foreground" />
 
 
 
 
 
 
 
 
75
  </div>
76
- </div>
77
- <h1 className="text-4xl font-bold mb-4">Edge LLM</h1>
78
- <p className="text-xl text-muted-foreground max-w-2xl mx-auto mb-8">
79
- Your local AI companion. Run powerful language models on your own hardware with complete privacy and control.
80
- </p>
81
- <div className="flex items-center justify-center gap-4">
82
- <Link to="/playground">
83
- <Button size="lg">
84
- <MessageSquare className="h-5 w-5 mr-2" />
85
  Start Chatting
 
86
  </Button>
87
- </Link>
88
- <Link to="/models">
89
- <Button variant="outline" size="lg">
90
  <BookOpen className="h-5 w-5 mr-2" />
91
  Browse Models
92
  </Button>
93
- </Link>
94
  </div>
95
  </div>
 
96
 
97
- {/* Features Grid */}
98
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-12">
99
- {features.map((feature, index) => (
100
- <Card key={index} className="text-center">
101
- <CardContent className="pt-6">
102
- <feature.icon className={`h-12 w-12 mx-auto mb-4 ${feature.color}`} />
103
- <h3 className="font-semibold mb-2">{feature.title}</h3>
104
- <p className="text-sm text-muted-foreground">{feature.description}</p>
105
- </CardContent>
106
- </Card>
107
- ))}
108
- </div>
109
-
110
  {/* Quick Actions */}
111
- <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
112
- {quickActions.map((action, index) => (
113
- <Card key={index} className="hover:shadow-lg transition-shadow">
114
- <CardContent className="pt-6">
115
- <div className="flex items-center gap-3 mb-3">
116
- <action.icon className="h-6 w-6 text-primary" />
117
- <h3 className="font-semibold">{action.title}</h3>
118
- </div>
119
- <p className="text-sm text-muted-foreground mb-4">{action.description}</p>
120
- <Link to={action.href}>
121
- <Button
122
- variant={action.primary ? "default" : "outline"}
123
- className="w-full"
124
- >
125
- Get Started
126
- <ArrowRight className="h-4 w-4 ml-2" />
127
- </Button>
128
- </Link>
129
- </CardContent>
130
- </Card>
131
- ))}
132
- </div>
133
-
134
- {/* Getting Started */}
135
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
136
- <Card>
137
- <CardHeader>
138
- <CardTitle>Getting Started</CardTitle>
139
- </CardHeader>
140
- <CardContent>
141
- <div className="space-y-4">
142
- <div className="space-y-2">
143
- <div className="flex items-center gap-2">
144
- <div className="w-6 h-6 bg-primary text-white rounded-full flex items-center justify-center text-sm font-medium">
145
- 1
146
- </div>
147
- <h4 className="font-medium">Browse Available Models</h4>
148
  </div>
149
- <p className="text-sm text-muted-foreground pl-8">
150
- Check out our model catalog to see what's available for your use case.
151
- </p>
152
- </div>
153
-
154
- <div className="space-y-2">
155
- <div className="flex items-center gap-2">
156
- <div className="w-6 h-6 bg-primary text-white rounded-full flex items-center justify-center text-sm font-medium">
157
- 2
158
- </div>
159
- <h4 className="font-medium">Load a Model</h4>
160
  </div>
161
- <p className="text-sm text-muted-foreground pl-8">
162
- Select and load a model that fits your hardware and requirements.
163
- </p>
164
- </div>
165
-
166
- <div className="space-y-2">
167
- <div className="flex items-center gap-2">
168
- <div className="w-6 h-6 bg-primary text-white rounded-full flex items-center justify-center text-sm font-medium">
169
- 3
170
- </div>
171
- <h4 className="font-medium">Start Chatting</h4>
172
- </div>
173
- <p className="text-sm text-muted-foreground pl-8">
174
- Go to the playground and start experimenting with prompts.
175
- </p>
176
- </div>
177
- </div>
178
-
179
- <div className="pt-4 border-t">
180
- <Link to="/playground">
181
- <Button className="w-full md:w-auto">
182
- <MessageSquare className="h-4 w-4 mr-2" />
183
- Open Playground
184
- </Button>
185
- </Link>
186
- </div>
187
  </CardContent>
188
  </Card>
189
-
190
- {/* Status */}
191
  <Card>
192
- <CardHeader>
193
- <CardTitle>System Status</CardTitle>
194
- </CardHeader>
195
- <CardContent>
196
- <div className="space-y-4">
197
- <div className="flex items-center justify-between">
198
- <span className="text-sm">Backend Status</span>
199
- <span className="inline-flex items-center gap-1 text-sm text-green-600">
200
- <div className="w-2 h-2 bg-green-600 rounded-full"></div>
201
- Online
202
- </span>
203
- </div>
204
-
205
- <div className="flex items-center justify-between">
206
- <span className="text-sm">Models Loaded</span>
207
- <span className="text-sm font-medium">Ready</span>
208
- </div>
209
-
210
- <div className="flex items-center justify-between">
211
- <span className="text-sm">Memory Usage</span>
212
- <span className="text-sm font-medium">Optimized</span>
213
- </div>
214
- </div>
215
-
216
- <div className="pt-4 border-t">
217
- <Link to="/settings">
218
- <Button variant="outline" className="w-full md:w-auto">
219
- <Cpu className="h-4 w-4 mr-2" />
220
- View Settings
221
- </Button>
222
- </Link>
223
- </div>
224
  </CardContent>
225
  </Card>
226
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  </div>
228
  </div>
229
  )
230
- }
 
1
+ import { useState, useEffect } from 'react'
2
+ import { Card, CardContent } from '@/components/ui/card'
3
  import { Button } from '@/components/ui/button'
4
+ import { Badge } from '@/components/ui/badge'
5
  import {
 
6
  MessageSquare,
7
  BookOpen,
8
+ Bot,
9
+ Users,
10
+ ArrowRight,
11
  Zap,
12
  Shield,
13
  Cpu,
14
+ Brain
15
  } from 'lucide-react'
 
16
 
17
+ export function Home() {
18
+ const [stats, setStats] = useState({
19
+ models: 0,
20
+ assistants: 0,
21
+ isOnline: false
22
+ })
23
+
24
+ useEffect(() => {
25
+ loadStats()
26
+ checkSystemStatus()
27
+ }, [])
28
+
29
+ const loadStats = () => {
30
+ try {
31
+ const assistants = JSON.parse(localStorage.getItem('savedAssistants') || '[]')
32
+ setStats(prev => ({ ...prev, assistants: assistants.length }))
33
+ } catch (error) {
34
+ console.error('Failed to load stats:', error)
35
+ }
 
 
 
 
 
36
  }
 
37
 
38
+ const checkSystemStatus = async () => {
39
+ try {
40
+ const baseUrl = `${window.location.protocol}//${window.location.host}`
41
+ const res = await fetch(`${baseUrl}/models`)
42
+ if (res.ok) {
43
+ const data = await res.json()
44
+ setStats(prev => ({
45
+ ...prev,
46
+ models: data.models?.length || 0,
47
+ isOnline: true
48
+ }))
49
+ }
50
+ } catch (error) {
51
+ console.error('System check failed:', error)
52
+ setStats(prev => ({ ...prev, isOnline: false }))
53
+ }
 
 
 
 
 
54
  }
 
55
 
56
+ const quickActions = [
57
+ {
58
+ title: 'Start Chatting',
59
+ description: 'Begin conversations with AI models',
60
+ icon: MessageSquare,
61
+ href: '/playground',
62
+ color: 'bg-blue-600',
63
+ primary: true
64
+ },
65
+ {
66
+ title: 'Browse Models',
67
+ description: 'Manage and load AI models',
68
+ icon: BookOpen,
69
+ href: '/models',
70
+ color: 'bg-green-600',
71
+ primary: false
72
+ },
73
+ {
74
+ title: 'My Assistants',
75
+ description: 'Custom AI assistant configurations',
76
+ icon: Bot,
77
+ href: '/assistants',
78
+ color: 'bg-purple-600',
79
+ primary: false
80
+ },
81
+ {
82
+ title: 'Community',
83
+ description: 'Discover and share templates',
84
+ icon: Users,
85
+ href: '/community',
86
+ color: 'bg-orange-600',
87
+ primary: false
88
+ }
89
+ ]
90
+
91
+ const features = [
92
+ {
93
+ icon: Shield,
94
+ title: 'Privacy First',
95
+ description: 'Local processing with complete data control'
96
+ },
97
+ {
98
+ icon: Zap,
99
+ title: 'High Performance',
100
+ description: 'Optimized for speed and efficiency'
101
+ },
102
+ {
103
+ icon: Cpu,
104
+ title: 'Local & Cloud',
105
+ description: 'Run models locally or access cloud APIs'
106
+ },
107
+ {
108
+ icon: Brain,
109
+ title: 'Advanced Models',
110
+ description: 'Support for latest AI capabilities'
111
+ }
112
+ ]
113
+
114
  return (
115
  <div className="min-h-screen bg-background">
116
+ {/* Hero Section */}
117
+ <div className="bg-gradient-to-br from-blue-50 to-indigo-100 border-b">
118
+ <div className="max-w-6xl mx-auto px-6 py-16">
119
+ <div className="text-center space-y-6">
120
+ <div className="flex items-center justify-center gap-2 mb-4">
121
+ <div className="w-12 h-12 bg-blue-600 rounded-xl flex items-center justify-center">
122
+ <Brain className="h-7 w-7 text-white" />
123
+ </div>
124
+ <div className="flex items-center gap-2">
125
+ <h1 className="text-4xl font-bold text-gray-900">Edge LLM</h1>
126
+ <Badge variant={stats.isOnline ? "default" : "secondary"} className="text-xs">
127
+ {stats.isOnline ? 'Online' : 'Offline'}
128
+ </Badge>
129
+ </div>
130
  </div>
131
+
132
+ <p className="text-xl text-gray-600 max-w-3xl mx-auto">
133
+ Professional AI platform for local and cloud language models.
134
+ Complete privacy, advanced features, industrial-grade performance.
135
+ </p>
136
+
137
+ <div className="flex items-center justify-center gap-4 pt-4">
138
+ <Button size="lg" onClick={() => window.location.href = '/playground'} className="flex items-center gap-2">
139
+ <MessageSquare className="h-5 w-5" />
140
  Start Chatting
141
+ <ArrowRight className="h-4 w-4" />
142
  </Button>
143
+
144
+ <Button size="lg" variant="outline" onClick={() => window.location.href = '/models'}>
 
145
  <BookOpen className="h-5 w-5 mr-2" />
146
  Browse Models
147
  </Button>
148
+ </div>
149
  </div>
150
  </div>
151
+ </div>
152
 
153
+ <div className="max-w-6xl mx-auto px-6 py-12 space-y-12">
154
+
 
 
 
 
 
 
 
 
 
 
 
155
  {/* Quick Actions */}
156
+ <section>
157
+ <h2 className="text-2xl font-semibold mb-6 text-center">Quick Actions</h2>
158
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
159
+ {quickActions.map((action) => (
160
+ <Card
161
+ key={action.title}
162
+ className={`hover:shadow-lg transition-all duration-200 cursor-pointer hover:-translate-y-1 ${
163
+ action.primary ? 'ring-2 ring-blue-200' : ''
164
+ }`}
165
+ onClick={() => window.location.href = action.href}
166
+ >
167
+ <CardContent className="p-6 text-center space-y-4">
168
+ <div className={`w-12 h-12 ${action.color} rounded-lg flex items-center justify-center mx-auto`}>
169
+ <action.icon className="h-6 w-6 text-white" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  </div>
171
+ <div>
172
+ <h3 className="font-semibold text-lg">{action.title}</h3>
173
+ <p className="text-sm text-gray-600 mt-1">{action.description}</p>
 
 
 
 
 
 
 
 
174
  </div>
175
+ </CardContent>
176
+ </Card>
177
+ ))}
178
+ </div>
179
+ </section>
180
+
181
+ {/* System Status */}
182
+ <section className="grid grid-cols-1 md:grid-cols-3 gap-6">
183
+ <Card>
184
+ <CardContent className="p-6 text-center">
185
+ <div className="text-3xl font-bold text-blue-600 mb-2">{stats.models}</div>
186
+ <div className="text-sm text-gray-600">Available Models</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  </CardContent>
188
  </Card>
189
+
 
190
  <Card>
191
+ <CardContent className="p-6 text-center">
192
+ <div className="text-3xl font-bold text-purple-600 mb-2">{stats.assistants}</div>
193
+ <div className="text-sm text-gray-600">My Assistants</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  </CardContent>
195
  </Card>
196
+
197
+ <Card>
198
+ <CardContent className="p-6 text-center">
199
+ <div className="text-3xl font-bold text-green-600 mb-2">5</div>
200
+ <div className="text-sm text-gray-600">Community Templates</div>
201
+ </CardContent>
202
+ </Card>
203
+ </section>
204
+
205
+ {/* Core Features */}
206
+ <section>
207
+ <h2 className="text-2xl font-semibold mb-6 text-center">Core Features</h2>
208
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
209
+ {features.map((feature) => (
210
+ <Card key={feature.title} className="text-center">
211
+ <CardContent className="p-6 space-y-4">
212
+ <div className="w-12 h-12 bg-gray-100 rounded-lg flex items-center justify-center mx-auto">
213
+ <feature.icon className="h-6 w-6 text-gray-700" />
214
+ </div>
215
+ <div>
216
+ <h3 className="font-semibold">{feature.title}</h3>
217
+ <p className="text-sm text-gray-600 mt-1">{feature.description}</p>
218
+ </div>
219
+ </CardContent>
220
+ </Card>
221
+ ))}
222
+ </div>
223
+ </section>
224
+
225
+ {/* Get Started */}
226
+ <section className="text-center bg-gray-50 rounded-2xl p-8">
227
+ <h2 className="text-2xl font-semibold mb-4">Ready to Get Started?</h2>
228
+ <p className="text-gray-600 mb-6 max-w-2xl mx-auto">
229
+ Choose your preferred way to begin. Load models for local processing or start chatting with cloud APIs immediately.
230
+ </p>
231
+ <div className="flex items-center justify-center gap-4">
232
+ <Button onClick={() => window.location.href = '/playground'}>
233
+ <MessageSquare className="h-4 w-4 mr-2" />
234
+ Open Playground
235
+ </Button>
236
+ <Button variant="outline" onClick={() => window.location.href = '/assistants'}>
237
+ <Bot className="h-4 w-4 mr-2" />
238
+ Create Assistant
239
+ </Button>
240
+ </div>
241
+ </section>
242
  </div>
243
  </div>
244
  )
245
+ }