Code review method and device

通过大语言模型对代码差异文件进行深度解析,自动化代码审查,解决了人工审查效率低的问题,实现了高效、准确的代码审查,提升了开发效率和代码质量。

CN119201210APending Publication Date: 2024-12-27BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411333836.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing manual code review is inefficient, easy to cause omissions, and lack of automation, resulting in reduced code review efficiency and software development efficiency.

Method used

The large language model is used to deeply analyze the code difference files, automatically identify potential problems and syntax errors, detect whether the code complies with the standards based on preset specifications, and build an automated code review process to reduce manual interference.

Benefits of technology

It improves the efficiency and accuracy of code review, reduces manual review time, improves code quality and development efficiency, and ensures consistency and standardization of the review process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201210A_ABST
    Figure CN119201210A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a code review method and device, and relates to the technical field of computers. The method comprises the steps of determining a code difference file based on a selected version file of a to-be-reviewed code and any historical version file of the selected version; wherein the code difference file comprises a change code line, of which the code content is changed, in the selected version file, and a context code line of the change code line; constructing input prompt information which comprises the code difference file and is used for code review; inputting the input prompt information into a large language model, and obtaining a code review result generated by the large language model based on the input prompt information; wherein the code review result is information used for representing whether the variable code line passes review or not. Therefore, by applying the scheme provided by the embodiment of the invention, automatic code review can be realized, and the code review efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a code review method and device. Background Art

[0002] The software development process involves multiple key steps, among which code review (CR) is an important part of ensuring code quality and maintaining code specifications. Currently, manual review is the mainstream method of code review. Usually, every member of the software development team needs to participate in code review, which not only improves the readability and maintainability of the code, but also reduces potential code defects.

[0003] However, as the scale of projects expands, the amount of code grows, and the complexity increases, manual review is not only time-consuming and labor-intensive, but also prone to omissions. For example, for large projects, a single code submission may involve hundreds or even thousands of lines of code, and developers may spend several hours or even more on code review each week. Affected by subjective factors such as the current mental state and fatigue level, developers are prone to inattention when faced with a large amount of code, which leads to ignoring some potential problems in the code during the code review process, resulting in omissions in the review. As mentioned above, the current manual code review method will undoubtedly reduce the efficiency of code review, and then reduce the efficiency of software development. Summary of the invention

[0004] The purpose of the embodiment of the present invention is to provide a code review method and device to realize automated code review and improve the efficiency of code review. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a code review method is provided, the method comprising:

[0006] Determine a code difference file based on a selected version file of the code to be reviewed and any historical version file of the selected version; wherein the code difference file includes: a changed code line in which the code content in the selected version file is changed, and a context code line of the changed code line;

[0007] Constructing input prompt information for code review including the code difference file;

[0008] The input prompt information is input into a large language model, and a code review result generated by the large language model based on the input prompt information is obtained; wherein the code review result is information used to characterize whether the changed code line has passed the review.

[0009] Optionally, in a specific implementation, determining the code difference file based on the selected version file of the code to be reviewed and any historical version file of the selected version includes:

[0010] Obtain the latest code file of the code to be reviewed as the selected version file, and obtain the previous version code file of the latest code file;

[0011] The selected version file is compared with the previous version code file to obtain a code difference file.

[0012] Optionally, in a specific implementation, the constructing includes input prompt information for code review of the code difference file, including:

[0013] Determine additional information for describing the code content of the code difference file; wherein the additional information includes: description information and domain knowledge information of the code difference file;

[0014] Input prompt information for code review including the code difference file and the attachment information is constructed.

[0015] Optionally, in a specific implementation manner, the determining of the additional information for describing the code content of the code difference file includes:

[0016] Obtaining natural language description information of the code difference file; wherein the natural language description information is used to describe the change in the code content of the changed code line;

[0017] Using the natural language description information as a query keyword, searching for a target code case including the query keyword in a preset knowledge base, and using the target code case, and the target code problem and target code solution corresponding to the target code case in the knowledge base as the domain knowledge information of the code difference file; wherein the knowledge base includes: a correspondence between code problems, code solutions and code cases;

[0018] The natural language description information and the domain knowledge information are determined as additional information for describing the code content of the code difference file.

[0019] Optionally, in a specific implementation, the obtaining of natural language description information of the code difference file includes:

[0020] The code difference file is input into the large language model, and natural language description information generated by the large language model based on the code difference file is obtained.

[0021] Optionally, in a specific implementation, the context code includes: a specified number of code lines located before the changed code line and continuous with the changed code line, and the specified number of code lines located after the changed code line and continuous with the changed code line.

[0022] Optionally, in a specific implementation, the comparing the selected version file with the previous version code file to obtain a code difference file includes:

[0023] Comparing the selected version file with the previous version code file to obtain the changed code lines in which the code content in the selected version file has changed;

[0024] In the selected version file, searching for the code block where the changed code line is located;

[0025] A differential code file including the code block is generated.

[0026] Optionally, in a specific implementation, before generating a differential code file including the code block, the method further includes:

[0027] Searching for explanation information of code information referenced in the code block; wherein the code information includes: a method name of a class, and / or an attribute name of a class;

[0028] The generating of a differential code file including the code block comprises:

[0029] By merging the code block and the interpretation information, a code difference file including the code block and the interpretation information is generated.

[0030] Optionally, in a specific implementation, the method further includes:

[0031] A question pair including the code review result and manual feedback information for the code review result is constructed, and the question pair is input into the large language model so that the large language model learns the question pair.

[0032] In a second aspect of the present invention, a code review device is provided, the device comprising:

[0033] A file acquisition module is used to determine a code difference file based on a selected version file of the code to be reviewed and any historical version file of the selected version; wherein the code difference file includes: a changed code line in which the code content in the latest code file has changed, and a context code line of the changed code line;

[0034] An information construction module, used to construct input prompt information for code review including the code difference file;

[0035] A code review module is used to input the input prompt information into a large language model and obtain a code review result generated by the large language model based on the input prompt information; wherein the code review result is information used to characterize whether the changed code line has passed the review.

[0036] Optionally, in a specific implementation, the file acquisition module includes:

[0037] A file acquisition submodule is used to acquire the latest code file of the code to be reviewed as the selected version file, and acquire the previous version code file of the latest code file;

[0038] The file comparison submodule is used to compare the selected version file with the previous version code file to obtain a code difference file.

[0039] Optionally, in a specific implementation, the information construction module includes:

[0040] An information determination submodule, used to determine additional information for describing the code content of the code difference file; wherein the additional information includes: description information and domain knowledge information of the code difference file;

[0041] The information construction submodule is used to construct input prompt information for code review including the code difference file and the attachment information.

[0042] Optionally, in a specific implementation, the information determination submodule includes:

[0043] An information acquisition unit, used to acquire natural language description information of the code difference file; wherein the natural language description information is used to describe the code content change of the changed code line;

[0044] An information search unit is used to use the natural language description information as a query keyword to search for a target code case including the query keyword in a preset knowledge base, and use the target code case, and the target code problem and target code solution corresponding to the target code case in the knowledge base as the domain knowledge information of the code difference file; wherein the knowledge base includes: a correspondence between code problems, code solutions and code cases;

[0045] The information determination unit is used to determine the natural language description information and the domain knowledge information as additional information for describing the code content of the code difference file.

[0046] Optionally, in a specific implementation, the information acquisition unit is specifically used to:

[0047] The code difference file is input into the large language model, and natural language description information generated by the large language model based on the code difference file is obtained.

[0048] Optionally, in a specific implementation, the context code includes: a specified number of code lines located before the changed code line and continuous with the changed code line, and the specified number of code lines located after the changed code line and continuous with the changed code line.

[0049] Optionally, in a specific implementation, the file comparison submodule includes:

[0050] A file comparison unit, used for comparing the selected version file with the previous version code file, to obtain changed code lines in which the code content in the selected version file has changed;

[0051] A code search unit, used for searching the code block where the changed code line is located in the latest code file;

[0052] The file generating unit is used to generate a differential code file including the code block.

[0053] Optionally, in a specific implementation, the file comparison submodule further includes:

[0054] An information search unit, used for searching for interpretation information of code information referenced in the code block before generating a differential code file including the code block; wherein the code information includes: a device name of a class, and / or an attribute name of a class;

[0055] The file generating unit is specifically configured to generate a code difference file including the code block and the interpretation information by merging the code block and the interpretation information.

[0056] Optionally, in a specific implementation, the device further includes:

[0057] A model updating module is used to construct a question pair including the code review result and manual feedback information for the code review result, and input the question pair into the large language model so that the large language model learns the question pair.

[0058] Another aspect of the embodiments of the present invention further provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0059] Memory, used to store computer programs;

[0060] The processor is used to implement the steps of any of the above-mentioned code review methods when executing the program stored in the memory.

[0061] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any of the above-mentioned code review methods are implemented.

[0062] In another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of any of the above-mentioned code review methods.

