# caixr9527/lingxi-core architecture

> Architecture diagram of the GitHub repository caixr9527/lingxi-core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/caixr9527/lingxi-core
- Repository: https://github.com/caixr9527/lingxi-core

## Overview

This is a Flask-based, no-code AI application development platform. Users configure an app, models, tools, workflows, and knowledge sources, then run or publish it through web, WeChat, or Open APIs; the platform also supports analytics and account management. The graph preserves the documented workflow, knowledge, publishing, and resource capabilities. Some subsystems are represented at directory level because their implementation was not sampled; edges are limited to README claims or indexed imports, so unsampled wiring is not asserted.

Main entry points: [`internal/handler`](https://github.com/caixr9527/lingxi-core/tree/main/internal/handler) (Request handlers), [`internal/core/agent/agents`](https://github.com/caixr9527/lingxi-core/tree/main/internal/core/agent/agents) (Agent runtime), [`internal/service/retrieval_service.py`](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/retrieval_service.py) (Knowledge retrieval), [`internal/service/app_service.py`](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/app_service.py) (App configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP entry"]
  node_http["HTTP server<br/>[http.py]"]
  node_router["API router<br/>[router.py]"]
  node_handlers["Request handlers"]
end

subgraph group_apps["Application runtime"]
  node_appconfig["App configuration<br/>[app_service.py]"]
  node_agent["Agent runtime"]
  node_workflow["Workflow engine<br/>[workflow.py]"]
  node_models["LLM providers"]
  node_tools["Tools and plugins"]
end

subgraph group_knowledge["Knowledge resources"]
  node_knowledge_ops["Knowledge ingestion"]
  node_retrieval["Knowledge retrieval"]
  node_retrievers["Retrieval strategies"]
end

subgraph group_platform["Platform capabilities"]
  node_services["Domain services"]
  node_publishing["Web / WeChat publishing<br/>[web_app_service.py]"]
  node_analytics["Usage analytics"]
  node_resource_hub["Built-in resources"]
  node_oauth["OAuth login<br/>[oauth_service.py]"]
end

subgraph group_persistence["Storage"]
  node_vector[("Vector database")]
  node_relational[("Relational database")]
end

node_user(("User / client"))
node_external_models(("Model services"))
node_external_channels(("Web / WeChat channels"))

node_user -->|"sends requests"| node_http
node_http -->|"routes requests"| node_router
node_router -->|"dispatches to"| node_handlers
node_handlers -->|"uses services"| node_services
node_services -.->|"configures apps"| node_appconfig
node_appconfig -->|"configures runtime"| node_agent
node_agent -.->|"invokes models"| node_models
node_agent -.->|"invokes tools"| node_tools
node_agent -.->|"runs workflows"| node_workflow
node_workflow -->|"retrieves knowledge"| node_retrieval
node_knowledge_ops -->|"indexes documents"| node_vector
node_retrieval -->|"selects strategy"| node_retrievers
node_retrieval -->|"queries vectors"| node_vector
node_retrieval -->|"reads datasets"| node_relational
node_models -.->|"calls provider"| node_external_models
node_publishing -->|"publishes apps"| node_external_channels
node_handlers -->|"exposes analytics"| node_analytics
node_handlers -.->|"exposes resources"| node_resource_hub
node_handlers -->|"handles login"| node_oauth
node_appconfig -->|"stores versions"| node_relational

click node_http "https://github.com/caixr9527/lingxi-core/blob/main/internal/server/http.py"
click node_router "https://github.com/caixr9527/lingxi-core/blob/main/internal/router/router.py"
click node_handlers "https://github.com/caixr9527/lingxi-core/tree/main/internal/handler"
click node_services "https://github.com/caixr9527/lingxi-core/tree/main/internal/service"
click node_appconfig "https://github.com/caixr9527/lingxi-core/blob/main/internal/service/app_service.py"
click node_agent "https://github.com/caixr9527/lingxi-core/tree/main/internal/core/agent/agents"
click node_workflow "https://github.com/caixr9527/lingxi-core/blob/main/internal/core/workflow/workflow.py"
click node_models "https://github.com/caixr9527/lingxi-core/blob/main/internal/core/language_model/language_model_manager.py"
click node_tools "https://github.com/caixr9527/lingxi-core/tree/main/internal/core/tools"
click node_knowledge_ops "https://github.com/caixr9527/lingxi-core/blob/main/internal/service/document_service.py"
click node_retrieval "https://github.com/caixr9527/lingxi-core/blob/main/internal/service/retrieval_service.py"
click node_retrievers "https://github.com/caixr9527/lingxi-core/tree/main/internal/core/retrievers"
click node_vector "https://github.com/caixr9527/lingxi-core/blob/main/internal/service/vector_database_service.py"
click node_relational "https://github.com/caixr9527/lingxi-core/tree/main/internal/model"
click node_publishing "https://github.com/caixr9527/lingxi-core/blob/main/internal/service/web_app_service.py"
click node_analytics "https://github.com/caixr9527/lingxi-core/blob/main/internal/service/analysis_service.py"
click node_resource_hub "https://github.com/caixr9527/lingxi-core/blob/main/internal/core/builtin_apps/builtin_app_manager.py"
click node_oauth "https://github.com/caixr9527/lingxi-core/blob/main/internal/service/oauth_service.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_http,node_router,node_handlers,node_user toneBlue
class node_appconfig,node_agent,node_workflow,node_models,node_tools toneAmber
class node_knowledge_ops,node_retrieval,node_retrievers toneMint
class node_services,node_publishing,node_analytics,node_resource_hub,node_oauth toneRose
class node_vector,node_relational,node_external_models,node_external_channels toneIndigo
```

## Components

### HTTP entry

- [HTTP server](https://github.com/caixr9527/lingxi-core/blob/main/internal/server/http.py): `internal/server/http.py`
- [API router](https://github.com/caixr9527/lingxi-core/blob/main/internal/router/router.py): `internal/router/router.py`
- [Request handlers](https://github.com/caixr9527/lingxi-core/tree/main/internal/handler): `internal/handler`

### Application runtime

- [App configuration](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/app_service.py): `internal/service/app_service.py`
- [Agent runtime](https://github.com/caixr9527/lingxi-core/tree/main/internal/core/agent/agents): `internal/core/agent/agents`
- [Workflow engine](https://github.com/caixr9527/lingxi-core/blob/main/internal/core/workflow/workflow.py): `internal/core/workflow/workflow.py`
- [LLM providers](https://github.com/caixr9527/lingxi-core/blob/main/internal/core/language_model/language_model_manager.py): `internal/core/language_model/language_model_manager.py`
- [Tools and plugins](https://github.com/caixr9527/lingxi-core/tree/main/internal/core/tools): `internal/core/tools`

### Knowledge resources

- [Knowledge ingestion](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/document_service.py): `internal/service/document_service.py`
- [Knowledge retrieval](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/retrieval_service.py): `internal/service/retrieval_service.py`
- [Retrieval strategies](https://github.com/caixr9527/lingxi-core/tree/main/internal/core/retrievers): `internal/core/retrievers`

### Platform capabilities

- [Domain services](https://github.com/caixr9527/lingxi-core/tree/main/internal/service): `internal/service`
- [Web / WeChat publishing](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/web_app_service.py): `internal/service/web_app_service.py`
- [Usage analytics](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/analysis_service.py): `internal/service/analysis_service.py`
- [Built-in resources](https://github.com/caixr9527/lingxi-core/blob/main/internal/core/builtin_apps/builtin_app_manager.py): `internal/core/builtin_apps/builtin_app_manager.py`
- [OAuth login](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/oauth_service.py): `internal/service/oauth_service.py`

### Storage

- [Vector database](https://github.com/caixr9527/lingxi-core/blob/main/internal/service/vector_database_service.py): `internal/service/vector_database_service.py`
- [Relational database](https://github.com/caixr9527/lingxi-core/tree/main/internal/model): `internal/model`

### Other components

- **User / client**
- **Model services**
- **Web / WeChat channels**

## Connections

- User / client → HTTP server: sends requests (evidence: `README.md`)
- HTTP server → API router: routes requests
- API router → Request handlers: dispatches to (evidence: `internal/router/router.py`)
- Request handlers → Domain services: uses services (evidence: `internal/handler/app_handler.py`)
- Domain services → App configuration: configures apps (evidence: `internal/service/__init__.py`)
- App configuration → Agent runtime: configures runtime (evidence: `internal/service/app_service.py`)
- Agent runtime → LLM providers: invokes models
- Agent runtime → Tools and plugins: invokes tools (evidence: `internal/core/agent/agents/agent_queue_manager.py`)
- Agent runtime → Workflow engine: runs workflows
- Workflow engine → Knowledge retrieval: retrieves knowledge (evidence: `README.md`)
- Knowledge ingestion → Vector database: indexes documents (evidence: `README.md`)
- Knowledge retrieval → Retrieval strategies: selects strategy (evidence: `internal/service/retrieval_service.py`)
- Knowledge retrieval → Vector database: queries vectors (evidence: `internal/service/retrieval_service.py`)
- Knowledge retrieval → Relational database: reads datasets (evidence: `internal/service/retrieval_service.py`)
- LLM providers → Model services: calls provider
- Web / WeChat publishing → Web / WeChat channels: publishes apps (evidence: `README.md`)
- Request handlers → Usage analytics: exposes analytics (evidence: `README.md`)
- Request handlers → Built-in resources: exposes resources
- Request handlers → OAuth login: handles login (evidence: `internal/service/oauth_service.py`)
- App configuration → Relational database: stores versions (evidence: `internal/model/app.py`)
