wu981526092 commited on
Commit
4f5b21f
·
1 Parent(s): ab56878

♻️ UNIFY CONFIGS: Create shared assistant configuration

Browse files

✅ Created shared configuration system:
- � New file: src/config/assistants.ts
- � Unified assistant configs for Templates & Playground
- � Single source of truth for all 3 use cases

� Shared configuration includes:
- Complete assistant definitions (id, name, description, etc.)
- System prompts, temperature, maxTokens
- Categories, tags, icons, usage stats
- Author info and ratings

� Updated pages:
- ✅ Templates.tsx: Now uses getTemplatesFromConfigs()
- ✅ Playground.tsx: Now uses getPresetsFromConfigs()

� Benefits:
- ❌ No more duplicate configurations
- ✅ Single place to maintain all assistant settings
- ✅ Consistent data across Templates & Assistant Studio
- ✅ Easy to add new assistants in the future

� Result: Templates and Assistant Studio now share the same 3 use case configurations

frontend/src/config/assistants.ts ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Unified assistant configurations shared between Templates and Playground
2
+ export interface AssistantConfig {
3
+ id: string
4
+ name: string
5
+ description: string
6
+ category: string
7
+ tags: string[]
8
+ icon: string
9
+ model: string
10
+ systemPrompt: string
11
+ temperature: number
12
+ maxTokens: number
13
+ isOfficial: boolean
14
+ usageCount: number
15
+ rating: number
16
+ createdAt: string
17
+ author: string
18
+ }
19
+
20
+ // Shared assistant configurations
21
+ export const ASSISTANT_CONFIGS: AssistantConfig[] = [
22
+ {
23
+ id: 'outdoor-rescue',
24
+ name: '🏔️ Outdoor Rescue',
25
+ description: 'Offline AI that guides survival in extreme environments',
26
+ category: 'Emergency & Safety',
27
+ tags: ['survival', 'outdoor', 'emergency', 'rescue'],
28
+ icon: '🏔️',
29
+ model: 'Qwen/Qwen3-30B-A3B',
30
+ systemPrompt: 'You are an expert outdoor survival guide and emergency responder. When hikers, travelers, or drivers lose connection in mountains, forests, or rural roads, you provide real-time survival guidance, first aid tips, and emergency signaling advice. You are their reliable voice of calm and safety in extreme environments. Provide step-by-step instructions for survival scenarios, prioritize immediate safety needs, and offer practical solutions using available resources.',
31
+ temperature: 0.3,
32
+ maxTokens: 1000,
33
+ isOfficial: true,
34
+ usageCount: 2847,
35
+ rating: 4.9,
36
+ createdAt: '2024-01-15',
37
+ author: 'EdgeLLM Team'
38
+ },
39
+ {
40
+ id: 'offline-healthcare',
41
+ name: '🏥 Offline Healthcare',
42
+ description: 'A simple device for seniors to access trusted medical guidance',
43
+ category: 'Healthcare',
44
+ tags: ['healthcare', 'seniors', 'medical', 'guidance'],
45
+ icon: '🏥',
46
+ model: 'Qwen/Qwen3-30B-A3B',
47
+ systemPrompt: 'You are a trusted medical assistant designed specifically for elderly users. You provide clear, step-by-step medical advice through simple voice interactions. Users can press a button or speak a request to get guidance on everyday health concerns. Offer practical, easy-to-understand health advice while always emphasizing when professional medical attention is needed. Keep responses simple, clear, and actionable. No internet required, no accounts needed, no complicated setup.',
48
+ temperature: 0.2,
49
+ maxTokens: 800,
50
+ isOfficial: true,
51
+ usageCount: 1934,
52
+ rating: 4.8,
53
+ createdAt: '2024-01-20',
54
+ author: 'EdgeLLM Team'
55
+ },
56
+ {
57
+ id: 'ai-companion',
58
+ name: '🧸 AI Companion',
59
+ description: 'A private, always-available conversational partner',
60
+ category: 'Companion & Support',
61
+ tags: ['companion', 'emotional support', 'conversation', 'private'],
62
+ icon: '🧸',
63
+ model: 'Qwen/Qwen3-30B-A3B',
64
+ systemPrompt: 'You are a warm, empathetic AI companion designed to provide emotional support and practical assistance. You can be embedded in a plush toy or device to serve as a private, always-available friend. You listen actively, engage in meaningful conversations, tell stories, and provide comfort during stressful or lonely times. You offer warmth, reassurance, and practical help while maintaining complete privacy - all processing stays local without uploading data to the cloud. Be supportive, understanding, and genuinely caring in all interactions.',
65
+ temperature: 0.7,
66
+ maxTokens: 1000,
67
+ isOfficial: true,
68
+ usageCount: 3421,
69
+ rating: 4.9,
70
+ createdAt: '2024-01-25',
71
+ author: 'EdgeLLM Team'
72
+ }
73
+ ]
74
+
75
+ // Convert to Template format for Templates page
76
+ export interface CommunityTemplate {
77
+ id: string
78
+ name: string
79
+ description: string
80
+ author: string
81
+ category: string
82
+ tags: string[]
83
+ model: string
84
+ systemPrompt: string
85
+ temperature: number
86
+ maxTokens: number
87
+ isOfficial: boolean
88
+ createdAt: string
89
+ icon: string
90
+ usageCount: number
91
+ rating: number
92
+ }
93
+
94
+ export function getTemplatesFromConfigs(): CommunityTemplate[] {
95
+ return ASSISTANT_CONFIGS.map(config => ({
96
+ id: config.id,
97
+ name: config.name.replace(/🏔️|🏥|🧸/g, '').trim(), // Remove emoji for Templates page
98
+ description: config.description,
99
+ author: config.author,
100
+ category: config.category,
101
+ tags: config.tags,
102
+ model: config.model,
103
+ systemPrompt: config.systemPrompt,
104
+ temperature: config.temperature,
105
+ maxTokens: config.maxTokens,
106
+ isOfficial: config.isOfficial,
107
+ createdAt: config.createdAt,
108
+ icon: config.icon,
109
+ usageCount: config.usageCount,
110
+ rating: config.rating
111
+ }))
112
+ }
113
+
114
+ // Convert to Preset format for Playground
115
+ export interface SystemPromptPreset {
116
+ name: string
117
+ prompt: string
118
+ }
119
+
120
+ export function getPresetsFromConfigs(): SystemPromptPreset[] {
121
+ return ASSISTANT_CONFIGS.map(config => ({
122
+ name: config.name, // Keep emoji for Playground
123
+ prompt: config.systemPrompt
124
+ }))
125
+ }
frontend/src/pages/Playground.tsx CHANGED
@@ -1,5 +1,6 @@
1
  import { useState, useEffect } from 'react'
