@digilogiclabs/create-saas-app 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli/commands/create.d.ts.map +1 -1
- package/dist/cli/commands/create.js +6 -2
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/template-generator.d.ts.map +1 -1
- package/dist/generators/template-generator.js +13 -7
- package/dist/generators/template-generator.js.map +1 -1
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/package.json +113 -0
- package/dist/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/package.json +74 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
- package/dist/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
- package/package.json +1 -1
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/README.md +655 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/app/(tabs)/ai.tsx +683 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/docs/MOBILE-SETUP.md +787 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +346 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/lib/rag/config.ts +180 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/package.json +113 -0
- package/src/templates/mobile/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +599 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/README.md +434 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/KnowledgeManager.tsx +642 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGAnalytics.tsx +466 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/components/rag/RAGChatInterface.tsx +393 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/docs/GETTING-STARTED.md +457 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/hooks/useRAGSystem.ts +478 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/lib/rag/config.ts +250 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/package.json +74 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/scripts/setup-rag.js +622 -0
- package/src/templates/web/ui-auth-payments-ai-rag/template/src/app/ai/page.tsx +396 -0
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
|
+
import { View, Text, ScrollView, StyleSheet, Dimensions, Alert } from 'react-native';
|
|
3
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
|
+
import * as Haptics from 'expo-haptics';
|
|
5
|
+
|
|
6
|
+
// UI Components with RAG support
|
|
7
|
+
import {
|
|
8
|
+
// AI Components with RAG
|
|
9
|
+
AIProvider,
|
|
10
|
+
RAGChatPanel,
|
|
11
|
+
KnowledgeSearchPanel,
|
|
12
|
+
RAGAnalytics,
|
|
13
|
+
KnowledgeManagementPanel,
|
|
14
|
+
AISetupStatus,
|
|
15
|
+
|
|
16
|
+
// Standard AI Components
|
|
17
|
+
AIChat,
|
|
18
|
+
AITextGenerator,
|
|
19
|
+
AIAudioGenerator,
|
|
20
|
+
AIVideoGenerator,
|
|
21
|
+
|
|
22
|
+
// Native UI Components
|
|
23
|
+
Card,
|
|
24
|
+
Button,
|
|
25
|
+
Badge,
|
|
26
|
+
PageTransition,
|
|
27
|
+
TabbedInterface,
|
|
28
|
+
LazyImage,
|
|
29
|
+
ProgressiveImage,
|
|
30
|
+
NativeFeatureHighlight,
|
|
31
|
+
VirtualScrollList,
|
|
32
|
+
SwipeableCard,
|
|
33
|
+
useTheme,
|
|
34
|
+
|
|
35
|
+
// Layout Components
|
|
36
|
+
Container,
|
|
37
|
+
Grid,
|
|
38
|
+
|
|
39
|
+
// Icons
|
|
40
|
+
Sparkles,
|
|
41
|
+
Mic,
|
|
42
|
+
Video,
|
|
43
|
+
MessageSquare,
|
|
44
|
+
Zap,
|
|
45
|
+
Brain,
|
|
46
|
+
Database,
|
|
47
|
+
Search,
|
|
48
|
+
BarChart3,
|
|
49
|
+
Settings,
|
|
50
|
+
BookOpen,
|
|
51
|
+
Lightbulb,
|
|
52
|
+
} from '@digilogiclabs/saas-factory-ui/native';
|
|
53
|
+
|
|
54
|
+
import { useRAGSystem } from '../../hooks/useRAGSystem';
|
|
55
|
+
import type { GenericRAGDocumentSchema } from '@digilogiclabs/saas-factory-ai-types';
|
|
56
|
+
|
|
57
|
+
const { width } = Dimensions.get('window');
|
|
58
|
+
|
|
59
|
+
export default function AIScreen() {
|
|
60
|
+
const [activeTab, setActiveTab] = useState('dashboard');
|
|
61
|
+
const [aiStats, setAiStats] = useState({
|
|
62
|
+
textGenerations: 42,
|
|
63
|
+
audioGenerations: 18,
|
|
64
|
+
videoGenerations: 7,
|
|
65
|
+
totalTokens: 125300,
|
|
66
|
+
knowledgeDocuments: 156,
|
|
67
|
+
ragQueries: 89,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const { theme, isDark } = useTheme();
|
|
71
|
+
|
|
72
|
+
// Initialize RAG system - domain can be configured based on app type
|
|
73
|
+
const ragSystem = useRAGSystem<GenericRAGDocumentSchema>({
|
|
74
|
+
domain: 'generic', // Can be: 'plants', 'ecommerce', 'education', etc.
|
|
75
|
+
enableOffline: true,
|
|
76
|
+
autoSync: true,
|
|
77
|
+
cacheResults: true
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// AI Configuration with RAG integration
|
|
81
|
+
const aiConfig = {
|
|
82
|
+
providers: {
|
|
83
|
+
openai: {
|
|
84
|
+
apiKey: process.env.EXPO_PUBLIC_OPENAI_API_KEY || '',
|
|
85
|
+
models: {
|
|
86
|
+
text: 'gpt-4',
|
|
87
|
+
audio: 'tts-1',
|
|
88
|
+
embedding: 'text-embedding-ada-002'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
elevenlabs: {
|
|
92
|
+
apiKey: process.env.EXPO_PUBLIC_ELEVENLABS_API_KEY || '',
|
|
93
|
+
},
|
|
94
|
+
replicate: {
|
|
95
|
+
apiKey: process.env.EXPO_PUBLIC_REPLICATE_API_TOKEN || '',
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
rag: {
|
|
99
|
+
enabled: true,
|
|
100
|
+
system: ragSystem.ragSystem,
|
|
101
|
+
options: {
|
|
102
|
+
enhanceWithKnowledge: true,
|
|
103
|
+
showSources: true,
|
|
104
|
+
confidenceThreshold: 0.7
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const handleTabChange = (tabId: string) => {
|
|
110
|
+
setActiveTab(tabId);
|
|
111
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const handleAIGeneration = async (type: string, result: any) => {
|
|
115
|
+
try {
|
|
116
|
+
// Update local stats
|
|
117
|
+
setAiStats(prev => ({
|
|
118
|
+
...prev,
|
|
119
|
+
[`${type}Generations`]: prev[`${type}Generations` as keyof typeof prev] + 1,
|
|
120
|
+
totalTokens: prev.totalTokens + (result.tokens || 100)
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
|
124
|
+
Alert.alert('Success', `${type} generation completed successfully!`);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
|
|
127
|
+
Alert.alert('Error', `${type} generation failed. Please try again.`);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const handleRAGQuery = async (query: string) => {
|
|
132
|
+
try {
|
|
133
|
+
const response = await ragSystem.query(query);
|
|
134
|
+
setAiStats(prev => ({
|
|
135
|
+
...prev,
|
|
136
|
+
ragQueries: prev.ragQueries + 1
|
|
137
|
+
}));
|
|
138
|
+
return response;
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.error('RAG query error:', error);
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const aiTabs = [
|
|
146
|
+
{
|
|
147
|
+
id: 'dashboard',
|
|
148
|
+
label: 'Dashboard',
|
|
149
|
+
icon: <Brain width={20} height={20} color={activeTab === 'dashboard' ? '#3b82f6' : '#64748b'} />,
|
|
150
|
+
component: renderDashboard(),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'rag-chat',
|
|
154
|
+
label: 'AI Chat',
|
|
155
|
+
icon: <MessageSquare width={20} height={20} color={activeTab === 'rag-chat' ? '#3b82f6' : '#64748b'} />,
|
|
156
|
+
component: renderRAGChat(),
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'knowledge',
|
|
160
|
+
label: 'Knowledge',
|
|
161
|
+
icon: <BookOpen width={20} height={20} color={activeTab === 'knowledge' ? '#3b82f6' : '#64748b'} />,
|
|
162
|
+
component: renderKnowledgeBase(),
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'text',
|
|
166
|
+
label: 'Text AI',
|
|
167
|
+
icon: <Lightbulb width={20} height={20} color={activeTab === 'text' ? '#3b82f6' : '#64748b'} />,
|
|
168
|
+
component: renderTextGenerator(),
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 'audio',
|
|
172
|
+
label: 'Audio AI',
|
|
173
|
+
icon: <Mic width={20} height={20} color={activeTab === 'audio' ? '#3b82f6' : '#64748b'} />,
|
|
174
|
+
component: renderAudioGenerator(),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'video',
|
|
178
|
+
label: 'Video AI',
|
|
179
|
+
icon: <Video width={20} height={20} color={activeTab === 'video' ? '#3b82f6' : '#64748b'} />,
|
|
180
|
+
component: renderVideoGenerator(),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 'analytics',
|
|
184
|
+
label: 'Analytics',
|
|
185
|
+
icon: <BarChart3 width={20} height={20} color={activeTab === 'analytics' ? '#3b82f6' : '#64748b'} />,
|
|
186
|
+
component: renderAnalytics(),
|
|
187
|
+
},
|
|
188
|
+
];
|
|
189
|
+
|
|
190
|
+
function renderDashboard() {
|
|
191
|
+
return (
|
|
192
|
+
<ScrollView style={styles.tabContent} showsVerticalScrollIndicator={false}>
|
|
193
|
+
<Container padding={16}>
|
|
194
|
+
{/* RAG System Status */}
|
|
195
|
+
<Card style={styles.card}>
|
|
196
|
+
<Text style={[styles.cardTitle, { color: theme.colors.text }]}>
|
|
197
|
+
AI & Knowledge System Status
|
|
198
|
+
</Text>
|
|
199
|
+
<View style={styles.statusGrid}>
|
|
200
|
+
<View style={styles.statusItem}>
|
|
201
|
+
<View style={[styles.statusDot, { backgroundColor: ragSystem.isReady ? '#10b981' : '#f59e0b' }]} />
|
|
202
|
+
<Text style={[styles.statusText, { color: theme.colors.text }]}>
|
|
203
|
+
{ragSystem.isReady ? 'Ready' : 'Loading...'}
|
|
204
|
+
</Text>
|
|
205
|
+
</View>
|
|
206
|
+
<View style={styles.statusItem}>
|
|
207
|
+
<View style={[styles.statusDot, { backgroundColor: ragSystem.isOnline ? '#10b981' : '#ef4444' }]} />
|
|
208
|
+
<Text style={[styles.statusText, { color: theme.colors.text }]}>
|
|
209
|
+
{ragSystem.isOnline ? 'Online' : 'Offline'}
|
|
210
|
+
</Text>
|
|
211
|
+
</View>
|
|
212
|
+
{ragSystem.offlineQueueSize > 0 && (
|
|
213
|
+
<View style={styles.statusItem}>
|
|
214
|
+
<View style={[styles.statusDot, { backgroundColor: '#f59e0b' }]} />
|
|
215
|
+
<Text style={[styles.statusText, { color: theme.colors.text }]}>
|
|
216
|
+
{ragSystem.offlineQueueSize} queued
|
|
217
|
+
</Text>
|
|
218
|
+
</View>
|
|
219
|
+
)}
|
|
220
|
+
</View>
|
|
221
|
+
</Card>
|
|
222
|
+
|
|
223
|
+
{/* Enhanced AI Stats with RAG */}
|
|
224
|
+
<Card style={[styles.card, styles.statsCard]}>
|
|
225
|
+
<Text style={[styles.cardTitle, { color: theme.colors.text }]}>
|
|
226
|
+
AI Usage Statistics
|
|
227
|
+
</Text>
|
|
228
|
+
<Grid columns={2} gap={12} style={styles.statsGrid}>
|
|
229
|
+
<View style={styles.statItem}>
|
|
230
|
+
<Text style={[styles.statNumber, { color: '#3b82f6' }]}>
|
|
231
|
+
{aiStats.ragQueries}
|
|
232
|
+
</Text>
|
|
233
|
+
<Text style={[styles.statLabel, { color: theme.colors.textMuted }]}>
|
|
234
|
+
RAG Queries
|
|
235
|
+
</Text>
|
|
236
|
+
</View>
|
|
237
|
+
<View style={styles.statItem}>
|
|
238
|
+
<Text style={[styles.statNumber, { color: '#8b5cf6' }]}>
|
|
239
|
+
{aiStats.knowledgeDocuments}
|
|
240
|
+
</Text>
|
|
241
|
+
<Text style={[styles.statLabel, { color: theme.colors.textMuted }]}>
|
|
242
|
+
Knowledge Docs
|
|
243
|
+
</Text>
|
|
244
|
+
</View>
|
|
245
|
+
<View style={styles.statItem}>
|
|
246
|
+
<Text style={[styles.statNumber, { color: '#10b981' }]}>
|
|
247
|
+
{aiStats.textGenerations}
|
|
248
|
+
</Text>
|
|
249
|
+
<Text style={[styles.statLabel, { color: theme.colors.textMuted }]}>
|
|
250
|
+
Text Generated
|
|
251
|
+
</Text>
|
|
252
|
+
</View>
|
|
253
|
+
<View style={styles.statItem}>
|
|
254
|
+
<Text style={[styles.statNumber, { color: '#f59e0b' }]}>
|
|
255
|
+
{(aiStats.totalTokens / 1000).toFixed(1)}K
|
|
256
|
+
</Text>
|
|
257
|
+
<Text style={[styles.statLabel, { color: theme.colors.textMuted }]}>
|
|
258
|
+
Total Tokens
|
|
259
|
+
</Text>
|
|
260
|
+
</View>
|
|
261
|
+
</Grid>
|
|
262
|
+
</Card>
|
|
263
|
+
|
|
264
|
+
{/* Quick Actions with RAG */}
|
|
265
|
+
<Card style={styles.card}>
|
|
266
|
+
<Text style={[styles.cardTitle, { color: theme.colors.text }]}>
|
|
267
|
+
Quick Actions
|
|
268
|
+
</Text>
|
|
269
|
+
<Grid columns={2} gap={12} style={styles.quickActions}>
|
|
270
|
+
<Button
|
|
271
|
+
variant="outline"
|
|
272
|
+
size="lg"
|
|
273
|
+
onPress={() => setActiveTab('rag-chat')}
|
|
274
|
+
style={styles.quickActionButton}
|
|
275
|
+
disabled={!ragSystem.canQuery}
|
|
276
|
+
>
|
|
277
|
+
<MessageSquare width={20} height={20} color="#3b82f6" />
|
|
278
|
+
<Text style={styles.quickActionText}>RAG Chat</Text>
|
|
279
|
+
</Button>
|
|
280
|
+
<Button
|
|
281
|
+
variant="outline"
|
|
282
|
+
size="lg"
|
|
283
|
+
onPress={() => setActiveTab('knowledge')}
|
|
284
|
+
style={styles.quickActionButton}
|
|
285
|
+
>
|
|
286
|
+
<Database width={20} height={20} color="#8b5cf6" />
|
|
287
|
+
<Text style={styles.quickActionText}>Knowledge Base</Text>
|
|
288
|
+
</Button>
|
|
289
|
+
<Button
|
|
290
|
+
variant="outline"
|
|
291
|
+
size="lg"
|
|
292
|
+
onPress={() => setActiveTab('text')}
|
|
293
|
+
style={styles.quickActionButton}
|
|
294
|
+
>
|
|
295
|
+
<Lightbulb width={20} height={20} color="#10b981" />
|
|
296
|
+
<Text style={styles.quickActionText}>Generate Text</Text>
|
|
297
|
+
</Button>
|
|
298
|
+
<Button
|
|
299
|
+
variant="outline"
|
|
300
|
+
size="lg"
|
|
301
|
+
onPress={() => setActiveTab('analytics')}
|
|
302
|
+
style={styles.quickActionButton}
|
|
303
|
+
>
|
|
304
|
+
<BarChart3 width={20} height={20} color="#f59e0b" />
|
|
305
|
+
<Text style={styles.quickActionText}>Analytics</Text>
|
|
306
|
+
</Button>
|
|
307
|
+
</Grid>
|
|
308
|
+
</Card>
|
|
309
|
+
|
|
310
|
+
{/* Recent RAG Queries */}
|
|
311
|
+
<Card style={styles.card}>
|
|
312
|
+
<Text style={[styles.cardTitle, { color: theme.colors.text }]}>
|
|
313
|
+
Recent RAG Queries
|
|
314
|
+
</Text>
|
|
315
|
+
<VirtualScrollList
|
|
316
|
+
data={ragSystem.recentQueries.slice(0, 5).map((query, index) => ({
|
|
317
|
+
id: index.toString(),
|
|
318
|
+
query: query.query,
|
|
319
|
+
category: query.category || 'General',
|
|
320
|
+
time: new Date(query.timestamp).toLocaleTimeString(),
|
|
321
|
+
}))}
|
|
322
|
+
renderItem={({ item }) => (
|
|
323
|
+
<SwipeableCard
|
|
324
|
+
rightActions={[
|
|
325
|
+
{ label: 'Repeat', color: '#3b82f6', onPress: () => handleRAGQuery(item.query) },
|
|
326
|
+
]}
|
|
327
|
+
style={styles.recentItem}
|
|
328
|
+
>
|
|
329
|
+
<View style={styles.recentItemContent}>
|
|
330
|
+
<View style={styles.recentItemIcon}>
|
|
331
|
+
<Database width={16} height={16} color="#8b5cf6" />
|
|
332
|
+
</View>
|
|
333
|
+
<View style={styles.recentItemText}>
|
|
334
|
+
<Text style={[styles.recentItemTitle, { color: theme.colors.text }]}>
|
|
335
|
+
{item.query}
|
|
336
|
+
</Text>
|
|
337
|
+
<Text style={[styles.recentItemTime, { color: theme.colors.textMuted }]}>
|
|
338
|
+
{item.category} • {item.time}
|
|
339
|
+
</Text>
|
|
340
|
+
</View>
|
|
341
|
+
</View>
|
|
342
|
+
</SwipeableCard>
|
|
343
|
+
)}
|
|
344
|
+
estimatedItemSize={80}
|
|
345
|
+
style={styles.recentList}
|
|
346
|
+
/>
|
|
347
|
+
</Card>
|
|
348
|
+
</Container>
|
|
349
|
+
</ScrollView>
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function renderRAGChat() {
|
|
354
|
+
return (
|
|
355
|
+
<Container padding={16} style={styles.chatContainer}>
|
|
356
|
+
<RAGChatPanel
|
|
357
|
+
ragSystem={ragSystem.ragSystem}
|
|
358
|
+
placeholder="Ask me anything about our knowledge base..."
|
|
359
|
+
showTypingIndicator={true}
|
|
360
|
+
showSources={true}
|
|
361
|
+
showConfidenceScore={false} // Hidden on mobile for cleaner UI
|
|
362
|
+
enableVoiceInput={true}
|
|
363
|
+
enableOfflineMode={true}
|
|
364
|
+
onQuery={handleRAGQuery}
|
|
365
|
+
style={styles.ragChat}
|
|
366
|
+
mobileOptimized={true}
|
|
367
|
+
/>
|
|
368
|
+
</Container>
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function renderKnowledgeBase() {
|
|
373
|
+
return (
|
|
374
|
+
<ScrollView style={styles.tabContent} showsVerticalScrollIndicator={false}>
|
|
375
|
+
<Container padding={16}>
|
|
376
|
+
<Card style={styles.card}>
|
|
377
|
+
<KnowledgeSearchPanel
|
|
378
|
+
ragSystem={ragSystem.ragSystem}
|
|
379
|
+
placeholder="Search knowledge base..."
|
|
380
|
+
showCategories={true}
|
|
381
|
+
showFilters={false} // Simplified for mobile
|
|
382
|
+
onSearch={ragSystem.searchKnowledge}
|
|
383
|
+
style={styles.knowledgeSearch}
|
|
384
|
+
/>
|
|
385
|
+
</Card>
|
|
386
|
+
|
|
387
|
+
<Card style={styles.card}>
|
|
388
|
+
<KnowledgeManagementPanel
|
|
389
|
+
ragSystem={ragSystem.ragSystem}
|
|
390
|
+
allowAdd={true}
|
|
391
|
+
allowEdit={true}
|
|
392
|
+
allowDelete={true}
|
|
393
|
+
showBulkActions={false} // Simplified for mobile
|
|
394
|
+
onAdd={ragSystem.addKnowledge}
|
|
395
|
+
onUpdate={ragSystem.updateKnowledge}
|
|
396
|
+
style={styles.knowledgeManagement}
|
|
397
|
+
/>
|
|
398
|
+
</Card>
|
|
399
|
+
</Container>
|
|
400
|
+
</ScrollView>
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function renderTextGenerator() {
|
|
405
|
+
return (
|
|
406
|
+
<ScrollView style={styles.tabContent} showsVerticalScrollIndicator={false}>
|
|
407
|
+
<Container padding={16}>
|
|
408
|
+
<Card style={styles.card}>
|
|
409
|
+
<AITextGenerator
|
|
410
|
+
placeholder="Describe what you want to generate..."
|
|
411
|
+
templates={[
|
|
412
|
+
'Blog post',
|
|
413
|
+
'Email marketing',
|
|
414
|
+
'Social media content',
|
|
415
|
+
'Product description',
|
|
416
|
+
'Code documentation',
|
|
417
|
+
'Creative writing'
|
|
418
|
+
]}
|
|
419
|
+
enhanceWithRAG={true}
|
|
420
|
+
ragSystem={ragSystem.ragSystem}
|
|
421
|
+
showWordCount={true}
|
|
422
|
+
maxLength={2000}
|
|
423
|
+
onGenerate={(result) => handleAIGeneration('text', result)}
|
|
424
|
+
style={styles.aiGenerator}
|
|
425
|
+
/>
|
|
426
|
+
</Card>
|
|
427
|
+
</Container>
|
|
428
|
+
</ScrollView>
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function renderAudioGenerator() {
|
|
433
|
+
return (
|
|
434
|
+
<ScrollView style={styles.tabContent} showsVerticalScrollIndicator={false}>
|
|
435
|
+
<Container padding={16}>
|
|
436
|
+
<Card style={styles.card}>
|
|
437
|
+
<AIAudioGenerator
|
|
438
|
+
placeholder="Describe the audio you want to generate..."
|
|
439
|
+
supportedFormats={['mp3', 'wav', 'ogg']}
|
|
440
|
+
showWaveform={true}
|
|
441
|
+
maxDuration={300}
|
|
442
|
+
voices={[
|
|
443
|
+
{ id: 'alloy', name: 'Alloy', language: 'en-US' },
|
|
444
|
+
{ id: 'echo', name: 'Echo', language: 'en-US' },
|
|
445
|
+
{ id: 'fable', name: 'Fable', language: 'en-US' },
|
|
446
|
+
{ id: 'onyx', name: 'Onyx', language: 'en-US' },
|
|
447
|
+
{ id: 'nova', name: 'Nova', language: 'en-US' },
|
|
448
|
+
{ id: 'shimmer', name: 'Shimmer', language: 'en-US' },
|
|
449
|
+
]}
|
|
450
|
+
onGenerate={(result) => handleAIGeneration('audio', result)}
|
|
451
|
+
style={styles.aiGenerator}
|
|
452
|
+
/>
|
|
453
|
+
</Card>
|
|
454
|
+
</Container>
|
|
455
|
+
</ScrollView>
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function renderVideoGenerator() {
|
|
460
|
+
return (
|
|
461
|
+
<ScrollView style={styles.tabContent} showsVerticalScrollIndicator={false}>
|
|
462
|
+
<Container padding={16}>
|
|
463
|
+
<Card style={styles.card}>
|
|
464
|
+
<AIVideoGenerator
|
|
465
|
+
placeholder="Describe the video you want to generate..."
|
|
466
|
+
supportedFormats={['mp4', 'webm']}
|
|
467
|
+
resolution="1080p"
|
|
468
|
+
showPreview={true}
|
|
469
|
+
maxDuration={60}
|
|
470
|
+
styles={[
|
|
471
|
+
'Photorealistic',
|
|
472
|
+
'Cartoon',
|
|
473
|
+
'Anime',
|
|
474
|
+
'Watercolor',
|
|
475
|
+
'Oil painting',
|
|
476
|
+
'Digital art'
|
|
477
|
+
]}
|
|
478
|
+
onGenerate={(result) => handleAIGeneration('video', result)}
|
|
479
|
+
style={styles.aiGenerator}
|
|
480
|
+
/>
|
|
481
|
+
</Card>
|
|
482
|
+
</Container>
|
|
483
|
+
</ScrollView>
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function renderAnalytics() {
|
|
488
|
+
return (
|
|
489
|
+
<ScrollView style={styles.tabContent} showsVerticalScrollIndicator={false}>
|
|
490
|
+
<Container padding={16}>
|
|
491
|
+
<Card style={styles.card}>
|
|
492
|
+
<RAGAnalytics
|
|
493
|
+
ragSystem={ragSystem.ragSystem}
|
|
494
|
+
showUsageStats={true}
|
|
495
|
+
showPerformanceMetrics={true}
|
|
496
|
+
showPopularQueries={true}
|
|
497
|
+
showKnowledgeGaps={true}
|
|
498
|
+
timeRange="7d"
|
|
499
|
+
style={styles.analytics}
|
|
500
|
+
/>
|
|
501
|
+
</Card>
|
|
502
|
+
</Container>
|
|
503
|
+
</ScrollView>
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return (
|
|
508
|
+
<AIProvider config={aiConfig}>
|
|
509
|
+
<PageTransition type="slide" duration={300}>
|
|
510
|
+
<SafeAreaView style={[styles.container, { backgroundColor: theme.colors.background }]}>
|
|
511
|
+
<View style={styles.header}>
|
|
512
|
+
<Text style={[styles.title, { color: theme.colors.text }]}>
|
|
513
|
+
AI Studio
|
|
514
|
+
</Text>
|
|
515
|
+
<View style={styles.headerActions}>
|
|
516
|
+
<Badge
|
|
517
|
+
variant={ragSystem.isReady ? "success" : "warning"}
|
|
518
|
+
size="sm"
|
|
519
|
+
>
|
|
520
|
+
RAG {ragSystem.isReady ? 'Ready' : 'Loading'}
|
|
521
|
+
</Badge>
|
|
522
|
+
<Badge variant="primary" size="sm">
|
|
523
|
+
v4.0.0
|
|
524
|
+
</Badge>
|
|
525
|
+
</View>
|
|
526
|
+
</View>
|
|
527
|
+
|
|
528
|
+
<TabbedInterface
|
|
529
|
+
tabs={aiTabs}
|
|
530
|
+
activeTabId={activeTab}
|
|
531
|
+
onTabChange={handleTabChange}
|
|
532
|
+
variant="pills"
|
|
533
|
+
showLabels={true}
|
|
534
|
+
scrollable={true}
|
|
535
|
+
hapticFeedback={true}
|
|
536
|
+
style={styles.tabbedInterface}
|
|
537
|
+
/>
|
|
538
|
+
</SafeAreaView>
|
|
539
|
+
</PageTransition>
|
|
540
|
+
</AIProvider>
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
const styles = StyleSheet.create({
|
|
545
|
+
container: {
|
|
546
|
+
flex: 1,
|
|
547
|
+
},
|
|
548
|
+
header: {
|
|
549
|
+
flexDirection: 'row',
|
|
550
|
+
justifyContent: 'space-between',
|
|
551
|
+
alignItems: 'center',
|
|
552
|
+
paddingHorizontal: 16,
|
|
553
|
+
paddingVertical: 12,
|
|
554
|
+
borderBottomWidth: 1,
|
|
555
|
+
borderBottomColor: 'rgba(0, 0, 0, 0.1)',
|
|
556
|
+
},
|
|
557
|
+
title: {
|
|
558
|
+
fontSize: 28,
|
|
559
|
+
fontWeight: '700',
|
|
560
|
+
},
|
|
561
|
+
headerActions: {
|
|
562
|
+
flexDirection: 'row',
|
|
563
|
+
alignItems: 'center',
|
|
564
|
+
gap: 8,
|
|
565
|
+
},
|
|
566
|
+
tabbedInterface: {
|
|
567
|
+
flex: 1,
|
|
568
|
+
},
|
|
569
|
+
tabContent: {
|
|
570
|
+
flex: 1,
|
|
571
|
+
},
|
|
572
|
+
card: {
|
|
573
|
+
marginBottom: 16,
|
|
574
|
+
padding: 16,
|
|
575
|
+
},
|
|
576
|
+
cardTitle: {
|
|
577
|
+
fontSize: 18,
|
|
578
|
+
fontWeight: '600',
|
|
579
|
+
marginBottom: 16,
|
|
580
|
+
},
|
|
581
|
+
statusGrid: {
|
|
582
|
+
flexDirection: 'row',
|
|
583
|
+
gap: 16,
|
|
584
|
+
flexWrap: 'wrap',
|
|
585
|
+
},
|
|
586
|
+
statusItem: {
|
|
587
|
+
flexDirection: 'row',
|
|
588
|
+
alignItems: 'center',
|
|
589
|
+
gap: 8,
|
|
590
|
+
},
|
|
591
|
+
statusDot: {
|
|
592
|
+
width: 8,
|
|
593
|
+
height: 8,
|
|
594
|
+
borderRadius: 4,
|
|
595
|
+
},
|
|
596
|
+
statusText: {
|
|
597
|
+
fontSize: 14,
|
|
598
|
+
fontWeight: '500',
|
|
599
|
+
},
|
|
600
|
+
statsCard: {
|
|
601
|
+
backgroundColor: 'rgba(59, 130, 246, 0.05)',
|
|
602
|
+
},
|
|
603
|
+
statsGrid: {
|
|
604
|
+
marginTop: 8,
|
|
605
|
+
},
|
|
606
|
+
statItem: {
|
|
607
|
+
alignItems: 'center',
|
|
608
|
+
padding: 12,
|
|
609
|
+
},
|
|
610
|
+
statNumber: {
|
|
611
|
+
fontSize: 24,
|
|
612
|
+
fontWeight: '700',
|
|
613
|
+
marginBottom: 4,
|
|
614
|
+
},
|
|
615
|
+
statLabel: {
|
|
616
|
+
fontSize: 12,
|
|
617
|
+
textAlign: 'center',
|
|
618
|
+
},
|
|
619
|
+
quickActions: {
|
|
620
|
+
marginTop: 8,
|
|
621
|
+
},
|
|
622
|
+
quickActionButton: {
|
|
623
|
+
flexDirection: 'column',
|
|
624
|
+
alignItems: 'center',
|
|
625
|
+
justifyContent: 'center',
|
|
626
|
+
height: 80,
|
|
627
|
+
gap: 8,
|
|
628
|
+
},
|
|
629
|
+
quickActionText: {
|
|
630
|
+
fontSize: 12,
|
|
631
|
+
fontWeight: '500',
|
|
632
|
+
color: '#64748b',
|
|
633
|
+
},
|
|
634
|
+
recentList: {
|
|
635
|
+
maxHeight: 300,
|
|
636
|
+
},
|
|
637
|
+
recentItem: {
|
|
638
|
+
marginBottom: 8,
|
|
639
|
+
},
|
|
640
|
+
recentItemContent: {
|
|
641
|
+
flexDirection: 'row',
|
|
642
|
+
alignItems: 'center',
|
|
643
|
+
padding: 12,
|
|
644
|
+
gap: 12,
|
|
645
|
+
},
|
|
646
|
+
recentItemIcon: {
|
|
647
|
+
width: 32,
|
|
648
|
+
height: 32,
|
|
649
|
+
borderRadius: 16,
|
|
650
|
+
backgroundColor: 'rgba(139, 92, 246, 0.1)',
|
|
651
|
+
alignItems: 'center',
|
|
652
|
+
justifyContent: 'center',
|
|
653
|
+
},
|
|
654
|
+
recentItemText: {
|
|
655
|
+
flex: 1,
|
|
656
|
+
},
|
|
657
|
+
recentItemTitle: {
|
|
658
|
+
fontSize: 14,
|
|
659
|
+
fontWeight: '500',
|
|
660
|
+
marginBottom: 2,
|
|
661
|
+
},
|
|
662
|
+
recentItemTime: {
|
|
663
|
+
fontSize: 12,
|
|
664
|
+
},
|
|
665
|
+
aiGenerator: {
|
|
666
|
+
minHeight: 400,
|
|
667
|
+
},
|
|
668
|
+
chatContainer: {
|
|
669
|
+
flex: 1,
|
|
670
|
+
},
|
|
671
|
+
ragChat: {
|
|
672
|
+
flex: 1,
|
|
673
|
+
},
|
|
674
|
+
knowledgeSearch: {
|
|
675
|
+
minHeight: 200,
|
|
676
|
+
},
|
|
677
|
+
knowledgeManagement: {
|
|
678
|
+
minHeight: 400,
|
|
679
|
+
},
|
|
680
|
+
analytics: {
|
|
681
|
+
minHeight: 500,
|
|
682
|
+
},
|
|
683
|
+
});
|