Code review method and device, equipment, medium and product

By introducing multi-model parallel collaboration and a dispute resolution model, the shortcomings of AI code review models in discovering problems are addressed, enabling deeper and broader code review, generating in-depth analysis reports that weigh decision-making, and improving code quality.

CN121455804APending Publication Date: 2026-02-03SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511736885.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Existing AI code review models are insufficient in detecting code issues, are prone to omissions, and have limited effectiveness in iterative reviews using a single model.

Method used

A multi-model parallel collaborative architecture is adopted. Through multiple iterative reviews, the code that was fixed in the previous iteration is used as the code to be reviewed in the next iteration. The different AI models in the intelligent agent resource pool are combined to conduct multi-directional reviews. Dispute resolution model arbitration conflict is introduced to generate the final fixed code.

Benefits of technology

It improves the breadth and depth of code reviews, uncovers more potential problems, generates in-depth analysis reports that weigh trade-offs, and optimizes code quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121455804A_ABST
    Figure CN121455804A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software development, in particular to a code review method and device, equipment, a medium and a product, and the method comprises the steps: obtaining a to-be-reviewed code, inputting the to-be-reviewed code and a prompt into a pre-trained artificial intelligence model, and generating a review result and a repair code; wherein the prompt words are used for indicating code review directions; updating the to-be-reviewed code into a repair code, and repeatedly executing the step of inputting the to-be-reviewed code and the prompt word into the pre-trained artificial intelligence model until an iteration stop condition is met, so as to obtain a final repair code; and obtaining a final review result based on the final repair code and the review result generated by each iteration. Through multiple iterative reviews, the repair code output by the artificial intelligence model last time is used as the code to be reviewed next time, the problem that the artificial intelligence model repeatedly outputs the found problem can be avoided, more program defects or problems can be found, and the code review effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of software development technology, and in particular to a code review method, apparatus, device, medium, and product. Background Technology

[0002] Code review is an important part of the software development process. It is a process of carefully examining and analyzing changes in the codebase, mainly used to check for errors, potential bugs, non-standard coding style, code complexity, and other issues in the source code.

[0003] Code review is typically the responsibility of engineers, which demands high levels of skill and is time-consuming and labor-intensive, resulting in less than ideal review outcomes in practice. With the rapid development of artificial intelligence, the use of AI models for code review is becoming increasingly common. However, the review capabilities of AI models are still somewhat lacking, limiting the number of issues they can detect and making them prone to oversights. Summary of the Invention

[0004] This disclosure is made in view of the above-mentioned problems and provides a code review method, apparatus, device, medium and product.

[0005] According to one aspect of this disclosure, a code review method is provided, comprising: The code to be reviewed is obtained, and the code and prompts are input into a pre-trained artificial intelligence model to generate review results and repair code; the prompts are used to indicate the direction of code review. Update the code to be reviewed to the repair code, and repeat the steps of inputting the code to be reviewed and the prompt into the pre-trained artificial intelligence model until the iteration stopping condition is met to obtain the final repair code; The final review result is obtained based on the final fixed code and the review results generated in each iteration.

[0006] The beneficial effects of this solution are as follows: by conducting multiple iterative reviews and using the repair code output by the AI ​​model in the previous iteration as the input code to be reviewed in the next iteration, new code to be reviewed is generated. This avoids the AI ​​model from repeatedly outputting problems that have already been discovered, which is conducive to discovering more program defects or problems and improving the effectiveness of code review.

[0007] Furthermore, according to one aspect of the code review method disclosed herein, the code to be reviewed and the prompts are input into a pre-trained artificial intelligence model to generate review results and fix code, including: The intelligent agent resource pool is invoked, and the code to be reviewed is input into each artificial intelligence model in the intelligent agent resource pool; among them, each artificial intelligence model has a different preset code review direction; Based on the code review direction of each AI model, set prompts for each AI model; Based on the code to be reviewed and the prompts, obtain the review results and initial fix code generated by each artificial intelligence model; Based on the review results and the initial fix code, generate the fix code.