[0063] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, a large language model can be used for code review. Among them, the code is deeply parsed through a large language model to automatically identify potential problems, syntax errors and performance bottlenecks in the code, and based on pre-set code specifications and standards, it is automatically detected whether the code meets the specifications to avoid the interference of human subjective consciousness. In other words, the solution provided by the embodiment of the present invention has multiple core functions including automatic code analysis and standardized review. Based on this, the embodiment of the present invention provides a more intelligent, efficient and standardized solution. By applying advanced natural language processing and machine learning technologies, code review can be automatically and efficiently performed, manual operations can be reduced, and the efficiency of code review can be improved. In addition, the solution can perform comprehensive semantic analysis and logical verification of the code, identify potential defects and irregularities, and at the same time ensure the consistency and standardization of the review process, greatly reduce the time and energy investment in manual review, and improve the overall development efficiency and code quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0065] Figure 1 A schematic diagram of a code review method according to an embodiment of the present invention;

[0066] Figure 2 A flowchart of another code review method according to an embodiment of the present invention;

[0067] Figure 3 A flowchart of another code review method according to an embodiment of the present invention;

[0068] Figure 4 A flowchart of another code review method according to an embodiment of the present invention;

[0069] Figure 5A flowchart of another code review method according to an embodiment of the present invention;

[0070] Figure 6 A flowchart of another code review method in an embodiment of the present invention is shown in FIG.

[0071] Figure 7 for Figure 6 A process architecture diagram of the code review method shown;

[0072] Figure 8 A flowchart of another code review method according to an embodiment of the present invention;

[0073] Fig. 9 A flowchart of another code review method according to an embodiment of the present invention;

[0074] Fig.10 for Fig. 9 A process architecture diagram of the specific implementation method shown;

[0075] Fig.11 This is a schematic diagram of the structure of a code review device in an embodiment of the present invention;

[0076] Fig.12 The figure is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0077] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0078] In the software development process, code review is an important part of ensuring code quality and maintaining code specifications, and manual review is the mainstream method of code review. However, manual review usually has the following problems:

[0079] 1. Manual review takes a lot of time

[0080] As the scale of projects expands and the amount of code continues to increase, the time developers spend on code review every day is becoming more and more significant. Especially for large projects, a single code submission may involve hundreds or even thousands of lines of code, and developers need to invest a lot of time in careful review. One data shows that the average time spent by each developer on code review can be as high as several hours per week, or even doubled. This undoubtedly has a significant impact on development efficiency and productivity, and also increases development costs.

[0081] 2. Manual review is less effective

[0082] Although manual review is the mainstream method of code review, there is significant uncertainty in its reliability and effectiveness. First, manual review is easily affected by subjective factors such as the reviewer's current mental state and fatigue level. Especially when faced with a large amount of code, the reviewer is prone to inattention and fatigue, which leads to omission or neglect of some potential problems. Secondly, during the manual review process, the reviewer's brain has limited speed and ability to process information. When faced with complex business logic or dense code, it is difficult to fully understand and grasp the core of the problem in a short period of time, and errors and omissions are difficult to avoid. Third, the reviewer's experience and technical level also affect the quality of code review. Reviewers with different backgrounds and levels may have large differences in their interpretation and judgment of the same code.

[0083] 3. Lack of effective regulations for manual review

[0084] In the manual review process, the lack of unified and standardized specifications is also an important issue. Although most teams will develop some code specifications or standards, the specific implementation will still be affected by the reviewer's personal subjective factors. Different reviewers may have different understandings and requirements for code style, naming rules, logical design, etc., resulting in inconsistent standards and scales in code review. This strong interference of subjective consciousness is not only of little help in improving code quality, but may even cause unnecessary disputes among team members, affecting teamwork and project progress.

[0085] In summary, the existing manual code review methods have significant problems such as low efficiency, poor reliability, and inconsistent standards, which in turn leads to low software development efficiency.

[0086] In order to solve the above problem, an embodiment of the present invention provides a code review method.

[0087] Among them, the code review method can be applied to various software development scenarios that require code review, such as video software development, shopping software development, game software development, etc. The embodiment of the present invention does not limit the specific application scenarios of the above-mentioned code review method.

[0088] Furthermore, the execution subject of the code review method may be a server used for software development and having a large language model calling function, hereinafter referred to as the server.

[0089] In addition, the code review method implements code review by calling a large language model. The so-called large language model (LLM) refers to an advanced artificial intelligence algorithm trained on a large amount of data, such as OpenAI's GPT-4, OpenAI's GPT-3, Qwen1.5-7B, etc. The embodiment of the present invention does not limit the specific type of the large language model used in the above-mentioned code review method.

[0090] A code review method provided by an embodiment of the present invention may include the following steps:

[0091] Determine a code difference file based on a selected version file of the code to be reviewed and any historical version file of the selected version; wherein the code difference file includes: a changed code line in which the code content in the selected version file is changed, and a context code line of the changed code line;

[0092] Constructing input prompt information for code review including the code difference file;

[0093] The input prompt information is input into a large language model, and a code review result generated by the large language model based on the input prompt information is obtained; wherein the code review result is information used to characterize whether the changed code line has passed the review.

[0094] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, a large language model can be used for code review. Among them, the code is deeply parsed through a large language model to automatically identify potential problems, syntax errors and performance bottlenecks in the code, and based on pre-set code specifications and standards, it is automatically detected whether the code meets the specifications to avoid the interference of human subjective consciousness. In other words, the solution provided by the embodiment of the present invention has multiple core functions including automatic code analysis and standardized review. Based on this, the embodiment of the present invention provides a more intelligent, efficient and standardized solution. By applying advanced natural language processing and machine learning technologies, code review can be automatically and efficiently performed, manual operations can be reduced, and the efficiency of code review can be improved. In addition, the solution can perform comprehensive semantic analysis and logical verification of the code, identify potential defects and irregularities, and at the same time ensure the consistency and standardization of the review process, greatly reduce the time and energy investment in manual review, and improve the overall development efficiency and code quality.

[0095] A code review method provided by an embodiment of the present invention is described in detail below in conjunction with the accompanying drawings.

[0096] Figure 1 A flowchart of a code review method provided by an embodiment of the present invention is shown as follows: Figure 1As shown, the method may include the following steps S101-S103.

[0097] S101: Determine a code difference file based on a selected version file of the code to be reviewed and any historical version file of the selected version.

[0098] The code difference file includes: the changed code lines in which the code content in the selected version file is changed, and the context code lines of the changed code lines.

[0099] In the process of software development, due to changes in software functions, software troubleshooting, etc., it is often necessary to update the written software code, for example, deleting certain content in the code line, changing certain content in the code line, etc., to achieve the purpose of eliminating code bugs (faults) and making the updated code meet the software development needs. Therefore, in the process of software development, for the developed software, there are usually multiple versions of code files, for example, for the developed software, the first version of the code file that is first written and completed, the second version of the code file that is updated by the above-mentioned first version of the code file, the third version of the code file that is updated by the above-mentioned second version of the code file, etc. As the number of updates increases, the number of versions of the code file may also increase accordingly. Among them, the code file obtained after the last update of the software code written for the developed software can be called the latest code file.

[0100] In addition, except for the first version of the code file, for each other version of the code file, each version of the code file obtained before the version of the code file can be called the historical version file of the version of the code file. For example, the first version of the code file is the historical version file of the second version of the code file, and the first version of the code file and the second version of the code file are both historical version files of the third version of the code file.

[0101] Among them, since the purpose of code review is to review whether the updated code content in the code file is passed, for example, whether the updated code content complies with the code specification and / or code standard, whether there are bugs in the updated code content, etc., therefore, when performing code review, it is necessary to first determine the code files that need to be code reviewed in the code files of each version of the code to be reviewed, and the determined code files that need to be code reviewed can be called selected version files, for example, the latest code file can be determined as the selected version file. In many cases, in the software development process, before the selected version file, the written code may have been updated at least once, so that for the selected version file, there is at least one historical version file. Therefore, in order to determine the code lines in the selected version file that have changed due to the code update, any one of the historical version files of the selected version file can be selected as the comparison basis for the code update, so that the code difference file can be determined based on the selected version file of the code to be reviewed and any one of the historical version files of the selected version.

[0102] For example, the latest code file of the code to be reviewed can be obtained as the selected version file, and the previous version code file of the latest code file can be obtained. The previous version code file is a historical version file selected from various historical version files of the latest code file as the selected version file. Therefore, the code difference file can be determined based on the latest code file and the previous version code file.

[0103] Exemplarily, during the development of software A, the developer first wrote an initial code file, which can be referred to as code 1.0; thereafter, the developer made a first modification to the initial code file, and the resulting code file can be referred to as code 2.0, wherein code 1.0 is the previous version of the code file of code 2.0. In the case where a code review is performed after the first modification, a code difference file can be determined based on code 2.0 and code 1.0; then, the developer made a second modification to the code file after the first modification, and the resulting code file can be referred to as code 3.0, wherein code 2.0 is the previous version of the code file of code 3.0. In the case where a code review is performed after the second modification, a code difference file can be determined based on code 3.0 and code 2.0.

