-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial_page.py
More file actions
336 lines (286 loc) · 10.7 KB
/
tutorial_page.py
File metadata and controls
336 lines (286 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
import streamlit as st
def show_tutorial_page():
"""Page de tutoriel pour utiliser CléfistAI en dehors de Replit"""
st.markdown("""
<style>
.tutorial-header {
background: linear-gradient(135deg, #ffeef8 0%, #e8f5ff 100%);
padding: 20px;
border-radius: 15px;
text-align: center;
margin-bottom: 30px;
}
.step-box {
background: rgba(255, 255, 255, 0.8);
border-left: 5px solid #ff69b4;
padding: 15px;
margin: 15px 0;
border-radius: 10px;
}
.code-box {
background: #f8f9fa;
border: 2px solid #ffc1dc;
border-radius: 10px;
padding: 15px;
margin: 10px 0;
}
.warning-box {
background: #fff3cd;
border: 2px solid #ffeaa7;
border-radius: 10px;
padding: 15px;
margin: 10px 0;
}
</style>
""", unsafe_allow_html=True)
# En-tête du tutoriel
st.markdown("""
<div class="tutorial-header">
<h1>🐱✨ Guide Complet CléfistAI ✨🐱</h1>
<p><strong>🌸 Comment utiliser votre IA magique en dehors de Replit 🌸</strong></p>
</div>
""", unsafe_allow_html=True)
# Table des matières
st.markdown("## 📋 Table des Matières")
st.markdown("""
1. [📥 Installation Local](#installation-local)
2. [🐍 Configuration Python](#configuration-python)
3. [🚀 Lancement de l'Application](#lancement-de-l-application)
4. [💫 Utilisation Avancée](#utilisation-avancée)
5. [🛠️ Dépannage](#dépannage)
6. [🎯 Conseils Pro](#conseils-pro)
""")
# Section 1: Installation Local
st.markdown("## 📥 Installation Local")
st.markdown("""
<div class="step-box">
<h3>🐾 Étape 1: Télécharger les fichiers</h3>
<p>Pour utiliser CléfistAI sur votre ordinateur, vous aurez besoin de ces fichiers magiques :</p>
</div>
""", unsafe_allow_html=True)
with st.expander("📁 Structure des fichiers nécessaires"):
st.markdown("""
```
clemfist-ai/
├── app.py # Interface principale
├── clemscript_analyzer.py # Cerveau d'analyse
├── clemscript_templates.py # Templates de code
├── code_generator.py # Générateur magique
├── tutorial_page.py # Page tutoriel
└── requirements.txt # Dépendances Python
```
""")
st.markdown("""
<div class="code-box">
<h4>🔗 Créer le fichier requirements.txt</h4>
<p>Créez un fichier <code>requirements.txt</code> avec le contenu suivant :</p>
</div>
""", unsafe_allow_html=True)
st.code("""
streamlit>=1.28.0
regex>=2023.0.0
""", language="text")
# Section 2: Configuration Python
st.markdown("## 🐍 Configuration Python")
st.markdown("""
<div class="step-box">
<h3>🐾 Étape 2: Installer Python</h3>
<p>CléfistAI fonctionne avec Python 3.8 ou plus récent !</p>
</div>
""", unsafe_allow_html=True)
tab1, tab2, tab3 = st.tabs(["🪟 Windows", "🍎 macOS", "🐧 Linux"])
with tab1:
st.markdown("""
**Installation sur Windows:**
1. Téléchargez Python depuis [python.org](https://python.org)
2. Lancez l'installateur et cochez "Add to PATH"
3. Ouvrez PowerShell ou Invite de commandes
""")
st.code("""
# Vérifier l'installation
python --version
# Installer les dépendances
pip install -r requirements.txt
""", language="bash")
with tab2:
st.markdown("""
**Installation sur macOS:**
1. Installez Homebrew: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
2. Installez Python: `brew install python`
3. Ouvrez Terminal
""")
st.code("""
# Vérifier l'installation
python3 --version
# Installer les dépendances
pip3 install -r requirements.txt
""", language="bash")
with tab3:
st.markdown("""
**Installation sur Linux (Ubuntu/Debian):**
""")
st.code("""
# Mettre à jour le système
sudo apt update
# Installer Python et pip
sudo apt install python3 python3-pip
# Installer les dépendances
pip3 install -r requirements.txt
""", language="bash")
# Section 3: Lancement
st.markdown("## 🚀 Lancement de l'Application")
st.markdown("""
<div class="step-box">
<h3>🐾 Étape 3: Démarrer CléfistAI</h3>
<p>Une fois tout installé, lancez votre IA magique !</p>
</div>
""", unsafe_allow_html=True)
st.code("""
# Naviguer vers le dossier CléfistAI
cd chemin/vers/clemfist-ai
# Lancer l'application
streamlit run app.py
""", language="bash")
st.markdown("""
<div class="warning-box">
<strong>🎉 Magie en cours !</strong><br>
L'application s'ouvrira automatiquement dans votre navigateur à l'adresse <code>http://localhost:8501</code>
</div>
""", unsafe_allow_html=True)
# Section 4: Utilisation Avancée
st.markdown("## 💫 Utilisation Avancée")
st.markdown("""
<div class="step-box">
<h3>🐾 Personnalisation de CléfistAI</h3>
<p>Vous pouvez adapter CléfistAI à vos besoins spécifiques !</p>
</div>
""", unsafe_allow_html=True)
with st.expander("🎨 Personnaliser l'interface"):
st.markdown("""
**Modifier les couleurs et le style:**
- Éditez le CSS dans `app.py` (section `st.markdown` avec `<style>`)
- Changez les couleurs en modifiant les codes hexadécimaux
- Ajoutez vos propres emojis et messages
""")
with st.expander("🧠 Ajouter des mots-clés"):
st.markdown("""
**Étendre le vocabulaire de CléfistAI:**
1. Ouvrez `clemscript_analyzer.py`
2. Trouvez la section `concept_keywords`
3. Ajoutez vos propres mots-clés français dans les listes appropriées
**Exemple:**
```python
'variable': [
# Mots existants...
'mon_nouveau_mot', 'autre_synonyme'
]
```
""")
with st.expander("⚡ Optimiser les performances"):
st.markdown("""
**Pour des performances optimales:**
- Utilisez un SSD pour stocker l'application
- Fermez les autres applications gourmandes
- Utilisez Python 3.11+ pour de meilleures performances
- Configurez un cache Streamlit personnalisé
""")
# Section 5: Dépannage
st.markdown("## 🛠️ Dépannage")
with st.expander("❌ Erreurs communes et solutions"):
st.markdown("""
**Problème: ModuleNotFoundError**
```bash
# Solution: Installer les dépendances manquantes
pip install streamlit
```
**Problème: Port déjà utilisé**
```bash
# Solution: Utiliser un autre port
streamlit run app.py --server.port 8502
```
**Problème: Permission denied**
```bash
# Solution sur Linux/macOS: Utiliser sudo
sudo pip3 install -r requirements.txt
```
**Problème: L'interface ne s'affiche pas correctement**
- Videz le cache du navigateur (Ctrl+F5)
- Essayez un autre navigateur (Chrome recommandé)
- Vérifiez que JavaScript est activé
""")
with st.expander("🔧 Commandes utiles"):
st.markdown("""
```bash
# Vérifier la version de Streamlit
streamlit version
# Lancer avec configuration spécifique
streamlit run app.py --server.maxUploadSize 200
# Mode développement (rechargement automatique)
streamlit run app.py --server.runOnSave true
# Lancer sans ouvrir le navigateur
streamlit run app.py --server.headless true
# Voir l'aide complète
streamlit run --help
```
""")
# Section 6: Conseils Pro
st.markdown("## 🎯 Conseils Pro")
st.markdown("""
<div class="step-box">
<h3>🐾 Astuces pour devenir un maître de CléfistAI</h3>
</div>
""", unsafe_allow_html=True)
col1, col2 = st.columns(2)
with col1:
st.markdown("""
**💡 Conseils d'utilisation :**
- Utilisez des phrases naturelles en français
- Soyez précis dans vos demandes
- Explorez tous les types de concepts disponibles
- Sauvegardez vos codes générés préférés
- Expérimentez avec différents styles d'écriture
""")
with col2:
st.markdown("""
**🚀 Optimisation :**
- Utilisez des mots-clés variés pour plus de précision
- Combinez plusieurs concepts dans un prompt
- Testez vos codes ClemScript avec l'interpréteur
- Créez vos propres bibliothèques de templates
- Partagez vos prompts réussis avec la communauté
""")
# Section bonus: FAQ
st.markdown("## ❓ Questions Fréquentes")
with st.expander("🤔 CléfistAI peut-elle fonctionner hors ligne ?"):
st.markdown("""
**Oui !** Une fois installée localement, CléfistAI fonctionne entièrement hors ligne.
Vous n'avez besoin d'internet que pour l'installation initiale des dépendances.
""")
with st.expander("🔒 Mes données sont-elles sécurisées ?"):
st.markdown("""
**Absolument !** CléfistAI traite tout localement sur votre machine.
Aucune donnée n'est envoyée vers des serveurs externes.
""")
with st.expander("🎨 Puis-je modifier l'apparence ?"):
st.markdown("""
**Bien sûr !** Le code est open source et entièrement personnalisable.
Vous pouvez modifier les couleurs, les emojis, et même ajouter de nouvelles fonctionnalités.
""")
with st.expander("🐛 Comment signaler un bug ?"):
st.markdown("""
**Méthodes de signalement :**
1. Créez un fichier `debug.log` avec l'erreur
2. Notez les étapes pour reproduire le problème
3. Incluez votre version de Python et Streamlit
4. Décrivez le comportement attendu vs observé
""")
# Footer kawaii
st.markdown("---")
st.markdown("""
<div style='text-align: center; padding: 20px; background: linear-gradient(45deg, #ffeef8, #e8f5ff); border-radius: 15px; margin-top: 30px;'>
<h3>🐱✨ Félicitations ! ✨🐱</h3>
<p>Vous êtes maintenant prêt(e) à utiliser CléfistAI partout ! 🌸</p>
<p><strong>🐾 Fait avec ❤️ par Clemylia 🐾</strong></p>
<p><em>Que la magie du code soit avec vous ! 🪄</em></p>
</div>
""", unsafe_allow_html=True)