[0008] In one or more embodiments, the beneficial effects of this solution are as follows: by using multiple artificial intelligence models to review from different directions, such as security vulnerabilities, performance bottlenecks, and formatting errors, a multi-model parallel collaboration architecture is adopted, rather than a single model's serial iteration. Each artificial intelligence model uses its own exclusive, highly optimized prompts to review the same code, which can improve the breadth and depth of code review and discover more hidden problems.

[0009] Furthermore, according to one aspect of the code review method of this disclosure, based on the review results and the initial fix code, fix code is generated, including: Identify whether there are conflicts in the initial repair codes generated by each artificial intelligence model; In response to a conflict between the initial fix codes generated by at least two target AI models, fix recommendations for each target AI model are generated based on the review results generated by the target AI models. Call the dispute resolution model in the agent resource pool, input the repair suggestions and conflicting code snippets into the dispute resolution model, and obtain the repair code.

[0010] In one or more embodiments, the beneficial effects of this solution are as follows: the rules for determining whether a conflict has occurred can be predefined. For example, AI model A suggests "adding a lock to ensure thread safety," while AI model B points out that "this lock may cause performance degradation." This situation can be considered a conflict between the two codes. For this disputed issue, a dispute resolution model can achieve scientific and reasonable arbitration, generating repair code that balances security and performance. An automated "dispute detection-arbitration" closed loop is introduced, simulating advanced human decision-making processes and solving the problem of inconsistent model opinions.

[0011] Furthermore, according to one aspect of the code review method of this disclosure, a final review result is obtained based on the final fixed code and the review results generated in each iteration, including: Based on the review results generated in each iteration, a review prompt is generated; the review prompt is generated based on the issues that appear in the review results. Input the final fix code and review prompts into the AI ​​model to obtain the final review results.

[0012] In one or more embodiments, the beneficial effect of this solution is as follows: by analyzing the review results generated in each iteration, the problems found during each iteration are analyzed, and the review prompts required by the artificial intelligence model are regenerated. For example, the review prompt might be: "Does the following code have these problems? If so, the problematic areas are marked, and repair suggestions are given." This ensures that after multiple iterations, the code to be reviewed no longer contains the problems that have already been discovered.

[0013] Furthermore, according to one aspect of the code review methodology disclosed herein, the final review results include a report of disputed issues and a report of no disputed issues. Uncontroversial issue reports include issues where there are no code conflicts; The dispute report includes the disputed issues with code conflicts, the conflicting code snippets, the fix suggestions output by the dispute resolution model, and the fix code.

[0014] In one or more embodiments, the beneficial effects of this solution are: the final output of the artificial intelligence model is no longer a simple list of problems, but a deep analysis report with a trade-off between the decision-making process and the solution, which can be used to optimize the model or rules and further improve the intelligence level of code review.

[0015] Furthermore, based on the code review method of one aspect of this disclosure, the dispute resolution model is updated according to the final review results.

[0016] In one or more embodiments, the beneficial effects of this solution are as follows: the dispute resolution model is used to resolve each dispute, specifically by analyzing the nature of the conflict and the rationality of both parties' positions, providing a comprehensive, cost-benefit-balanced final decision, offering a new compromise solution that takes both sides into account, or clearly indicating which party's suggestion should be prioritized and explaining the reasons. Updating the dispute resolution model through the final review results can improve its intelligence level and provide more reasonable dispute resolution solutions.

[0017] According to another aspect of this disclosure, a code review apparatus is provided, comprising: The initial review module is used to obtain the code to be reviewed, input the code to be reviewed and the prompts into a pre-trained artificial intelligence model, and generate review results and repair code; among them, the prompts are used to indicate the direction of code review; The iterative review module is used to update the code to be reviewed to the repair code, repeatedly executing the steps of inputting the code to be reviewed and the prompts into the pre-trained artificial intelligence model until the iteration stopping condition is met, and the final repair code is obtained. The final review module is used to obtain the final review result based on the final fixed code and the review results generated in each iteration.

[0018] According to another aspect of this disclosure, a computer device is provided, including a memory, a processor, and a computer program stored in the memory, the processor executing the computer program to implement the method of one aspect above.

[0019] According to another aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method of one aspect above.

[0020] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method of the above-described aspect.