[0104] Optionally, GibLab can be used to obtain the latest code file and the previous version of the latest code file, wherein the acquisition process may include three steps: GitLab API configuration, WebHooks configuration of Merge Request Event (code merge event) and code content acquisition.

[0105] Specific:

[0106] 1. Configure the GitLab API on the server: that is, configure the API (Application Programming Interface) token of GitLab (code management tool) in the server to enable the code file content in the software development project to be obtained through the above GitLab API.

[0107] 2. WebHooks configuration for Merge Request Event: Configure Webhooks in the settings of the GitLab project. Webhooks is a mechanism for sending event notifications to a specified URL when a specific event occurs. Usually, the above event notification is an HTTP (HyperText Transfer Protocol) POST request. In this way, Webhooks can allow external systems to respond to changes in the GitLab project in real time, such as code push, merge requests, branch creation, etc. Therefore, when configuring Webhooks in the settings of the GitLab project, the essence is to specify a URL (Universal Resource Locator) so that when the developer submits the Merge Request Event of the software development project to GitLab, the Webhooks event can be triggered to notify the external system to process the above Webhooks event, that is, to enter the Merge Request Event processing flow. The so-called Webhooks event is when a developer submits a Merge Request Event of a software development project to GitLab, GitLab will send an HTTP POST request to the above specified URL, for example, a Webhooks request, and the HTTP POST request includes the above Merge Request Event information. Specifically:

[0108] A service for receiving Webhooks requests is deployed in the server, for example, a Webhooks receiving service, which is used to parse the content of the Webhooks request to obtain the Merge Request Event ID (identification) and related information. As mentioned above, the developer first submits the Merge RequestEvent of the software development project to GitLab, triggering the Webhooks event, that is, GitLab sends a Webhooks request to the above-specified URL. After that, the Webhooks receiving service obtains the above-mentioned Webhooks request, parses the content of the above-mentioned Webhooks request, and extracts the MergeRequest Event ID and related information. Among them, the above-mentioned related information includes the source branch to which the code to be reviewed belongs and the target branch to be merged, as well as information such as the access path of the code file to which the code to be reviewed belongs.

[0109] 3. Obtaining code content: After obtaining the above-mentioned Merge Request Event ID and related information, you can call the above-mentioned GitLab API to obtain the latest code file of the code to be reviewed and the previous version of the code file of the above-mentioned latest code file through the above-mentioned Merge Request Event ID and related information.

[0110] After obtaining the selected version file and any one of the historical version files of the selected version file, the selected version file and the obtained historical version file can be compared to determine which code lines in the selected version file have changed relative to the obtained historical version file, thereby obtaining a code difference file. In order to facilitate subsequent description, in the following text, any one of the historical version files of the selected version file used to determine the code difference file can be referred to as the target historical version file.

[0111] In the above comparison process, the code lines in the above selected version file whose code content has changed relative to the above target historical version file can be determined as changed code lines, and then the context code lines of the above changed code lines can be determined in the above selected version file. In this way, the obtained code difference file can include: the changed code lines in the selected version file whose code content has changed, and the context code lines of the changed code lines. Among them, the context code lines of the above changed code lines can include: one or more lines of code in the above selected version file that are located before the above changed code line and continuous with the changed code line, and one or more lines of code in the above selected version file that are located after the above changed code line and continuous with the changed code line.

[0112] As mentioned above, optionally, in a specific implementation, Figure 2 As shown, the above step S101 may include the following steps S1011 - S1012 .

[0113] S1011: Obtain the latest code file of the code to be reviewed as the selected version file, and obtain the previous version code file of the latest code file;

[0114] S1012: Compare the selected version file with the previous version code file to obtain a code difference file.

[0115] For example, in the above Figure 2 In the specific implementation method shown, when comparing the above-mentioned latest code file with the above-mentioned previous version of the code file, it is found that the code content of the fourth line of code in the latest code file has changed, then the fourth line of code is determined as the changed code line, and then, the first three lines of code and the last three lines of code of the fourth line of code can be determined as the context code lines of the fourth line of code, so that the final code difference file includes: the first line of code to the seventh line of code in the latest code file.

[0116] Among them, the embodiment of the present application does not limit the number of context code lines of the above-mentioned change code line. Specifically, the number of the above-mentioned context code lines can be fixed. For example, the above-mentioned context code lines can include 3 lines of code located before the change code line and continuous with the change code line, and 3 lines of code located after the change code line and continuous with the change code line, then the number of the above-mentioned context code lines is 6 lines; of course, the number of the above-mentioned context code lines can also be non-fixed, which can change according to the different positions of the change code line in the code file where it is located. For example, the above-mentioned change code line is the second line of code in the code file where it is located, then the above-mentioned context code line can include the previous line of code of the above-mentioned change code line, and 3 lines of code located after the above-mentioned change code line and continuous with the above-mentioned change code line, then the number of the above-mentioned context code lines is 4 lines.

[0117] Optional, in the above Figure 2In the specific implementation shown, as mentioned above, GibLab can be used to obtain the latest code file and the original code file. Similarly, after calling the above-mentioned GitLab API to obtain the latest code file and the previous version of the code file of the code to be reviewed, GibLab can continue to be used to compare the latest code file and the previous version of the code file to obtain the above-mentioned changed code lines, and the context code lines of the changed code lines. Among them, usually, the number of context code lines of the changed code lines obtained by GibLab is fixed, that is, the context code lines of the changed code lines obtained by GibLab can include: a specified number of code lines located before the changed code line and continuous with the changed code line, and a specified number of code lines located after the changed code line and continuous with the changed code line. For example, the above-mentioned specified number is 3, etc.

[0118] Optional, in the above Figure 2 In the specific implementation shown, Python's standard difflib (code difference library) or other open source diff (code difference) libraries can be used to compare the latest code file and the previous version of the code file to obtain the changed code lines and the context code lines of the changed code lines. Among them, using the above standard difflib or other open source diff libraries, a detailed comparison of the above latest code file and the previous version of the code file can be achieved.

[0119] Based on this, optionally, the context code of the above-mentioned change code line includes: a specified number of code lines located before the change code line and continuous with the change code line, and a specified number of code lines located after the change code line and continuous with the change code line. For example, the above-mentioned specified number can be 3, and the context code includes: 3 lines of code located before the change code line and continuous with the change code line, and 3 lines of code located after the change code line and continuous with the change code line, that is, the above-mentioned context code line includes the first three lines of code and the last three lines of code of the change code line.

[0120] S102: Construct input prompt information for code review including a code difference file.

[0121] After obtaining the above code difference file, input prompt information (Prompt) for code review including the above code difference file can be constructed. The input prompt information will be input into the large language model so that the large language model can perform inference learning on the input prompt information to obtain the code review result.

[0122] That is to say, when using a large language model for code review, the input prompt information input into the large language model includes at least: the above-mentioned code difference file, and since the above-mentioned code difference file includes the changed code lines in the selected version file whose code content has changed, and the context code lines of the changed code lines, therefore, the above-mentioned input prompt information input into the large language model includes at least the specific content of the code lines in the above-mentioned selected version file whose code content has changed compared to the above-mentioned target historical version file.

[0123] Optionally, the code difference file may be directly determined as the input prompt information.

[0124] In order to improve the richness of the above-mentioned input prompt information and to improve the accuracy of the final code review result, other information related to the above-mentioned code difference file may also be determined, so as to construct input prompt information with richer content by combining the above-mentioned code difference file and the above-mentioned other information.

[0125] For example, in some cases, in order to improve the readability of the written code, code comments can be added to the code file. Therefore, when the above-mentioned code difference file is obtained, the code comments of the changed code lines and context code lines in the above-mentioned code difference file can be further obtained, thereby constructing input prompt information including the above-mentioned code difference file and the above-mentioned code comments.

[0126] Based on this, optionally, in a specific implementation, such as Figure 3 As shown, the above step S102 may include the following steps S1021-S1022.

[0127] S1021: Determine additional information for describing the code content of the code difference file.

[0128] The attachment information includes: description information of the code difference file and domain knowledge information.

[0129] S1022: Construct input prompt information for code review including the code difference file and additional information.

[0130] In this specific implementation, after obtaining the above-mentioned code difference file, since the above-mentioned code difference file includes the changed code lines and the upper and lower code lines of the changed code lines, the code difference file includes code content, and then the additional information used to explain the code content included in the code difference file can be further determined, wherein the above-mentioned additional information can include the description information and domain knowledge information of the code difference file. The so-called description information of the code difference file is used to describe the code content of the code difference file in a specific dimension, for example, to describe the algorithmic logical relationship between the lines of code included in the code difference file, and for example, natural language description information used to explain the changes in the code content of the changed code lines included in the code difference file. The so-called domain knowledge information of the code difference file is used to characterize the relevant code information of the specific field corresponding to the code content of the code difference file. In this way, the determined attachment information can be used as part of the input prompt information, thereby constructing input prompt information for code review including the code difference file and the attachment information.

