$ show chi111i/BypassAIGC
This repository is a full-stack web application, 'BypassAIGC', functioning as an AI-powered academic writing assistant. Its core operational logic, confirmed by code analysis of its two-stage 'polish' and 'enhance' pipeline and configuration flags, is to rewrite text to evade detection by AIGC classifiers like GPTZero. It is a monolithic application built with a FastAPI backend and a React frontend, packaged for standalone deployment via PyInstaller. The codebase features a highly sophisticated, deterministic Word document formatting engine (`word_formatter`) that parses markdown into a Document AST, renders it to OOXML, validates the structure against a StyleSpec, and applies patch-based auto-corrections. This module demonstrates exceptional craftsmanship in document engineering. While functionally complete, the application suffers from significant technical debt. This includes critical security vulnerabilities (default secrets, permissive CORS, plaintext API key storage), ad-hoc database migrations, duplicated application entry points, and incomplete features (e.g., PDF export is a stub). The project is maintained but carries a high risk of technical drift, making it unsuitable for production deployment without substantial hardening.
The LLM identified 4 files worth highlighting for reuse:
Provides a `DocxPackage` class that abstracts a `.docx` file as a ZIP archive of XML parts. It enables reading, modifying, and saving individual XML files (document, styles, numbering, etc.) within the package. This is a foundational, self-contained utility for any programmatic Word document generation or manipulation task, demonstrating deep understanding of the OOXML standard. It is fully extractable and has no internal dependencies.
Implements a `ConcurrencyManager` using `asyncio.Condition` to limit the number of concurrent AI API calls. It provides a clean, generic abstraction for managing access to rate-limited or resource-constrained external services in an async application. It is fully self-contained and can be extracted with zero modifications.
Manages per-session Server-Sent Events (SSE) queues using `asyncio.Queue`. It allows multiple clients to receive real-time progress updates for their specific background jobs. This is a clean, reusable pattern for decoupling job execution from client communication in any async web application.
Implements a patch-based auto-correction system for Word documents. A `ValidationReport` is generated, which contains a list of `Patch` objects. Each `Patch` has an action and parameters, and is applied deterministically to the OOXML. This decouples issue detection from issue resolution, making the system robust and extensible. A strong example of the Command pattern applied to document engineering.