[0021] It should be understood that both the foregoing general description and the following detailed description are exemplary and intended to provide further illustration of the claimed technology. Attached Figure Description

[0022] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.

[0023] Figure 1 This is a system architecture diagram illustrating a code review method applied according to an embodiment of this disclosure.

[0024] Figure 2 This is a flowchart illustrating a code review method for an application according to an embodiment of this disclosure.

[0025] Figure 3 This is a flowchart illustrating yet another code review method applied according to an embodiment of the present disclosure.

[0026] Figure 4 This is a schematic diagram illustrating the structure of a code review apparatus according to an embodiment of the present disclosure.

[0027] Figure 5 This is a schematic diagram illustrating the structure of a computer device according to an embodiment of the present disclosure.

[0028] Figure 6 This is a schematic diagram illustrating a computer program product according to an embodiment of the present disclosure. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of this disclosure more apparent, exemplary embodiments according to this disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments of this disclosure. It should be understood that this disclosure is not limited to the exemplary embodiments described herein.

[0030] Code review is a crucial part of the software development process. It involves carefully examining and analyzing changes in the codebase, primarily to check for errors, potential bugs, non-standard coding styles, and code complexity in the source code. This process typically involves two or more developers, at least one of whom is the developer who submitted the code change (called the "author" or "submitter"), while the others are developers responsible for reviewing the code (called "reviewers" or "examiners").

[0031] Code reviews are typically handled by engineers, which demands high levels of skill and is time-consuming and labor-intensive, resulting in less than ideal review outcomes in practice. With the rapid development of artificial intelligence, AI-based code reviews are becoming increasingly common. Through technologies such as machine learning, natural language processing, and deep learning, AI helps developers improve code quality, accelerate the review process, and reduce human error. Here are some key aspects of AI-automated code reviews: 1. Static code analysis Static code analysis is the foundation of automated code review; it checks source code for errors, potential bugs, poor coding style, code complexity, and other issues without running the code. Artificial intelligence (AI) models can enhance this process by training models to identify more complex code patterns, potential logical errors, and security vulnerabilities.

[0032] 2. Code Quality Assessment AI can learn and understand high-quality code standards, such as readability, maintainability, and testability. By comparing the code to be reviewed with these standards, AI can provide a code quality score and point out areas for improvement. This helps developers quickly understand the code's quality and make corresponding adjustments.

[0033] 3. Recommendations for Automated Code Review AI can automatically provide code review suggestions based on historical review data and code quality assessment results. These suggestions may include refactoring recommendations, performance optimization suggestions, and code style improvement suggestions. These suggestions can help developers quickly improve code quality and reduce subsequent modification work.

[0034] However, current AI is not powerful enough. A single AI review can only uncover a limited number of issues. Even if AI is used for multiple reviews, if the prompts remain unchanged, the number of issues discovered is still limited and easily overlooked.

[0035] The above description, with reference to the accompanying drawings, illustrates a code review method, apparatus, device, medium, and product according to embodiments of the present disclosure. By conducting multiple iterative reviews and using the previously output repair code from the artificial intelligence model as the input code to be reviewed in the next review, new code to be reviewed is generated. This avoids the artificial intelligence model repeatedly outputting problems that have already been discovered, which is beneficial for discovering more program defects or problems and improving the effectiveness of code review.

[0036] To facilitate understanding of this embodiment, a code review method disclosed in this disclosure will first be described in detail. The execution entity of the code review method provided in this disclosure is generally a computer device with certain computing capabilities. This computer device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, this code review method can be implemented by a processor calling computer-readable instructions stored in memory.

[0037] like Figure 1 The diagram shown is a system architecture diagram of the code review method provided in this embodiment of the disclosure, including Gerrit system 1, code review system 2, and intelligent agent resource pool 3. The intelligent agent resource pool 3 includes AI 31. The following is a detailed description of each module: Gerrit is an open-source code review and project management tool designed for use with the Git version control system. It provides a web-based interface that allows developers to upload code changes, have others review them, and ultimately merge those changes into the codebase.

[0038] The Gerrit system is mainly used to detect if there are any newly submitted code (code to be reviewed). If so, it sends the code to the code review system 2 for review and displays the final review results on the interface.