[0131] Optionally, in a specific implementation, such as Figure 4 As shown, the above step S1021 may include the following steps S1021A-S1021C.

[0132] S1021A: Obtain natural language description information of the code difference file.

[0133] The natural language description information is used to explain the changes in the code content of the changed code lines.

[0134] S1021B: Using natural language description information as query keywords, searching for target code cases including the query keywords in a preset knowledge base, and using the target code cases, as well as target code problems and target code solutions corresponding to the target code cases in the knowledge base, as domain knowledge information of the code difference file.

[0135] The knowledge base includes: the correspondence between code problems, code solutions and code cases.

[0136] S1021C: Determine the natural language description information and the domain knowledge information as additional information for describing the code content of the code difference file.

[0137] In this specific implementation, after obtaining the above-mentioned code difference file, additional information for describing the code content of the code difference file can be further determined. Among them, the natural language description information of the above-mentioned code difference file can be first obtained, wherein the above-mentioned natural language description information is used to describe the code content change of the changed code line, that is, the above-mentioned natural language description information is information used to describe the code content change of the above-mentioned latest code file compared with the above-mentioned original code file.

[0138] Among them, optionally, in a specific implementation method, the above step S1021A may include the following step 1.

[0139] Step 1: Input the code difference file into the large language model, and obtain the natural language description information generated by the large language model based on the code difference file.

[0140] In this specific implementation, the API of the large language model may be called to input the above code difference file into the large language model to obtain natural language description information of the code difference file generated by the large language model based on the code difference file.

[0141] In addition, during the software development process, for each field, common potential problems, solutions, and best practice cases in the field can be collected during the code writing process. Therefore, a knowledge base for a specific field can be created in advance and regularly maintained, and the knowledge base includes the corresponding relationship between field-specific code problems, code solutions, and code cases. In this way, after obtaining the natural language description information of the above-mentioned code difference file, the above-mentioned natural language description information can be used as a query keyword to search for a code case including the above-mentioned query keyword, that is, including the above-mentioned natural language description information, in the preset knowledge base as a target code case, and then, the corresponding relationship including the above-mentioned target code case in the above-mentioned knowledge base can be determined, and the code problem and code solution corresponding to the above-mentioned target code case included in the above-mentioned correspondence relationship can be obtained, respectively as the target code problem and the target code solution. In this way, the above-mentioned target code case, the target code problem, and the target code solution can be used as the domain knowledge information of the above-mentioned code difference file. At this point, the above-mentioned natural language description information and domain knowledge information obtained can be determined as additional information for explaining the code content of the code difference file.

[0142] Based on this, after obtaining the above-mentioned natural language description information and domain knowledge information as additional information, the above-mentioned code difference file, natural language description information and domain knowledge information can be integrated to generate a structured input prompt information (Prompt) for code review, that is, construct input prompt information for code review including code difference file, natural language description information and domain knowledge information. Therefore, the above-mentioned input prompt information includes: detailed code change description (natural language description information), relevant domain knowledge (domain indication information) and specific difference details (code difference file).

[0143] S103: Input the input prompt information into the large language model, and obtain the code review result generated by the large language model based on the input prompt information.

[0144] The code review result is information used to indicate whether the changed code line has passed the review.

[0145] After obtaining the above input prompt information, the above input prompt information can be used to call the inference service of the large language model to obtain the code review result generated by the large language model. That is to say, after obtaining the above input prompt information, the above input prompt information is input into the large language model so that the above large language model infers the above input prompt information and generates the code review result. In this way, the code review result generated by the large language model based on the above input prompt information can be obtained.

[0146] Usually, when updating a code file, the code content of the updated code line often meets the requirements of meeting the preset code specifications and / or code standards, not containing code bugs, etc. Therefore, when the above-mentioned large language model performs code review based on the above-mentioned input prompt information, the purpose of the review is to review whether the code content of the above-mentioned changed code line meets the code writing requirements, for example, whether it meets the preset code specifications and / or code standards, whether it does not contain code bugs, etc., and then obtain a review result on whether the above-mentioned changed code line passes the review. Based on this, the code review result generated by the above-mentioned large language model based on the above-mentioned input prompt information is: information used to characterize whether the changed code line passes the review.

[0147] Among them, when the above code review result indicates that the changed code line has passed the review, it means that the code content of the changed code line meets the code writing requirements; on the contrary, when the above code review result indicates that the changed code line has not passed the review, it means that the code content of the changed code line does not meet the code writing requirements and needs to be further updated. In addition, when there are multiple changed code lines, the above code review result indicates that the changed code line has passed the review, which means that the code content of all changed code lines meets the code writing requirements; on the contrary, when there are multiple changed code lines, the above code review result indicates that the changed code line has not passed the review, which means that there are one or more changed code lines that do not meet the code writing requirements, and the above code review result may include identification information of the changed code lines that do not meet the code writing requirements, such as line numbers.

[0148] Optionally, when the above-mentioned code review result indicates that the changed code line failed the review, the above-mentioned code review result may include: prompt information used to characterize the failure to pass the review, identification information of the changed code line that failed the review, code problems existing in the above-mentioned changed code line that failed the review, and the update method of the above-mentioned changed code line that failed the review.

[0149] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, a large language model can be used for code review. Among them, the code is deeply parsed through a large language model to automatically identify potential problems, syntax errors and performance bottlenecks in the code, and based on pre-set code specifications and standards, it is automatically detected whether the code meets the specifications to avoid the interference of human subjective consciousness. In other words, the solution provided by the embodiment of the present invention has multiple core functions including automatic code analysis and standardized review. Based on this, the embodiment of the present invention provides a more intelligent, efficient and standardized solution. By applying advanced natural language processing and machine learning technologies, code review can be automatically and efficiently performed, manual operations can be reduced, and the efficiency of code review can be improved. In addition, the solution can perform comprehensive semantic analysis and logical verification of the code, identify potential defects and irregularities, and at the same time ensure the consistency and standardization of the review process, greatly reduce the time and energy investment in manual review, and improve the overall development efficiency and code quality.

[0150] Optionally, in a specific implementation, a code review method provided by an embodiment of the present invention may further include the following step 104.

[0151] Step 104: Output the code review result.

[0152] In this specific implementation, after obtaining the above code review results, the above code review results can be sent to various messaging tools such as GitLab to notify developers and reviewers to view, review, and provide feedback on the above code review results. For example, the above code review results can be added as comments to the Merge Request Event submitted by the above developer through the GitLab API to ensure that all members of the development team can view and discuss the above code review results. For another example, the webhook or API of various messaging tools can be used to push the above code review results to the development team's instant messaging group.

[0153] Optionally, when the above code review result indicates that the changed code line has passed the review, the GitLab API can be called to perform an approval operation, that is, the final decision on this Merge Request Event is determined to be approved through the above GitLab API, thereby eliminating the process of determining the above decision as passed through manual operation.

[0154] As mentioned above, after the output of the above-mentioned code review results, the developer can receive the output notification of the above-mentioned code review results, thereby, the above-mentioned code review results can be viewed, for example, on an instant messaging tool or GitLab. Furthermore, the developer can manually review the above-mentioned code review results and provide manual feedback information of the manual review. In this way, the server can collect the manual feedback information of the developer and store the above-mentioned manual feedback information in a storage device such as a database or a cloud storage space. Furthermore, the large language model can learn the manual feedback information of the above-mentioned developer on the code review results, thereby improving the accuracy of its own code review.

[0155] Based on this, optionally, in a specific implementation, such as Figure 5 As shown, a code review method provided by an embodiment of the present invention may further include the following step S105.

[0156] S105: Construct a question pair including the code review result and manual feedback information for the code review result, and input the question pair into the large language model so that the large language model learns the question pair.

[0157] In this specific implementation, based on the Cot (Chain-of-Thought) idea, after receiving the manual feedback information from the developer regarding the above code review results, the above code review results and the above feedback information can be integrated to construct a question pair including the above code review results and the above feedback information. Usually, the question pair is provided in a question-and-answer format, in which Q (Question) and A (Answer) appear in pairs. As an example, the following is a specific implementation example of a constructed question pair,

[0158] Q: String s=null; System.out.println(s.toLowerCase());

[0159] A: There is a NPE problem here, s is null.

[0160] Q:List list=new ArrayList(); for(int i=0; i<1000; i++){new Thread(()->{try

[0161] {list.add(UUID.randomUUID().toString().substring(20)); System.out.println(list);}

[0162] catch(ConcurrentModificationException e)

[0163] {System.out.println(e.fillInStackTrace());}},String.valueOf(i)).start();};

