awacke1 commited on
Commit
32beef2
ยท
verified ยท
1 Parent(s): 6142169

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +193 -741
app.py CHANGED
@@ -11,15 +11,14 @@ from urllib.parse import quote
11
  from gradio_client import Client
12
  from datetime import datetime
13
 
14
- # ๐ŸŒณ๐Ÿค– AIKnowledgeTreeBuilder - Because every app needs a good costume!
15
-
16
  Site_Name = 'AI Knowledge Tree Builder ๐Ÿ“ˆ๐ŸŒฟ Grow Smarter with Every Click'
17
  title = "๐ŸŒณโœจAI Knowledge Tree Builder๐Ÿ› ๏ธ๐Ÿค“"
18
  helpURL = 'https://huggingface.co/spaces/awacke1/AIKnowledgeTreeBuilder/'
19
  bugURL = 'https://huggingface.co/spaces/awacke1/AIKnowledgeTreeBuilder/'
20
  icons = '๐ŸŒณโœจ๐Ÿ› ๏ธ๐Ÿค“'
21
 
22
- SidebarOutline="""๐ŸŒณ๐Ÿค– Designed with the following tenets:
23
  1 ๐Ÿ“ฑ **Portability** - Universal access via any device & link sharing
24
  2. โšก **Speed of Build** - Rapid deployments < 2min to production
25
  3. ๐Ÿ”— **Linkiness** - Programmatic access to AI knowledge sources
@@ -43,7 +42,6 @@ st.set_page_config(
43
 
44
  st.sidebar.markdown(SidebarOutline)
45
 
46
-
47
  # Initialize session state variables
48
  if 'selected_file' not in st.session_state:
49
  st.session_state.selected_file = None
@@ -52,519 +50,7 @@ if 'view_mode' not in st.session_state:
52
  if 'files' not in st.session_state:
53
  st.session_state.files = []
54
 
55
-
56
- BiologyAndLevel36MagicUsers="""
57
- 0. Biology Core Rules and Future Exceptions
58
- 1. Central Dogma DNA RNA Protein
59
- - Current CRISPR RNA editing ๐Ÿงช
60
- - Research Gene therapy siRNA ๐Ÿ”ฌ
61
- - Future Programmable genetics ๐Ÿš€
62
-
63
- 2. Cell Origin
64
- - Current iPSCs organoids ๐Ÿฆ 
65
- - Research Synthetic cells ๐Ÿ”ฌ
66
- - Future De novo cell creation ๐Ÿš€
67
-
68
- 3. Form Function
69
- - Current Bioprinting ๐Ÿซ€
70
- - Research 4D printing ๐Ÿ”ฌ
71
- - Future Self assembling structures ๐Ÿš€
72
-
73
- 4. Homeostasis
74
- - Current Artificial pancreas ๐Ÿค–
75
- - Research Nanorobots ๐Ÿ”ฌ
76
- - Future Autonomous regulation ๐Ÿš€
77
-
78
- 5. Evolution
79
- - Current Directed evolution ๐Ÿงซ
80
- - Research Synthetic biology ๐Ÿ”ฌ
81
- - Future Accelerated adaptation ๐Ÿš€
82
-
83
- 6. Energy Conservation
84
- - Current Biofuel cells โšก
85
- - Research Quantum biology ๐Ÿ”ฌ
86
- - Future Biological perpetual motion ๐Ÿš€
87
-
88
- 7. Cellular Life
89
- - Current Organoid systems ๐Ÿ”ฎ
90
- - Research Hybrid cells ๐Ÿ”ฌ
91
- - Future Silicon based life ๐Ÿš€
92
-
93
- 8. Inheritance Patterns
94
- - Current Gene drives ๐Ÿงฉ
95
- - Research Epigenetic control ๐Ÿ”ฌ
96
- - Future Designed inheritance ๐Ÿš€
97
-
98
- 9. Energy Requirements
99
- - Current Metabolic engineering ๐Ÿ”‹
100
- - Research Synthetic photosynthesis ๐Ÿ”ฌ
101
- - Future Zero energy life ๐Ÿš€
102
-
103
- 10. Random Mutation
104
- - Current Base editing ๐ŸŽฏ
105
- - Research Mutation prediction ๐Ÿ”ฌ
106
- - Future Controlled evolution ๐Ÿš€
107
-
108
- 11. Carbon Based Life
109
- - Current Alternative biochemistry ๐Ÿ’Ž
110
- - Research Silicon biology ๐Ÿ”ฌ
111
- - Future Non carbon life ๐Ÿš€
112
-
113
- 12. Size Limitations
114
- - Current Nanostructures ๐Ÿ“
115
- - Research Quantum biology ๐Ÿ”ฌ
116
- - Future Scalable organisms ๐Ÿš€
117
-
118
- 13. Species Interdependence
119
- - Current Synthetic ecosystems ๐ŸŒฟ
120
- - Research Artificial symbiosis ๐Ÿ”ฌ
121
- - Future Independent life ๐Ÿš€
122
-
123
- 14. Stimulus Response
124
- - Current Brain computer interfaces ๐Ÿง 
125
- - Research Neural engineering ๐Ÿ”ฌ
126
- - Future Direct consciousness control ๐Ÿš€
127
-
128
- 15. Development Complexity
129
- - Current Accelerated growth ๐ŸŒฑ
130
- - Research Development control ๐Ÿ”ฌ
131
- - Future Instant maturation ๐Ÿš€
132
-
133
- 16. Population Growth
134
- - Current Population control ๐Ÿ“Š
135
- - Research Sustainable ecosystems ๐Ÿ”ฌ
136
- - Future Perfect equilibrium ๐Ÿš€
137
-
138
- 17. Energy Flow
139
- - Current Enhanced photosynthesis ๐ŸŒž
140
- - Research Energy optimization ๐Ÿ”ฌ
141
- - Future Perpetual systems ๐Ÿš€
142
-
143
- 18. Environmental Adaptation
144
- - Current Climate resistance ๐ŸŒ
145
- - Research Universal adaptation ๐Ÿ”ฌ
146
- - Future Environment independence ๐Ÿš€
147
-
148
- 19. Genetic Inheritance
149
- - Current Gene editing ๐Ÿงฌ
150
- - Research Trait programming ๐Ÿ”ฌ
151
- - Future Perfect inheritance ๐Ÿš€
152
-
153
- 20. Reproduction
154
- - Current Artificial wombs ๐Ÿ‘ถ
155
- - Research Cloning advances ๐Ÿ”ฌ
156
- - Future Asexual human reproduction ๐Ÿš€
157
-
158
- 21. Aging Death
159
- - Current Longevity therapy โฐ
160
- - Research Age reversal ๐Ÿ”ฌ
161
- - Future Biological immortality ๐Ÿš€
162
- """
163
-
164
- AITopicsToInnovate1="""
165
- 1. Major AI Industry Players ๐ŸŒ
166
- 1. Research Leaders ๐ŸŽฏ
167
- - OpenAI: GPT-4 DALL-E Foundation Models ๐Ÿ”ต
168
- - Google: PaLM Gemini LLMs ๐ŸŸฆ
169
- - Anthropic: Claude Constitutional AI โšก
170
- - Meta: LLaMA Open Source LLMs ๐Ÿ‘ค
171
- - xAI: Grok Conversational AI ๐Ÿค–
172
-
173
- 2. Technical AI Development ๐Ÿ› ๏ธ
174
- 1. Architecture Advances ๐Ÿ’ซ
175
- - Transformer Models Attention Mechanisms ๐Ÿง 
176
- - Mixture of Experts MoE Architecture ๐ŸŽช
177
- - Sparse Neural Networks ๐Ÿ•ธ๏ธ
178
- - Multi-modal LLM Systems ๐ŸŒˆ
179
- - Flash Attention Optimization โš”๏ธ
180
-
181
- 2. Training Methodologies ๐Ÿ“š
182
- - LLM Supervised Fine-tuning ๐Ÿ‘จโ€๐Ÿซ
183
- - RLHF Reward Models ๐Ÿค
184
- - Constitutional AI Training ๐Ÿ“œ
185
- - RLAIF Feedback Models ๐Ÿ”„
186
- - Synthetic Data LLM Training ๐ŸŽฒ
187
- - Chain of Thought Prompting ๐Ÿงฉ
188
- - Tree of Thoughts Reasoning ๐ŸŒณ
189
-
190
- 3. Post-Training Implementation ๐Ÿ”ง
191
- - Neural Network Distillation ๐Ÿงช
192
- - LLM Quantization Methods ๐Ÿ“Š
193
- - Neural Network Pruning ๏ฟฝ๏ฟฝ๏ฟฝ๏ธ
194
- - Knowledge Distillation Transfer ๐Ÿ“–
195
- - Few-shot LLM Learning ๐ŸŽฏ
196
-
197
- 3. Mechanistic Interpretability ๐Ÿ”ฌ
198
- 1. Core Concepts ๐Ÿ’ก
199
- - Neural Network Growth Analysis ๐ŸŒฑ
200
- - LLM Architecture Analysis ๐Ÿ—๏ธ
201
- - Training Loss Optimization ๐ŸŽจ
202
- - Neural Network Analogies ๐Ÿงฌ
203
-
204
- 2. Technical Features ๐Ÿ“
205
- - LLM Linear Representations โžก๏ธ
206
- - Neural Vector Arithmetic ๐Ÿ”ข
207
- - Neural Activation Patterns ๐ŸŒŠ
208
- - LLM Feature Detection ๐Ÿ”
209
- - Neural Sparse Autoencoders ๐ŸŽญ
210
-
211
- 3. Network Analysis ๐Ÿ•ต๏ธ
212
- - LLM Induction Heads ๐Ÿ‘€
213
- - Transformer Attention Analysis ๐ŸŽช
214
- - Neural Circuit Analysis ๐Ÿ”Œ
215
- - LLM Feature Visualization ๐Ÿ“ˆ
216
- - Neural Concept Directions ๐ŸŽณ
217
-
218
- 4. Future AI Developments ๐Ÿš€
219
- 1. AGI Timeline โฐ
220
- - AGI Capability Projections ๐Ÿ“…
221
- - Neural Hardware Scaling ๐Ÿ’พ
222
- - LLM Training Data Limits ๐Ÿ“‰
223
- - AI Compute Resources ๐Ÿ—บ๏ธ
224
-
225
- 2. Integration Fields ๐ŸŽก
226
- - AI Biology Integration ๐Ÿ”ฎ
227
- - AI Drug Discovery Systems ๐Ÿ’Š
228
- - AI Clinical Trial Analysis ๐Ÿฅ
229
- - AI Code Generation ๐Ÿคน
230
- - AI Scientific Discovery ๐Ÿงฎ
231
-
232
- 5. Industry Best Practices ๐Ÿ’Ž
233
- 1. AI Team Building ๐Ÿข
234
- - AI Talent Development ๐Ÿ‘ฅ
235
- - AI Research Alignment ๐ŸŽช
236
- - AI Team Scaling ๐Ÿ“Š
237
- - AI Research Culture ๐ŸŒŸ
238
-
239
- 2. AI Research Qualities ๐ŸŽ“
240
- - AI Research Methodology ๐Ÿงญ
241
- - AI Experimentation Protocols ๐Ÿ—๏ธ
242
- - AI Innovation Thinking ๐Ÿ’ซ
243
- - AI Testing Framework โš–๏ธ
244
-
245
- 3. AI Safety Standards ๐Ÿ›ก๏ธ
246
- - LLM Behavioral Specifications ๐Ÿ“‹
247
- - AI Safety Guidelines ๐ŸŽฎ
248
- - AI Ethics Framework โ›‘๏ธ
249
- - AI Industry Standards ๐Ÿคฒ
250
-
251
- 6. Emerging Research Areas ๐Ÿ”ฎ
252
- 1. Technical Focus ๐ŸŽฏ
253
- - LLM Long Context Learning โณ
254
- - LLM Multi-agent Interaction ๐Ÿ‘พ
255
- - AI Evaluation Metrics ๐Ÿ“Œ
256
- - Neural Interpretability Methods ๐Ÿ”ญ
257
-
258
- 2. AI Applications ๐Ÿ’ผ
259
- - AI Automated Research ๐Ÿงซ
260
- - AI Code Synthesis โŒจ๏ธ
261
- - AI Biological Modeling ๐Ÿงฏ
262
- - AI Medical Diagnostics ๐Ÿ’‰
263
-
264
- 7. Model Intelligence ๐Ÿงฟ
265
- 1. LLM System Development ๐ŸŽช
266
- - LLM Prompt Engineering ๐Ÿ“
267
- - LLM Response Generation โ™Ÿ๏ธ
268
- - LLM Behavioral Training ๐ŸŽน
269
- - LLM Personality Development ๐ŸŽช
270
-
271
- 2. LLM User Interaction ๐ŸŽญ
272
- - LLM Autonomy Alignment ๐ŸŽช
273
- - LLM Safety Boundaries ๐Ÿ”’
274
- - LLM Communication Patterns ๐Ÿ—ฃ๏ธ
275
- - LLM Performance Tuning ๐ŸŽข
276
- """
277
-
278
- Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds = """
279
-
280
-
281
- 0. Fantasy Domain Introduction
282
- 1. Setting the Scene
283
- - Current Create a high-fantasy realm with unique ecosystems, magical phenomena, and cultural diversity ๐Ÿž๏ธ
284
- - Research Add domain-specific entities like mythical creatures, enchanted terrains, or ancient artifacts ๐Ÿงโ€โ™‚๏ธ
285
- - Future Fully AI-generated interactive worldbuilding ๐Ÿš€
286
-
287
- 2. Archetypal Overview
288
- - Current Write a summary of a classic D&D character archetype ๐Ÿ—ก๏ธ
289
- - Research Add roles, special abilities, and motivations for NPC creation ๐Ÿ”ฎ
290
- - Future AI-enhanced roleplay character dynamics ๐Ÿš€
291
-
292
- 3. Entity-Focused Narrative Creation
293
- 1. Monster Mythology
294
- - Current Create monsters with unique traits like โ€˜Crimson Obelisk Wurmโ€™ ๐Ÿ‰
295
- - Research Add lore and origin stories with detailed classifications ๐Ÿ”ฌ
296
- - Future Dynamic AI monster lore generators ๐Ÿš€
297
- 2. Artifact Legacy
298
- - Current Describe legendary artifacts like โ€˜The Aetherflame Prismโ€™ ๐Ÿง™โ€โ™‚๏ธ
299
- - Research Add historical narratives and effects on wielders ๐Ÿ”ฌ
300
- - Future AI-designed item crafting ๐Ÿš€
301
- 3. Heroic Figures
302
- - Current Write backstories for heroic figures like โ€˜Syran Stormbladeโ€™ โš”๏ธ
303
- - Research Integrate figures into broader campaigns and their achievements ๐Ÿ”ฌ
304
- - Future Procedurally generated heroes ๐Ÿš€
305
-
306
- 4. Immersive Dialogues and Roleplay
307
- 1. NPC Conversations
308
- - Current Generate realistic NPC dialogues like in โ€˜The Ghostwood Forestโ€™ ๐Ÿ—จ๏ธ
309
- - Research Add depth to NPC motivations and interactions ๐Ÿ”ฌ
310
- - Future AI-led adaptive NPC behavior ๐Ÿš€
311
- 2. Villain Confrontations
312
- - Current Design confrontations with unique villains like โ€˜Eldrazar the Timelessโ€™ ๐Ÿ‘น
313
- - Research Layer villains with complex personalities and backstories ๐Ÿ”ฌ
314
- - Future AI-driven antagonist strategy generation ๐Ÿš€
315
-
316
- 5. World-Building
317
- 1. Cultural Narratives
318
- - Current Describe civilizations like โ€˜The Emberkinโ€™ ๐ŸŒ‹
319
- - Research Add societal structures and traditions ๐Ÿ”ฌ
320
- - Future AI-created evolving societies ๐Ÿš€
321
- 2. Mythic Locations
322
- - Current Create locations like โ€˜The Whispering Wastesโ€™ ๐Ÿœ๏ธ
323
- - Research Integrate locations into broader world lore ๐Ÿ”ฌ
324
- - Future Fully explorable AI worlds ๐Ÿš€
325
- 3. Dimensional Realms
326
- - Current Design parallel dimensions like โ€˜The Veil of Shadowsโ€™ ๐ŸŒŒ
327
- - Research Add magical laws and inhabitants ๐Ÿ”ฌ
328
- - Future AI-generated multiverses ๐Ÿš€
329
-
330
- 6. Quests and Campaigns
331
- 1. Campaign Arcs
332
- - Current Design multi-part campaigns like retrieving โ€˜The Obsidian Crownโ€™ ๐ŸŽฏ
333
- - Research Add NPC, obstacle, and objective integration ๐Ÿ”ฌ
334
- - Future AI-created campaign blueprints ๐Ÿš€
335
- 2. Encounter Design
336
- - Current Create encounters like facing โ€˜The Frostbane Golemโ€™ ๐ŸงŠ
337
- - Research Add detailed strategies and reward systems ๐Ÿ”ฌ
338
- - Future AI-led encounter simulations ๐Ÿš€
339
- 3. Legendary Betrayals
340
- - Current Write scenarios with plot twists, e.g., โ€˜Thane Vorthakโ€™s betrayalโ€™ ๐Ÿค”
341
- - Research Add motivations and dramatic tension ๐Ÿ”ฌ
342
- - Future AI-generated unpredictable twists ๐Ÿš€
343
-
344
- 7. AI Collaboration for Dual Perspectives
345
- 1. Scene Duality
346
- - Current Generate battle scenes like adventurers vs. a Beholder ๐Ÿ›ก๏ธ
347
- - Research Rewrite scenes from different perspectives ๐Ÿ”ฌ
348
- - Future AI-enhanced multi-perspective storytelling ๐Ÿš€
349
- 2. Tag Comparison
350
- - Current Classify entities like MON, LOC, ART using NER tags ๐Ÿท๏ธ
351
- - Research Refine classifications with AI collaboration ๐Ÿ”ฌ
352
- - Future Real-time AI entity extraction ๐Ÿš€
353
-
354
- 8. Experimental Storytelling Techniques
355
- 1. Lore Fusion
356
- - Current Combine legends like โ€˜Stormcallersโ€™ and โ€˜Voidseersโ€™ ๐ŸŒ€
357
- - Research Create shared histories with dynamic lore layers ๐Ÿ”ฌ
358
- - Future AI-driven mythos merging ๐Ÿš€
359
- 2. Procedural Creativity
360
- - Current Generate tables of random D&D entities ๐Ÿ“Š
361
- - Research Add adaptive tags for dynamic storytelling ๐Ÿ”ฌ
362
- - Future Procedural AI entity generation ๐Ÿš€
363
-
364
- 9. Advanced NER Applications
365
- 1. Custom Tags
366
- - Current Create tags like SPELL and TRAP for dungeon-specific entities ๐Ÿ”—
367
- - Research Train AI on niche tags for unique entity extraction ๐Ÿ”ฌ
368
- - Future AI-driven custom tag creation ๐Ÿš€
369
- 2. Entity Extraction
370
- - Current Extract entities from passages like โ€˜The Sunken Cryptsโ€™ ๐Ÿš๏ธ
371
- - Research Add advanced AI classification accuracy ๐Ÿ”ฌ
372
- - Future Automated fine-tuning for AI models ๐Ÿš€
373
- 3. Dimensional Entities
374
- - Current Classify niche entities like โ€˜Voidwalkersโ€™ ๐ŸŒ 
375
- - Research Train models for multi-dimensional lore ๐Ÿ”ฌ
376
- - Future AI multiverse exploration ๐Ÿš€
377
-
378
-
379
-
380
-
381
-
382
- Active Multiplayer Games 2024 ๐ŸŽฎ
383
-
384
- 1 Traditional MMORPGs ๐Ÿ—ก๏ธ
385
-
386
- 1.1 Major MMORPGs ๐Ÿฐ
387
- - Final Fantasy XIV Dawntrail 2024 โš”๏ธ
388
- - Advanced Job System Rework ๐ŸŽญ
389
- - Cross Platform Integration ๐ŸŽช
390
- - New Housing Districts ๐Ÿ˜๏ธ
391
-
392
- - World of Warcraft 2024 Season ๐Ÿฒ
393
- - Dragon Combat System ๐Ÿฆ‹
394
- - Cross Faction Features โšœ๏ธ
395
- - Mythic Plus Seasons ๐Ÿ†
396
-
397
- - Elder Scrolls Online Gold Road ๐Ÿ—๏ธ
398
- - Dynamic Event System ๐ŸŒŸ
399
- - Housing Construction ๐Ÿ›๏ธ
400
- - Champion System 2.0 ๐Ÿ“Š
401
-
402
- - Lost Ark Western T4 Update โšก
403
- - Legion Raid Content ๐Ÿ‘พ
404
- - Island Adventure System ๐Ÿ๏ธ
405
- - Class Balance Rework ๐Ÿ”ฐ
406
-
407
- - Black Desert Online Remaster ๐ŸŽช
408
- - Combat System Update ๐ŸŽฏ
409
- - Node Empire System ๐Ÿน
410
- - Life Skill Evolution ๐ŸŒณ
411
-
412
- 1.2 Emerging MMORPGs ๐ŸŒ 
413
- - Throne and Liberty Launch ๐Ÿ‘‘
414
- - Weather Combat System ๐ŸŒฆ๏ธ
415
- - Territory Wars ๐Ÿ—บ๏ธ
416
- - Transformation System ๐Ÿ‰
417
-
418
- - Pax Dei Medieval MMO โš”๏ธ
419
- - City Management ๐Ÿฐ
420
- - Faith Based Magic โœจ
421
- - Global Trading ๐Ÿ’Ž
422
-
423
- - Blue Protocol Western Release ๐ŸŒŒ
424
- - Action Combat Design ๐ŸŽญ
425
- - Class Change System โšก
426
- - Dungeon Scaling ๐Ÿ—ผ
427
-
428
- 2 Survival MMOs ๐Ÿน
429
-
430
- 2.1 Established Survival ๐Ÿ›ก๏ธ
431
- - Rust 2024 Updates ๐Ÿฆพ
432
- - Electricity Programming ๐Ÿ’ก
433
- - Vehicle System Update ๐Ÿš—
434
- - Automated Defenses โšก
435
-
436
- - ARK Survival Ascended ๐Ÿฆ–
437
- - Cross ARK System ๐ŸŒ
438
- - Creature Breeding 2.0 ๐Ÿฅš
439
- - Base Defense Network ๐Ÿฐ
440
-
441
- - DayZ 2024 Content ๐ŸงŸ
442
- - Medical System Update ๐Ÿ’‰
443
- - Disease Mechanics ๐Ÿฆ 
444
- - Base Building 2.0 ๐Ÿ—๏ธ
445
-
446
- - 7 Days to Die Alpha 22 ๐Ÿš๏ธ
447
- - Physics Engine Update ๐Ÿ’ฅ
448
- - AI Pathfinding System ๐Ÿง 
449
- - Vehicle Customization ๐Ÿš™
450
-
451
- 2.2 New Survival MMOs ๐Ÿ†•
452
- - Once Human Launch ๐Ÿงฌ
453
- - Mutation System ๐Ÿงช
454
- - Base Building Tech ๐Ÿญ
455
- - Weather Impact System ๐ŸŒช๏ธ
456
-
457
- - Nightingale Release ๐ŸŒ™
458
- - Portal Realm System ๐ŸŒŒ
459
- - Victorian Crafting ๐ŸŽฉ
460
- - Fae World Design ๐Ÿงš
461
-
462
- 3 Hybrid MMOs ๐ŸŽฏ
463
-
464
- 3.1 Looter Shooters ๐Ÿ”ซ
465
- - Destiny 2 2024 Season ๐Ÿ›ธ
466
- - Build System 3.0 ๐Ÿ› ๏ธ
467
- - Raid Mechanics โญ
468
- - Season Structure ๐Ÿ“ˆ
469
-
470
- - The Division 2 Year 6 ๐Ÿ™๏ธ
471
- - Loadout Expansion ๐ŸŽ’
472
- - Dark Zone Update ๐ŸŒƒ
473
- - Manhunt System ๐ŸŽฏ
474
-
475
- - Warframe 2024 Update ๐Ÿค–
476
- - Movement Tech 2.0 ๐Ÿƒ
477
- - Mod System Rework โš™๏ธ
478
- - Open World Expansion ๐ŸŒ…
479
-
480
- 3.2 Action RPG MMOs ๐Ÿ’ซ
481
- - Path of Exile 2 Beta ๐Ÿ’Ž
482
- - Gem System Rework ๐Ÿ’ซ
483
- - New Skill Tree ๐ŸŒฒ
484
- - League Content ๐Ÿ†
485
-
486
- - Diablo 4 Season Structure ๐Ÿ˜ˆ
487
- - Season Journey System ๐ŸŽญ
488
- - World Boss Events ๐Ÿฒ
489
- - PvP Territories ๐Ÿ—ก๏ธ
490
-
491
- 4 Simulation MMOs ๐ŸŒ
492
-
493
- 4.1 Space Simulation ๐Ÿš€
494
- - EVE Online 2024 ๐Ÿ›ธ
495
- - Corporation Warfare ๐Ÿดโ€โ˜ ๏ธ
496
- - Market System Update ๐Ÿ“Š
497
- - Fleet Operations ๐Ÿšข
498
-
499
- - Elite Dangerous Update ๐ŸŒŒ
500
- - Ground Combat System ๐Ÿ‘จโ€๐Ÿš€
501
- - Fleet Carrier Content โญ
502
- - Planet Exploration ๐Ÿช
503
-
504
- - Star Citizen Alpha ๐Ÿ›ธ
505
- - Persistent Universe ๐ŸŒ
506
- - Ship Combat Update โš”๏ธ
507
- - Trading System 2.0 ๐Ÿ’ฐ
508
-
509
- 4.2 World Simulation ๐ŸŒŽ
510
- - New World Eternal ๐Ÿ—บ๏ธ
511
- - Territory System ๐Ÿฐ
512
- - Crafting Update ๐Ÿ› ๏ธ
513
- - War System 2.0 โš”๏ธ
514
-
515
- - Albion Online 2024 ๐Ÿน
516
- - Guild Warfare Update โš”๏ธ
517
- - Economy System 2.0 ๐Ÿ’ฐ
518
- - Territory Control ๐Ÿฐ
519
-
520
- 5 Unique Multiplayer Games ๐ŸŽฒ
521
-
522
- 5.1 Adventure Multiplayer ๐Ÿ—บ๏ธ
523
- - Sea of Thieves 2024 โ›ต
524
- - Ship Combat Physics ๐ŸŒŠ
525
- - Crew Management ๐Ÿดโ€โ˜ ๏ธ
526
- - World Events ๐ŸŽช
527
-
528
- - Valheim Updates โšก
529
- - Building System 2.0 ๐Ÿ—๏ธ
530
- - Boss Progression ๐Ÿ‘น
531
- - Exploration Update ๐Ÿ—บ๏ธ
532
-
533
- 5.2 Combat Focused ๐Ÿ—ก๏ธ
534
- - Mordhau 2024 โš”๏ธ
535
- - Combat Physics Update ๐Ÿคบ
536
- - Map System Rework ๐Ÿฐ
537
- - Tournament System ๐Ÿ†
538
-
539
- - For Honor Year 8 ๐Ÿ›ก๏ธ
540
- - Faction War Update โš”๏ธ
541
- - Hero Rework System ๐ŸŽญ
542
- - Seasonal Content ๐ŸŒŸ
543
-
544
- 6 Upcoming 2024 Games ๐Ÿ”ฎ
545
-
546
- 6.1 Launching Soon ๐Ÿ“…
547
- - Gray Zone Warfare ๐ŸŽ–๏ธ
548
- - Tactical Systems ๐ŸŽฏ
549
- - Base Operations ๐Ÿข
550
- - Territory Control ๐Ÿ—บ๏ธ
551
-
552
- - Fractured Online ๐ŸŒŸ
553
- - City Building ๐Ÿ—๏ธ
554
- - Knowledge System ๐Ÿ“š
555
- - Player Economy ๐Ÿ’ฐ
556
-
557
- 6.2 In Development ๐Ÿ› ๏ธ
558
- - Ashes of Creation ๐Ÿฐ
559
- - Node System ๐ŸŒฑ
560
- - Castle Siege โš”๏ธ
561
- - Caravan System ๐Ÿช
562
-
563
- - Pantheon Rise of the Fallen ๐ŸŒ…
564
- - Climate System ๐ŸŒฆ๏ธ
565
- - Group Content Focus ๐Ÿ‘ฅ
566
- - Perception System ๐Ÿ‘๏ธ
567
- """
568
 
569
  def get_display_name(filename):
570
  """Extract text from parentheses or return filename as is."""
@@ -582,30 +68,19 @@ def get_time_display(filename):
582
 
583
  def sanitize_filename(text):
584
  """Create a safe filename from text while preserving spaces."""
585
- # First replace unsafe characters with spaces
586
  safe_text = re.sub(r'[^\w\s-]', ' ', text)
587
- # Remove any multiple spaces
588
  safe_text = re.sub(r'\s+', ' ', safe_text)
589
- # Trim leading/trailing spaces
590
  safe_text = safe_text.strip()
591
- return safe_text[:50] # Limit length to 50 chars
592
 
593
  def generate_timestamp_filename(query):
594
  """Generate filename with format: 1103AM 11032024 (Query).md"""
595
- # Get current time in Central timezone
596
  central = pytz.timezone('US/Central')
597
  current_time = datetime.now(central)
598
-
599
- # Format the timestamp parts
600
- time_str = current_time.strftime("%I%M%p") # 1103AM format
601
- date_str = current_time.strftime("%m%d%Y") # 11032024 format
602
-
603
- # Clean up the query for filename - now preserving spaces
604
  safe_query = sanitize_filename(query)
605
-
606
- # Construct filename: "1103AM 11032024 (Input with spaces).md"
607
  filename = f"{time_str} {date_str} ({safe_query}).md"
608
-
609
  return filename
610
 
611
  def delete_file(file_path):
@@ -620,8 +95,6 @@ def delete_file(file_path):
620
  def save_ai_interaction(query, ai_result, is_rerun=False):
621
  """Save AI interaction to a markdown file with new filename format."""
622
  filename = generate_timestamp_filename(query)
623
-
624
- # Format the content differently for rerun vs normal query
625
  if is_rerun:
626
  content = f"""# Rerun Query