[0039] Code Review System 2: This system receives the code to be reviewed from the Gerrit system, calls the AI's Application Programming Interface (API), receives the review results and fixes returned by the AI ​​each time, and finally summarizes all the issues to obtain the final review result.

[0040] Intelligent Agent Resource Pool 3: Receives requests from Code Review System 2 via API interface, calls AI 31, reviews the code to be reviewed according to the prompts, and returns the review results and repair code generated in each iteration to Code Review System 2.

[0041] In one or more embodiments, the intelligent agent resource pool 3 includes multiple AIs, each focusing on a different code review direction, such as: Security vulnerabilities include: injection vulnerabilities, privilege escalation vulnerabilities, and data breaches. Performance bottlenecks include: algorithm complexity, memory management, and I / O operations. Maintainability aspects: such as code style, structure, duplicate code, and documentation clarity; Correctness direction: such as logical errors, boundary conditions, exception handling.

[0042] In one or more embodiments, the agent resource pool 3 also includes a dispute resolution model responsible for handling disagreements between AIs.

[0043] The training cues for the dispute resolution model are specially designed, for example: "You are responsible for resolving disputes during code reviews. The AI ​​has raised conflicting opinions regarding the following code snippet:" [Code Snippet] Recommended fix for AI(A): [Add locking to ensure thread safety] AI(B) Fix Recommendation: [This lock may cause performance degradation] Your task is: Analyze the nature of the conflict and the rationality of both sides' positions.

[0044] Provide a comprehensive final decision that weighs the pros and cons.

[0045] Provide a new, compromise-based code solution that balances security and performance, or clearly indicate which AI's suggestion should be prioritized and explain the reasons. Based on the above embodiments, this embodiment provides the following: Figure 2 The code review flowchart shown includes S201~S210: S201: Developers submit changes to the code to source code management systems such as Gerrit.

[0046] Source Code Management (SCM), also known as Version Control System (VCS), is a key tool used in the software development process to organize, track, and control changes to project code.

[0047] S202: The Gerrit system sends the code to be reviewed to the automated review system.

[0048] The Gerrit system detects a code change submission, extracts the file containing the changed code, marks the modified code and its context information, obtains the code to be reviewed, and sends the code to be reviewed to the automated review system.

[0049] S203: The automatic review system calls the AI's API interface and uses a preset prompt to ask the AI ​​to perform a review.

[0050] Specifically, the prompt message mainly contains two parts: a) Please perform vulnerability analysis on the following code to be reviewed; b) Provide the review results and the code after the fix.

[0051] If you are particularly concerned about certain types of vulnerabilities, you can specify this in the warning message.

[0052] In one or more embodiments, the automated review system can invoke multiple AIs at once, each focusing on a different code review direction, for example: Security vulnerabilities include: injection vulnerabilities, privilege escalation vulnerabilities, and data breaches. Performance bottlenecks include: algorithm complexity, memory management, and I / O operations. Maintainability aspects: such as code style, structure, duplicate code, and documentation clarity; Correctness direction: such as logical errors, boundary conditions, exception handling.

[0053] Each AI has specific prompts, such as: a) Please perform a security vulnerability analysis on the following code to be reviewed; b) Provide the review results and the corrective code. Optionally, the prompts need to be continuously iterated and optimized to maximize the AI's professional focus capabilities.

[0054] In one or more embodiments, it is identified whether the fix code generated by each AI conflicts. If at least two AIs conflict, a dispute resolution model is invoked. For each point of contention, the conflicting code snippets and the review results of each AI (including fix suggestions, problem type and severity, etc.) are obtained for arbitration. A final fix code that can take both into account is generated or it is clearly indicated which AI's fix suggestion should be adopted first and the reasons are explained.

[0055] S204: AI returns review results and fix code.

[0056] The review results include the issues discovered by AI, the type of issue, the severity, the code location, and the suggested fixes.

[0057] S205: The automated review system records the problems found by the AI ​​and the returned repair code, inputs the repair code as a new code to be reviewed into the AI, and asks questions using the same prompts.

[0058] S206: Determine if the iteration stopping condition is met. If yes, proceed to S207; otherwise, return to S203.