[0164] A: There is a concurrent modification exception here - java.util.ConcurrentModifyException.

[0165] Then, the constructed question pairs can be input into the large language model as part of the input prompt information (prompt) of the large language model. In this way, the large language model can learn the relationship between the audit results obtained by itself in the above question pairs and the manual feedback information provided by the developer, and learn the audit method of the developer for manual audit, so as to make its own audit algorithm closer to the audit method of manual audit, thereby improving the accuracy of its own code audit.

[0166] Based on this, in this specific implementation, by outputting the above code review results, developers can be provided with detailed code review reports and optimization suggestions, thereby helping developers to quickly locate problems and make corresponding improvements. In addition, expert suggestions can be formed based on the continuously accumulated manual feedback information and fed back to the large language model in a timely manner, thereby improving the accuracy of the large language model in code review.

[0167] In order to facilitate understanding of a code review method provided in an embodiment of the present application, the following is a code review method provided in an embodiment of the present application. Figure 5 The specific example shown is used as an example. Figure 6 As shown, a code review method provided in an embodiment of the present application may include the following steps S601-S608.

[0168] S601: Obtain the latest code file of the code to be reviewed and the previous version of the code file of the latest code file;

[0169] S602: Compare the latest code file with the previous version of the code file to obtain a code difference file.

[0170] S603: Obtain natural language description information of the code difference file.

[0171] S604: Using the natural language description information as a query keyword, searching for a target code case including the query keyword in a preset knowledge base, and using the target code case, as well as the target code problem and target code solution corresponding to the target code case in the knowledge base as domain knowledge information of the code difference file.

[0172] S605: Construct input prompt information for code review including a code difference file, natural language description information, and domain knowledge information.

[0173] S606: Input the input prompt information into the large language model, and obtain the code review result generated by the large language model based on the input prompt information.

[0174] S607: Output code review results.

[0175] S608: Construct a question pair including the code review result and manual feedback information for the code review result, and input the question pair into the large language model so that the large language model learns the question pair.

[0176] and then, Figure 7 For the above Figure 6 A process architecture diagram of the code review method shown in FIG. Figure 7 As shown, in a specific implementation, when executing the above Figure 6When using the code review method shown in the figure, the server can be pre-configured with GitLab API, and Webhooks can be configured in the settings of the GitLab project, and the tool used to output the code review results can be Feishu Robot. Figure 7 As shown above Figure 6 The process architecture of the code review method shown includes the following steps 1-7.

[0177] Step 1: Webhook triggering: When a developer submits a Merge Request Event in GitLab, Webhooks are triggered to start the code review process.

[0178] Specifically, Figure 7 As shown, the above link 1 includes Figure 7 The following are: 1. Submit MG (Merge Request Event), 2. GitLab, 3. Webhooks, and 4. Connect to GitLab to obtain MR submission information.

[0179] 1. Submit MG: The developer submits a Merge Request Event to GitLab, triggering a Webhooks event to start the code review process.

[0180] 2. GitLab: GitLab sends a Webhooks request to the Webhooks request receiving service.

[0181] 3. Webhooks: The Webhooks request receiving service parses the content of the Webhooks request sent by GitLab to obtain the Merge Request Event ID and related information.

[0182] 4. Connect to GitLab to obtain MR submission information: Call the GitLab API and obtain the latest code file and the previous version of the latest code file of the code to be reviewed through the above Merge Request EventID and related information.

[0183] Step 2: Obtaining and summarizing code differences: After receiving the Webhooks request, obtain the code difference (diff) of the MergeRequest Event through the GitLab API, and use the large language model to generate a summary description of the code changes (natural language description information).

[0184] Specifically, Figure 7 As shown, the above link 2 includes Figure 7 5.diff context completion and cleaning, and 6.diff code summary.

[0185] 5. Diff context completion and cleaning: As mentioned above, after receiving the above-mentioned Webhooks request, the latest code file and the previous version of the code file of the latest code file can be obtained. Then, by calling the GitLab API, GitLab is used to compare the latest code file obtained above with the previous version of the code file to obtain the changed code lines in the latest code file. Then, the changed code lines are context-completed to provide a more complete code block where the changed code lines are located. For example, through context completion, the code block where the changed code lines are located in the latest code file is obtained; and the code block obtained by context completion is cleaned to filter out irrelevant code in the above code block, such as commented out code, spaces, etc. At this point, a diff file is obtained.

[0186] 6.diff code summary: Using a large language model, that is Figure 7 The codeqwen1.5 in the codeqwen1.5 obtains the natural language description information of the diff file obtained above, and the above natural language description information can also be called a summary description of the code changes.

[0187] Step 3: Domain knowledge query: Use the generated summary description to query the knowledge base and obtain knowledge information in related fields through similarity search to enhance the intelligence level of the review.

[0188] Specifically, Figure 7 As shown, the above link 3 includes Figure 7 7. Similarity search process, 8. Knowledge base, and 9. Re-ranking and filtering.

[0189] 7. Similarity search: Using the summary description of the code changes generated above as the query keyword, using the similarity search method, in the knowledge base shown in 8, retrieve the target code cases including the summary description above, as well as the target code problems and target code solutions corresponding to the target code cases, as domain knowledge information (i.e., knowledge information in related fields).

[0190] 8. Knowledge base: includes the correspondence between code problems, code solutions and code cases.

[0191] 9. Re-ranking and filtering: The knowledge base retrieval process in 7 is retrieved through similar vectors, which may retrieve irrelevant data. Therefore, it is necessary to further filter the retrieval results in 7, that is, re-rank and filter the retrieval results in 7. The principle of re-ranking and filtering is: construct a prompt word from each retrieval result and the code summary in 6, and input the prompt word into the large language model, that is, Figure 7The rerank model in the algorithm is used to enable the large language model to perform relevance scoring, and then filter out the search results with relevance scores less than 0 to obtain the domain knowledge information that is ultimately used for subsequent AI-CR services.

[0192] In addition, if Figure 7 As shown, the above 7. Similarity search process may include Figure 7 Among them: 23.MG details, 24.Prompt, 25.LLM, 26.Generate summary, 27.embedding, and 28.Retrieval.

[0193] in:

[0194] 23.MG detailed information: includes the Merge Request Event ID and related information in 4 above, and the diff file in 5 above.

[0195] 24. Prompt: Generates input prompt information for a large language model including the above MG detailed information for generating a summary description.

[0196] 26. Generate summary: Input the Prompt in 24 into the LLM in 25, so that the LLM generates the summary description based on the received Prompt. The LLM in 25 and the LLM in 11 can be the same model or different models.

[0197] 27.embedding: Convert the summary description in 26 above into a vector.

[0198] 28. Retrieval: Use the vector obtained in 27 above to perform vector similarity retrieval on the knowledge base, thereby obtaining domain knowledge information.

[0199] Step 4: Generate Code Review Prompts: Integrate summary descriptions, domain knowledge, and code difference files to generate structured Code Review Prompts.

[0200] Specifically, Figure 7 As shown, the above link 4 includes Figure 7 10. Generate CR Prompt.

[0201] 10. Generate CR Prompt: Integrate the diff file in 5, the summary description (natural language description information) in 6, and the domain knowledge information in 9 to generate input prompt information (Prompt) for code review, which includes the above diff file, summary description, and domain knowledge information.

[0202] Step 5: Call the large language model for review: Use the organized prompt to call the large language model to generate detailed Code Review results.

[0203] Specifically, Figure 7 As shown, the above link 5 includes Figure 7 Among them: 11. LLM, and 12. CR results.

[0204] 11.LLM: Output the input prompt information (Prompt) in 10 above to LLM, that is, Figure 7 The codeqwen1.5 model in is used to obtain the code review result generated by LLM based on the above input prompt information, that is, the CR result in 12 is obtained.

[0205] Step 6: Result notification and feedback: Output the review results to the Merge Request comment area of ​​GitLab, and notify relevant developers and reviewers through Lark bots or other instant messaging tools.

[0206] Specifically, Figure 7 As shown, the above step 6 includes Figure 7 Among them: 13. Generate markdown format text, 14. aireview results, 15. GitLab API, 16. Add comments to execute approval, and 17. Feishu robot. Among them:

[0207] 13. Generate markdown format text: Convert the CR result output by the above LLM into markdown format text, and the result obtained is the CR result for output display for developers to see, which can also be called the ai (Artificial Intelligence) review result in 14. Markdown is a lightweight markup language that supports writing documents in an easy-to-read and easy-to-write plain text format, and then converts it into a valid XHTML (ExtensibleHyperText Markup Language) or HTML (Hyper Text MarkupLanguage) document.

[0208] 16. Add comments and execute approval: By calling the GitLab API in 15, the above ai review result can be added as a comment to the Merge Request Event submitted by the above developer to GitLab in 2, and pushed to the developer's instant messaging group through the Lark robot in 17. In addition, when the above ai review result indicates that the changed code line has passed the review, the GitLab API in 15 can continue to be called to execute the approval operation to determine that the final decision of this MergeRequest Event is approval.

