Requirement document automatic processing method and system, computer device, and storage medium
By performing knowledge analysis and structuring on the project codebase, requirement solutions and code that conform to project specifications are generated, solving the problem that existing AI tools cannot understand business logic and technical constraints, and achieving efficient and accurate automatic processing of requirement documents.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI BILIBILI TECH CO LTD
- Filing Date
- 2026-02-09
- Publication Date
- 2026-06-05
AI Technical Summary
Existing AI tools cannot understand the business logic and technical constraints of requirements documents, which may cause the generated requirements solutions to deviate from the actual needs. They also lack enterprise-level general components and business function reuse mechanisms, resulting in low efficiency and a high risk of errors. They cannot make full use of the work already done by AI tools, and human-machine collaboration is inefficient.
By performing knowledge analysis on the project codebase related to the requirements document, project information and specifications are extracted to generate a structured project knowledge base. Based on this, requirements analysis reports and code are automatically generated, and quality assessment standards are combined to ensure that the generated solutions and code comply with project specifications.
It has implemented a fully automated AI agent collaboration mechanism from requirements documents to runnable code, which improves the efficiency of requirement solutions and code generation, ensures the correctness and functional integrity of the generated requirements solutions and code, and reduces the time spent on manual writing.
Smart Images

Figure CN122152275A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of AI-based automatic generation of requirements documents, and particularly to a method and system for automatic processing of requirements documents, computer equipment, and storage medium. Background Technology
[0002] The current software development process generally includes: requirements review, technical review, code development, test case review, testing and acceptance, and deployment. While AI code generation tools have matured and can now assist developers in writing simple code, key stages such as requirements design, project background analysis, and requirements-driven code construction still heavily rely on manual labor, requiring significant time investment.
[0003] Existing AI tools cannot understand the business logic and technical constraints of requirements documents, leading to generated requirements solutions that may deviate from actual needs or not conform to the project's technology stack. This requires developers to spend a significant amount of time manually analyzing requirements and designing solutions, resulting in minimal improvement in overall development efficiency. The code generated by existing AI tools differs greatly from the project's existing code style, requiring extensive manual proofreading and adjustments, and sometimes even rewriting critical sections, increasing workload and reducing trust in the AI tools. Existing AI tools lack understanding of the enterprise's internal technical architecture, coding standards, and middleware usage, and lack enterprise-level common component and business function reuse mechanisms, requiring the generation of similar code each time. For common functions such as file export, cache-to-origin, and memory caching, as well as middleware usage, AI tools need to be re-understood and regenerated each time, resulting in low efficiency and a high risk of errors. Existing AI tools lack quality control mechanisms, leading to "illusion" problems in the generated requirements solutions and code, such as logical errors, omissions of key scenarios, and failure to consider boundary conditions, requiring repeated manual verification and debugging. When existing AI tools fail to deliver the expected output, there is a lack of human intervention and adjustment mechanisms. The only options are to regenerate the entire tool or have it completely taken over by humans. This prevents the full utilization of the work already done by the AI tool, resulting in low efficiency in human-machine collaboration. Summary of the Invention
[0004] In view of the above problems, this application provides a method and system for automatic processing of requirements documents, a computer device and a storage medium, which can automatically generate requirements solutions and code based on AI agents, improve the efficiency of generating requirements solutions and code, and ensure the correctness and functional integrity of the generated requirements solutions and code.
[0005] On the one hand, this application provides an automatic processing method for requirements documents, which includes: performing knowledge analysis on the project code library related to the requirements document to extract project information and project specifications, and compressing the project information into a structured project knowledge base; automatically generating a requirements analysis report based on the requirements document and the project knowledge base; generating a requirements solution document that conforms to the project specifications based on the requirements analysis report; and generating complete code that conforms to the project specifications based on the requirements analysis report.
[0006] Preferably, the automatic processing method for requirement documents further includes: performing a quality assessment on the requirement documents according to predefined quality assessment standards.
[0007] Preferably, the step of evaluating the quality of the requirement document according to a predefined quality assessment standard includes: converting the requirement document into a text format; dividing the text format requirement document into multiple text blocks according to the chapter structure; evaluating the quality of each text block using few-sample prompt words and generating a quality score and quality assessment result for each text block; determining whether the quality score of each text block reaches a predetermined score of the quality assessment standard; if the quality score of any text block does not reach the predetermined score, generating a dialog message and displaying it on the user interface to prompt modification of the text content of that text block; if the quality scores of all text blocks reach the predetermined score, outputting the quality assessment result of the requirement document.
[0008] Preferably, the step of performing knowledge analysis on the project codebase related to the requirements document to extract project information and project specifications, and compressing the project information into a structured project knowledge base, includes: parsing the code structure of the project codebase using an abstract syntax tree parser to extract project information; statistically analyzing the project information using a dependency graph analyzer to extract project specifications; constructing a project knowledge base based on the project information and the project specifications; and compressing the project information in the project knowledge base into predefined structured data to generate a structured project knowledge base.
[0009] Preferably, the step of automatically generating a requirements analysis report based on the requirements document and the project knowledge base specifically includes: extracting the requirements keywords from the requirements document; retrieving the project requirements and service items of the requirements document from the project knowledge base based on the requirements keywords; automatically retrieving the requirements solution from the requirements document based on the project requirements and service items; generating a requirements analysis report of the requirements document based on the requirements solution; and outputting the requirements analysis report.
[0010] Preferably, the requirement scheme of automatically calling the requirement document from the project knowledge base according to the project requirements and service projects includes: loading the technology stack information of the service projects from the service knowledge base of the project knowledge base according to the project requirements; scanning the skill base of the project knowledge base according to the task description of the service projects to obtain a list of skills available for the service tasks; obtaining the skill services corresponding to the service projects from the skill list through semantic matching based on the task description of the service projects, and obtaining sample code and actual cases of the skill services from the skill base; obtaining the business specifications of the service projects from the business domain knowledge base of the project knowledge base, and adding the sample code, actual cases and business specifications of the skill services to the requirement scheme.
[0011] Preferably, the step of generating complete code conforming to the project specifications based on the requirements analysis report specifically includes: generating code in a bottom-up, layered manner; performing self-correcting loop compilation on the generated code at each layer; testing the functional code using a self-correcting loop and generating test code; checking code specifications and outputting compilable complete code that conforms to the project specifications.
[0012] This application also provides an automatic requirements document processing system, comprising: a project compression AI agent for performing knowledge analysis on the project codebase related to the requirements document to extract project information and project specifications, and compressing the project information into a structured project knowledge base; a requirements analysis AI agent for automatically generating a requirements analysis report based on the requirements document and the project knowledge base; a solution writing AI agent for generating a requirements solution document conforming to the project specifications based on the requirements analysis report; and a code generation AI agent for generating complete code conforming to the project specifications based on the requirements analysis report.
[0013] Preferably, the automatic processing system for requirement documents further includes: a requirement evaluation AI agent, used to evaluate the quality of requirement documents according to predefined quality evaluation standards.
[0014] This application also provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the automatic processing method for requirements documents as described in any of the foregoing embodiments.
[0015] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the automatic processing method for requirement documents described in any of the foregoing embodiments.
[0016] This application also provides a computer program product comprising a computer program that, when executed by one or more processors, implements the steps of the automatic requirement document processing method described in the embodiments of this application.
[0017] Compared with existing technologies, the automatic processing method and system for requirement documents, computer equipment, and storage media provided in this application embodiment can realize a fully automated AI agent collaboration mechanism from requirement documents to runnable code. The AI agent assesses the quality of requirement documents through requirement evaluation to ensure the completeness and clarity of project requirements from the source; the AI agent performs full analysis and knowledge extraction of project code from the project codebase and compresses it into a project knowledge base usable by AI, ensuring that the generated solutions and code conform to the project style; the AI agent generates detailed analysis reports through requirement analysis, providing a basis for human decision-making; the AI agent automatically generates standardized and easy-to-read requirement solution documents through solution writing, significantly reducing manual writing time; and the AI agent automatically generates complete, compileable, and runnable code that conforms to project specifications through code generation, ensuring code quality and functional completeness. Attached Figure Description
[0018] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0019] Figure 1 This is a functional structure diagram of a computer device provided in an embodiment of this application; Figure 2 This is a functional structure diagram of an automatic requirements document processing system provided in an embodiment of this application; Figure 3 This is a flowchart illustrating an automatic requirements document processing method provided in an embodiment of this application; Figure 4 yes Figure 3 A detailed flowchart of step S11; Figure 5 yes Figure 3 A detailed flowchart of step S12; Figure 6 yes Figure 3 A detailed flowchart of step S13; Figure 7 yes Figure 3 A detailed flowchart of step S15. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been provided in the various embodiments of this application to help readers better understand this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments. The division of the various embodiments below is for the convenience of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined with and referenced by each other without contradiction.
[0021] participate Figure 1 As shown, Figure 1 This is a functional structure diagram of a computer device provided in an embodiment of this application. In this embodiment, the computer device 1 includes, but is not limited to, a central processing unit 11, a memory 12, an input unit 13, and a display unit 14. The memory 12 stores the automatic requirement document processing system 10 provided in this embodiment of the application, which includes one or more functional modules or functional units composed of a series of computer program code instructions, and can be executed by the processor 11 of the computer device 1 to implement various method steps of the automatic requirement document processing method provided in this embodiment of the application.
[0022] The computer device 1 is an electronic device with data processing capabilities, including, but not limited to, personal computers (PCs), servers, workstations, notebook computers, or mobile computing terminal devices such as smartphones, personal digital assistants (PDAs), and tablet PCs with computing or programming functions. It should be noted that... Figure 1 Only a computer device 1 with the above-described basic functional components is shown. However, those skilled in the art should understand that the embodiments of this application only show some of the functional components of the computer device 1. In other embodiments, the computer device 1 may also include more or fewer other functional components than those in this embodiment.
[0023] In this embodiment, the processor 11 may be a central processing unit (CPU), microprocessor, controller, microcontroller, or other data processing chip. The processor 11 is typically used to perform the overall functional operations of the computer device 1. The processor 11 is used to execute computer program code stored in the memory 12 or process data, for example, executing the computer program code of the automatic demand document processing system 10 provided in this application embodiment, to realize the various functions of the AI agent-collaborative demand document-driven end-to-end automated processing system.
[0024] The memory 12 includes at least one type of computer-readable storage medium, including memory, flash memory, hard disk, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 12 may be an internal storage unit of a computer device, such as the memory or hard disk of computer device 1. In other embodiments, the memory 12 may also be an external storage device of a computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on computer device 1. In this embodiment, the memory 12 is typically used to store the computer program code of the operating system and various application software installed in computer device 1, such as the computer program code and data of the automatic demand document processing system 10 provided in this embodiment.
[0025] The input unit 13 is an I / O device for information exchange between the user and the computer device 1. The user can input various operation data and interactive information to the computer device 1 through the input unit 13. The input unit 13 can be a keyboard, mouse, light pen, handwriting input tablet, scanner, or voice input device, etc.
[0026] The display unit 14 can be a display component such as an LCD display, an LED display, or a touch screen. In this embodiment, the display unit 14 can display various user interfaces, user interaction information, requirement documents, technical implementation solutions, and programming code generated by the computer device 1, such as user-input requirement documents, user interaction instructions, and program instruction code.
[0027] refer to Figure 2 As shown, Figure 2This is a functional structure diagram of an automatic requirements document processing system provided in an embodiment of this application. In this embodiment, the automatic requirements document processing system 10 includes a requirements evaluation AI agent 101, a project compression AI agent 102, a requirements analysis AI agent 103, a solution writing AI agent 104, and a code generation AI agent 105. The various AI agents 101-105 provided in this embodiment are automated execution units or functional execution modules capable of autonomously decomposing target tasks, invoking tools, and collaborating within a context.
[0028] In this embodiment, the requirement evaluation AI agent 101 is used to evaluate the quality of the requirement document according to predefined quality assessment standards. The project compression AI agent 102 is used to perform knowledge analysis and extract project information from the project codebase, and compress the project information into a structured project knowledge base, enabling subsequent AI agents to understand the project context. The requirement analysis AI agent 103 is used to generate a requirement analysis report based on the requirement document and the project knowledge base. The solution writing AI agent 104 is used to automatically generate a standardized requirement solution document based on the requirement analysis report. The code generation AI agent 105 is used to generate compileable, runnable, and project-compliant complete code based on the requirement analysis report. The specific implementation functions of the various AI agents 101-105 are as follows. Figures 3 to 7 The various methods and steps of the automatic processing method for the requirements document shown are explained in detail, but will not be described in detail here.
[0029] In this embodiment, the automatic requirement document processing system 10 is installed and runs on computer device 1. It can evaluate the quality of requirement documents through requirement evaluation AI agent 101 to ensure the completeness and clarity of requirements from the source; compress project code into a project knowledge base that can be used by AI through project compression AI agent 102 to ensure that the generated solutions and code conform to the project style; generate detailed analysis reports through requirement analysis AI agent 103 to provide a basis for human decision-making; automatically generate standardized and easy-to-read requirement solution documents through solution writing AI agent 104, which greatly reduces the time for manual writing; and automatically generate complete code that can be compiled and run and conforms to project specifications through code generation AI agent 105, which ensures the code quality and functional integrity of requirement documents.
[0030] This application provides an automated requirement document processing method. This method is a requirement document-driven, end-to-end automated processing method based on AI agent collaboration. It can automatically generate requirement solutions and code from requirement documents using AI agents, improving the efficiency of requirement solution and code generation and ensuring the correctness and functional completeness of the generated requirements solutions and code. In this embodiment, the AI agent refers to an automated execution unit capable of autonomously decomposing target tasks, invoking tools, and collaborating within a context. The requirement document refers to the document output by the product manager during technical development, describing business requirements, functional specifications, and interaction processes, used as input for technical development. The requirement solution refers to the technical implementation plan produced by R&D personnel based on the requirement document, including architecture design, interface definitions, storage schemes, upstream and downstream dependencies, etc., used for technical review and coordination with other departments.
[0031] refer to Figure 3 As shown, Figure 3 This is a flowchart illustrating an automatic requirements document processing method provided in this embodiment. In this embodiment, the automatic requirements document processing method is applied to, for example... Figure 1 In the computer device 1 shown, the computer program code instructions that implement the method are stored in the memory 12 of the computer device 1 and can be executed by the processor 11 of the computer device 1 to implement the automatic processing method of requirement documents described in the embodiments of this application, thereby realizing a fully automated multi-agent collaboration mechanism from requirement documents to runnable code, including five stages: requirement evaluation, project analysis, requirement parsing, solution generation, and code implementation.
[0032] Step S11: Evaluate the quality of the requirement document according to predefined quality assessment standards. In this embodiment, the quality assessment standards include five dimensions: clarity of functional description, explicitness of input and output, completeness of boundary conditions, explicitness of business rules, and logical consistency. Before the requirement document is transferred to R&D, this embodiment uses a requirement evaluation AI agent 101 to evaluate the requirement document according to predefined quality assessment standards. This ensures the completeness and explicitness of the requirements at the source of requirement document analysis, guaranteeing that the quality of the requirement document meets the standards for automated analysis and laying the foundation for subsequent automated document analysis. The role of the requirement evaluation AI agent 101 is defined as "You are a senior product requirement review expert." The requirement evaluation AI agent 101 uses a temperature parameter of 0.3 to reduce randomness and improve the consistency of the requirement document quality assessment.
[0033] Step S12 involves performing knowledge analysis on the project codebase related to the requirements document to extract project information and specifications, and compressing the project information into a structured project knowledge base. In this embodiment, the project compression AI agent 102 can convert a large amount of project information from the original project codebase into a structured project knowledge base (e.g., compressing it to 5-10% of the project codebase), enabling the AI to understand and follow the project specifications. The original project codebase refers to the historical project knowledge base pre-stored in the memory 12 of the computer device 1, which records project-related information for use in analyzing the requirements document. The role of the project compression AI agent 102 is defined as "You are a senior system architecture analysis expert," and the temperature parameter used by the project compression AI agent 102 is 0.2 to accurately extract the technical facts of the project.
[0034] Step S13: Generate a requirements analysis report based on the requirements document and project knowledge base. In this embodiment, the requirements analysis AI agent 103 uses a thought chain guidance to retrieve the requirements document from the project knowledge base and generate the requirements analysis report. The thought chain guidance includes analyzing requirements, identifying services, designing collaborative processes, and proposing requirement solutions. Specifically, after the user inputs the requirements document, the requirements analysis AI agent 103 extracts keywords from the requirements document, retrieves the requirements from the requirements document in the project knowledge base through the Retrievalaugmented Generation (RAG) module to identify services, automatically calls the Skill library to obtain collaborative processes and service-related requirement solutions and sample code, and generates a detailed requirements analysis report based on the requirement solutions and sample code, thereby providing a basis for technical decisions. In this embodiment, the role of the requirements analysis AI agent 103 is defined as "You are a senior system architect," and the requirements analysis AI agent 103 uses a temperature parameter of 0.4, enabling it to output creative requirement solutions.
[0035] Step S14: Generate a requirement solution document that conforms to project specifications based on the requirement analysis report. In this embodiment, the solution writing AI agent 104 can load the requirement solution template and output a standardized requirement solution document according to the template based on the requirement analysis report. This requirement solution document is a Markdown document that can be directly used for technical review. In this embodiment, the role of the solution writing AI agent 104 is defined as "You are a technical document writing expert." The solution writing AI agent 104 uses a temperature parameter of 0.3 to output a standardized requirement solution document.
[0036] Step S15: Generate complete, compileable, and executable code based on the requirements analysis report, conforming to project specifications. In this embodiment, the code generation AI agent 105 provides code examples conforming to project specifications using few-shot examples, enabling the generation of complete, compileable code, including error handling and logging. In this embodiment, the role of the code generation AI agent 105 is defined as "you are a senior backend engineer," and the temperature parameter used by the code generation AI agent 105 is 0.2 to output accurate and complete code.
[0037] In this embodiment, the automatic requirement document processing method can assess the quality of requirement documents through a requirement evaluation AI agent 101 to ensure the completeness and clarity of requirements from the source; compress project code into a project knowledge base usable by AI through a project compression AI agent 102 to ensure that the generated solutions and code conform to the project style; generate detailed analysis reports through a requirement analysis AI agent 103 to provide a basis for human decision-making; automatically generate standardized and easy-to-read requirement solution documents through a solution writing AI agent 104, significantly reducing human writing time; and automatically generate complete, compileable, and project-compliant code through a code generation AI agent 105, ensuring code quality and functional completeness. Furthermore, a human review and adjustment mechanism is introduced at key decision-making nodes to achieve an organic combination of AI automation and human control, improving efficiency while ensuring quality control.
[0038] Figure 4 yes Figure 3 A detailed flowchart of step S11. (See attached diagram.) Figure 3 As shown, step S11 is for the requirement evaluation AI agent to perform a quality evaluation on the requirement document according to the predefined quality evaluation criteria. Step S11 includes the following steps S111 to S116.
[0039] Step S111: Convert the requirement document into a text-based requirement document. In this embodiment, the requirement evaluation AI agent 101 converts the requirement document into Markdown syntax. Markdown is a lightweight markup language that allows users to write documents in an easy-to-read and easy-to-write plain text format, which can be converted into valid HTML. Markdown syntax ensures that the requirement document itself has high readability and can be read directly without the need for complex formatting instructions.
[0040] Step S112 involves dividing the text-formatted requirement document into multiple text blocks according to its chapter structure, so that the requirement evaluation AI agent 101 can perform quality assessment on the requirement document by chapter. In this embodiment, the requirement evaluation AI agent 101 intelligently divides the requirement document into multiple document blocks according to its chapter structure. For example, each text block has a length of less than or equal to 4000 text units (tokens). In the field of artificial intelligence, a token is the smallest unit of text processed by a large model. In English text, a token can be a word or root word, while in Chinese text, a token can be a single Chinese character or word.
[0041] Step S113 involves performing a quality assessment on each text block using Few-Shot Prompt Learning, and generating a quality score and assessment result for each text block. In this embodiment, the requirement assessment AI agent 101 is guided by a few prompts to complete a five-dimensional quality assessment of each text block. This five-dimensional quality assessment includes evaluating the clarity of the functional description of the requirement document, the explicitness of input and output, the completeness of boundary conditions, the explicitness of business rules, and logical consistency. Few-Shot Prompt Learning is a method that uses machine learning with few-shot prompts to guide the requirement assessment AI agent 101 in generating a quality score and assessment result for each text block. For example, if a user inputs the few-shot prompt: "Provide 3 high-quality requirements and 3 low-quality requirements as comparison cases," the requirement assessment AI agent 101 generates a quality assessment result for the text block based on the user's input, including a quality score, a list of issues, and improvement suggestions. This example uses few-shot examples to stimulate the requirement assessment AI agent 101's ability to learn the context of the requirement document, enabling it to quickly complete the requirement document quality assessment task.
[0042] Step S114: Sequentially determine whether the quality score of each text block reaches the predetermined score of the quality assessment standard (e.g., the predetermined score is 80 points). If the quality score of any text block does not reach the predetermined score, proceed to step S115; if the quality scores of all text blocks reach the predetermined scores, proceed to step S116 and output the quality assessment result of the requirements document, for example, output the quality assessment result of the requirements document in JSON format.
[0043] Step S115: Generate dialogue information and display it on the user interface to prompt manual modification of the text content of text blocks whose quality scores have not reached the predetermined score. In this embodiment, if the quality score of a certain text block is <80 points, dialogue information is automatically generated and displayed on the user interface of the display unit 13 to prompt the product manager to manually modify the text content of the text block according to the problem list and improvement suggestions of the text block, and then resubmit it to the requirement evaluation AI agent 101 for quality assessment.
[0044] Step S116: Output the evaluation results of the requirement document. In this embodiment, the requirement evaluation AI agent 101 performs a five-dimensional quality evaluation of the requirement document according to predefined quality evaluation standards. This ensures the completeness and clarity of the requirements during the requirement evaluation stage, laying the foundation for subsequent automated analysis of the requirement document. The requirement evaluation AI agent 101 improves evaluation accuracy by learning from few sample prompts, reduces temperature parameters, and ensures scoring stability.
[0045] Figure 5 yes Figure 3 A detailed flowchart of step S12. (See attached diagram.) Figure 3 As shown, step S12 involves the AI agent performing knowledge analysis on the project codebase related to the requirements document to extract project information and project specifications, and compressing the project information into a structured project knowledge base. Step S12 includes the following steps S121 to S124.
[0046] Step S121 involves parsing the code structure of the project codebase using an Abstract Syntax Tree (AST) parser to extract project information. In this embodiment, the project information includes project context, code style, and technology stack information. The AST parser can parse the source code of the project code into an abstract syntax tree, presenting the programming language syntax in the form of an abstract syntax tree, thus improving code processing efficiency. In this embodiment, the project compression AI agent 102 uses the AST parser to scan the directory structure of the requirement document to identify all document modules of the requirement document, parses the code structure of the project codebase of each document module into an abstract syntax tree, extracts the project dependencies of the abstract syntax tree to construct the service dependency graph of the requirement document, and identifies the project technology stack based on the service dependency graph of the requirement document. The project technology stack includes language, framework, database, and middleware.
[0047] Step S122: The project information is statistically analyzed using a dependency graph analyzer to extract project specifications. In this embodiment, the project specifications include project naming conventions, project design patterns, and project engineering practice information. The project compression AI agent 102 analyzes project naming conventions (e.g., camelCase / underscore ratio) using the dependency graph analyzer; identifies project design patterns (e.g., singleton, factory, etc.); and extracts project engineering practice information (e.g., error handling patterns, logging conventions, etc.).
[0048] Step S123: Construct a project knowledge base based on project information and project specifications. In this embodiment, the project knowledge base includes a knowledge service knowledge base, a skill library, and a business domain knowledge base. The project compression AI agent 102 stores an independent Markdown document for each service as a service knowledge base for each project, based on project knowledge and project specifications. Each Markdown document in the service knowledge base includes: basic project information, technology stack information, API definitions, data models, dependencies, code structure, etc. The project compression AI agent 102 generates a skill library based on project knowledge and project specifications. This skill library includes multiple SKILL description files (e.g., SKILL.md files). The skill library is used to store reusable code and practical cases. Each skill description file includes a name, function description, applicable scenarios, sample code, and usage guidelines, as well as instructions for guiding AI to generate code that conforms to specifications. The project compression AI agent 102 automatically identifies reusable code patterns in the project (e.g., cached source code, exported files, etc.) and generates skill description files. The cache-to-origin mode is a standard mode for implementing Redis caching and MySQL origin retrieval, applicable to scenarios requiring high-frequency reads such as caching user data and configuration data. The project compression AI agent 102 stores a separate Markdown document for each business as a business domain knowledge base based on project knowledge and specifications. This business domain knowledge base contains a database of specific knowledge in areas such as business terminology, business processes, and business rules, helping the AI understand the business context.
[0049] Step S124: The project information in the project knowledge base is compressed into structured data conforming to a predefined schema to generate a structured project knowledge base. In this embodiment, the project compression AI agent 102 compresses the project information in the project knowledge base into structured data conforming to a predefined schema to generate a structured project knowledge base. This schema is a way of defining and organizing structured data in a database, used to define the logical structure of the data, object relationships, and constraint rules, etc. The project compression AI agent 102 converts the massive amount of information in the original project codebase into a structured knowledge base, compressing the amount of information to 5-10% of the original project codebase, enabling the AI agent to understand and follow project specifications.
[0050] In this embodiment, the project compression AI agent 102 analyzes the code structure of the original project codebase using an AST parser to extract project dependencies, identifies the project technology stack using a dependency graph analyzer, and generates a project knowledge base. The project information (including project context, project code style, and project technology stack information) in the project knowledge base is compressed into a project knowledge base that can be used by AI, ensuring that the generated requirement schemes and code conform to the project style.
[0051] Figure 6 yes Figure 3 A detailed flowchart of step S13. (See attached diagram.) Figure 3 As shown, step S13 is for the requirement analysis AI agent to generate a requirement analysis report based on the requirement document and the project knowledge base. Step S13 includes the following steps S131 to S134.
[0052] Step S131: Extract the requirement keywords from the requirement document. In this embodiment, the requirement analysis AI agent 103 receives the requirement document input by the user from the input unit 14, extracts the requirement keywords from the input requirement document, and vectorizes the extracted requirement keywords, for example, using an embedding model to vectorize the requirement keywords.
[0053] Step S132: Retrieve project requirements and service items from the project knowledge base based on the requirement keywords. In this embodiment, the requirement analysis AI agent 103 retrieves relevant information from the project knowledge base using the RAG module based on the keywords in the requirement document, and generates project requirements and service information based on the retrieved information. For example, the requirement analysis AI agent 103 retrieves the project knowledge base using the RAG module and returns the main related services (Top 3 services) of the requirement document. These main related services include the main service and collaborative services. The RAG module retrieves and identifies the relevant services based on the keyword descriptions, for example, by using AI reasoning to determine what the main service and collaborative services are.
[0054] Step S133: Automatically retrieve the requirement solution from the requirement document based on the project requirements and service items. In this embodiment, the requirement analysis AI agent 103 loads the technology stack information of the service items from the service knowledge base according to the project requirements; the requirement analysis AI agent 103 scans the SKILL.md files of all skill libraries (Skill Library) according to the task description of the service items to obtain the list of skills available for the service tasks (Skill List), selects the most relevant skill services from the Skill List through semantic matching (e.g., vector similarity) based on the task description, and obtains sample code and actual cases of the skill services from the skill library (Skill Library) based on the skill services. The requirement analysis AI agent 103 obtains business terminology, business processes, business rules and other business specification information of the service items from the business domain knowledge base, and adds the sample code, actual cases and business specification information of the skill services to the requirement solution.
[0055] Step S134: Generate a requirements analysis report based on the requirements scheme and output the requirements analysis report. In this embodiment, the requirements analysis AI agent 103 outputs the requirements analysis report according to the seven-step analysis method, and the requirements analysis report is in Markdown format. The seven-step analysis method includes basic information, service identification, collaboration process, requirements scheme, task breakdown, risk assessment, and legacy issues.
[0056] In this embodiment, the requirement analysis AI agent 103 vectorizes the requirement keywords using the RAG module and then retrieves related services (e.g., Top 3 services) to improve service identification accuracy. The requirement analysis AI agent 103 supports an automatic skill invocation mechanism, capable of automatically reading all SKILL.md files, deciding whether to invoke a skill service from a specific skill list based on the current task description, and progressively outputting the reasoning process for service items, avoiding direct jumps to the requirement analysis conclusion and improving the interpretability of the requirement analysis.
[0057] Figure 7 yes Figure 3 A detailed flowchart of step S15. (See attached diagram.) Figure 3 As shown, step S15 is for the code generation AI agent to generate complete code that conforms to the project specifications and can be compiled and run based on the requirements analysis report. Step S15 includes the following steps S151 to S154.
[0058] Step S151 involves generating code from the bottom up, layer by layer. These layers include an interface layer, a data layer, a business layer, and a client layer. Specifically: In the interface layer, code for the interface layer (e.g., gRPC / HTTP interface) is generated; in the data layer, data models are generated, and Skill libraries are automatically called (e.g., MySQL sharding) to generate compliant DAO code; in the business layer, service code is generated, and Skill libraries are automatically called to implement Redis cache origin pull and generate caching logic; in the client layer, the client-side encapsulation of the interface layer services is performed.
[0059] Step S152: Compile the generated code at each layer. In this embodiment, the code generation AI agent 105 uses a self-correcting loop to compile the generated code at each layer, executing compilation commands (e.g., the `go build` command) to compile the code. If compilation fails, the code generation AI agent 105 analyzes the code compilation error information, automatically repairs the code, and recompiles. This example uses a maximum of three retries. If the compilation still fails after three attempts, a manual intervention marker is added to the code location where compilation failed.
[0060] Step S153: Test the functional code and generate test code. In this embodiment, the code generation AI agent 105 uses a self-correcting loop to test the functional code, executing test commands (e.g., the `go test` command) to perform code testing; if the code test fails, the reason for the failure is analyzed, the functional code or test code is automatically repaired, and then the test is retried. This example uses a maximum of three retries for code testing.
[0061] Step S154: Check code style and output compilable, complete code that conforms to project style. In this embodiment, the code generation AI agent 105 checks code style by running code checking commands (e.g., golint / eslint commands). If the code style check fails, the failed code is corrected to conform to the format, and the successfully tested compilable complete code is output.
[0062] In this embodiment, during the code generation process, the code generation AI agent 105 automatically calls the functions of the corresponding Skill library (e.g., "Redis cache back to origin") according to the requirements, and integrates the sample code from the Skill library into the generated code. Furthermore, the code generation AI agent 105 uses a self-correcting loop to compile the code, self-correcting any compilation errors, receiving compilation error output information (e.g., "undefined: UserID"), guiding the analysis of the compilation error cause through prompts (e.g., "missing import statement"), generating repair code, and recompiling. It then uses a self-correcting loop to test the code, analyzing the reasons for test failures and repairing the code. The loop count is up to 3 times; if it still fails, it prompts for manual intervention in code testing.
[0063] Another embodiment of this application also provides a computer device, such as... Figure 1 As shown, the computer device 1 includes, but is not limited to, a processor 11, a memory 12, and a computer program stored on the memory 12 and executable on the processor 11. When the processor 11 executes the computer program, it implements various method steps of the automatic processing method for requirement documents described in the embodiments of this application.
[0064] Another embodiment of this application provides a computer-readable storage medium storing a computer program. When executed by the processor 11 of computer device 1, the computer program implements various method steps of the automatic processing method for requirement documents described in the embodiments of this application.
[0065] Another embodiment of this application provides a computer program product, which includes a computer program that, when executed by the processor 11 of the computer device 1, implements various method steps of the automatic processing method for requirement documents described in the embodiments of this application.
[0066] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. This computer program is stored in a storage medium and includes several program instructions to cause the processor of computer device 1 to execute all or part of the steps of the automatic processing method for requirement documents described in the various embodiments of this application. The aforementioned computer-readable storage medium includes, but is not limited to, various storage media capable of storing computer program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0067] Those skilled in the art will understand that the above embodiments are specific examples of implementing the present invention, and in practical applications, various changes in form and detail may be made without departing from the spirit and scope of the present invention.
Claims
1. A method for automatically processing requirement documents, characterized in that, The method includes: Knowledge analysis is performed on the project codebase related to the requirements document to extract project information and project specifications, and the project information is compressed into a structured project knowledge base; A requirements analysis report is automatically generated based on the requirements document and project knowledge base. Based on the requirements analysis report, generate a requirements specification document that conforms to the project specifications; and Based on the requirements analysis report, generate complete code that conforms to the project specifications.
2. The automatic processing method for requirement documents according to claim 1, characterized in that, The method also includes: performing a quality assessment on the requirements document according to predefined quality assessment criteria.
3. The automatic processing method for requirement documents according to claim 2, characterized in that, The quality assessment of the requirements document according to the predefined quality assessment criteria includes: The requirement document is converted into a text format requirement document; The required document in the specified text format is divided into multiple text blocks according to the chapter structure; The quality of each text block is assessed by learning from few-sample cue words, and a quality score and quality assessment result are generated for each text block. Determine whether the quality score of each text block meets the predetermined score of the quality assessment standard; If a text block's quality score does not reach the predetermined score, a dialog message is generated and displayed on the user interface, prompting the user to modify the text content of that text block. If the quality scores of all text blocks reach the predetermined scores, the quality assessment results of the requirement document will be output.
4. The automatic processing method for requirement documents according to claim 1, characterized in that, The step of performing knowledge analysis on the project codebase related to the requirements document to extract project information and project specifications, and compressing the project information into a structured project knowledge base, includes: The project codebase is parsed using an abstract syntax tree parser to extract project information; The project information is statistically analyzed using a dependency graph analyzer to extract project specifications. A project knowledge base is constructed based on the project information and project specifications; and The project information in the project knowledge base is compressed into predefined structured data to generate a structured project knowledge base.
5. The automatic processing method for requirement documents according to claim 1, characterized in that, The automatic generation of a requirements analysis report based on the requirements document and project knowledge base includes: Extract the requirement keywords from the requirement document; Based on the stated requirements keywords, retrieve the project requirements and service items from the project knowledge base in the required document; Based on the project requirements and service projects, the system automatically retrieves the requirement solutions from the requirement document in the project knowledge base; and Generate a requirements analysis report based on the requirements scheme, and output the requirements analysis report.
6. The automatic processing method for requirement documents according to claim 5, characterized in that, The requirement scheme, which automatically retrieves the requirement document from the project knowledge base based on the project requirements and service projects, includes: Based on the project requirements, load the technology stack information of the aforementioned service project from the service knowledge base of the project knowledge base; Based on the task description of the service item, scan the skill base of the project knowledge base to obtain the list of skills available for the service task; The service item's task description is used to obtain the corresponding skill service from the skill list through semantic matching, and the skill service's example code and actual cases are obtained from the skill library. The business specifications of the service project are obtained from the business domain knowledge base of the project knowledge base, and the sample code, actual cases and business specifications of the skill service are added to the requirement scheme.
7. The automatic processing method for requirement documents according to claim 1, characterized in that, The generation of complete code conforming to the project specifications based on the requirements analysis report includes: The code is generated in a bottom-up, layered manner. The generated code at each level is compiled and self-correcting in a loop. The functional code is tested and test code is generated using a self-correcting loop; and Check code style and output complete, compileable code that conforms to project style.
8. A system for automatically processing requirement documents, characterized in that, The system includes: The project compression AI agent is used to perform knowledge analysis on the project code library related to the requirements document to extract project information and project specifications, and compress the project information into a structured project knowledge base; A requirements analysis AI agent is used to automatically generate a requirements analysis report based on the requirements document and the project knowledge base. An AI agent for solution writing is used to generate a requirement solution document that conforms to the project specifications based on the requirement analysis report; and An AI agent for code generation is used to generate complete code that conforms to the project specifications based on the requirements analysis report.
9. The automatic requirement document processing system according to claim 8, characterized in that, The system also includes a requirements assessment AI agent, which is used to assess the quality of the requirements document according to predetermined quality assessment criteria.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the automatic processing method for requirements documents as described in any one of claims 1 to 7.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by one or more processors, implements the steps of the automatic processing method for requirements documents as described in any one of claims 1 to 7.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by one or more processors, it implements the steps of the automatic requirements document processing method as described in any one of claims 1 to 7.