2
  import { AssistantInfo } from '@/types/chat'
 
3
  import { Button } from '@/components/ui/button'
4
  import { Card } from '@/components/ui/card'
5
  import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
@@ -192,21 +193,8 @@ export function Playground() {
192
  }
193
  }
194
 
195
- // Preset system prompts
196
- const systemPromptPresets = [
197
- {
198
- name: "🏔️ Outdoor Rescue",
199
- prompt: "You are an expert outdoor survival guide and emergency responder. When hikers, travelers, or drivers lose connection in mountains, forests, or rural roads, you provide real-time survival guidance, first aid tips, and emergency signaling advice. You are their reliable voice of calm and safety in extreme environments. Provide step-by-step instructions for survival scenarios, prioritize immediate safety needs, and offer practical solutions using available resources."
200
- },
201
- {
202
- name: "🏥 Offline Healthcare",
203
- prompt: "You are a trusted medical assistant designed specifically for elderly users. You provide clear, step-by-step medical advice through simple voice interactions. Users can press a button or speak a request to get guidance on everyday health concerns. Offer practical, easy-to-understand health advice while always emphasizing when professional medical attention is needed. Keep responses simple, clear, and actionable. No internet required, no accounts needed, no complicated setup."
204
- },
205
- {
206
- name: "🧸 AI Companion",
207
- prompt: "You are a warm, empathetic AI companion designed to provide emotional support and practical assistance. You can be embedded in a plush toy or device to serve as a private, always-available friend. You listen actively, engage in meaningful conversations, tell stories, and provide comfort during stressful or lonely times. You offer warmth, reassurance, and practical help while maintaining complete privacy - all processing stays local without uploading data to the cloud. Be supportive, understanding, and genuinely caring in all interactions."
208
- }
209
- ]
210
 
211
  // Handle preset selection
212
  const handlePresetSelect = (presetName: string) => {
 
1
  import { useState, useEffect } from 'react'
2
  import { AssistantInfo } from '@/types/chat'
3
+ import { getPresetsFromConfigs } from '@/config/assistants'
4
  import { Button } from '@/components/ui/button'
5
  import { Card } from '@/components/ui/card'
6
  import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
 
193
  }
194
  }
195
 
196
+ // Preset system prompts from shared config
197
+ const systemPromptPresets = getPresetsFromConfigs()
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
  // Handle preset selection