[0209] Step 7: Use feedback mechanism to improve review accuracy: In the last step of the Code Review process, after outputting the results to the message tool, developers can evaluate and provide feedback on the review results. These feedbacks will be collected and stored as samples for subsequent model training to continuously improve the review capabilities of the large language model.

[0210] Specifically, Figure 7 As shown, the above link 7 includes Figure 7 Among them: 18. Feedback, 19. Manual review written to GitLab, 20. Feedback results written to the database, 21. Manual feedback results and 22. Expert advice. Among them:

[0211] 18.Feedback: As mentioned above, developers can view the above code review results, so that developers can manually review the above review results and provide manual feedback information, that is, manual review.

[0212] 19. Write manual review to GitLab: You can use the above 15. GitLab API and 16. Add comments to execute approval, and add the above manual review as a comment to the MergeRequest Event submitted by the above developer to GitLab in 2. In this way, you can build a question pair including the ai review results and manual review, and use the constructed question pairs to train the large language model to continuously improve the review capability of the large language model.

[0213] 20. Writing feedback results into a database: Writing the above manual review into a database to obtain the manual feedback results stored in 21.

[0214] 22. Expert advice: Generally, the manual feedback information from developers can be considered as high-quality review results. Therefore, the manual feedback results in 21 can be added to the database in 8 as expert advice, so that they can be used as reference examples for large language models during subsequent code reviews.

[0215] In summary, the code review method provided by the embodiment of the present invention can have the following technical effects:

[0216] 1. Improve code review efficiency by automating code review and quickly identifying problems.

[0217] The code review implementation scheme and device based on the Large Language Model (LLM) performs code review tasks through automated processes, greatly reducing the time and effort required for developers to manually review code. After each Merge Request is submitted, the system automatically obtains the code differences and generates corresponding review results, greatly improving the efficiency of code review. Through an efficient automated review mechanism, the system can scan and analyze a large amount of code in a short period of time, quickly identifying potential defects, performance issues, and non-compliant code segments. This rapid response capability helps the development team discover and fix problems in a timely manner, reducing the outflow of code bugs (faults).

[0218] 2. Improve code review quality by reducing human errors and in-depth semantic analysis.

[0219] Manual code review is easily affected by the reviewer's subjective factors and mental state, and may miss problems or produce inconsistent review results. Automated code review based on LLM can provide stable and consistent review standards, significantly reducing code quality problems caused by human errors. The large language model has powerful natural language processing and semantic understanding capabilities, and can perform in-depth analysis of code logic. It is not limited to syntax checking, but can also detect potential logical errors and performance bottlenecks. Compared with traditional code review tools, the code review method provided in the embodiment of the present invention provides a more comprehensive review perspective.

[0220] 3. Standardize the code review process through unified review standards and continuous optimization and improvement.

[0221] Through the preset knowledge base and domain knowledge, this solution can provide unified standards and specifications for code review, avoiding inconsistent review results due to different experiences and opinions of different reviewers. This standardized process helps to improve the readability and maintainability of the code. The code review method provided in the embodiment of the present invention supports the collection of manual review feedback and continuous optimization of large language models. Through the CoT mechanism, it can adapt to the changing needs and standards of the team. With the passage of time and the increase of manual suggestions, the system will become more and more intelligent and accurate, further improving the effect of code review.

[0222] 4. Enhance team collaboration and communication through real-time notifications, feedback and transparent review process.

[0223] By automatically feeding back code review results to GitLab and instant messaging tools (such as Lark, Slack, etc.), team members can obtain review results and improvement suggestions in real time, which promotes instant communication and collaboration between developers and reviewers and improves work efficiency. Review results are stored in the Merge Request comment area of ​​GitLab, and all team members can view and discuss them, which enhances the transparency and fairness of the review process and reduces internal conflicts within the team caused by inconsistent review standards.

[0224] 5. Reduce development costs by saving human resources and improving product quality.

[0225] Automated code review significantly reduces the time developers spend on code review, allowing them to focus more on core development tasks. According to estimates, automated code review solutions can save teams up to 80% of code review time, significantly reducing human resource costs. Efficient and accurate code review not only improves the quality of software products, but also reduces bugs and maintenance costs after release.

[0226] As mentioned above, when using Python's standard difflib or other open source diff libraries to compare the latest code file and the previous version of the latest code file, the number of context code lines of the changed code line is usually limited and fixed. For example, the three lines before and after the changed code line are used as the context code lines of the changed code line. Since the limited context code lines provide less information such as code background and code semantics, and the core of code review is to understand the logic and structure of the code, such limited context code lines have caused significant limitations on the large language model to parse and understand the semantics of code updates, affecting the accuracy and quality of code review.

[0227] Based on this, in an embodiment of the present invention, in order to improve the accuracy and reliability of code review based on LLM and improve the efficiency and quality of code review, more complete context code for changed code lines can be provided to help the large language model better understand the semantics of code updates in the latest code files.

[0228] Based on this, optionally, in a specific implementation, such as Figure 8 As shown, the above step S1012, comparing the selected version file with the previous version code file to obtain a code difference file, may include the following steps S1012A-S1012C.

[0229] S1012A: Compare the selected version file with the previous version code file to obtain the changed code lines in which the code content in the selected version file has changed.

[0230] S1012B: In the selected version file, find the code block where the changed code line is located.

[0231] S1012C: Generate a code difference file including code blocks.

[0232] In this specific implementation, in the above Figure 2 On the basis of the specific implementation method shown, when determining the code difference file based on the latest version file and the previous version of the code file of the latest version file, the changed code lines in the latest code file where the code content has changed can be obtained by first comparing the latest code file with the previous version of the code file of the latest version file.

[0233] Optionally, use Python's standard difflib or other open source diff libraries to compare the latest code file and the previous version of the latest code file to obtain code differences (diff), and generate a list of changed code lines to indicate which code lines in the latest code file have changed. The list of changed code lines can indicate the specific line numbers and contents of the code lines in the latest code file where the code content has changed, so as to accurately locate the code changes. In this way, with the help of the generated list of changed code lines, the changed code lines in the latest code file can be accurately located, and the comprehensiveness and accuracy of the capture of the context code lines of the changed code lines can be guaranteed.

[0234] After obtaining the above-mentioned changed code line, the code block where the changed code line is located can be searched in the latest code file. Among them, the changed code line can be used as the starting line, the starting position of the code block where the changed code line is located can be searched upward, and the end position of the code block where the changed code line is located can be searched downward to obtain the code block where the changed code line is located. In this way, the found code block can be packaged to generate a code file including the above-mentioned code block as a difference code file.

[0235] Among them, a code block can generally be understood as a combination of multiple continuous lines of code used to implement a complete function. The starting position of a code block is the starting line in the code block. Usually, the code content of the first line of a code block includes the method declaration, class definition, and other contents of the code block. Therefore, the sign of judging whether a code line is the starting position of a code block is whether the code line includes the definition keywords, class names, and other contents of a function or method. If included, the code line is the starting position of the code block, otherwise, the code line is not the starting position of the code block. Correspondingly, the ending position of a code block is the last line in the code block. Usually, the code content of the last line of a code block includes the closing braces of a method, the closing braces of a class, and other contents. Therefore, the sign of judging whether a code line is the ending position of a code block is whether the code line includes the closing braces, the terminator of a statement, and other contents. If included, the code line is the ending position of the code block, otherwise, the code line is not the ending position of the code block.

[0236] In this way, for the above-mentioned changed code line, you can start from the above-mentioned changed code line in the above-mentioned latest code file, traverse upward to find the starting position of the code block, and traverse downward to find the ending position of the code block. When the starting position and ending position of the code block are found, you can get a code block with the above-mentioned starting position as the starting line and the above-mentioned ending position as the ending line. This code block is the code block where the above-mentioned changed code line is located.

[0237] Among them, when comparing the latest code file with the previous version of the code file of the latest version file, the number of changed code lines obtained can be multiple. Then, for each changed code line, the code block where each changed code line is located can be found in the above-mentioned latest code file. Therefore, the obtained code difference file can include: the code block where each of the above-mentioned changed code lines is located.

[0238] Furthermore, in some cases, in the latest code file, there may be multiple changed code lines in the same code block. In this way, the complete context code in the latest code file can be found by recursive search. Specifically, for each changed code line, when the code block where the changed code line is located is obtained, if the above code block is the code block where other changed code lines have been obtained before, the code block determined this time is ignored, and only the previously obtained code block is retained, that is, for multiple changed code lines belonging to the same code block, only one code block is retained. In this way, recursive processing of each changed code line can ensure that the context code lines of the changed code line in all the code blocks where each changed code line is located are captured and completed.

