From ef61bc38cc73547808cf713d8df83686efbe04e6 Mon Sep 17 00:00:00 2001
From: lintsinghua <1930438860@qq.com>
Date: Fri, 24 Oct 2025 16:20:32 +0800
Subject: [PATCH] update
---
README.md | 5 +
README_EN.md | 5 +
public/diagram.svg | 361 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 371 insertions(+)
create mode 100644 public/diagram.svg
diff --git a/README.md b/README.md
index cbc2b92..033a5ff 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,11 @@
在快节奏的软件开发中,保证代码质量至关重要。传统代码审计工具规则死板、效率低下,而人工审计则耗时耗力。XCodeReviewer 借助 Google Gemini AI 的强大能力,彻底改变了代码审查的方式:
+
+
XCodeReviewer系统架构图
+
+---
+
- **AI 驱动的深度分析**:超越传统静态分析,理解代码意图,发现深层逻辑问题。
- **多维度、全方位评估**:从**安全性**、**性能**、**可维护性**到**代码风格**,提供 360 度无死角的质量评估。
- **清晰、可行的修复建议**:独创 **What-Why-How** 模式,不仅告诉您“是什么”问题,还解释“为什么”,并提供“如何修复”的具体代码示例。
diff --git a/README_EN.md b/README_EN.md
index 5bf5e8e..e3bb832 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -25,6 +25,11 @@
In the fast-paced world of software development, ensuring code quality is crucial. Traditional code audit tools are rigid and inefficient, while manual audits are time-consuming and labor-intensive. XCodeReviewer leverages the powerful capabilities of Google Gemini AI to revolutionize the way code reviews are conducted:
+
+System Architecture Diagram of XCodeReviewer
+
+---
+
- **🤖 AI-Driven Deep Analysis**: Beyond traditional static analysis, understands code intent and discovers deep logical issues.
- **🎯 Multi-dimensional, Comprehensive Assessment**: From **security**, **performance**, **maintainability** to **code style**, providing 360-degree quality evaluation.
- **💡 Clear, Actionable Fix Suggestions**: Innovative **What-Why-How** approach that not only tells you "what" the problem is, but also explains "why" and provides "how to fix" with specific code examples.
diff --git a/public/diagram.svg b/public/diagram.svg
new file mode 100644
index 0000000..599c032
--- /dev/null
+++ b/public/diagram.svg
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ USER PERSONAS
+
+
+
+
+ System Administrator
+ Global Config & User Management
+
+
+
+ Developer
+ Project Creation & Code Analysis
+
+
+
+ Security Auditor
+ Issue Review & Risk Assessment
+
+
+
+
+
+ LAYER 0 · INFRASTRUCTURE & DEPLOYMENT
+
+
+
+ 🐳 Docker Container
+ Multi-stage: Node.js 18 + Nginx
+ Docker Compose Orchestration
+ Port: 5174 → 80
+
+
+ 💚 Health Monitoring
+ Interval: 30s | Timeout: 10s
+ HTTP Healthcheck (wget)
+ Retries: 3 | Start: 40s
+
+
+ 🌐 Network & Serving
+ Bridge Network Isolation
+ Nginx Static Assets
+ SPA Routing Config
+
+
+ ⚙️ Environment Config
+ LLM Provider Keys
+ Supabase Credentials
+ Optional Database
+
+
+
+
+ LAYER 1 · PRESENTATION (React 18 + TypeScript)
+
+
+
+ 📊 Dashboard
+ Quality Trends
+ Project Statistics
+ System Overview
+ Recharts Viz
+ Real-time Updates
+
+
+ 📁 Projects
+ Repo Integration
+ ZIP Upload
+ Language Detection
+ GitHub/GitLab API
+ Team Collaboration
+
+
+ ⚡ Instant Analysis
+ Code Snippet Input
+ Real-time Results
+ 10+ Languages
+ No Persistence
+ Privacy Protected
+
+
+ ✅ Audit Tasks
+ Batch Processing
+ Progress Tracking
+ Issue Management
+ Max: 40 Files
+ 200KB per File
+
+
+ 🛡️ Admin Panel
+ User Management
+ System Config
+ LLM Settings
+ RBAC Control
+ Admin Only
+
+
+
+
+ LAYER 2 · APPLICATION LOGIC
+
+
+
+ 🧠 Code Analysis Engine
+ • Analysis Service (codeAnalysis.ts) - XAI Framework
+ • Project Service (repoScan.ts, repoZipScan.ts)
+ • LLM Orchestrator (llm-service.ts)
+ • Config Manager (env.ts, database.ts)
+ Features: analysis/, projects/
+
+
+ ⚠️ Error Handler
+ Status Classification: 401/403/429/500+
+ Detailed Error Messages
+
+
+ 📦 Batch Processor
+ Worker Pool (Shared Index)
+ Update Every 10 Files
+
+
+ 🔄 Retry Logic
+ Exponential Backoff: 1s, 2s, 4s
+
+
+ 📝 Logging System
+ Console (Emoji-prefixed)
+
+
+
+
+ ⭐ LAYER 2.5 · CONCURRENCY CONTROL (CORE INNOVATION #1)
+
+
+
+ 🎯 Worker Pool Orchestrator
+ • Concurrency: LLM_CONCURRENCY = 2
+ • Rate Limit: LLM_GAP_MS = 500ms
+ • Timeout: 150s per request
+ • Shared index for parallel workers
+ Configurable concurrency control
+
+
+ 📊 Performance Metrics
+ • Throughput: ~0.13 files/s (2 workers)
+ • Capacity: 40 files/batch
+ • File Size: 200KB max
+ • Progress: Update every 10 files
+ Rate limit avoidance strategy
+
+
+ 📁 File Filtering Engine
+ • Supported: .js, .ts, .py, .java, .go, .cpp, .c, etc.
+ • Excluded: node_modules, .git, dist, build, vendor
+ • Size Check: 200KB per file limit
+ • Type Check: Text-based source only
+ Smart filtering for efficient processing
+
+
+
+
+ ⭐ LAYER 3 · LLM ABSTRACTION (CORE INNOVATION #2)
+
+
+
+ 🔀 LLM Service Layer
+ • Unified Interface (LLMService)
+ • Factory Pattern (llm-factory.ts)
+ • Config Manager (env.ts)
+ • Provider-agnostic Design
+ Switch providers without code change
+
+
+ 🛠️ BaseLLMAdapter
+ • Error Classification (401/403/429/500+)
+ • Retry Logic (Exponential Backoff)
+ • Timeout Protection (Promise.race)
+ • Abstract Base for All Adapters
+ Consistent error handling across providers
+
+
+ 11 Provider Adapters
+
+
+ ☁️ Cloud Providers (10)
+ • Google Gemini (gemini-2.5-flash)
+ • OpenAI GPT (gpt-4o-mini)
+ • Anthropic Claude (claude-3-5-sonnet)
+ • Alibaba Qwen • DeepSeek • Zhipu AI
+ • Moonshot Kimi • Baidu ERNIE
+ • MiniMax • Bytedance Doubao
+ HTTPS with TLS 1.3 encryption
+ Custom endpoints & proxy support
+
+
+ 🔒 Ollama (Local Model)
+ • Models: llama3, codellama, qwen2.5
+ • Endpoint: localhost:11434/v1
+ • No External API Calls
+ ✅ Privacy Mode: Local processing only
+
+
+ ⚙️ Configuration Manager
+ • API Keys: Environment Variables
+ • Base URLs: Custom Endpoints
+ • Timeout: VITE_LLM_TIMEOUT = 150s
+ Flexible provider configuration
+
+
+
+
+ LAYER 4 · DATA PERSISTENCE (Supabase BaaS)
+
+
+
+ 🐘 PostgreSQL Database
+ • profiles: users, roles, permissions, system preferences
+ • projects: repositories, languages, team members, metadata
+ • audit_tasks: status, progress, quality metrics, scan results
+ • audit_issues: vulnerabilities, severity, XAI explanations
+ Row-Level Security (RLS) + Indexes for performance
+
+
+ 🔐 Authentication
+ JWT Tokens + Session Mgmt
+
+
+ 📦 Object Storage
+ ZIP Uploads & Artifacts
+
+
+ ⚡ Realtime Sync
+ WebSocket-based Live Updates
+
+
+ 🛡️ Row-Level Security
+ RBAC Enforcement at DB Level
+
+
+
+
+ LAYER 5 · EXTERNAL SERVICES
+
+
+
+ 🔗 Version Control Systems
+ GitHub API • GitLab API
+ Repository metadata and branch info
+
+
+ 🧠 Cloud LLM Provider APIs
+ Gemini • OpenAI • Claude • Qwen • DeepSeek • Zhipu • Moonshot • Baidu • MiniMax • Doubao
+ HTTPS communication with TLS 1.3 encryption
+
+
+ 🔒 Ollama (Local)
+ Local Model Processing
+ No External Communication
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file