[0059] Specifically, the iteration stopping condition can be: reaching the maximum number of repetitions N, or the AI ​​not discovering any new problems.

[0060] S207: The automated review system summarizes all issues returned by the AI ​​and, combined with the initial code to be reviewed, regenerates review prompts.

[0061] Specifically, the review prompts may include: "Does the following code have these problems? If so, please indicate the problem and provide suggestions for fixing it."

[0062] S208: AI returns the final review result to the automated review system.

[0063] S209: The automated review system returns the final review results to the Gerrit system.

[0064] S210: The Gerrit system displays the final review results on a web page.

[0065] Based on the above embodiments, this embodiment also provides a code review method, such as... Figure 3 The diagram shown is another flowchart of the code review method, including S301-S303: S301: Obtain the code to be reviewed, input the code to be reviewed and the prompt into the pre-trained artificial intelligence model, and generate the review results and the repair code.

[0066] The prompts are used to indicate the direction of code review.

[0067] S302: Update the code to be reviewed to the repair code, and repeat the steps of inputting the code to be reviewed and the prompt into the pre-trained artificial intelligence model until the iteration stopping condition is met to obtain the final repair code.

[0068] S303: Obtain the final review result based on the final fix code and the review results generated in each iteration.

[0069] By conducting multiple iterative reviews and using the previously output repair code from the AI ​​model as the input code for the next review, new code to be reviewed is generated. This avoids the AI ​​model repeatedly outputting problems that have already been discovered, which helps to find more program defects or problems and improves the effectiveness of code review.

[0070] In one or more embodiments, S301 includes: The process involves accessing the intelligent agent resource pool and inputting the code to be reviewed into various AI models within the pool. Based on the code review direction of each AI model, prompts are set for each model. Based on the code to be reviewed and the prompts, the review results and initial repair code generated by each AI model are obtained. Finally, repair code is generated based on the review results and the initial repair code. Note that each AI model has a different preset code review direction. By using multiple AI models to review code from different angles, such as security vulnerabilities, performance bottlenecks, and formatting errors, a multi-model parallel collaboration architecture is adopted, rather than a single model's serial iteration. Each AI model uses its own exclusive, highly optimized prompts to review the same code, which can improve the breadth and depth of code review and uncover more hidden problems.

[0071] In one or more embodiments, generating repair code based on review results and initial repair code includes: identifying whether the initial repair codes generated by each artificial intelligence model conflict; in response to a conflict between the initial repair codes generated by at least two target artificial intelligence models, generating repair opinions for each target artificial intelligence model based on the review results generated by the target artificial intelligence models; and invoking a dispute resolution model in the agent resource pool, inputting the repair opinions and conflicting code fragments into the dispute resolution model to obtain the repair code.

[0072] The rules for determining whether a conflict has occurred can be predefined. For example, AI model A might suggest "using locks to ensure thread safety," while AI model B might point out that "this lock may cause performance degradation." This situation can be considered a conflict between the two code snippets. For this disputed issue, a dispute resolution model can achieve scientific and reasonable arbitration, generating fix code that balances safety and performance. An automated "dispute detection-arbitration" closed loop is introduced, simulating advanced human decision-making processes and solving the problem of inconsistent model opinions.

[0073] In one or more embodiments, obtaining the final review result based on the final fix code and the review results generated in each iteration includes: generating a review prompt based on the review results generated in each iteration; and inputting the final fix code and the review prompt into an artificial intelligence model to obtain the final review result. The review prompt is generated based on issues identified in the review results.

[0074] By analyzing the review results generated in each iteration, and addressing the issues discovered during each iteration, the review prompts required by the AI ​​model are regenerated. For example, the review prompt might be: "Does the following code contain these problems? If so, mark the problematic areas and provide suggested fixes." This ensures that after multiple iterations, the code to be reviewed no longer contains the previously discovered issues.

[0075] In one or more embodiments, the final review results include a disputed issue report and a non-disputed issue report. The non-disputed issue report includes issues where there are no code conflicts; the disputed issue report includes disputed issues where there are code conflicts, conflicting code snippets, fix suggestions output by the dispute resolution model, and fix code.