627
  Original file content used for rerun:
@@ -637,8 +110,6 @@ Original file content used for rerun:
637
  ## AI Response
638
  {ai_result}
639
  """
640
-
641
- # Save to file
642
  try:
643
  with open(filename, 'w', encoding='utf-8') as f:
644
  f.write(content)
@@ -659,50 +130,139 @@ def get_file_download_link(file_path):
659
  st.error(f"Error creating download link: {e}")
660
  return None
661
 
662
- def extract_terms(markdown_text):
663
- """Parse markdown text and extract terms."""
664
- lines = markdown_text.strip().split('\n')
665
- terms = []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
666
  for line in lines:
667
- line = re.sub(r'^[#*\->\d\.\s]+', '', line).strip()
668
- if line:
669
- terms.append(line)
670
- return terms
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
 
672
- def extract_urls(text):
673
- try:
674
- date_pattern = re.compile(r'### (\d{2} \w{3} \d{4})')
675
- abs_link_pattern = re.compile(r'\[(.*?)\]\((https://arxiv\.org/abs/\d+\.\d+)\)')
676
- pdf_link_pattern = re.compile(r'\[โฌ‡๏ธ\]\((https://arxiv\.org/pdf/\d+\.\d+)\)')
677
- title_pattern = re.compile(r'### \d{2} \w{3} \d{4} \| \[(.*?)\]')
678
- date_matches = date_pattern.findall(text)
679
- abs_link_matches = abs_link_pattern.findall(text)
680
- pdf_link_matches = pdf_link_pattern.findall(text)
681
- title_matches = title_pattern.findall(text)
682
-
683
- # markdown with the extracted fields
684
- markdown_text = ""
685
- for i in range(len(date_matches)):
686
- date = date_matches[i]
687
- title = title_matches[i]
688
- abs_link = abs_link_matches[i][1]
689
- pdf_link = pdf_link_matches[i]
690
- markdown_text += f"**Date:** {date}\n\n"
691
- markdown_text += f"**Title:** {title}\n\n"
692
- markdown_text += f"**Abstract Link:** [{abs_link}]({abs_link})\n\n"
693
- markdown_text += f"**PDF Link:** [{pdf_link}]({pdf_link})\n\n"
694
- markdown_text += "---\n\n"
695
- return markdown_text
696
-
697
- except:
698
- st.write('.')
699
- return ''
700
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
701
 
702
- # HTML5 based Speech Synthesis (Text to Speech in Browser)
703
  @st.cache_resource
704
  def SpeechSynthesis(result):
705
- documentHTML5='''
706
  <!DOCTYPE html>
707
  <html>
708
  <head>
@@ -719,8 +279,8 @@ def SpeechSynthesis(result):
719
  <h1>๐Ÿ”Š Read It Aloud</h1>
720
  <textarea id="textArea" rows="10" cols="80">
721
  '''
722
- documentHTML5 = documentHTML5 + result
723
- documentHTML5 = documentHTML5 + '''
724
  </textarea>
725
  <br>
726
  <button onclick="readAloud()">๐Ÿ”Š Read Aloud</button>
@@ -729,124 +289,20 @@ def SpeechSynthesis(result):
729
  '''
730
  components.html(documentHTML5, width=1280, height=300)
731
 
732
- def display_terms_with_links(terms):
733
- """Display terms with various search links."""
734
- search_urls = {
735
- "๐Ÿ“š๐Ÿ“–ArXiv": lambda k: f"/?q={quote(k)}", # Academic/paper theme
736
- "๐Ÿ”ฎ<sup>Google</sup>": lambda k: f"https://www.google.com/search?q={quote(k)}", # Crystal ball for search
737
- "๐Ÿ“บ<sup>Youtube</sup>": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}", # TV for videos
738
- "๐Ÿ”ญ<sup>Bing</sup>": lambda k: f"https://www.bing.com/search?q={quote(k)}", # Telescope for search
739
- "๐Ÿ’ก<sup>Truth</sup>": lambda k: f"https://truthsocial.com/search?q={quote(k)}", # Light bulb for insight
740
- "๐Ÿ“ฑX": lambda k: f"https://twitter.com/search?q={quote(k)}", # Phone for social media
741
- }
742
- for term in terms:
743
- links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
744
- st.markdown(f"- **{term}** {links_md}", unsafe_allow_html=True)
745
-
746
- def search_arxiv(query):
747
-
748
- st.write("Performing AI Lookup...")
749
- client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
750
-
751
- result1 = client.predict(
752
- prompt=query,
753
- llm_model_picked="mistralai/Mixtral-8x7B-Instruct-v0.1",
754
- stream_outputs=True,
755
- api_name="/ask_llm"
756
- )
757
- st.markdown("### Mixtral-8x7B-Instruct-v0.1 Result")
758
- st.markdown(result1)
759
-
760
- result2 = client.predict(
761
- prompt=query,
762
- llm_model_picked="mistralai/Mistral-7B-Instruct-v0.2",
763
- stream_outputs=True,
764
- api_name="/ask_llm"
765
- )
766
- st.markdown("### Mistral-7B-Instruct-v0.2 Result")
767
- st.markdown(result2)
768
- combined_result = f"{result1}\n\n{result2}"
769
- #return combined_result
770
-
771
- return responseall
772
-
773
- # Function to generate a filename based on prompt and time (because names matter ๐Ÿ•’)
774
- def generate_filename(prompt, file_type):
775
- central = pytz.timezone('US/Central')
776
- safe_date_time = datetime.now(central).strftime("%m%d_%H%M")
777
- safe_prompt = re.sub(r'\W+', '_', prompt)[:90]
778
- return f"{safe_date_time}_{safe_prompt}.{file_type}"
779
-
780
- # Function to create and save a file (and avoid the black hole of lost data ๐Ÿ•ณ)
781
- def create_file(filename, prompt, response):
782
- with open(filename, 'w', encoding='utf-8') as file:
783
- file.write(prompt + "\n\n" + response)
784
-
785
-
786
-
787
- def perform_ai_lookup(query):
788
- start_time = time.strftime("%Y-%m-%d %H:%M:%S")
789
- client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
790
- response1 = client.predict(
791
- query,
792
- 20,
793
- "Semantic Search",
794
- "mistralai/Mixtral-8x7B-Instruct-v0.1",
795
- api_name="/update_with_rag_md"
796
- )
797
- Question = '### ๐Ÿ”Ž ' + query + '\r\n' # Format for markdown display with links
798
- References = response1[0]
799
- ReferenceLinks = extract_urls(References)
800
-
801
- RunSecondQuery = True
802
- results=''
803
- if RunSecondQuery:
804
- # Search 2 - Retrieve the Summary with Papers Context and Original Query
805
- response2 = client.predict(
806
- query,
807
- "mistralai/Mixtral-8x7B-Instruct-v0.1",
808
- True,
809
- api_name="/ask_llm"
810
- )
811
- if len(response2) > 10:
812
- Answer = response2
813
- SpeechSynthesis(Answer)
814
- # Restructure results to follow format of Question, Answer, References, ReferenceLinks
815
- results = Question + '\r\n' + Answer + '\r\n' + References + '\r\n' + ReferenceLinks
816
- st.markdown(results)
817
-
818
- st.write('๐Ÿ”Run of Multi-Agent System Paper Summary Spec is Complete')
819
- end_time = time.strftime("%Y-%m-%d %H:%M:%S")
820
- start_timestamp = time.mktime(time.strptime(start_time, "%Y-%m-%d %H:%M:%S"))
821
- end_timestamp = time.mktime(time.strptime(end_time, "%Y-%m-%d %H:%M:%S"))
822
- elapsed_seconds = end_timestamp - start_timestamp
823
- st.write(f"Start time: {start_time}")
824
- st.write(f"Finish time: {end_time}")
825
- st.write(f"Elapsed time: {elapsed_seconds:.2f} seconds")
826
-
827
-
828
- filename = generate_filename(query, "md")
829
- create_file(filename, query, results)
830
- return results
831
-
832
  def display_file_content(file_path):
833
  """Display file content with editing capabilities."""
834
  try:
835
  with open(file_path, 'r', encoding='utf-8') as f:
836
  content = f.read()
837
-
838
  if st.session_state.view_mode == 'view':
839
- # Display as markdown when viewing
840
  st.markdown(content)
841
  else:
842
- # Edit functionality
843
  edited_content = st.text_area(
844
  "Edit content",
845
  content,
846
  height=400,
847
  key=f"edit_{os.path.basename(file_path)}"
848
  )
849
-
850
  if st.button("Save Changes", key=f"save_{os.path.basename(file_path)}"):
851
  try:
852
  with open(file_path, 'w', encoding='utf-8') as f:
@@ -860,62 +316,43 @@ def display_file_content(file_path):
860
  def file_management_sidebar():
861
  """Redesigned sidebar with improved layout and additional functionality."""
862
  st.sidebar.title("๐Ÿ“ File Management")
863
-
864
- # Get list of .md files excluding README.md
865
  md_files = [file for file in glob.glob("*.md") if file.lower() != 'readme.md']
866
  md_files.sort()
867
  st.session_state.files = md_files
868
-
869
  if md_files:
870
  st.sidebar.markdown("### Saved Files")
871
  for idx, file in enumerate(md_files):
872
- st.sidebar.markdown("---") # Separator between files
873
-
874
- # Display time
875
  st.sidebar.text(get_time_display(file))
876
-
877
- # Display download link with simplified text
878
  download_link = get_file_download_link(file)
879
  if download_link:
880
  st.sidebar.markdown(download_link, unsafe_allow_html=True)
881
-
882
- # Action buttons in a row
883
  col1, col2, col3, col4 = st.sidebar.columns(4)
884
-
885
  with col1:
886
  if st.button("๐Ÿ“„View", key=f"view_{idx}"):
887
  st.session_state.selected_file = file
888
  st.session_state.view_mode = 'view'
889
-
890
  with col2:
891
  if st.button("โœ๏ธEdit", key=f"edit_{idx}"):
892
  st.session_state.selected_file = file
893
  st.session_state.view_mode = 'edit'
894
-
895
  with col3:
896
  if st.button("๐Ÿ”„Run", key=f"rerun_{idx}"):
897
  try:
898
  with open(file, 'r', encoding='utf-8') as f:
899
  content = f.read()
900
-
901
- # Prepare the prompt with the prefix
902
  rerun_prefix = """For the markdown below reduce the text to a humorous fun outline with emojis and markdown outline levels in outline that convey all the facts and adds wise quotes and funny statements to engage the reader:
903
 
904
  """
905
  full_prompt = rerun_prefix + content
906
-
907
- # Perform AI lookup and save results
908
  ai_result = perform_ai_lookup(full_prompt)
909
  saved_file = save_ai_interaction(content, ai_result, is_rerun=True)
910
-
911
  if saved_file:
912
  st.success(f"Created fun version in {saved_file}")
913
  st.session_state.selected_file = saved_file
914
  st.session_state.view_mode = 'view'
915
-
916
  except Exception as e:
917
  st.error(f"Error during rerun: {e}")
918
-
919
  with col4:
920
  if st.button("๐Ÿ—‘๏ธDelete", key=f"delete_{idx}"):
921
  if delete_file(file):
@@ -923,9 +360,7 @@ def file_management_sidebar():
923
  st.rerun()
924
  else:
925
  st.error(f"Failed to delete {file}")
926
-
927
  st.sidebar.markdown("---")
928
- # Option to create a new markdown file
929
  if st.sidebar.button("๐Ÿ“ Create New Note"):
930
  filename = generate_timestamp_filename("New Note")
931
  with open(filename, 'w', encoding='utf-8') as f:
@@ -943,22 +378,68 @@ def file_management_sidebar():
943
  st.session_state.selected_file = filename
944
  st.session_state.view_mode = 'edit'
945
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946
  def main():
947
  st.markdown("### AI Knowledge Tree Builder ๐Ÿง ๐ŸŒฑ Cultivate Your AI Mindscape!")
948
-
949
- # Process query parameters and AI lookup first
950
  query_params = st.query_params
951
  query = query_params.get('q', '')
952
- show_initial_content = True # Flag to control initial content display
953
 
954
- # First priority: Handle active query
955
  if query:
956
- show_initial_content = False # Hide initial content when showing query results
957
  st.write(f"### Search query received: {query}")
958
  try:
959
  ai_result = perform_ai_lookup(query)
960
-
961
- # Save the interaction
962
  saved_file = save_ai_interaction(query, ai_result)
963
  if saved_file:
964
  st.success(f"Saved interaction to {saved_file}")
@@ -967,12 +448,10 @@ def main():
967
  except Exception as e:
968
  st.error(f"Error during AI lookup: {e}")
969
 
970
- # File management sidebar
971
  file_management_sidebar()
972
-
973
- # Second priority: Display selected file content if any
974
  if st.session_state.selected_file:
975
- show_initial_content = False # Hide initial content when showing file content
976
  if os.path.exists(st.session_state.selected_file):
977
  st.markdown(f"### Current File: {st.session_state.selected_file}")
978
  display_file_content(st.session_state.selected_file)
@@ -981,35 +460,8 @@ def main():
981
  st.session_state.selected_file = None
982
  st.rerun()
983
 
984
- # Show initial content: Either when first landing or when no interactive elements are active
985
  if show_initial_content:
986
- # First show the clickable terms with links
987
- terms1 = extract_terms(AITopicsToInnovate1)
988
- terms2 = extract_terms(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
989
- terms3 = extract_terms(BiologyAndLevel36MagicUsers)
990
-
991
- all_terms = terms1 + terms2 + terms3
992
-
993
- col1, col2, col3, col4, col5, col6 = st.columns(6)
994
-
995
- with col1:
996
- st.markdown("#### AI Topics to Innovate With")
997
- st.markdown(AITopicsToInnovate1)
998
- with col2:
999
- st.markdown("#### AI Agent Links")
1000
- display_terms_with_links(terms1)
1001
- with col3:
1002
- st.markdown("#### Biology Innovation with Data Science and AI Solutions")
1003
- st.markdown(BiologyAndLevel36MagicUsers)
1004
- with col4:
1005
- st.markdown("#### Biology Innovation Agent Links")
1006
- display_terms_with_links(terms3)
1007
- with col5:
1008
- st.markdown("#### Multiplayer Games and MMOs")
1009
- st.markdown(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
1010
- with col6:
1011
- st.markdown("#### Multiplayer Game and MMO Links")
1012
- display_terms_with_links(terms2)
1013
 
1014
  if __name__ == "__main__":
1015
- main()
 
11
  from gradio_client import Client
12
  from datetime import datetime
13
 
14
+ # Page configuration
 
15
  Site_Name = 'AI Knowledge Tree Builder ๐Ÿ“ˆ๐ŸŒฟ Grow Smarter with Every Click'
16
  title = "๐ŸŒณโœจAI Knowledge Tree Builder๐Ÿ› ๏ธ๐Ÿค“"
17
  helpURL = 'https://huggingface.co/spaces/awacke1/AIKnowledgeTreeBuilder/'
18
  bugURL = 'https://huggingface.co/spaces/awacke1/AIKnowledgeTreeBuilder/'
19
  icons = '๐ŸŒณโœจ๐Ÿ› ๏ธ๐Ÿค“'
20
 
21
+ SidebarOutline = """๐ŸŒณ๐Ÿค– Designed with the following tenets:
22
  1 ๐Ÿ“ฑ **Portability** - Universal access via any device & link sharing
