To make the diagram more elegant and visually satisfying, we can focus on improving the layout, spacing, and color scheme while maintaining clarity. Here's the improved version of your Mermaid diagram:
Improvements:
- Consistent Direction: Use consistent directions (e.g.,
TB for top-to-bottom) for better readability.
- Color Palette: Use a more cohesive and modern color palette for better aesthetics.
- Spacing and Alignment: Adjust the layout to reduce clutter and improve alignment.
- Node Labels: Simplify and clarify node labels where possible.
- Class Definitions: Use class definitions for consistent styling across similar elements.
- Comments: Add comments for better maintainability.
Here’s the improved version:
graph TD
%% User Interaction
A[User]
%% Frontend Service
subgraph Srv_Frontend ["Frontend Service (React UI)"]
direction TB
B["Modern Web UI"]
B1["Conversation History<br>Management"]
B2["Markdown Rendering"]
B3["Code Highlighting"]
B -->|User Interaction| B1
B -->|Content Display| B2
B -->|Code Display| B3
style Srv_Frontend fill:#f0f9ff,stroke:#007acc,stroke-width:1px,color:#333
end
%% Simple Adapter Service
subgraph Srv_SimpleAdapter ["Simple Adapter Service"]
direction TB
C["API Endpoints"]
C1["Repo Init Trigger"]
C -->|Handle Requests| C1
style Srv_SimpleAdapter fill:#e8f5e9,stroke:#43a047,stroke-width:1px,color:#333
end
%% Initialization Logic
subgraph Srv_Init ["Initialization Logic"]
direction TB
C1 -->|GitHub URL?| C_URL["Initialize via URL"]
C1 -->|ZIP Upload?| C_ZIP["Initialize via Upload"]
C_URL -->|Clone| D["Git Clone"]
C_ZIP -->|Extract| G["Extract Zip"]
D --> E["Volume: repository_data"]
G --> E
style Srv_Init fill:#f3e5f5,stroke:#8e24aa,stroke-width:1px,color:#333
end
%% Classifier Service
subgraph Srv_Classifier ["Classifier Service"]
direction TB
H["Classifier Endpoint"]
I["File Classification &<br>Data Extraction"]
H --> I
style Srv_Classifier fill:#e3f2fd,stroke:#1e88e5,stroke-width:1px,color:#333
end
%% Model Server Service
subgraph Srv_ModelServer ["Model Server Service"]
direction TB
M["Model Server Endpoint"]
N["Select Model Logic"]
M --> N
style Srv_ModelServer fill:#fff3e0,stroke:#fb8c00,stroke-width:1px,color:#333
end
%% Libraire Service
subgraph Srv_Libraire ["Libraire Service (Custom Documentalist)"]
direction TB
Q["Libraire Endpoint"]
R["Retrieve Data &<br>Augment Query"]
Q --> R
style Srv_Libraire fill:#f9fbe7,stroke:#c0ca33,stroke-width:1px,color:#333
end
%% Shared Docker Volumes
subgraph DataVolumes ["Shared Docker Volumes"]
direction TB
E -->|Repo Path| H
I -->|Save JSON| J["Volume: docstrings_json"]
I -->|Save JSON| K["Volume: documentations_json"]
I -->|Save JSON| L["Volume: configs_json"]
R -->|Read JSON| J
R -->|Read JSON| K
R -->|Read JSON| L
style DataVolumes fill:#eceff1,stroke:#607d8b,stroke-width:1px,color:#333
end
%% Browser Local Storage
subgraph BrowserStorage ["Browser Local Storage"]
direction TB
S["Conversation History"]
T["User Preferences"]
style BrowserStorage fill:#ffebee,stroke:#e53935,stroke-width:1px,color:#333
end
%% External LLM APIs
subgraph ExternalAPIs ["External LLM APIs"]
direction TB
O["Gemini API"]
P["Anthropic API"]
style ExternalAPIs fill:#e8f5e9,stroke:#43a047,stroke-width:1px,color:#333
end
%% Connections Between Services/Subgraphs
A -->|Interacts with UI| B
B -->|Display Response| A
B -->|Save/Load Conversations| S
B -->|Save/Load Preferences| T
B -->|API Requests| C
C -->|Forward Requests| M
M -->|Route based on Model| N
N -->|Standard Model Request| O
N -->|Standard Model Request| P
O -->|Response| N
P -->|Response| N
N -->|Custom Request| Q
R -->|Augmented Query| O
R -->|Augmented Query| P
O -->|Response to Libraire| R
P -->|Response to Libraire| R
R -->|Formatted Response| Q
Q -->|Final Response| N
N -->|Routed Response| M
M -->|Response to Adapter| C
C -->|Response to UI| B
%% Class Definitions for Consistent Styling
classDef service fill:#007acc,stroke:#005b9f,stroke-width:2px,color:#fff;
classDef volume fill:#607d8b,stroke:#455a64,stroke-width:2px,color:#fff;
classDef external fill:#43a047,stroke:#2e7d32,stroke-width:2px,color:#fff;
%% Apply Classes
class B,C,H,M,Q service;
class E,J,K,L,S,T volume;
class O,P external;