[0076] The final output of the artificial intelligence model is no longer a simple list of problems, but an in-depth analysis report that weighs the decision-making process and solutions. This report can be used to optimize the model or rules and further improve the intelligence level of code review.

[0077] In one or more embodiments, the dispute resolution model is updated based on the final review results.

[0078] Dispute resolution models are used to resolve each dispute, specifically by analyzing the nature of the conflict and the rationality of both parties' positions, providing a comprehensive, cost-benefit-balanced final decision, offering a new compromise solution that takes both sides into account, or clearly indicating which party's suggestion should be prioritized and explaining the reasons. Updating the dispute resolution model through the final review results improves its intelligence and provides more reasonable dispute resolution solutions.

[0079] According to another aspect of the embodiments of this disclosure, a code review apparatus is provided, such as... Figure 4 As shown, the device includes: The initial review module 401 is used to obtain the code to be reviewed, input the code to be reviewed and the prompts into a pre-trained artificial intelligence model, and generate review results and repair code; wherein, the prompts are used to indicate the direction of code review; The iterative review module 402 is used to update the code to be reviewed to the repair code, and repeatedly execute the steps of inputting the code to be reviewed and the prompt into the pre-trained artificial intelligence model until the iteration stopping condition is met, and the final repair code is obtained. The final review module 403 is used to obtain the final review result based on the final fix code and the review results generated in each iteration.

[0080] In one or more embodiments, the initial review module 401 is used to: The intelligent agent resource pool is invoked, and the code to be reviewed is input into each artificial intelligence model in the intelligent agent resource pool; among them, each artificial intelligence model has a different preset code review direction; Based on the code review direction of each AI model, set prompts for each AI model; Based on the code to be reviewed and the prompts, obtain the review results and initial fix code generated by each artificial intelligence model; Based on the review results and the initial fix code, generate the fix code.

[0081] In one or more embodiments, the initial review module 401 is further configured to: Identify whether there are conflicts in the initial repair codes generated by each artificial intelligence model; In response to a conflict between the initial fix codes generated by at least two target AI models, fix recommendations for each target AI model are generated based on the review results generated by the target AI models. Call the dispute resolution model in the agent resource pool, input the repair suggestions and conflicting code snippets into the dispute resolution model, and obtain the repair code.

[0082] In one or more embodiments, the final review module 403 is used to: Based on the review results generated in each iteration, a review prompt is generated; the review prompt is generated based on the issues that appear in the review results. Input the final fix code and review prompts into the AI ​​model to obtain the final review results.

[0083] The code review device and the code review method provided in this disclosure are based on the same inventive concept and have the same beneficial effects as the methods they adopt, operate or implement.

[0084] This disclosure also provides a computer device for performing the above-described code review method. Please refer to... Figure 5 It illustrates a schematic diagram of a computer device provided by some embodiments of this disclosure. For example... Figure 5 As shown, the computer device 5 includes: a processor 500, a memory 501, a bus 502, and a communication interface 503. The processor 500, the communication interface 503, and the memory 501 are connected via the bus 502. The memory 501 stores a computer program that can run on the processor 500. When the processor 500 runs the computer program, it executes the code review method provided in any of the foregoing embodiments of this disclosure.

[0085] The memory 501 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this device network element and at least one other network element is achieved through at least one communication interface 503 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.

[0086] Bus 502 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The memory 501 is used to store programs. After receiving an execution instruction, the processor 500 executes the program. The code review method disclosed in any of the foregoing embodiments of this disclosure can be applied to the processor 500, or implemented by the processor 500.

[0087] The processor 500 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 500 or by instructions in software form. The processor 500 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPTA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 501. The processor 500 reads the information in memory 501 and, in conjunction with its hardware, completes the steps of the above method.

[0088] The computer device and the code review method provided in this disclosure are based on the same inventive concept and have the same beneficial effects as the methods they adopt, run or implement.

[0089] This disclosure also provides a computer-readable storage medium corresponding to the code review method provided in the foregoing embodiments. The computer-readable storage medium is an optical disc, on which a computer program (i.e., a computer program product) is stored. When the computer program is run by a processor, it executes the code review method provided in any of the foregoing embodiments.