200
  const handlePresetSelect = (presetName: string) => {
frontend/src/pages/Templates.tsx CHANGED
@@ -25,61 +25,11 @@ interface CommunityTemplate {
25
  rating: number
26
  }
27
 
28
- // Get all community templates
 
 
29
  function getCommunityTemplates(): CommunityTemplate[] {
30
- return [
31
- {
32
- id: 'outdoor-rescue',
33
- name: 'Outdoor Rescue',
34
- description: 'Offline AI that guides survival in extreme environments',
35
- author: 'EdgeLLM Team',
36
- category: 'Emergency & Safety',
37
- tags: ['survival', 'outdoor', 'emergency', 'rescue'],
38
- model: 'Qwen/Qwen3-30B-A3B',
39
- systemPrompt: 'You are an expert outdoor survival guide and emergency responder. When hikers, travelers, or drivers lose connection in mountains, forests, or rural roads, you provide real-time survival guidance, first aid tips, and emergency signaling advice. You are their reliable voice of calm and safety in extreme environments. Provide step-by-step instructions for survival scenarios, prioritize immediate safety needs, and offer practical solutions using available resources.',
40
- temperature: 0.3,
41
- maxTokens: 1000,
42
- isOfficial: true,
43
- createdAt: '2024-01-15',
44
- icon: '🏔️',
45
- usageCount: 2847,
46
- rating: 4.9
47
- },
48
- {
49
- id: 'offline-healthcare',
50
- name: 'Offline Healthcare',
51
- description: 'A simple device for seniors to access trusted medical guidance',
52
- author: 'EdgeLLM Team',
53
- category: 'Healthcare',
54
- tags: ['healthcare', 'seniors', 'medical', 'guidance'],
55
- model: 'Qwen/Qwen3-30B-A3B',
56
- systemPrompt: 'You are a trusted medical assistant designed specifically for elderly users. You provide clear, step-by-step medical advice through simple voice interactions. Users can press a button or speak a request to get guidance on everyday health concerns. Offer practical, easy-to-understand health advice while always emphasizing when professional medical attention is needed. Keep responses simple, clear, and actionable. No internet required, no accounts needed, no complicated setup.',
57
- temperature: 0.2,
58
- maxTokens: 800,
59
- isOfficial: true,
60
- createdAt: '2024-01-20',
61
- icon: '🏥',
62
- usageCount: 1934,
63
- rating: 4.8
64
- },
65
- {
66
- id: 'ai-companion',
67
- name: 'AI Companion and Assistance',
68
- description: 'A private, always-available conversational partner',
69
- author: 'EdgeLLM Team',
70
- category: 'Companion & Support',
71
- tags: ['companion', 'emotional support', 'conversation', 'private'],
72
- model: 'Qwen/Qwen3-30B-A3B',
73
- systemPrompt: 'You are a warm, empathetic AI companion designed to provide emotional support and practical assistance. You can be embedded in a plush toy or device to serve as a private, always-available friend. You listen actively, engage in meaningful conversations, tell stories, and provide comfort during stressful or lonely times. You offer warmth, reassurance, and practical help while maintaining complete privacy - all processing stays local without uploading data to the cloud. Be supportive, understanding, and genuinely caring in all interactions.',
74
- temperature: 0.7,
75
- maxTokens: 1000,
76
- isOfficial: true,
77
- createdAt: '2024-01-25',
78
- icon: '🧸',
79
- usageCount: 3421,
80
- rating: 4.9
81
- }
82
- ]
83
  }
84
 
85
  export function Templates() {
 
25
  rating: number
26
  }
27
 
28
+ import { getTemplatesFromConfigs } from '@/config/assistants'
29
+
30
+ // Get all community templates from shared config
31
  function getCommunityTemplates(): CommunityTemplate[] {
32
+ return getTemplatesFromConfigs()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
35
  export function Templates() {
static/assets/index-e234eec6.js ADDED
The diff for this file is too large to render. See raw diff
 
static/assets/index-e234eec6.js.map ADDED
The diff for this file is too large to render. See raw diff
 
static/index.html CHANGED
@@ -5,7 +5,7 @@
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>Edge LLM</title>
8
- <script type="module" crossorigin src="/assets/index-daab7b3c.js"></script>
9
  <link rel="stylesheet" href="/assets/index-3910a5a8.css">
10
  </head>
11
  <body>
 
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>Edge LLM</title>
8
+ <script type="module" crossorigin src="/assets/index-e234eec6.js"></script>
9
  <link rel="stylesheet" href="/assets/index-3910a5a8.css">
10
  </head>
11
  <body>