An AI-Empowered Element-Based Pleading Generation Platform | Second Prize Winner of Guangdong Bar Association's First AI Innovation Competition
Details an AI-powered legal pleading generation platform that won second prize at the Guangdong Bar Association's AI Innovation Competition, featuring element-based form filling, multimodal OCR, smart analysis, and private model support for confidential legal document drafting.
The Guangdong Bar Association’s first AI Innovation Competition was successfully held in Foshan yesterday (September 8). The “AI Law Lab” team, composed of the author and team member Attorney Ye Junxi, was fortunate to be among the 15 teams entering the finals, performing as the first to present and ultimately winning the second prize overall.
The competition has concluded for now — it’s time to discuss the specific details of this project.
*This article represents only the author’s personal views and is not intended as legal advice or opinion.
I. Basic Introduction
Currently, the mainstream element-based pleading filling platforms on the market mainly use two approaches:
One is directly embedding an online Word/WPS/LibreOffice document editing service to directly edit Word documents.
The other is based on AI Q&A, where AI arranges questions and fills in based on user choices or answers — low efficiency, poor editability.
To address these pain points, I transformed each cause of action’s pleadings and applications into [controllable] forms:
Anyone no longer needs to worry about adjusting Word document formatting — just focus on filling in the content. The final content will always generate a Word document that meets formatting and font requirements perfectly.
II. Existing Features
Currently, this project is divided into three versions: “Business Experience Edition,” “Strict Edition,” and “Open Edition.” Each version has different features, but all deeply integrate AI technology in various functions to assist in filling out pleadings from multiple aspects.
Below are some of the currently available feature descriptions:
AI Cause of Action Determination
For interns, trainee lawyers, cross-industry new lawyers, and ordinary citizens who are unfamiliar with causes of action, this feature provides AI-powered cause determination. Simply state the case in one sentence, and the AI will perform semantic analysis, recommending the most suitable form from the existing causes of action.
AI Smart Form Filling
“The ultimate goal of filling forms is not to fill forms.”
I introduced [multimodal/OCR (backend-selectable)] automatic analysis and form filling. Whether it’s text DOCX, text PDF, scanned PDF (even multipage), or image files, the backend can automatically analyze and select which analysis workflow to use.
AI Real-Time Assistance — Smart Continuation
“Programmers can tab, and we can tab too.”
Each text input box features smart continuation. When facing writer’s block, the AI provides intelligent continuation suggestions, shown as gray ghost text. If the suggestion is acceptable, simply press Tab to adopt.
AI Real-Time Assistance — Smart Analysis
After filling, the AI performs real-time analysis. If the content may violate laws or regulations or might not be recognized by the court, the AI will issue a warning.
Text Smart Optimization
Whether professional exposition or ordinary people’s colloquial speech, one click generates 3 different optimized versions in “legal language” for reference and selection, with one-click adoption and backfill.
Smart Legal Analysis
After filling in sufficient information, use AI to perform legal analysis on all factual content in the document. The AI disassembles all the filled text, analyzing potential legal issues to form a key issues checklist.
AI Smart Full-Text Evaluation
After filling, preview the full text and use AI for completeness evaluation across three dimensions: completeness, potential legal risks, and language expression suggestions.
Smart Evidence Index
Based on excellent backend generation performance, pleadings can be generated in a very short time (usually within 2 seconds).
If the “generate recommended index” option is also checked, the AI will analyze the full text, generate a recommended evidence index, and provide explanations of “why these pieces of evidence are needed.”
Smart Q&A Assistant
In addition to basic chat, a knowledge base Q&A feature is also introduced. The AI is also regulated to clearly state its identity during conversations, as well as understand the current cause of action being handled.
Cross-Reference Defense Filling (Currently Strict Edition Only)
By entering the case number and verification code for verification, you can retrieve the relevant form content from the complaint, making it easy to fill in defense matters.
AI Smart Analysis of Complaints (Currently Strict Edition Only)
After successfully loading the complaint, AI performs smart analysis of potential issues in the complaint, providing defense ideas and litigation strategy suggestions.
AI Smart Analysis of Objection Directions (Currently Strict Edition Only)
If you want to rebut the claims in the complaint but have no direction, the AI can directly analyze the complaint content, providing suggestions for objections and rebuttal angles.
III. Other Features
Beyond the basic AI features above, there are numerous humanized designs to ensure the final output document reaches a higher level.
Cause of Action-Based Knowledge Base
I divided separate knowledge bases for each cause of action, with “private” and “shared” libraries. The private library is for users to upload their own materials.
AI Model Center
Unlike other online services, this project doesn’t force the use of the platform’s default model. Any user can freely add their own AI model and activate it.
Common Agent Information Management
Common agent information can be saved and edited in the backend for quick recall when filling out documents.
Document Management and Editing
Previously generated documents are all [encrypted] and stored on the server, and can be edited again.
Automatic Totals and Automatic Capitalization
Where totals need to be calculated, the program automatically performs the calculation with capitalized numbers.
Token Usage Statistics
Both administrators and regular users can view their AI token usage statistics.
IV. Technical Details
Completely Independent Program Design
The frontend and backend of this program, totaling over 50,000 lines of code, were completely independently developed by me — fully autonomous and controllable.
Frontend: Vite + React + Tailwind CSS + DaisyUI
Backend: FastAPI + Docx-Template + PyMuPDF4LLM + PaddleOCR + Langchain
Database: PostgreSQL + Qdrant + Redis
Security, compliance, and privacy have always been the core requirements of this project.
Data Encryption
All passwords and user-generated document data are encrypted. Only ciphertext is stored in the database.
Docker One-Click Deployment
10 seconds, one command, one-click deployment.
Any person or organization with a suitable machine can deploy and use it locally.
Keep element-based pleading data on-premises.
V. Welcome to Try
If you’re interested in this project, feel free to try it at the link below:
Notes:
- This is only a trial service; please do not use this link for actual document generation;
- This link may be closed at any time;
- To experience AI features, please add your own private AI model information;
- This trial server has average performance;
- As this is a personal side project, some features may not have been fully tested.
VI. Finally
Given that some features still need refinement, open-sourcing plans require careful feature separation or further optimization.
But does anyone actually need an open-source version?