23
  2. โšก **Speed of Build** - Rapid deployments < 2min to production
24
  3. ๐Ÿ”— **Linkiness** - Programmatic access to AI knowledge sources
 
42
 
43
  st.sidebar.markdown(SidebarOutline)
44
 
 
45
  # Initialize session state variables
46
  if 'selected_file' not in st.session_state:
47
  st.session_state.selected_file = None
 
50
  if 'files' not in st.session_state:
51
  st.session_state.files = []
52
 
53
+ # --- Utility Functions ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  def get_display_name(filename):
56
  """Extract text from parentheses or return filename as is."""
 
68
 
69
  def sanitize_filename(text):
70
  """Create a safe filename from text while preserving spaces."""
 
71
  safe_text = re.sub(r'[^\w\s-]', ' ', text)
 
72
  safe_text = re.sub(r'\s+', ' ', safe_text)
 
73
  safe_text = safe_text.strip()
74
+ return safe_text[:50]
75
 
76
  def generate_timestamp_filename(query):
77
  """Generate filename with format: 1103AM 11032024 (Query).md"""
 
78
  central = pytz.timezone('US/Central')
79
  current_time = datetime.now(central)
80
+ time_str = current_time.strftime("%I%M%p")
81
+ date_str = current_time.strftime("%m%d%Y")
 
 
 
 
82
  safe_query = sanitize_filename(query)
 
 