[0090] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.

[0091] The computer-readable storage medium provided in the above embodiments of this disclosure and the code review method provided in the embodiments of this disclosure are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.

[0092] This disclosure also provides a computer program product; please refer to [reference needed]. Figure 6 The computer program product 600 carries program code, namely computer program 601. The instructions included in the computer program 601 can be used to execute the steps of the code review method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0093] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0094] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.

[0095] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.

[0096] Additionally, as used herein, the "or" used in a list of items beginning with "at least one" indicates a separate list, such that a list of, for example, "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not imply that the described example is preferred or better than other examples.

[0097] It should also be noted that in the systems and methods of this disclosure, the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered as equivalent solutions to this disclosure.

[0098] Various changes, substitutions, and modifications can be made to the technology described herein without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of this disclosure is not limited to the specific aspects of the processes, machines, manufactures, events, means, methods, and actions described above. Currently existing or later-developed processes, machines, manufactures, events, means, methods, or actions that perform substantially the same function or achieve substantially the same result as the corresponding aspects described herein can be utilized. Therefore, the appended claims include such processes, machines, manufactures, events, means, methods, or actions within their scope.

[0099] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.

[0100] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.

Claims

1. A code review method, characterized in that, include: The code to be reviewed is obtained, and the code to be reviewed and the prompt are input into a pre-trained artificial intelligence model to generate review results and repair code; wherein, the prompt is used to indicate the direction of code review; The code to be reviewed is updated with the code to be repaired, and the steps of inputting the code to be reviewed and the prompt into the pre-trained artificial intelligence model are repeated until the iteration stopping condition is met to obtain the final code to be repaired. Based on the final fix code and the review results generated in each iteration, the final review result is obtained.

2. The code review method as described in claim 1, characterized in that, The code to be reviewed and the prompt are input into a pre-trained artificial intelligence model to generate review results and repair code, including: The intelligent agent resource pool is invoked, and the code to be reviewed is input into each of the artificial intelligence models in the intelligent agent resource pool; wherein, each of the artificial intelligence models has a different preset code review direction; Based on the code review direction of each AI model, set the prompt message for each AI model; Based on the code to be reviewed and the prompt, the review results and initial repair code generated by each of the artificial intelligence models are obtained; Based on the review results and the initial repair code, repair code is generated.

3. The code review method as described in claim 2, characterized in that, Based on the review results and the initial fix code, fix code is generated, including: Identify whether the initial repair code generated by each of the aforementioned artificial intelligence models conflicts; In response to a conflict between the initial fix codes generated by at least two target AI models, fix recommendations for each target AI model are generated based on the review results generated by the target AI models. The dispute resolution model in the intelligent agent resource pool is invoked, and the repair suggestions and conflicting code snippets are input into the dispute resolution model to obtain the repair code.

4. The code review method as described in claim 1, characterized in that, Based on the final fix code and the review results generated in each iteration, the final review result is obtained, including: Based on the review results generated in each iteration, a review prompt is generated; wherein, the review prompt is generated based on the issues that appear in the review results; The final repair code and the review prompt are input into the artificial intelligence model to obtain the final review result.

5. The code review method as described in claim 3, characterized in that, The final review results include a report on disputed issues and a report on undisputed issues. The uncontroversial issue report includes issues where there are no code conflicts; The dispute report includes the disputed issue with code conflict, the conflicting code snippet, the fix suggestion output by the dispute resolution model, and the fix code.

6. The code review method as described in claim 3, characterized in that, Also includes: The dispute resolution model is updated based on the final review results.

7. A code review device, characterized in that, include: The initial review module is used to obtain the code to be reviewed, input the code to be reviewed and the prompts into a pre-trained artificial intelligence model, and generate review results and repair code; wherein, the prompts are used to indicate the direction of code review; The iterative review module is used to update the code to be reviewed with the repair code, and repeatedly execute the step of inputting the code to be reviewed and the prompt into the pre-trained artificial intelligence model until the iteration stop condition is met, and the final repair code is obtained. The final review module is used to obtain the final review result based on the final fix code and the review results generated in each iteration.

8. A computer embedded device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 6.