[0239] As can be seen from the above, this specific implementation method proposes an implementation scheme for completing the context code lines of the changed code lines in the LLM-based code review, aiming to help the large language model understand the code more accurately by obtaining and completing more complete code line context information, thereby improving the effect of code review. In this way, more comprehensive code line context information can allow the large language model to have more knowledge references to more accurately generate code review results, improve the accuracy of code review results, and at the same time, further improve the instructions of the developed software products and reduce labor costs.

[0240] Furthermore, in some cases, the code block where the changed code line is located may reference code information such as methods or properties of other classes to implement its own functions, while the code block where the changed code line is located often does not record the explanation information of the above-referenced code information. Therefore, in order to further improve the accuracy and reliability of the code review method provided in the embodiment of the present invention in code review based on LLM, and improve the efficiency and quality of code review, after obtaining the code block where the changed code line is located, the explanation information of the code information referenced by the code block where the changed code line is located can be further searched for to generate a code difference file to enrich the content of the code difference file.

[0241] Based on this, optionally, in a specific implementation, such as Fig. 9 As shown, before the above step S1012C, generating a code difference file including code blocks, a code review method provided by an embodiment of the present invention may further include the following step S1012D.

[0242] S1012D: Search for explanation information of the code information referenced in the code block.

[0243] The code information includes: the method name of the class, and / or the attribute name of the class.

[0244] Correspondingly, in this specific implementation, the above step S1012C, generating a code difference file including code blocks, may include the following step S1012E.

[0245] S1012E: Generate a code difference file including the code block and the interpretation information by merging the code block and the interpretation information.

[0246] In this specific implementation, for the changed code line, after obtaining the code block where the changed code line is located, the code information such as methods or properties of other classes referenced in the code block can be determined, and the explanation information of the above-referenced code information can be found.

[0247] For example, the code block where the above-mentioned changed code line is located can reference methods and / or attributes of other classes, and the above-mentioned code block can record the method name of the referenced class and / or the attribute name of the class, and then determine the keywords and vectors in the above-mentioned method name and / or attribute name, so that, through keyword and vector query, the detailed explanation of the method name of the referenced class and / or the attribute name of the class is found in the preset knowledge base about the class. Among them, the so-called class is a concept in object-oriented programming language. Class is actually a prototype that defines variables and methods for a certain type of object. It represents the abstraction of a class of things with common characteristics in real life and is the basis of object-oriented programming. A class defines a group of objects. Classes have behaviors, which describe what an object can do and the methods (methods) of doing it. They are programs and processes that can operate on this object.

[0248] In this way, the above explanation information can be merged with the above code block, and a code difference file including the code block where the above changed code line is located and the explanation information of the code information referenced by the above code block can be generated through the above merger. Among them, the code block obtained by merging the above explanation information with the above code block can be called the complete code block of the changed code line, and can also be called the complete context of the changed code line.

[0249] That is to say, input prompt information for code review can be constructed based on the code difference file including the above-mentioned complete code block. Among them, the constructed input prompt information may include: the changed code line, the code block where the changed code line is located, and the explanation information of the code information referenced by the code block where the changed code line is located. Of course, in some cases, the constructed input prompt information may also include other additional information, such as the above-mentioned natural language description information, domain knowledge information, code comments of the code block where the changed code line is located, etc., and this embodiment of the present application does not make specific limitations on this.

[0250] In this way, the input prompt information constructed above is used to call the large language model for code review. Since the input prompt information output to the large language model is relatively complete and clear, the large language model can deeply parse and understand the code updates in the above latest code file.

[0251] in, Fig.10 For the above Fig. 9 The process architecture diagram of the specific implementation method shown in the figure is as follows. Fig.10 For example, for the above Fig. 9 The specific implementation process architecture shown in FIG. Fig.10 As shown above Fig. 9The process architecture of the specific implementation method shown includes the following steps S1001-S1004:

[0252] S1001: Get detailed information of the Merge Request Event submitted by GitLab. Specifically, by calling the GitLab API, with the help of Webhooks configured in the settings of the GitLab project, when the developer submits the Merge Request Event to GitLab, extract the detailed information of the Merge Request Event, such as the Merge Request Event ID and related information. Then, using the above detailed information, obtain the latest code file of the code to be reviewed and the previous version of the code file of the latest version file.

[0253] S1002: Get diff results. Specifically, compare the latest code file obtained above with the previous version of the code file of the latest version file to obtain the latest code line in the latest code file. Usually, the latest code file and the previous version of the code file obtained above include Source branch code files and Target branch code files. Therefore, when comparing the latest code file and the previous version of the code file, the Source branch code files of the latest code file and the previous version of the code file are compared, and the Target branch code files of the latest code file and the previous version of the code file are compared.

[0254] S1003: Completing the file internal context. Specifically, for each changed code line, in the above latest code file, start from the changed code line, search upward, and traverse the previous line of code of the current code line in sequence until the start mark of the method block is found; and in the above latest code file, start from the changed code line, search downward, and traverse the next line of code of the current code line in sequence until the end mark of the method block is found, and exit.

[0255] S1004: Searching for relevant knowledge. Specifically, vectorizing the method names and / or attribute names of other classes referenced in the code block where the changed code line is located, thereby performing a similar vector query in a preset knowledge base about the class to obtain the explanation information of the method names and / or attribute names of other classes referenced above, and the obtained explanation information can be called the relevant knowledge of the changed code line. The above knowledge base can be used to maintain the detailed description of the class.

[0256] At this point, after obtaining the above method block and finding related knowledge, the complete context of the changed code line can be obtained.

[0257] like Fig. 9 and Fig.10 As shown above Fig. 9 The core ideas of the specific implementation method shown include the following first to fourth aspects.

[0258] First: Get the original files. Get the latest code files and the previous version of the latest version of the files for detailed code comparison. For example, get the code files through GitLab.

[0259] Second aspect: Difference comparison. Compare the latest code file with the previous version of the latest version to find the specific code lines that have changed. For example, use Python's diff library for detailed comparison.

[0260] The third aspect: context completion. For each changed code line, find the start position of the code block (such as the method declaration) and find the end position of the code block (such as the closing brace of the method) backward. Recursively ensure that the complete context of the code block where all changed code lines are located is captured and completed, and then use similarity vector query technology to complete the description of the referenced class, thereby supplementing the context information of the code block where the changed code line is located.

[0261] Fourth aspect: Optimize prompts. The completed code block is used as input prompt information and provided to the large language model for comprehensive semantic analysis and intelligent review, thereby improving the accuracy and intelligence level of the large language model's code review.

[0262] Accordingly, based on the above core ideas, the above Fig. 9 and Fig.10 The specific implementation shown provides a more in-depth and comprehensive contextual completion mechanism, which is as follows:

[0263] Context integrity: Get the latest code file and the previous version of the latest code file; compare the latest code file and the previous version of the code file to locate the specific line numbers of the changed code lines in the latest code file.

[0264] Expand forward and backward: For each changed line of code, search forward to the beginning of the code block (such as method declaration) and backward to the end of the code block (such as method closing brace) to ensure the semantic context of the entire code.

[0265] Recursive processing: Recursively process nested code blocks to fully capture associated context information.

[0266] Knowledge base supplement: The methods or properties of other classes referenced are supplemented through the knowledge base.

[0267] This contextual completion mechanism ensures that the large language model can obtain sufficient code context to more accurately understand the semantics of code changes, thereby improving the accuracy and effectiveness of code review.

[0268] As can be seen above, applying the above Fig. 9 The specific implementation method shown not only obtains a wider range of code content for the changed code lines, but also processes and completes these contents appropriately, ensuring that the information input by the large language model is complete enough to support its deep analysis and intelligent review when conducting code review.

[0269] Specifically, apply the above Fig. 9 In the specific implementation method shown, rich context information can help the large language model understand the overall logic and structure of the code more accurately, thereby more effectively judging the significance, rationality and potential problems of code updates; sufficient context information can enable the large language model to fully obtain the complete semantics of the code, reduce the model's misjudgment and omissions, improve the accuracy and comprehensiveness of the code review results, and ensure the output of high-quality code review results; the automated context completion mechanism can reduce the burden of developers manually supplementing the context, making the code review process smoother and more efficient, and further improving development efficiency and productivity.

[0270] In the process of software development, it is often necessary to keep the written code confidential, and the API of the external model involves the security issues of the enterprise, especially for business code, which is not suitable for use on the openapi. Therefore, when conducting code review, it is often necessary to privatize the above-mentioned large language model to improve the confidentiality of the code review and, in turn, improve the security of the code. Furthermore, in order to obtain better code review results, a variety of large language models can be internally tested, and then, according to the test results of the internal test, a large language model suitable for the company's own business can be selected. As shown in Table 1 below, the internal test results of various large language models are shown, so the large language model can be selected according to the internal test results of Table 1 below.

[0271] Table 1

[0272]

[0273]