83
  filename = f"{time_str} {date_str} ({safe_query}).md"
 
84
  return filename
85
 
86
  def delete_file(file_path):
 
95
  def save_ai_interaction(query, ai_result, is_rerun=False):
96
  """Save AI interaction to a markdown file with new filename format."""
97
  filename = generate_timestamp_filename(query)
 
 
98
  if is_rerun:
99
  content = f"""# Rerun Query
100
  Original file content used for rerun:
 
110
  ## AI Response
111
  {ai_result}
112
  """
 
 
113
  try:
114
  with open(filename, 'w', encoding='utf-8') as f:
115
  f.write(content)
 
130
  st.error(f"Error creating download link: {e}")
131
  return None
132
 
133
+ # --- New Functions for Markdown File Parsing and Link Tree ---
134
+
135
+ def clean_item_text(line):
136
+ """
137
+ Remove emoji and numbered prefix from a line.
138
+ E.g., "๐Ÿ”ง 1. Low-level system integrations compilers Cplusplus" becomes
139
+ "Low-level system integrations compilers Cplusplus".
140
+ Also remove any bold markdown markers.
141
+ """
142
+ # Remove leading emoji and number+period
143
+ cleaned = re.sub(r'^[^\w]*(\d+\.\s*)', '', line)
144
+ # Remove any remaining emoji (simple unicode range) and ** markers
145
+ cleaned = re.sub(r'[\U0001F300-\U0001FAFF]', '', cleaned)
146
+ cleaned = cleaned.replace("**", "")
147
+ return cleaned.strip()
148
+
149
+ def clean_header_text(header_line):
150
+ """
151
+ Extract header text from a markdown header line.
152
+ E.g., "๐Ÿ”ง **Systems, Infrastructure & Low-Level Engineering**" becomes
153
+ "Systems, Infrastructure & Low-Level Engineering".
154
+ """
155
+ match = re.search(r'\*\*(.*?)\*\*', header_line)
156
+ if match:
157
+ return match.group(1).strip()
158
+ return header_line.strip()
159
+
160
+ def parse_markdown_sections(md_text):
161
+ """
162
+ Parse markdown text into sections.
163
+ Each section starts with a header line containing bold text.
164
+ Returns a list of dicts with keys: 'header' and 'items' (list of lines).
165
+ Skips any content before the first header.
166
+ """
167
+ sections = []
168
+ current_section = None
169
+ lines = md_text.splitlines()
170
  for line in lines:
171
+ if line.strip() == "":
172
+ continue
173
+ # Check if line is a header (contains bold markdown and an emoji)
174
+ if '**' in line:
175
+ header = clean_header_text(line)
176
+ current_section = {'header': header, 'raw': line, 'items': []}
177
+ sections.append(current_section)
178
+ elif current_section is not None:
179
+ # Only add lines that appear to be list items (start with an emoji and number)
180
+ if re.match(r'^[^\w]*\d+\.\s+', line):
181
+ current_section['items'].append(line)
182
+ else:
183
+ if current_section['items']:
184
+ current_section['items'][-1] += " " + line.strip()
185
+ else:
186
+ current_section['items'].append(line)
187
+ return sections
188
+
189
+ def display_section_items(items):
190
+ """
191
+ Display list of items as links.
192
+ For each item, clean the text and generate search links using your original link set.
193
+ """
194
+ search_urls = {
195
+ "๐Ÿ“š๐Ÿ“–ArXiv": lambda k: f"/?q={quote(k)}",
196
+ "๐Ÿ”ฎ<sup>Google</sup>": lambda k: f"https://www.google.com/search?q={quote(k)}",
197
+ "๐Ÿ“บ<sup>Youtube</sup>": lambda k: f"https://www.youtube.com/results?search_query={quote(k)}",
198
+ "๐Ÿ”ญ<sup>Bing</sup>": lambda k: f"https://www.bing.com/search?q={quote(k)}",
199
+ "๐Ÿ’ก<sup>Truth</sup>": lambda k: f"https://truthsocial.com/search?q={quote(k)}",
200
+ "๐Ÿ“ฑX": lambda k: f"https://twitter.com/search?q={quote(k)}",
201
+ }
202
+ for item in items:
203
+ cleaned_text = clean_item_text(item)
204
+ links_md = ' '.join([f"[{emoji}]({url(cleaned_text)})" for emoji, url in search_urls.items()])
205
+ st.markdown(f"- **{cleaned_text}** {links_md}", unsafe_allow_html=True)
206
+
207
+ def display_markdown_tree():
208
+ """
209
+ Allow user to upload a .md file or load README.md.
210
+ Parse the markdown into sections and display each section in a collapsed expander
211
+ with the original markdown and a link tree of items.
212
+ """
213
+ st.markdown("## Markdown Tree Parser")
214
+ uploaded_file = st.file_uploader("Upload a Markdown file", type=["md"])
215
+ if uploaded_file is not None:
216
+ md_content = uploaded_file.read().decode("utf-8")
217
+ else:
218
+ if os.path.exists("README.md"):
219
+ with open("README.md", "r", encoding="utf-8") as f:
220
+ md_content = f.read()
221
+ else:
222
+ st.info("No Markdown file uploaded and README.md not found.")
223
+ return
224
 
