Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
| 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]
|
| 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 |
-
|
| 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 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 666 |
for line in lines:
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 671 |
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 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
|
| 723 |
-
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("---")
|
| 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
|
| 953 |
|
| 954 |
-
# First priority: Handle active query
|
| 955 |
if query:
|
| 956 |
-
show_initial_content = False
|
| 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
|
| 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 |
-
|
| 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()
|