[0274] In Table 1 above, the project refers to various large language models; the prompt word is the input prompt information, i.e., Prompt, and "Submit message + summary + knowledge base" in Table 1 means: submitting input prompt information consisting of code difference files, natural language description information, and domain knowledge information, wherein message is the code difference file, summary is the natural language description information, and knowledge base is the domain knowledge information. In addition, OOM in Table 1 above is the abbreviation of Out Of Memory, and GPU is the abbreviation of Graphics Processing Unit.

[0275] Corresponding to the code review method provided by the above-mentioned embodiment of the present invention, the embodiment of the present invention also provides a code review device.

[0276] Fig.11 A schematic diagram of the structure of a code review device provided by an embodiment of the present invention is shown in FIG. Fig.11 As shown, the device may include the following modules:

[0277] The file acquisition module 1110 is used to determine a code difference file based on a selected version file of the code to be reviewed and any historical version file of the selected version; wherein the code difference file includes: a changed code line in which the code content in the latest code file has changed, and a context code line of the changed code line;

[0278] An information construction module 1120, used to construct input prompt information for code review including the code difference file;

[0279] The code review module 1130 is used to input the input prompt information into the large language model and obtain the code review result generated by the large language model based on the input prompt information; wherein the code review result is information used to characterize whether the changed code line has passed the review.

[0280] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, a large language model can be used for code review. Among them, the code is deeply parsed through a large language model to automatically identify potential problems, syntax errors and performance bottlenecks in the code, and based on pre-set code specifications and standards, it is automatically detected whether the code meets the specifications to avoid the interference of human subjective consciousness. In other words, the solution provided by the embodiment of the present invention has multiple core functions including automatic code analysis and standardized review. Based on this, the embodiment of the present invention provides a more intelligent, efficient and standardized solution. By applying advanced natural language processing and machine learning technologies, code review can be automatically and efficiently performed, manual operations can be reduced, and the efficiency of code review can be improved. In addition, the solution can perform comprehensive semantic analysis and logical verification of the code, identify potential defects and irregularities, and at the same time ensure the consistency and standardization of the review process, greatly reduce the time and energy investment in manual review, and improve the overall development efficiency and code quality.

[0281] Optionally, in a specific implementation, the file acquisition module 1110 includes:

[0282] A file acquisition submodule is used to acquire the latest code file of the code to be reviewed as the selected version file, and acquire the previous version code file of the latest code file;

[0283] The file comparison submodule is used to compare the selected version file with the previous version code file to obtain a code difference file.

[0284] Optionally, in a specific implementation, the information construction module 1120 includes:

[0285] An information determination submodule, used to determine additional information for describing the code content of the code difference file; wherein the natural language description information is used to describe the change in the code content of the changed code line;

[0286] The information construction submodule is used to construct input prompt information for code review including the code difference file and the attachment information.

[0287] Optionally, in a specific implementation, the information determination submodule includes:

[0288] An information acquisition unit, used to acquire natural language description information of the code difference file; wherein the natural language description information is used to describe the code content change of the changed code line;

[0289] An information search unit is used to use the natural language description information as a query keyword to search for a target code case including the query keyword in a preset knowledge base, and use the target code case, and the target code problem and target code solution corresponding to the target code case in the knowledge base as the domain knowledge information of the code difference file; wherein the knowledge base includes: a correspondence between code problems, code solutions and code cases;

[0290] The information determination unit is used to determine the natural language description information and the domain knowledge information as additional information for describing the code content of the code difference file.

[0291] Optionally, in a specific implementation, the information acquisition unit is specifically used to:

[0292] The code difference file is input into the large language model, and natural language description information generated by the large language model based on the code difference file is obtained.

[0293] Optionally, in a specific implementation, the context code includes: a specified number of code lines located before the changed code line and continuous with the changed code line, and the specified number of code lines located after the changed code line and continuous with the changed code line.

[0294] Optionally, in a specific implementation, the file comparison submodule includes:

[0295] A file comparison unit, used for comparing the selected version file with the previous version code file, to obtain changed code lines in which the code content in the selected version file has changed;

[0296] A code search unit, used for searching the code block where the changed code line is located in the latest code file;

[0297] The file generating unit is used to generate a differential code file including the code block.

[0298] Optionally, in a specific implementation, the file comparison submodule further includes:

[0299] An information search unit, used for searching for interpretation information of code information referenced in the code block before generating a differential code file including the code block; wherein the code information includes: a device name of a class, and / or an attribute name of a class;

[0300] The file generating unit is specifically configured to generate a code difference file including the code block and the interpretation information by merging the code block and the interpretation information.

[0301] Optionally, in a specific implementation, the device further includes:

[0302] A model updating module is used to construct a question pair including the code review result and manual feedback information for the code review result, and input the question pair into the large language model so that the large language model learns the question pair.

[0303] The embodiment of the present invention further provides an electronic device, such as Fig.12 As shown, it includes a processor 1201, a communication interface 1202, a memory 1203 and a communication bus 1204, wherein the processor 1201, the communication interface 1202, and the memory 1203 communicate with each other through the communication bus 1204.

[0304] Memory 1203, used for storing computer programs;

[0305] The processor 1201 is used to implement the steps of any code review method provided by the above-mentioned embodiment of the present invention when executing the program stored in the memory 1203.

[0306] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0307] The communication interface is used for communication between the above terminal and other devices.

[0308] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0309] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0310] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the code review method described in any one of the above embodiments is implemented.

[0311] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the code review method described in any one of the above embodiments.

[0312] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0313] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0314] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, electronic device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0315] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A code review method, characterized in that: The method comprises: Determine a code difference file based on a selected version file of the code to be reviewed and any historical version file of the selected version; wherein the code difference file includes: a changed code line in which the code content in the selected version file is changed, and a context code line of the changed code line; Constructing input prompt information for code review including the code difference file; The input prompt information is input into a large language model, and a code review result generated by the large language model based on the input prompt information is obtained; wherein the code review result is information used to characterize whether the changed code line has passed the review.

2. The method according to claim 1, characterized in that The determining of the code difference file based on the selected version file of the code to be reviewed and any historical version file of the selected version includes: Obtain the latest code file of the code to be reviewed as the selected version file, and obtain the previous version code file of the latest code file; The selected version file is compared with the previous version code file to obtain a code difference file.

3. The method according to claim 1 or 2, characterized in that: The building includes input prompt information for code review of the code difference file, including: Determine additional information for describing the code content of the code difference file; wherein the additional information includes: description information and domain knowledge information of the code difference file; Input prompt information for code review including the code difference file and the attachment information is constructed.

4. The method according to claim 3, characterized in that The determining of the additional information for describing the code content of the code difference file includes: Obtaining natural language description information of the code difference file; wherein the natural language description information is used to describe the change in the code content of the changed code line; Using the natural language description information as a query keyword, searching for a target code case including the query keyword in a preset knowledge base, and using the target code case, and the target code problem and target code solution corresponding to the target code case in the knowledge base as the domain knowledge information of the code difference file; wherein the knowledge base includes: a correspondence between code problems, code solutions and code cases; The natural language description information and the domain knowledge information are determined as additional information for describing the code content of the code difference file.

5. The method according to claim 4, characterized in that The obtaining of natural language description information of the code difference file includes: The code difference file is input into the large language model, and natural language description information generated by the large language model based on the code difference file is obtained.

6. The method according to claim 4 or 5, characterized in that: The context code includes: a specified number of code lines located before the changed code line and continuous with the changed code line, and the specified number of code lines located after the changed code line and continuous with the changed code line.

7. The method according to claim 2, characterized in that The comparing the selected version file with the previous version code file to obtain a code difference file includes: Comparing the selected version file with the previous version code file to obtain changed code lines in which code content in the selected version file has changed; In the selected version file, searching for the code block where the changed code line is located; A differential code file including the code block is generated.

8. The method according to claim 7, characterized in that Before generating the differential code file including the code block, the method further includes: Searching for explanation information of code information referenced in the code block; wherein the code information includes: a method name of a class, and / or an attribute name of a class; The generating of a differential code file including the code block comprises: By merging the code block and the interpretation information, a code difference file including the code block and the interpretation information is generated.

9. The method according to claim 1, characterized in that: The method further comprises: A question pair including the code review result and manual feedback information for the code review result is constructed, and the question pair is input into the large language model so that the large language model learns the question pair.

10. A code review device, characterized in that: The device comprises: A file acquisition module is used to determine a code difference file based on a selected version file of the code to be reviewed and any historical version file of the selected version; wherein the code difference file includes: a changed code line in which the code content in the latest code file has changed, and a context code line of the changed code line; An information construction module, used to construct input prompt information for code review including the code difference file; A code review module is used to input the input prompt information into a large language model and obtain a code review result generated by the large language model based on the input prompt information; wherein the code review result is information used to characterize whether the changed code line has passed the review.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 9 when executing a program stored in a memory.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 9 are implemented.

Citation Information

Cited By

  • Multi-modal document information processing method, device and equipment based on large model agent and storage medium

    CN119623650A

  • Code review method based on large language model and related equipment

    CN119883358A