# a0000001/platform_war architecture

> Architecture diagram of the GitHub repository a0000001/platform_war, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/a0000001/platform_war
- Repository: https://github.com/a0000001/platform_war

## Overview

##### Component Details and Relationships

a. Knowledge Graph System (Group these components together):
- Core KG Component (knowledgeGraph.py)
- Entity Management (graph_entity.py)
- Search Functionality (graph_search.py)
- Storage System (graph_storage.py)
- Visualization Component (graph_visualization.py)

b. RAG System (Group these components):
- Embedding Model (embedding_model.py)
- Knowledge Retriever (knowledge_retriever.py)
- Graph Extractor (knowledgeGraphExtractor.py)

c. Platform Debate System (Group these components):
- Main Debate Controller (platform_war.py)
- UI System (platform_war_UI.py)
- Chat Agents (chat.py)

- Data flow from JSON input → Knowledge Graph Extraction
- Knowledge Graph → RAG System interactions
- RAG System → Platform Agents
- Agent interactions with the UI
- Embedding model interactions with both KG and RAG systems

##### External Dependencies (Show as external services)
- Moonshot-v1 Model API
- CUDA/GPU Infrastructure (optional)
- FAISS Vector Database

##### Technical Details

Notes about:
- Python 3.11.7 environment
- CUDA/PyTorch integration
- FAISS-GPU requirements
- API configuration requirements

- The modular nature of the system
- Clear separation between knowledge processing and dialogue components
- The central role of the knowledge graph in connecting different components
- The platform-specific nature of the debate agents
- The RAG system's integration with both knowledge graph and dialogue components

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph DI[Data Input Layer]
        JSON[JSON Data Input]
        KGE[Knowledge Graph Extraction]
    end

    subgraph KP[Knowledge Processing Layer]
        subgraph KGS[Knowledge Graph System]
            CKG[Core KG Component]
            EM[Entity Management]
            SF[Search Functionality]
            SS[Storage System]
            VC[Visualization Component]
        end

        subgraph RS[RAG System]
            EMB[Embedding Model]
            KR[Knowledge Retriever]
        end
    end

    subgraph DS[Dialogue System Layer]
        PA[Platform Agents]
        DMS[Debate Management System]
        UI[UI Interface]
    end

    subgraph EXT[External Dependencies]
        MS[Moonshot-v1 API]
        CUDA[CUDA/GPU]
        FAISS[FAISS Vector DB]
    end

    subgraph PT[Prompt Templates]
        ET[Entity Templates]
        RT[Relationship Templates]
        DT[Debate Templates]
        ST[Summary Templates]
        MT[Merge Templates]
        QT[Query Templates]
    end

    %% Connections
    JSON --> KGE
    KGE --> CKG
    CKG --> EMB
    EMB --> KR
    KR --> PA
    PA --> DMS
    DMS --> UI
    
    %% Internal KG System connections
    CKG --> EM
    CKG --> SF
    CKG --> SS
    CKG --> VC

    %% Template connections
    ET --> KGE
    RT --> KGE
    DT --> PA
    ST --> DMS
    MT --> KGE
    QT --> KR

    %% External connections
    MS --> PA
    CUDA --> EMB
    FAISS --> KR

    %% Click events
    click KGE "https://github.com/a0000001/platform_war/blob/main/knowledgeGraphExtractor.py"
    click CKG "https://github.com/a0000001/platform_war/blob/main/knowledgeGraph.py"
    click EM "https://github.com/a0000001/platform_war/blob/main/graph_entity.py"
    click SF "https://github.com/a0000001/platform_war/blob/main/graph_search.py"
    click SS "https://github.com/a0000001/platform_war/blob/main/graph_storage.py"
    click VC "https://github.com/a0000001/platform_war/blob/main/graph_visualization.py"
    click EMB "https://github.com/a0000001/platform_war/blob/main/embedding_model.py"
    click KR "https://github.com/a0000001/platform_war/blob/main/knowledge_retriever.py"
    click PA "https://github.com/a0000001/platform_war/blob/main/chat.py"
    click DMS "https://github.com/a0000001/platform_war/blob/main/platform_war.py"
    click UI "https://github.com/a0000001/platform_war/blob/main/platform_war_UI.py"
    click ET "https://github.com/a0000001/platform_war/blob/main/prompt/entity_extraction.txt"
    click RT "https://github.com/a0000001/platform_war/blob/main/prompt/relationship_extraction.txt"
    click DT "https://github.com/a0000001/platform_war/blob/main/prompt/associate_debate.txt"
    click ST "https://github.com/a0000001/platform_war/blob/main/prompt/community_summary.txt"
    click MT "https://github.com/a0000001/platform_war/blob/main/prompt/entity_merge.txt"
    click QT "https://github.com/a0000001/platform_war/blob/main/prompt/generate_query.txt"

    %% Styling
    classDef kg fill:#a8d1f0
    classDef rag fill:#90EE90
    classDef platform fill:#FFB366
    classDef external fill:#DDA0DD
    classDef template fill:#D3D3D3

    class CKG,EM,SF,SS,VC kg
    class EMB,KR rag
    class PA,DMS,UI platform
    class MS,CUDA,FAISS external
    class ET,RT,DT,ST,MT,QT template
```