225
+ sections = parse_markdown_sections(md_content)
226
+ if not sections:
227
+ st.info("No sections found in the markdown file.")
228
+ return
229
+
230
+ for sec in sections:
231
+ with st.expander(sec['header'], expanded=False):
232
+ st.markdown(f"**Original Markdown:**\n\n{sec['raw']}\n")
233
+ if sec['items']:
234
+ st.markdown("**Link Tree:**")
235
+ display_section_items(sec['items'])
236
+ else:
237
+ st.write("No items found in this section.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
 
239
+ # --- Existing AI and File Management Functions ---
240
+
241
+ def search_arxiv(query):
242
+ st.write("Performing AI Lookup...")
243
+ client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
244
+ result1 = client.predict(
245
+ prompt=query,
246
+ llm_model_picked="mistralai/Mixtral-8x7B-Instruct-v0.1",
247
+ stream_outputs=True,
248
+ api_name="/ask_llm"
249
+ )
250
+ st.markdown("### Mixtral-8x7B-Instruct-v0.1 Result")
251
+ st.markdown(result1)
252
+ result2 = client.predict(
253
+ prompt=query,
254
+ llm_model_picked="mistralai/Mistral-7B-Instruct-v0.2",
255
+ stream_outputs=True,
256
+ api_name="/ask_llm"
257
+ )
258
+ st.markdown("### Mistral-7B-Instruct-v0.2 Result")
259
+ st.markdown(result2)
260
+ combined_result = f"{result1}\n\n{result2}"
261
+ return combined_result
262
 
 
263
  @st.cache_resource
264
  def SpeechSynthesis(result):
265
+ documentHTML5 = '''
266
  <!DOCTYPE html>
267
  <html>
268
  <head>
 
279
  <h1>๐Ÿ”Š Read It Aloud</h1>
280
  <textarea id="textArea" rows="10" cols="80">
281
  '''
282
+ documentHTML5 += result
283
+ documentHTML5 += '''
284
  </textarea>
285
  <br>
286
  <button onclick="readAloud()">๐Ÿ”Š Read Aloud</button>
 
289
  '''
290
  components.html(documentHTML5, width=1280, height=300)
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  def display_file_content(file_path):
293
  """Display file content with editing capabilities."""
294
  try:
295
  with open(file_path, 'r', encoding='utf-8') as f:
296
  content = f.read()
 
297
  if st.session_state.view_mode == 'view':
 
298
  st.markdown(content)
299
  else:
 
300
  edited_content = st.text_area(
301
  "Edit content",
302
  content,
303
  height=400,
304
  key=f"edit_{os.path.basename(file_path)}"
305
  )
 
306
  if st.button("Save Changes", key=f"save_{os.path.basename(file_path)}"):
307
  try:
308
  with open(file_path, 'w', encoding='utf-8') as f:
 
316
  def file_management_sidebar():
317
  """Redesigned sidebar with improved layout and additional functionality."""
318
  st.sidebar.title("๐Ÿ“ File Management")
 
 
319
  md_files = [file for file in glob.glob("*.md") if file.lower() != 'readme.md']
320
  md_files.sort()
321
  st.session_state.files = md_files
 
322
  if md_files:
323
  st.sidebar.markdown("### Saved Files")
324
  for idx, file in enumerate(md_files):
325
+ st.sidebar.markdown("---")
 
 
326
  st.sidebar.text(get_time_display(file))
 
 
327
  download_link = get_file_download_link(file)
328
  if download_link:
329
  st.sidebar.markdown(download_link, unsafe_allow_html=True)
 
 
330
  col1, col2, col3, col4 = st.sidebar.columns(4)
 
331
  with col1:
332
  if st.button("๐Ÿ“„View", key=f"view_{idx}"):
333
  st.session_state.selected_file = file
334
  st.session_state.view_mode = 'view'
 
335
  with col2:
336
  if st.button("โœ๏ธEdit", key=f"edit_{idx}"):
337
  st.session_state.selected_file = file
338
  st.session_state.view_mode = 'edit'
 
339
  with col3:
340
  if st.button("๐Ÿ”„Run", key=f"rerun_{idx}"):
341
  try:
342
  with open(file, 'r', encoding='utf-8') as f:
343
  content = f.read()
 
 
344
  rerun_prefix = """For the markdown below reduce the text to a humorous fun outline with emojis and markdown outline levels in outline that convey all the facts and adds wise quotes and funny statements to engage the reader:
345
 
346
  """
347
  full_prompt = rerun_prefix + content
 
 
348
  ai_result = perform_ai_lookup(full_prompt)
349
  saved_file = save_ai_interaction(content, ai_result, is_rerun=True)
 
350
  if saved_file:
351
  st.success(f"Created fun version in {saved_file}")
352
  st.session_state.selected_file = saved_file
353
  st.session_state.view_mode = 'view'
 
354
  except Exception as e:
355
  st.error(f"Error during rerun: {e}")
 
356
  with col4:
357
  if st.button("๐Ÿ—‘๏ธDelete", key=f"delete_{idx}"):
358
  if delete_file(file):
 
360
  st.rerun()
361
  else:
362
  st.error(f"Failed to delete {file}")
 
363
  st.sidebar.markdown("---")
 
364
  if st.sidebar.button("๐Ÿ“ Create New Note"):
365
  filename = generate_timestamp_filename("New Note")
366
  with open(filename, 'w', encoding='utf-8') as f:
 
378
  st.session_state.selected_file = filename
379
  st.session_state.view_mode = 'edit'
380
 
381
+ def perform_ai_lookup(query):
382
+ start_time = time.strftime("%Y-%m-%d %H:%M:%S")
383
+ client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
384
+ response1 = client.predict(
385
+ query,
386
+ 20,
387
+ "Semantic Search",
388
+ "mistralai/Mixtral-8x7B-Instruct-v0.1",
389
+ api_name="/update_with_rag_md"
390
+ )
391
+ Question = '### ๐Ÿ”Ž ' + query + '\r\n'
392
+ References = response1[0]
393
+ ReferenceLinks = ""
394
+ results = ""
395
+ RunSecondQuery = True
396
+ if RunSecondQuery:
397
+ response2 = client.predict(
398
+ query,
399
+ "mistralai/Mixtral-8x7B-Instruct-v0.1",
400
+ True,
401
+ api_name="/ask_llm"
402
+ )
403
+ if len(response2) > 10:
404
+ Answer = response2
405
+ SpeechSynthesis(Answer)
406
+ results = Question + '\r\n' + Answer + '\r\n' + References + '\r\n' + ReferenceLinks
407
+ st.markdown(results)
408
+ st.write('๐Ÿ”Run of Multi-Agent System Paper Summary Spec is Complete')
409
+ end_time = time.strftime("%Y-%m-%d %H:%M:%S")
410
+ start_timestamp = time.mktime(time.strptime(start_time, "%Y-%m-%d %H:%M:%S"))
411
+ end_timestamp = time.mktime(time.strptime(end_time, "%Y-%m-%d %H:%M:%S"))
412
+ elapsed_seconds = end_timestamp - start_timestamp
413
+ st.write(f"Start time: {start_time}")
414
+ st.write(f"Finish time: {end_time}")
415
+ st.write(f"Elapsed time: {elapsed_seconds:.2f} seconds")
416
+ filename = generate_filename(query, "md")
417
+ create_file(filename, query, results)
418
+ return results
419
+
420
+ def generate_filename(prompt, file_type):
421
+ central = pytz.timezone('US/Central')
422
+ safe_date_time = datetime.now(central).strftime("%m%d_%H%M")
423
+ safe_prompt = re.sub(r'\W+', '_', prompt)[:90]
424
+ return f"{safe_date_time}_{safe_prompt}.{file_type}"
425
+
426
+ def create_file(filename, prompt, response):
427
+ with open(filename, 'w', encoding='utf-8') as file:
428
+ file.write(prompt + "\n\n" + response)
429
+
430
+ # --- Main Application ---
431
+
432
  def main():
433
  st.markdown("### AI Knowledge Tree Builder ๐Ÿง ๐ŸŒฑ Cultivate Your AI Mindscape!")
 
 
434
  query_params = st.query_params
435
  query = query_params.get('q', '')
436
+ show_initial_content = True
437
 
 
438
  if query:
439
+ show_initial_content = False
440
  st.write(f"### Search query received: {query}")
441
  try:
442
  ai_result = perform_ai_lookup(query)
 
 
443
  saved_file = save_ai_interaction(query, ai_result)
444
  if saved_file:
445
  st.success(f"Saved interaction to {saved_file}")
 
448
  except Exception as e:
449
  st.error(f"Error during AI lookup: {e}")
450
 
 
451
  file_management_sidebar()
452
+
 
453
  if st.session_state.selected_file:
454
+ show_initial_content = False
455
  if os.path.exists(st.session_state.selected_file):
456
  st.markdown(f"### Current File: {st.session_state.selected_file}")
457
  display_file_content(st.session_state.selected_file)
 
460
  st.session_state.selected_file = None
461
  st.rerun()
462
 
 
463
  if show_initial_content:
464
+ display_markdown_tree()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
 
466
  if __name__ == "__main__":
467
+ main()