File size: 2,632 Bytes
47ded99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
```dot
digraph WorldGeographyArchitecture {
    rankdir=TB;
    node [shape=box, style=rounded];
    
    // User Interface Layer
    subgraph cluster_ui {
        label="User Interface Layer";
        style=filled;
        color=lightblue;
        gradio [label="Gradio ChatInterface"];
        oauth [label="HF OAuth\n(Cloud Mode)"];
    }
    
    // Application Layer
    subgraph cluster_app {
        label="Application Layer";
        style=filled;
        color=lightgreen;
        
        app [label="app.py\nMain Application"];
        game_logic [label="Game Logic\n• Question tracking\n• Response formatting\n• Session management"];
        response_cleaner [label="Response Cleaner\n• JSON parsing\n• Artifact removal\n• Text formatting"];
    }
    
    // Data Layer
    subgraph cluster_data {
        label="Data Layer";
        style=filled;
        color=lightyellow;
        
        countries_db [label="Countries Database\n(COUNTRIES list)"];
        country_selector [label="Country Selector\n• Random selection\n• Session initialization"];
        facts_fetcher [label="Facts Fetcher\n• Web scraping\n• HTML parsing"];
    }
    
    // External Services
    subgraph cluster_external {
        label="External Services";
        style=filled;
        color=lightcoral;
        
        hf_api [label="HuggingFace\nInference API"];
        local_model [label="Local Model Server\n(LM Studio/Ollama)"];
        travel_guide [label="Kids World Travel Guide\nWebsite"];
    }
    
    // Environment
    env_vars [label=".env Configuration\n• BASE_URL\n• TOKEN\n• MODEL_NAME", shape=ellipse, style=dashed];
    
    // User flow
    user [label="User", shape=ellipse];
    
    // Connections
    user -> gradio [label="Interact"];
    gradio -> oauth [label="Authenticate\n(Cloud Mode)"];
    gradio -> app [label="Send Message"];
    
    app -> game_logic [label="Process Question"];
    app -> country_selector [label="Initialize Game"];
    app -> response_cleaner [label="Clean Response"];
    
    country_selector -> countries_db [label="Select Country"];
    country_selector -> facts_fetcher [label="Fetch Facts"];
    facts_fetcher -> travel_guide [label="Scrape Data"];
    
    game_logic -> hf_api [label="Cloud Mode"];
    game_logic -> local_model [label="Local Mode"];
    
    env_vars -> app [label="Configure", style=dashed];
    
    response_cleaner -> gradio [label="Formatted Response"];
    gradio -> user [label="Display"];
    
    // Styling
    user [fillcolor=lightsteelblue, style=filled];
    env_vars [fillcolor=lavender, style="filled,dashed"];
}
```