Code processing method and code repair testing method

By automating the code repair process through code knowledge graphs and processing models, the problem of low efficiency in traditional manual repair is solved, achieving efficient and accurate code repair and maintenance, and improving software development efficiency and quality.

WO2026051572A1PCT designated stage Publication Date: 2026-03-12ALIBABA (CHINA) CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-07-04
Publication Date
2026-03-12

AI Technical Summary

Technical Problem

In traditional software development, code defect identification and repair rely on manual operation, which leads to low efficiency and consumes a lot of time and human resources.

Method used

The code repair process is automated by using code knowledge graphs and code processing models, including problem understanding, bug location, code analysis and repair, and verification. Initial repair code is obtained by inputting code problems and problematic code into the code processing model, and test code is used to test the repair code to ensure its correctness.

Benefits of technology

It significantly improves software development and maintenance efficiency, reduces code maintenance costs, enhances code fix quality and product iteration speed, and achieves end-to-end automated bug fixing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025107212_12032026_PF_FP_ABST
    Figure CN2025107212_12032026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a code processing method and a code repair testing method. The code processing method comprises: acquiring a code issue of a target project; determining a problematic code of the target project on the basis of the code issue and a code knowledge graph of the target project; inputting the code issue and the problematic code into a code processing model to obtain an initial repaired code; and testing the initial repaired code by using a test code, and when the test is passed, obtaining a target repaired code for the code issue. By determining the problematic code by means of the code knowledge graph, the structure and dependency relationships of codes of the target project are better understood, thereby improving the accuracy of the problematic code; using the code processing model for automated code repair enables efficient code processing; and using the test code to test the initial repaired code ensures the correctness of the target repaired code, reduces code maintenance costs, and enhances code processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Code processing method and code repair testing method TECHNICAL FIELD

[0001] Embodiments of the present disclosure relate to the technical field of computer, and particularly, to a code processing method and a code repair testing method. BACKGROUND

[0002] In a traditional software development process, code writing is one of the core parts of the whole process. The code written may include some abnormal problems (bugs), and these errors or incorrect implementations can be referred to as code problems, code errors or code defects. Code defects can cause the program to not run as expected, therefore, how to process the code has gradually become a research focus.

[0003] At present, code defects are usually identified from the written code manually by human beings, and the identified code defects are repaired by using prior knowledge. However, manual code defect identification and code defect repair by human beings need to consume a large amount of time and human resources, which leads to extremely low code processing efficiency, therefore, an efficient code processing scheme is urgently needed. SUMMARY

[0004] Therefore, the embodiments of the present disclosure provide a code processing method. One or more embodiments of the present disclosure also relate to a code repair testing method, a code processing device, a code repair testing device, a task platform, a code processing system, a computing device, a computer-readable storage medium and a computer program product, to solve the technical defects in the prior art.

[0005] According to a first aspect of the embodiments of the present disclosure, a code processing method is provided, comprising:

[0006] obtaining a code problem of a target project;

[0007] determining a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent a code context relationship and a code reference relationship of the target project;

[0008] inputting the code problem and the problem code into a code processing model to obtain an initial repair code;

[0009] testing the initial repair code by using a test code, and obtaining a target repair code of the code problem in the case of passing the test, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0010] According to a second aspect of the embodiments of the present disclosure, a code repair testing method is provided, comprising:

[0011] acquire a code problem of a target project and initial repair code, wherein the initial repair code is obtained by a code processing model based on the code problem and problem code, the problem code is obtained based on the code problem and a code knowledge graph of the target project, and the code knowledge graph is used to represent code context relationships and code reference relationships of the target project;

[0012] test the initial repair code by using test code, and obtain target repair code of the code problem in a case where the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0013] According to a third aspect of the embodiments of the present disclosure, a code processing method applied to a task platform is provided, including:

[0014] receiving a code problem of a target project sent by a client;

[0015] determining problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent code context relationships and code reference relationships of the target project;

[0016] inputting the code problem and the problem code into a code processing model to obtain initial repair code;

[0017] testing the initial repair code by using test code, and obtaining target repair code of the code problem in a case where the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0018] According to a fourth aspect of the embodiments of the present disclosure, a task platform is provided, including a request interface and a response unit;

[0019] the request interface is used to receive a code problem of a target project sent by a client;

[0020] the response unit is used to determine problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent code context relationships and code reference relationships of the target project; input the code problem and the problem code into a code processing model to obtain initial repair code; and test the initial repair code by using test code, and obtain target repair code of the code problem in a case where the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0021] According to a fifth aspect of the embodiments of the present disclosure, a code processing system is provided, including a client and a server;

[0022] the client is used to send a code problem of a target project to the server;

[0023] The server is configured to determine problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent code context relationship and code reference relationship of the target project; input the code problem and the problem code into a code processing model to obtain initial repair code; test the initial repair code by using test code, and obtain target repair code of the code problem in the case that the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem; and send the target repair code of the code problem to the client.

[0024] The client is further configured to receive the target repair code of the code problem sent by the server.

[0025] According to a sixth aspect of the embodiments of the present disclosure, a code processing apparatus is provided, comprising:

[0026] The first obtaining module is configured to obtain a code problem of a target project.

[0027] The first determining module is configured to determine problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent code context relationship and code reference relationship of the target project.

[0028] The first input module is configured to input the code problem and the problem code into a code processing model to obtain initial repair code.

[0029] The first testing module is configured to test the initial repair code by using test code, and obtain target repair code of the code problem in the case that the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0030] According to a seventh aspect of the embodiments of the present disclosure, a code repair testing apparatus is provided, comprising:

[0031] The second obtaining module is configured to obtain a code problem of a target project and initial repair code, wherein the initial repair code is obtained based on the code problem and problem code by a code processing model, the problem code is obtained based on the code problem and a code knowledge graph of the target project, and the code knowledge graph is used to represent code context relationship and code reference relationship of the target project.

[0032] The second testing module is configured to test the initial repair code by using test code, and obtain target repair code of the code problem in the case that the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0033] According to an eighth aspect of the embodiments of the present disclosure, a code processing apparatus applied to a task platform is provided, comprising:

[0034] The receiving module is configured to receive a code problem of a target project sent by a client;

[0035] The second determining module is configured to determine a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent a code context relationship and a code reference relationship of the target project;

[0036] The second input module is configured to input the code problem and the problem code into a code processing model to obtain an initial repair code;

[0037] The third testing module is configured to test the initial repair code by using a test code, and obtain a target repair code of the code problem in a case that the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0038] According to a ninth aspect of the embodiments of the present disclosure, a computing device is provided, comprising:

[0039] a memory and a processor;

[0040] The memory is configured to store computer programs / instructions, and the processor is configured to execute the computer programs / instructions, and the computer programs / instructions, when executed by the processor, implement the steps of the method provided in the first aspect or the second aspect or the third aspect.

[0041] According to a tenth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, which stores computer programs / instructions, and the computer programs / instructions, when executed by the processor, implement the steps of the method provided in the first aspect or the second aspect or the third aspect.

[0042] According to an eleventh aspect of the embodiments of the present disclosure, a computer program product is provided, which comprises computer programs / instructions, and the computer programs / instructions, when executed by the processor, implement the steps of the method provided in the first aspect or the second aspect or the third aspect.

[0043] The code processing method provided by one embodiment of the present disclosure comprises: obtaining a code problem of a target project; determining a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent the code context relationship and the code reference relationship of the target project; inputting the code problem and the problem code into a code processing model to obtain an initial repair code; and testing the initial repair code by using test code to obtain a target repair code of the code problem in the case that the test is passed, wherein the test code is obtained based on the code problem and is used to reproduce the code problem. The problem code is determined by using the code knowledge graph, so that the structure and the dependency relationship of the code of the target project can be better understood, the accuracy of the problem code is improved, the code is automatically repaired by using the code processing model, the code is efficiently processed, the test code is used to test the initial repair code, the code problem in the target repair code is avoided, the correctness of the target repair code is ensured, the code maintenance cost is reduced, and the code processing efficiency is further improved. BRIEF DESCRIPTION OF DRAWINGS

[0044] FIG. 1 is an architecture diagram of a code processing system according to one embodiment of the present disclosure;

[0045] FIG. 2 is an architecture diagram of another code processing system according to one embodiment of the present disclosure;

[0046] FIG. 3 is a flowchart of a code processing method according to one embodiment of the present disclosure;

[0047] FIG. 4 is a flowchart of a processing process of a code processing method according to one embodiment of the present disclosure;

[0048] FIG. 5 is a flowchart of a code repair testing method according to one embodiment of the present disclosure;

[0049] FIG. 6 is a flowchart of another code processing method according to one embodiment of the present disclosure;

[0050] FIG. 7 is a structural schematic diagram of a task platform according to one embodiment of the present disclosure;

[0051] FIG. 8 is a structural schematic diagram of a code processing apparatus according to one embodiment of the present disclosure;

[0052] FIG. 9 is a structural schematic diagram of a code repair testing apparatus according to one embodiment of the present disclosure;

[0053] FIG. 10 is a structural schematic diagram of another code processing apparatus according to one embodiment of the present disclosure;

[0054] FIG. 11 is a structural block diagram of a computing device according to one embodiment of the present disclosure. DETAILED DESCRIPTION

[0055] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure. However, the present disclosure can be practiced without the specific details described herein. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to unnecessarily obscure aspects of the present disclosure.

[0056] The terminology used in this disclosure, including the specific embodiments described herein, is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the disclosure. As used in one or more embodiments of the present disclosure and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present disclosure, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0057] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used only to distinguish one from another. For example, without departing from the scope of one or more embodiments of the present disclosure, first can be termed second, and similarly, second can be termed first. The word "if' as used herein means "when" or "upon" or "in response to a determination" depending on the context.

[0058] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0059] In one or more embodiments of the present disclosure, a large model refers to a deep learning model with a large number of model parameters, usually containing hundreds of millions, tens of billions, hundreds of billions, tens of billions or even more than one hundred billion model parameters. The large model can also be called a foundation model. Through large-scale unlabeled corpus pre-training, a pre-training model with hundreds of millions of parameters is output. Such a model can adapt to a wide range of downstream tasks, and the model has good generalization ability. For example, large language models (LLM, Large Language Model), multi-modal pre-training models, etc.

[0060] Large models can be widely applied in natural language processing (NLP) and computer vision fields, and can be applied to tasks such as visual question answering (VQA), image captioning (IC), image generation, sentiment classification based on text, text summary generation, machine translation, and other natural language processing tasks. The main application scenarios of large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.

[0061] First, the technical terms related to one or more embodiments of the present disclosure are explained.

[0062] Automating Software Engineering (ASE): refers to the use of artificial intelligence technology to automate software development and maintenance processes.

[0063] Multi-Agent: refers to a system that uses multiple cooperating agents (artificial intelligence agents) to achieve a specific goal.

[0064] Software Engineering Benchmark (SWE-bench): refers to a benchmark test set for evaluating the performance of an automated software engineering system.

[0065] Monte Carlo Tree Search (MCTS): is a probabilistic algorithm for decision-making and planning, suitable for environments with very large search spaces or uncertainties, such as chess games (e.g. Go, chess, etc.), decision-making problems, etc.

[0066] Retrieval-Augmented Generation (RAG): is an artificial intelligence technology that combines information retrieval and language generation.

[0067] Spectrum-Based Fault Localization (SBFL): is a technique in software engineering that helps developers quickly locate bugs in code.

[0068] ReAct (Reason and Act) mechanism: a method used in artificial intelligence for decision-making and reasoning. The core idea of this mechanism is to divide the decision-making process into two main stages: reasoning and action.

[0069] In the traditional software development process, due to the complexity of the code, manual bug identification of local code ignores the structure and dependency of the code, resulting in poor bug identification accuracy. Further manual repair of bugs with poor accuracy requires a large amount of time and human resources. This mode is inefficient in a fast iteration software development environment. With the development of artificial intelligence technology, especially the breakthrough of large models in code understanding and generation, it provides a new possibility to solve this problem.

[0070] The embodiments of the present disclosure propose a code processing method, which uses a code processing model to automate the entire software code repair process, including problem understanding, bug positioning, code analysis and repair, code verification and other links, greatly shortening the bug repair cycle, thereby greatly improving the efficiency of software development and maintenance, and realizing end-to-end automated bug repair. Specifically, a code problem of a target project is obtained; according to the code problem and a code knowledge graph of the target project, problem code of the target project is determined, wherein the code knowledge graph is used to represent the code context relationship and code reference relationship of the target project; the code problem and the problem code are input into a code processing model to obtain initial repair code; the initial repair code is tested by using test code, and in the case of passing the test, target repair code of the code problem is obtained, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0071] Through the above scheme, not only the software development efficiency can be significantly improved, the code maintenance cost is reduced, but also the code repair quality and product iteration speed are improved, solving the key problems of time-consuming and low efficiency in traditional methods, providing an automated solution for the software industry.

[0072] In the present disclosure, a code processing method is provided, and the present disclosure also relates to a code repair method, a code processing device, a code repair device, a task platform, a code processing system, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0073] Referring to FIG. 1, FIG. 1 shows an architecture diagram of a code processing system according to an embodiment of the present disclosure. The code processing system can include a client 100 and a server 200.

[0074] The client 100 is configured to send a code problem of a target project to the server 200.

[0075] The server 200 is configured to determine a problem code of the target project according to the code question and a code knowledge graph of the target project, where the code knowledge graph is used to represent a code context relationship and a code reference relationship of the target project; input the code question and the problem code into a code processing model to obtain an initial repair code; test the initial repair code by using test code, where the test code is obtained based on the code question, and the test code is used to reproduce the code question; and send the target repair code of the code question to the client 100.

[0076] The client 100 is further configured to receive the target repair code of the code question sent by the server 200.

[0077] By using the scheme of the embodiments of the present disclosure, the problem code is determined by using the code knowledge graph, so that the structure and dependency relationship of the code of the target project can be better understood, the accuracy of the problem code is improved, the code is automatically repaired by using the code processing model, the efficient code processing is realized, and the correctness of the target repair code is ensured by testing the initial repair code by using the test code, the code maintenance cost is reduced, and the code processing efficiency is further improved.

[0078] Referring to FIG. 2, FIG. 2 shows an architecture diagram of another code processing system according to an embodiment of the present disclosure. The code processing system can include a plurality of clients 100 and a server 200. The client 100 can include an end-side device, and the server 200 can include a cloud-side device. The plurality of clients 100 can establish a communication connection through the server 200. In a code processing scenario, the server 200 is used to provide code processing services between the plurality of clients 100. The plurality of clients 100 can be used as a sending end or a receiving end, and the communication can be realized through the server 200.

[0079] The user can interact with the server 200 through the client 100 to receive data sent by other clients 100 or send data to other clients 100, and the like. In a code processing scenario, the user can publish a data stream to the server 200 through the client 100. The server 200 generates a target repair code according to the data stream, and pushes the target repair code to other clients that establish a communication. The client 100 and the server 200 establish a connection through a network. The network provides a medium for a communication link between the client 100 and the server 200. The network can include various connection types, such as a wired, wireless communication link, or a fiber optic cable, and the like. The data transmitted by the client 100 can need to be processed by encoding, transcoding, compression, and the like before being published to the server 200.

[0080] The client 100 can be a browser, an application (APP), or a web application such as a HyperText Markup Language 5 (H5) application, or a light application (also known as a mini-program, a lightweight application), or a cloud application, etc. The client 100 can be developed based on a software development kit (SDK) of a corresponding service provided by the server 200, such as a real-time communication (RTC) SDK, etc. The client 100 can be deployed in an electronic device, and needs to rely on the device or some APP in the device, etc. The electronic device can have a display screen and support information browsing, etc., such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications can also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, mailbox clients, social platform software, etc.

[0081] The server 200 can include servers that provide various services, such as servers that provide communication services for multiple clients, servers that provide support for models used on clients for background training, servers that process data sent by clients, etc. It should be noted that the server 200 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server of cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, etc. basic cloud computing services, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0082] It should be noted that the code processing method provided in the embodiments of the present disclosure is generally executed by the server, but in other embodiments of the present disclosure, the client can also have similar functions as the server, so as to execute the code processing method provided in the embodiments of the present disclosure. In other embodiments, the code processing method provided in the embodiments of the present disclosure can also be executed by the client and the server together.

[0083] Referring to FIG. 3, FIG. 3 shows a flowchart of a code processing method according to an embodiment of the present disclosure, which specifically includes the following steps:

[0084] Step 302: Obtain a code problem of a target project.

[0085] In one or more embodiments of the present disclosure, the code processing can be performed by obtaining the code issues of the target project, and then performing code processing based on the code issues, such as problematic code positioning, code repair, repaired code testing, and the like.

[0086] It should be noted that the target project can be a software development project in different scenarios, such as a shopping software development project in an e-commerce scenario, an office software development project in an office scenario, and the like. The code issue (Coding Issue) refers to various code-related problems or errors encountered during software development. The code issues include logical errors, compatibility issues, syntax errors, security vulnerabilities, and the like.

[0087] In actual applications, there are various ways to obtain the code issues of the target project, which are selected according to actual conditions, and the present disclosure does not make any limitation on this. In one possible implementation of the present disclosure, the code issues of the target project can be received by the user through the client. In another possible implementation of the present disclosure, the code issues of the target project can be read from other data acquisition devices or databases.

[0088] Step 304: determining the problematic code of the target project according to the code issues and the code knowledge graph of the target project, wherein the code knowledge graph is used to represent the code context relationship and the code reference relationship of the target project.

[0089] In one or more embodiments of the present disclosure, after obtaining the code issues of the target project, the problematic code of the target project can be determined according to the code issues and the code knowledge graph of the target project.

[0090] It should be noted that the code knowledge graph (Code Knowledge Graph) of the target project refers to a data structure that represents the information of the code library of the target project in a graphical manner. The code knowledge graph usually includes multiple code entities in the code context and the relationships between the multiple code entities. The code entity can be referred to as a node in the code knowledge graph, and the code entity includes classes, functions, variables, and the like. The relationship between the code entities can be referred to as a code reference relationship, which can be represented by edges in the knowledge graph, and the relationship between the code entities includes calling relationship, inheritance relationship, containing relationship, and the like. The problematic code (Problematic Code) refers to a code segment in the project program that has defects, errors, or does not meet the expected effect. These defects and errors can be understood as code issues.

[0091] In actual application, there are multiple ways to determine the problem code of the target project according to the code problem and the code knowledge graph of the target project, and the specific selection is based on actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the target processing path can be filtered from all processing paths in the code knowledge graph according to the code problem, and the problem code of the target project can be filtered from the project code of the target project according to the target processing path.

[0092] In another possible implementation manner of the present disclosure, since the code knowledge graph includes information of a complex code base, in order to improve the positioning efficiency of the problem code, a code processing subgraph can be constructed according to the code problem and the code knowledge graph, so as to narrow the search space when positioning the problem code, that is, the above determining the problem code of the target project according to the code problem and the code knowledge graph of the target project can include the following steps:

[0093] constructing a code processing subgraph according to the code problem and the code knowledge graph of the target project, wherein the code processing subgraph includes multiple processing paths;

[0094] filtering a target processing path from the multiple processing paths according to the code problem;

[0095] filtering the problem code of the target project from the project code of the target project according to the target processing path.

[0096] It should be noted that the code processing subgraph refers to a knowledge graph composed of nodes associated with the code problem in the code knowledge graph. The target processing path refers to a processing path in the code processing subgraph with a high similarity to the code problem. The processing path includes nodes and edges passed from the root node to the leaf node.

[0097] In actual application, there are multiple ways to construct the code processing subgraph according to the code problem and the code knowledge graph of the target project, and the specific selection is based on actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the upper confidence bounds applied to trees (UCT) algorithm can be used to select nodes from the code knowledge graph to construct the code processing subgraph according to the code problem. In another possible implementation manner of the present disclosure, nodes with a high similarity to the code problem can be determined from multiple nodes in the code knowledge graph, and nodes having edges with the nodes with a high similarity are used as nodes of the code processing subgraph to obtain the code processing subgraph.

[0098] Further, there are various ways to filter the target processing path from the plurality of processing paths according to the code problem, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the keyword matching and semantic matching algorithm can be used to evaluate the similarity between the plurality of processing paths and the code problem, and the target processing path is selected according to the similarity, wherein the processing path with higher similarity refers to the processing path with similarity greater than a similarity threshold, and the similarity threshold is, for example, 0.8, which is set according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In another possible implementation manner of the present disclosure, the code processing model can be used to generate the similarity indicators between the leaf nodes corresponding to the plurality of processing paths and the code problem, and the target processing path is filtered according to the similarity indicators.

[0099] There are various ways to filter the target project problem code from the project code of the target project according to the target processing path, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the code retrieval information can be generated according to the code problem and the target processing path; the candidate code segment is retrieved from the project code of the target project according to the code retrieval information, and the candidate code segment is determined as the target project problem code. In another possible implementation manner of the present disclosure, since the candidate code segment can include correct code content, after obtaining the candidate code segment, the code positioning model can be further used to determine the problem code location information of the problem code; and the problem code is extracted from the project code according to the problem code location information.

[0100] By using the scheme of the embodiments of the present disclosure, the problem code is determined through the code knowledge graph, so that the structure and dependency relationship of the code of the target project can be better understood, and the accuracy of the problem code is improved.

[0101] In an optional embodiment of the present disclosure, the above filtering the target processing path from the plurality of processing paths according to the code problem can include the following steps:

[0102] The leaf nodes corresponding to the plurality of processing paths are respectively searched in the code knowledge graph;

[0103] The similarity indicators between the leaf nodes and the code problem are calculated;

[0104] The target processing path is filtered from the plurality of processing paths according to the similarity indicators.

[0105] It should be noted that the similarity index is used to describe the correlation degree between the leaf node and the code problem. There are many ways to calculate the similarity index between the leaf node and the code problem, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the keyword matching and / or semantic matching algorithm can be used to calculate the similarity index between the leaf node and the code problem. In another possible implementation manner of the present disclosure, the index generation prompt information, the leaf node and the code problem can be input into the code processing model to obtain the similarity index output by the code processing model.

[0106] In actual application, when the target processing path is selected from the plurality of processing paths according to the similarity index, in a possible implementation manner, the K processing paths with higher similarity can be selected as the target processing path, wherein K is a positive integer, which is selected according to actual conditions. In another possible implementation manner, the processing path with a similarity index greater than a similarity index threshold can be determined as the target processing path, and the similarity index threshold is set according to actual conditions, and the embodiments of the present disclosure will not be described again.

[0107] By determining the target processing path according to the similarity index between the leaf node and the code problem, the embodiments of the present disclosure ensure that each node in the target processing path has a high correlation degree with the code problem, and further improve the accuracy of filtering the problem code of the target project from the project code of the target project according to the target processing path.

[0108] In an optional embodiment of the present disclosure, the above filtering the problem code of the target project from the project code of the target project according to the target processing path can include the following steps:

[0109] Generating code retrieval information according to the code problem and the target processing path;

[0110] Retrieving a candidate code segment from the project code of the target project according to the code retrieval information;

[0111] Inputting the code problem and the candidate code segment into a code positioning model to obtain problem code position information;

[0112] Extracting the problem code from the project code according to the problem code position information.

[0113] It should be noted that the code retrieval information is used to retrieve the candidate code snippet from the project code of the target project. The code retrieval information is, for example, a code retrieval formula. The candidate code snippet refers to a candidate code snippet in the project code that meets the code retrieval information. The problem code location information is used to describe the location of the problem code in the project code. The code positioning model is used to generate the problem code location information based on the code problem and the candidate code snippet. The code positioning model can be a pre-trained large model or a neural network model trained based on sample problems, sample code snippets, and sample location information.

[0114] In actual applications, there are various ways to generate the code retrieval information based on the code problem and the target processing path, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation in this regard. In a possible implementation manner of the present disclosure, the code problem and the target processing path can be input into a code processing model to obtain the code retrieval information. In another possible implementation manner of the present disclosure, a retrieval information template corresponding to the code problem can be obtained, and the nodes in the target processing path can be added to the retrieval information template to obtain the code retrieval information.

[0115] Further, there are various ways to retrieve the candidate code snippet from the project code of the target project based on the code retrieval information, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation in this regard. In a possible implementation manner of the present disclosure, the candidate code snippet can be directly retrieved from the complete project code by using the code retrieval information. In another possible implementation manner of the present disclosure, a retrieval file or a function code corresponding to the code retrieval information can be determined, and the candidate code snippet can be retrieved in the retrieval file or the function code.

[0116] By applying the scheme of the embodiments of the present disclosure, since the code retrieval information is obtained based on the code problem and the target processing path, the code retrieval information can accurately retrieve the candidate code snippet, and the accuracy of the problem code is ensured by using the code location information obtained based on the candidate code snippet to position the problem code.

[0117] In an optional embodiment of the present disclosure, before the above-mentioned step of determining the problem code of the target project based on the code problem and the code knowledge graph of the target project, the following steps can be further included:

[0118] obtaining the project code of the target project;

[0119] performing syntax analysis on the project code to determine a plurality of code entities;

[0120] constructing a code hierarchy tree based on the context relationship of the plurality of code entities;

[0121] According to the reference relationship between the plurality of code entities, a directed edge is added in the code hierarchy tree to obtain the code knowledge graph of the target project.

[0122] It should be noted that the code hierarchy tree is a tree structure diagram composed of code entities, including files, classes and functions. The code hierarchy tree can clearly describe the context and scope of the code. The hierarchy tree has the following characteristics: single root node: the tree has a unique root node, which is the starting point of the tree. Branch structure: each non-root node has exactly one parent node, and each node can have zero or more child nodes. Acyclic: there is no loop (cycle) in the tree, which means that it is not possible to return to itself through a series of consecutive edges from any node. Hierarchy: the relationship between nodes forms a hierarchy, and each node is in some sense above its child nodes. Through the hierarchy tree, the overall architecture of the project and the relationship between each code module can be clearly seen. According to the reference relationship between the plurality of code entities, a directed edge is added in the code hierarchy tree to realize the addition of the reference graph in the code hierarchy tree. The directed edge is used to indicate the relationship from one node to another node. Through the reference graph, the calling relationship and dependency path between project functions can be clearly seen. Optionally, because functions are the basic units of program execution, the calling relationship between functions directly affects the behavior and execution logic of the program, and too many reference relationships will increase the complexity of the graph structure, therefore the reference relationship can only involve functions in the code entities.

[0123] In practical applications, each code file of the project code can be recursively traversed, and the corresponding files can be parsed using an abstract syntax tree to obtain basic units such as classes and functions, including their names, code snippets, paths and positions in the files. Then, these basic units are added to the code hierarchy tree as nodes from top to bottom. Finally, the reference relationship between functions is analyzed, and the corresponding directed edges are added in the graph to obtain the code knowledge graph of the target project, for example, if function a references function b, a directed edge from function a to function b is added in the graph.

[0124] By using the scheme of the embodiments of the present disclosure, through the structured code knowledge graph, the positioning efficiency of the problem code is improved, and the consistency and reliability of the automatic code processing are ensured.

[0125] Step 306: input the code problem and the problem code into the code processing model to obtain the initial repair code.

[0126] In one or more embodiments of the present disclosure, after the code problem of the target item is obtained and the problem code corresponding to the code problem is located using the code knowledge graph, the problem code can be repaired based on the code problem using a code processing model to obtain initial repair code.

[0127] It should be noted that the code processing model refers to a deep learning model with code generation capability. The code processing model can be a pre-trained large model or a neural network model trained using a plurality of sample code problems, a plurality of sample problem codes respectively corresponding to the sample code problems, and sample repair codes. The initial repair code refers to a code obtained by repairing the code problem in the problem code. Ideally, the initial repair code does not have code problems.

[0128] In actual applications, there are various ways to input the code problem and the problem code into the code processing model to obtain the initial repair code. The specific selection is based on actual conditions, and the present disclosure does not make any limitation in this regard. In one possible implementation of the present disclosure, the repair code generation prompt information, the code problem, and the problem code can be input into the code processing model to obtain the initial repair code output by the code processing model. The repair code generation prompt information is set according to actual conditions, such as "You are a professional programmer, please repair the code problem in the problem code and output the initial repair code". In another possible implementation of the present disclosure, a before-after mode can be used. The code processing model first repeatedly generates a part of the problem code to assist in locating the code to be repaired in the problem code. Then, the code processing model is used to repair the code to be repaired in the problem code to obtain a patch code. Finally, the initial repair code is generated based on the code to be repaired obtained in the before stage and the patch code obtained in the after stage.

[0129] In an optional embodiment of the present disclosure, the above inputting the code problem and the problem code into the code processing model to obtain the initial repair code can include the following steps:

[0130] Inputting the locating prompt information, the code problem, and the problem code into the code processing model to obtain the code to be repaired in the problem code;

[0131] Inputting the repair prompt information and the code to be repaired into the code processing model to obtain the patch code;

[0132] Replacing the code to be repaired in the problem code with the patch code to obtain the initial repair code.

[0133] It should be noted that the positioning prompt information is used to prompt the code processing model to locate the to-be-repaired code in the problem code based on the code problem. The positioning prompt information is specifically set according to actual conditions, such as "You are a professional code developer, please locate the code corresponding to the code problem in the problem code, and output the located code as the to-be-repaired code". The repair prompt information is used to prompt the code processing model to generate the patch code of the to-be-repaired code. The to-be-repaired code refers to a code segment in the problem code that needs to be corrected or improved. The patch code refers to a code segment written to repair or improve the to-be-repaired code. The goal of the patch code is to solve the problem of the to-be-repaired code and restore the code to a normal or better working state. The patch code can be as small as a line of code change, or as complex as a refactoring code.

[0134] Exemplarily, assuming that the problem code includes three code segments, which are code segment 1, code segment 2 and code segment 3. The positioning prompt information, the code problem and the problem code are input into the code processing model, and the to-be-repaired code in the problem code is obtained as the code segment 2. The repair prompt information and the to-be-repaired code are input into the code processing model, and the patch code is obtained as patch code 4 and patch code 5. The initial repair code includes four code segments, which are code segment 1, patch code 4, patch code 5 and code segment 3, by replacing the to-be-repaired code in the problem code with the patch code.

[0135] By applying the scheme of the embodiments of the present disclosure, the to-be-repaired code in the problem code is first determined by using the code processing model, and then the accurate patch code corresponding to the to-be-repaired code is generated by using the code processing model, so that the problem code is repaired more accurately, and the accuracy of the initial repair code is improved.

[0136] Step 308: testing the initial repair code by using test code, and obtaining the target repair code of the code problem in the case of passing the test, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0137] In one or more embodiments of the present disclosure, the code problem of the target project is obtained, the problem code corresponding to the code problem is determined, and the initial repair code is obtained by using the code processing model to repair the problem code. Further, in order to ensure the accuracy of the initial repair code, the initial repair code can be tested for problems by using test code, and whether the initial repair code is used as the final target repair code is determined according to the test result.

[0138] It should be noted that the test code can reproduce the code problem, so the test code can be called reproduction code, that is, code for reproducing the code problem. The target repair code refers to the accurate code obtained after solving the code problem in the problem code. The target repair code does not appear after running the code problem.

[0139] By applying the scheme of the embodiment of the present disclosure, the problem code is determined through the code knowledge graph, so that the structure and dependency of the code of the target project can be better understood, the accuracy of the problem code is improved, the code automatic repair is performed by using the code processing model, the efficient code processing is realized, and the test code is used to test the initial repair code, so as to avoid the code problem in the target repair code, ensure the correctness of the target repair code, reduce the code maintenance cost, and further improve the code processing efficiency.

[0140] In practical application, there are various ways to test the initial repair code by using the test code, which is specifically selected according to actual conditions, and the present disclosure does not make any limitation on this. In a possible implementation manner of the present disclosure, the similarity between the test code and the initial repair code can be calculated, and in the case that the similarity is less than a similarity threshold, it is determined that the initial repair code passes the test.

[0141] In another possible implementation manner of the present disclosure, whether the initial repair code passes the test can be determined according to the test running log of the test code and the initial running log of the initial repair code, that is, the above-mentioned testing the initial repair code by using the test code can include the following steps:

[0142] The test code is run to obtain a test running log of the test code, and the initial repair code is run to obtain an initial running log of the initial repair code, wherein the test running log includes a test code problem of the test code;

[0143] In the case that the test code problem does not appear in the initial running log, it is determined that the test result of the initial repair code is test pass.

[0144] It should be noted that the test running log refers to a record file generated in the running process of the test code. The initial running log refers to a record file generated in the running process of the initial repair code. The record file records the state and activity of the code running, and can be used for code problem diagnosis, exception tracking, etc.

[0145] In actual application, after obtaining the test running log of the test code and the initial running log of the initial repair code, since the test code can reproduce the code problem of the target project, if the test code problem is included in the initial running log, it indicates that the initial repair code still has the code problem, the test result of the initial repair code is test failure, at this time, the code processing can be returned to be performed again. Optionally, when the test result is test failure, it indicates that the code repair capability of the code processing model is poor, the model parameters of the code processing model can be adjusted, so that the code processing model is more accurate. If the test code problem does not appear in the initial running log, it indicates that the initial repair code does not have the code problem, the test result of the initial repair code is test pass, and the initial repair code can be directly determined as the target repair code.

[0146] By using the scheme of the embodiment of the present disclosure, whether the initial repair code has the code problem is verified by using the test code, and the correctness of the initial repair code is ensured.

[0147] In an optional embodiment of the present disclosure, after the code problem and the problem code are input into the code processing model to obtain the initial repair code, the following steps can be further included:

[0148] The initial repair code is subjected to function detection to obtain a function detection result.

[0149] The initial repair code is tested by using the test code, and in the case of test pass, the target repair code of the code problem is obtained, which can include the following steps:

[0150] In the case of the function detection result being function detection pass, the initial repair code is tested by using the test code, and in the case of test pass, the target repair code of the code problem is obtained.

[0151] It should be noted that, when repairing the problem code, on the one hand, the initial repair code can be tested by using the test code to ensure that the problem code no longer has code problems, and on the other hand, it can also be ensured that the initial repair code obtained after repair is the same as the function of the problem code, so that the function of the initial repair code can be detected after the initial repair code is obtained. The main goal of the function detection is to ensure that the function of the initial repair code is the same as that of the problem code and can normally work. The function detection manner includes but is not limited to regression testing, unit testing, and integration testing, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. The function detection result includes function detection pass and function detection fail. The function detection pass indicates that the code function of the initial repair code is the same as that of the problem code. The function detection fail indicates that the code function of the initial repair code is different from that of the problem code.

[0152] In actual application, the function of the initial repair code can be detected before the initial repair code is tested by using the test code. The function of the initial repair code can also be detected after the initial repair code is tested by using the test code, that is, the code problem and the problem code are input into the code processing model to obtain the initial repair code, the initial repair code is tested by using the test code, in the case of test pass, the function of the initial repair code is detected to obtain the function detection result, and in the case of function detection result being function detection pass, the initial repair code is determined as the target repair code.

[0153] By applying the scheme of the embodiments of the present disclosure, the function of the initial repair code is detected and the problem is tested, which simultaneously ensures that the function of the repaired code is the same as that of the code before repair and the code problem no longer exists, and improves the accuracy of code repair and the stability of the code.

[0154] In an optional embodiment of the present disclosure, the test code can be obtained before the initial repair code is tested by using the test code. There are various ways to obtain the test code, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the candidate test code with the same problem label as the code problem can be selected from the test code library, and the candidate test code is determined as the test code, wherein the test code library includes a plurality of candidate test codes, and each candidate test code carries a problem label.

[0155] In another possible implementation of the present disclosure, the test code can be generated by using a code processing model, that is, before the target repair code of the code problem is obtained after the initial repair code is tested by using the test code, the following step can be further included:

[0156] The test generation prompt information and the code problem are input into the code processing model to obtain initial test code;

[0157] The initial test code is run to obtain an initial running log of the initial test code, wherein the initial running log includes an initial code problem of the initial test code.

[0158] In a case where the initial code problem is the same as the code problem, the initial test code is determined as the test code.

[0159] It should be noted that the test generation prompt information is used to prompt the code processing model to generate the initial test code with the code problem. The test generation prompt information is specifically set according to actual conditions, for example, "You are a professional code developer, please write an initial test code with the above code problem".

[0160] In actual application, after the code processing model outputs the initial test code, in order to ensure that the initial test code can successfully reproduce the code problem of the target project, the initial test code can be run to obtain a running log of the initial test code, and it is determined whether the initial code problem in the initial running log is the same as the code problem of the target project. If they are the same, it indicates that the initial test code can successfully reproduce the code problem of the target project, and at this time, the initial test code can be directly determined as the test code. If they are not the same, it indicates that the initial test code cannot successfully reproduce the code problem of the target project, and at this time, the initial test code can be re-generated, or the test code is adjusted based on the initial running log to obtain the initial test code that can successfully reproduce the code problem.

[0161] By using the scheme of the present disclosure, since the initial test code is generated by the code processing model based on the code problem, the efficiency of obtaining the initial test code is improved, and it is determined whether the initial code problem of the initial test code is the same as the code problem, so that it is ensured that the test code can successfully reproduce the code problem, and the accuracy of the target repair code is further ensured.

[0162] In an optional embodiment of the present disclosure, after the initial test code is run to obtain the initial running log of the initial test code, the following step can be further included:

[0163] In the case that the initial code problem and the code problem are different, the initial test code is adjusted according to the initial running log until the initial code problem of the adjusted initial test code is the same as the code problem, and the adjusted initial test code is determined as the test code.

[0164] It should be noted that, if the initial code problem of the initial test code is different from the code problem, it indicates that the initial test code cannot successfully reproduce the code problem of the target project, and the initial test code at this time cannot be used as the test code to test the repaired code. Therefore, the initial test code can be adjusted according to the initial running log until the initial code problem of the adjusted initial test code is the same as the code problem, and the adjusted initial test code is determined as the test code.

[0165] In practical applications, there are various ways to adjust the initial test code according to the initial running log, such as adding or deleting specific code paths, changing conditional judgment statements in the initial test code, adjusting variable values, and the like, which are selected according to actual conditions, and the present disclosure does not make any limitation on this.

[0166] By adjusting the initial test code based on the code problem and the initial code problem, the scheme of the present disclosure ensures that the final test code can successfully reproduce the code problem, and further ensures the accuracy of the target repaired code.

[0167] Referring to FIG. 4, FIG. 4 shows a processing process flowchart of a code processing method according to an embodiment of the present disclosure, and the code processing process can include three stages of code knowledge graph construction, code knowledge understanding, and code processing. Next, the three stages are described in detail.

[0168] Code knowledge graph construction: complex code base information in the code base of the target project is compressed into a hierarchical structure tree and a reference graph to obtain a code knowledge graph (as shown in FIG. 4, where a circle represents a node, a solid arrow connects the circles to form a hierarchical structure tree, and a dashed arrow represents the reference relationship of the nodes). Specifically, the project code is parsed to determine a plurality of code entities; a code hierarchical structure tree is constructed according to the context relationship of the plurality of code entities; directed edges are added in the code hierarchical structure tree according to the reference relationship between the plurality of code entities to obtain the code knowledge graph of the target project.

[0169] Code base knowledge understanding: a code base exploration strategy based on MCTS is used to narrow down the search range of the code knowledge graph, and the target processing path that is important to solve the code problem is explored from the code knowledge graph. Specifically, the MCTS process starts from the root node representing the code base and expands through four iterative stages: selection, associated expansion, simulation and evaluation, back propagation and reference expansion. The selection stage starts from the root node, recursively selects child nodes until it reaches the leaf node, thereby constructing a code processing subgraph; in the associated expansion stage, the leaf nodes in the code processing subgraph are expanded to incorporate new nodes in the code knowledge graph, for example, determining the child nodes of the current leaf node in the code knowledge graph, and selecting the child nodes with higher similarity to the code problem as the new expansion nodes of the code processing subgraph leaf nodes in the sub-stage. After the expansion is completed, enter the simulation and evaluation stage, in which the simulation is started from the newly expanded nodes along the possible processing paths to evaluate the effectiveness of these paths in solving the code problem, and the similarity indicators are obtained. After the simulation and evaluation stage, enter the back propagation and reference expansion stage, specifically, the similarity indicators are propagated from the leaf nodes to the root nodes from bottom to top, comprehensively capturing the relevance of the processing path to the code problem, and obtaining the target processing path;

[0170] Code processing: the code processing stage can be divided into problem code positioning stage, patch generation stage and code testing stage. Next, these stages will be described respectively. In the problem code positioning stage, the code processing model is used to analyze and summarize the target processing path and the code problem, and generate a code base summary (including plan and analysis results) for solving the code problem. The search interface is called from the code base through the ReAct mechanism to dynamically obtain code retrieval information. RAG technology is used for code base search, combined with software engineering tools such as SBFL to assist in positioning the problem code. In the patch generation stage, the before-after mode is adopted, and the code processing model is used to generate patch code. Syntax detection tools are used for syntax checking and automatic correction of patch code to obtain initial repair code. In the code testing stage, the code processing model is used to automatically extract the test code corresponding to the code problem, and run the test code. According to the code problem, test code and test running log of test code, it is judged whether the code problem is successfully reproduced. In the case of successful reproduction of the code problem, through integrated testing and test code verification, it is ensured that the generated initial repair code is correct and does not damage the original code function, and the target repair code is obtained.

[0171] By using the scheme of the embodiments of the present disclosure, the structure and dependency of the entire code library can be better understood by constructing the code knowledge graph and using the MCTS exploration strategy, and the global understanding ability of the complex project code can be improved. In combination with the RAG technology and the SBFL method, the location of the bug can be more accurately located, and the accurate positioning of the problem code is realized. From the problem code positioning to the patch generation and then to the code testing stage, the end-to-end automated software engineering is realized, and the code processing model is introduced in multiple stages, so that the code processing system is a multi-agent system, and the code processing efficiency is improved. Moreover, the scheme provided in the embodiments of the present disclosure can achieve 33.0% SOTA performance in the SWE-bench Lite benchmark test, and greatly shorten the bug repair cycle.

[0172] It should be noted that the scheme provided by the embodiments of the present disclosure can improve the automation degree of software repair, and when dealing with extremely complex or requiring deep domain knowledge problems, the scheme can also receive human intervention of experts (such as manual review of code repair effect), so as to ensure that the generated patch code meets the quality standards and safety requirements of the project.

[0173] Referring to FIG. 5, FIG. 5 shows a flowchart of a code repair testing method according to an embodiment of the present disclosure, which specifically includes the following steps:

[0174] Step 502: Obtain the code problem of the target project and the initial repair code, wherein the initial repair code is obtained by the code processing model based on the code problem and the problem code, the problem code is obtained based on the code problem and the code knowledge graph of the target project, and the code knowledge graph is used to represent the code context relationship and the code reference relationship of the target project.

[0175] Step 504: Test the initial repair code by using the test code, and obtain the target repair code of the code problem in the case of passing the test, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0176] It should be noted that the implementation manner of step 504 is the same as that of step 308 described above, and the embodiments of the present disclosure will not be described again.

[0177] In actual applications, there are various ways to obtain the code problem of the target project and the initial repair code, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the code problem of the target project sent by the client can be received, the problem code of the target project is determined according to the code problem and the code knowledge graph of the target project, the code problem and the problem code are input into the code processing model, and the initial repair code is obtained. In another possible implementation manner of the present disclosure, the code problem of the target project and the initial repair code can be read from other data acquisition devices or databases. Optionally, the initial repair code can be obtained manually by artificial repair based on the code problem.

[0178] By applying the scheme of the embodiments of the present disclosure, since the test code is obtained based on the code problem and can reproduce the code problem, the initial repair code is tested by using the test code, whether the code problem of the initial repair code is repaired is accurately judged, the code problem in the target repair code is avoided, the correctness of the target repair code is ensured, the code maintenance cost is reduced, and the code processing efficiency is further improved.

[0179] Referring to FIG. 6, FIG. 6 shows a flowchart of another code processing method provided by an embodiment of the present disclosure, and the code processing method is applied to a task platform and specifically includes the following steps:

[0180] Step 602: receiving a code problem of a target project sent by a client.

[0181] Step 604: determining a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent a code context relationship and a code reference relationship of the target project.

[0182] Step 606: inputting the code problem and the problem code into a code processing model to obtain an initial repair code.

[0183] Step 608: testing the initial repair code by using a test code, and obtaining a target repair code of the code problem in the case of passing the test, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0184] It should be noted that the implementation manners of steps 602 to 608 are the same as those of steps 302 to 308, and the embodiments of the present disclosure will not be described again. The task platform can be deployed on an end-side device or a cloud-side device, which is specifically set according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this.

[0185] By applying the scheme of the embodiments of the present disclosure, the task platform determines the problem code through the code knowledge graph, so that the structure and dependency of the code of the target project can be better understood, the accuracy of the problem code is improved, the code automatic repair is performed by using the code processing model, efficient code processing is achieved, and the initial repair code is tested by using the test code, so as to avoid the occurrence of code problems in the target repair code, ensure the correctness of the target repair code, reduce the code maintenance cost, and further improve the code processing efficiency.

[0186] In an optional embodiment of the present disclosure, before the code problem and the problem code are input into the code processing model to obtain the initial repair code, the following steps can be further included:

[0187] Based on the model request, a code processing model is determined from a plurality of processing models, wherein the model request includes at least one of a scene identifier of a target scene, scene input data of the target scene, and a model specification parameter.

[0188] It should be noted that the model request can be a request for determining the code processing model sent by the user to the task platform through the client. There are various ways to determine the code processing model from the plurality of processing models based on the model request, which are selected according to actual conditions, and the embodiments of the present disclosure do not make any limitation on this. In a possible implementation manner of the present disclosure, the corresponding code processing model can be found from at least one processing model included in the model library based on the model request; in another possible implementation manner of the present disclosure, the code processing model can be obtained by training based on the model request; and in another optional manner of the present disclosure, the code processing model can be constructed based on the model request.

[0189] For example, at least one processing model that has been trained in advance can be found from the model library based on the scene identifier of the target scene, then an initial processing model can be selected from the at least one processing model based on the model specification parameter, and then the initial processing model selected can be trained based on the scene input data of the target scene to obtain a code processing model suitable for the user's demand.

[0190] By applying the scheme of the embodiments of the present disclosure, the code processing model suitable for the user's demand is obtained, personalized model service is achieved, an efficient, flexible and easy-to-use code service method based on the code processing model is provided for the user, and the user experience is improved.

[0191] In an optional embodiment of the present disclosure, the model request includes the scene identifier of the target scene; and based on the model request, the code processing model can be determined from the plurality of processing models, which can include the following steps:

[0192] The code processing model adapted to the target scene is found from the model library based on the scene identification of the target scene, wherein the model library stores a plurality of processing models adapted to different task scenes.

[0193] It should be noted that the scene identification refers to a unique or specific label used to distinguish different task scenes. The model library is a database for storing and managing various pre-trained deep learning models. The plurality of processing models adapted to different task scenes cover different application scenarios and requirements. Each model is optimized for a specific application environment. The model library allows users to select appropriate models according to their own needs, or directly use the models for code task processing through an application programming interface.

[0194] By applying the scheme of the embodiments of the present disclosure, the code processing model adapted to the scene is accurately found based on the scene requirement through the scene identification, so that the code processing is more accurate and more suitable for the scene, thereby improving the user experience and the code processing quality.

[0195] In an optional embodiment of the present disclosure, the model request includes scene input data of the target scene; and the determining, based on the model request, the code processing model from the plurality of processing models can include the following steps:

[0196] Determining an initial processing model adapted to the target scene from the plurality of processing models;

[0197] Training the initial processing model based on the scene input data of the target scene to obtain the code processing model.

[0198] It should be noted that the initial processing model refers to a model in the plurality of processing models that is applicable to the target scene. The initial processing model can not only be applicable to the target scene, but also can be applicable to other scenes, and is a general processing model that can be applicable to different scenes. The initial processing model can be used for code processing, but the effect can not be very good. At this time, the initial processing model can be optimized based on the scene input data of the target scene. The scene input data of the target scene can be understood as sample data (including sample code problems, sample problem codes, and sample repair codes) of sample code tasks in the target scene.

[0199] By applying the scheme of the embodiments of the present disclosure, the general initial processing model is further trained based on the scene input data according to the scene requirement to obtain the code processing model adapted to the scene, so that the code processing model is more suitable for the scene, thereby improving the user experience and the code task processing quality.

[0200] In an optional embodiment of the present disclosure, the model request includes a model specification parameter; and the determining, based on the model request, the code processing model from the plurality of processing models can include the following steps:

[0201] Based on the model specification parameter, a corresponding code processing model is searched from a model library, wherein the model library stores processing models of different model specification parameters.

[0202] It should be noted that the model specification parameter refers to various parameters that define the structure and behavior of the model. These parameters can be roughly divided into two categories: model parameters (learnable parameters) and hyperparameters. Model parameters refer to parameters that are automatically adjusted during model training through backpropagation algorithms, including but not limited to weight matrices (weights) and bias terms (biases). For example, in a simple fully connected layer, the weight matrix is a two-dimensional tensor that connects the input layer and the output layer of the neurons; the bias term is a one-dimensional vector that provides an additional offset value for each output neuron. Hyperparameters refer to parameters that are set before starting model training, used to control the learning process and architecture of the model. Hyperparameters include but are not limited to learning rate (Learning Rate), number of neurons per layer (Number of Neurons per Layer), which are selected according to actual conditions.

[0203] By applying the scheme of the embodiments of the present disclosure, based on the model specification parameter, the corresponding code processing model can be accurately found, ensuring efficient and stable operation of the code processing model and improving user experience.

[0204] Referring to FIG. 7, FIG. 7 shows a structural schematic diagram of a task platform provided by an embodiment of the present disclosure, the task platform comprising a request interface 702 and a response unit 704;

[0205] The request interface 702 is configured to receive a code problem of a target project sent by a client.

[0206] The response unit 704 is configured to determine a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent the code context relationship and the code reference relationship of the target project; input the code problem and the problem code into a code processing model to obtain an initial repair code; and test the initial repair code by using test code, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem; and in the case that the test is passed, obtain a target repair code of the code problem.

[0207] By applying the scheme of the embodiments of the present disclosure, the task platform is adapted to obtain the code processing model according to the user demand, realizes personalized model service, provides an efficient, flexible and easy-to-use code service platform for the user, and improves user experience.

[0208] The above is a schematic solution of the task platform of the embodiment. It should be noted that the technical solution of the task platform and the technical solution of the code processing method described above belong to the same concept, and the details of the technical solution of the task platform that are not described in detail can be referred to the description of the technical solution of the code processing method.

[0209] Corresponding to the code processing method embodiment, the disclosure also provides a code processing device embodiment, and FIG. 8 shows a structural schematic diagram of a code processing device according to an embodiment of the disclosure. As shown in FIG. 8, the device comprises:

[0210] The first acquisition module 802 is configured to acquire a code problem of a target project;

[0211] The first determination module 804 is configured to determine a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent the code context relationship and the code reference relationship of the target project;

[0212] The first input module 806 is configured to input the code problem and the problem code into a code processing model to obtain an initial repair code;

[0213] The first test module 808 is configured to test the initial repair code by using a test code, and obtain a target repair code of the code problem in the case of passing the test, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0214] Optionally, the device further comprises a running module configured to input the test generation prompt information and the code problem into the code processing model to obtain an initial test code, and run the initial test code to obtain an initial running log of the initial test code, wherein the initial running log comprises an initial code problem of the initial test code; and in the case that the initial code problem is the same as the code problem, the initial test code is determined as the test code.

[0215] Optionally, the device further comprises an adjustment module configured to, in the case that the initial code problem is different from the code problem, adjust the initial test code according to the initial running log until the initial code problem of the adjusted initial test code is the same as the code problem, and determine the adjusted initial test code as the test code.

[0216] Optionally, the device further comprises a third test module configured to perform function detection on the initial repair code to obtain a function detection result; and the first test module 808 is further configured to, in the case that the function detection result is function detection passing, test the initial repair code by using the test code, and obtain the target repair code of the code problem in the case of passing the test.

[0217] Optionally, the first test module 808 is further configured to run the test code, obtain a test run log of the test code, and run the initial repair code to obtain an initial run log of the initial repair code, wherein the test run log includes a test code problem of the test code; and in a case where the test code problem does not appear in the initial run log, determine that a test result of the initial repair code is test passed.

[0218] Optionally, the first input module 806 is further configured to input the positioning prompt information, the code problem and the problem code into the code processing model to obtain a to-be-patched code in the problem code; input the patching prompt information and the to-be-patched code into the code processing model to obtain the patch code; and replace the to-be-patched code in the problem code with the patch code to obtain the initial repair code.

[0219] Optionally, the first determination module 804 is further configured to construct a code processing subgraph according to the code problem and a code knowledge graph of the target project, wherein the code processing subgraph includes a plurality of processing paths; filter a target processing path from the plurality of processing paths according to the code problem; and filter the problem code of the target project from project code of the target project according to the target processing path.

[0220] Optionally, the first determination module 804 is further configured to find leaf nodes corresponding to the plurality of processing paths in the code knowledge graph respectively; calculate a similarity index between the leaf nodes and the code problem; and filter the target processing path from the plurality of processing paths according to the similarity index.

[0221] Optionally, the first determination module 804 is further configured to generate code retrieval information according to the code problem and the target processing path; retrieve a candidate code segment from the project code of the target project according to the code retrieval information; input the code problem and the candidate code segment into a code positioning model to obtain problem code position information; and extract the problem code from the project code according to the problem code position information.

[0222] Optionally, the apparatus further includes a construction module configured to obtain project code of a target project; perform syntax analysis on the project code to determine a plurality of code entities; construct a code hierarchical structure tree according to context relationships of the plurality of code entities; and add directed edges in the code hierarchical structure tree according to reference relationships between the plurality of code entities to obtain a code knowledge graph of the target project.

[0223] By applying the scheme of the embodiment of the present disclosure, the problem code is determined through the code knowledge graph, so that the structure and dependency relationship of the code of the target project can be better understood, the accuracy of the problem code is improved, the code automatic repair is performed by using the code processing model, efficient code processing is realized, and the correctness of the target repair code is ensured by testing the initial repair code by using the test code, the code maintenance cost is reduced, and the code processing efficiency is further improved.

[0224] The above is a schematic scheme of the code processing device of the embodiment. It should be noted that the technical scheme of the code processing device belongs to the same concept as the technical scheme of the code processing method described above, and the details of the technical scheme of the code processing device that are not described in detail can be referred to the description of the technical scheme of the code processing method.

[0225] Corresponding to the code repair test method embodiment described above, the present disclosure also provides a code repair test device embodiment. FIG. 9 shows a structural schematic diagram of a code repair test device according to an embodiment of the present disclosure. As shown in FIG. 9, the device comprises:

[0226] The second acquisition module 902 is configured to acquire a code problem of a target project and an initial repair code, wherein the initial repair code is obtained by a code processing model based on the code problem and a problem code, the problem code is obtained based on the code problem and a code knowledge graph of the target project, and the code knowledge graph is used to represent a code context relationship and a code reference relationship of the target project.

[0227] The second test module 904 is configured to test the initial repair code by using a test code, and obtain a target repair code of the code problem in the case of passing the test, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0228] By applying the scheme of the embodiment of the present disclosure, since the test code is obtained based on the code problem and can reproduce the code problem, the test of the initial repair code by using the test code can accurately determine whether the code problem of the initial repair code is repaired, avoid the occurrence of the code problem in the target repair code, ensure the correctness of the target repair code, reduce the code maintenance cost, and further improve the code processing efficiency.

[0229] The above is a schematic scheme of the code repair test device of the embodiment. It should be noted that the technical scheme of the code repair test device belongs to the same concept as the technical scheme of the code repair test method described above, and the details of the technical scheme of the code repair test device that are not described in detail can be referred to the description of the technical scheme of the code repair test method.

[0230] Corresponding to the code processing method applied to the task platform, the disclosure also provides a code processing device applied to the task platform. FIG. 10 shows a structural schematic diagram of another code processing device according to an embodiment of the disclosure. As shown in FIG. 10, the device comprises:

[0231] The receiving module 1002 is configured to receive the code problem of the target project sent by the client;

[0232] The second determining module 1004 is configured to determine the problem code of the target project according to the code problem and the code knowledge graph of the target project, wherein the code knowledge graph is used to represent the code context relationship and the code reference relationship of the target project;

[0233] The second input module 1006 is configured to input the code problem and the problem code into the code processing model to obtain the initial repair code;

[0234] The third testing module 1008 is configured to test the initial repair code by using the test code, and obtain the target repair code of the code problem in the case of passing the test, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

[0235] By using the scheme of the embodiment of the disclosure, the task platform determines the problem code through the code knowledge graph, so that the structure and dependency relationship of the code of the target project can be better understood, the accuracy of the problem code is improved, the code automatic repair is performed by using the code processing model, the efficient code processing is realized, the initial repair code is tested by using the test code, the code problem in the target repair code is avoided, the correctness of the target repair code is ensured, the code maintenance cost is reduced, and the code processing efficiency is further improved.

[0236] The above is a schematic scheme of the code processing device of the embodiment. It should be noted that the technical scheme of the code processing device belongs to the same concept as the technical scheme of the code processing method applied to the task platform. The details of the technical scheme of the code processing device that are not described in detail can be referred to the description of the technical scheme of the code processing method applied to the task platform.

[0237] FIG. 11 shows a structural block diagram of a computing device according to an embodiment of the disclosure. The components of the computing device 1100 include but are not limited to a memory 1110 and a processor 1120. The processor 1120 is connected with the memory 1110 through a bus 1130, and a database 1150 is used to save data.

[0238] The computing device 1100 also includes an access device 1140 that enables the computing device 1100 to communicate via one or more networks 1160. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or combinations of such networks, such as the Internet. The access device 1140 can include one or more of any type of network interface (for example, a network interface card (NIC)) such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Global System for Mobile (GSM) interface, a Code Division Multiple Access (CDMA) interface, a Bluetooth interface, a Near Field Communication (NFC) interface, a Universal Serial Bus (USB) interface, a Wi-Fi® interface, a Wi-MAX interface, an Ethernet interface, a token ring interface, a wireless entry interface, a token ring interface, and so on.

[0239] In one embodiment of the present disclosure, the above-mentioned components of the computing device 1100 and other components not shown in FIG. 11 can also be connected to each other, for example, through a bus. It should be understood that the computing device structure block diagram shown in FIG. 11 is only for the purpose of example, and is not a limitation on the scope of the present disclosure. Those skilled in the art can add or replace other components as needed.

[0240] The computing device 1100 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (for example, a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, and so on), a mobile phone (for example, a smartphone), a wearable computing device (for example, a smart watch, smart glasses, and so on), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1100 can also be a mobile or stationary server.

[0241] The processor 1120 is configured to execute computer program / instructions that implement the steps of the above-mentioned code processing method or code repair test method when the computer program / instructions are executed by the processor.

[0242] The above is a schematic scheme of the computing device of the embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the code processing method and the code repair test method described above belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be seen from the description of the technical scheme of the code processing method or the code repair test method.

[0243] An embodiment of the present disclosure further provides a computer readable storage medium storing computer programs / instructions, which, when executed by a processor, implement the steps of the code processing method or the code repair test method.

[0244] The above is a schematic scheme of the computer readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the code processing method and the code repair test method described above belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be seen from the description of the technical scheme of the code processing method or the code repair test method.

[0245] An embodiment of the present disclosure further provides a computer program product comprising computer programs / instructions, which, when executed by a processor, implement the steps of the code processing method or the code repair test method.

[0246] The above is a schematic scheme of the computer program product of the embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the code processing method and the code repair test method described above belong to the same concept, and the details of the technical scheme of the computer program product that are not described in detail can be seen from the description of the technical scheme of the code processing method or the code repair test method.

[0247] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order than the order described in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous or necessary.

[0248] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate additions or subtractions according to the requirements of patent practice. For example, according to the patent practice in some regions, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0249] It should be noted that, for the foregoing method embodiments, in order to facilitate description, they are all described as a combination of a series of actions, but those skilled in the art should know that the disclosed embodiments are not limited to the order of the actions described, because according to the disclosed embodiments, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the disclosed embodiments.

[0250] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0251] The preferred embodiments of the disclosure disclosed above are only used to help explain the disclosure. The alternative embodiments do not describe all the details and do not limit the invention to the specific embodiments described. Obviously, according to the content of the disclosed embodiments, many modifications and changes can be made. The disclosure selects and describes these embodiments in order to better explain the principles and practical applications of the disclosed embodiments, so that those skilled in the art can well understand and utilize the disclosure. The disclosure is limited only by the claims and their full scope and equivalents.

Claims

1. A code processing method, comprising: obtaining a code problem of a target project; determining a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent a code context relationship and a code reference relationship of the target project; inputting the code problem and the problem code into a code processing model to obtain an initial repair code; testing the initial repair code by using a test code to obtain a target repair code of the code problem in a case where the test is passed, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

2. The method of claim 1, before the testing the initial repair code by using a test code to obtain a target repair code of the code problem in a case where the test is passed, further comprising: inputting test generation prompt information and the code problem into the code processing model to obtain an initial test code; running the initial test code to obtain an initial running log of the initial test code, wherein the initial running log comprises an initial code problem of the initial test code; in a case where the initial code problem is the same as the code problem, determining the initial test code as the test code.

3. The method of claim 2, after the running the initial test code to obtain an initial running log of the initial test code, further comprising: in a case where the initial code problem is different from the code problem, adjusting the initial test code according to the initial running log until an initial code problem of the adjusted initial test code is the same as the code problem, and determining the adjusted initial test code as the test code.

4. The method of claim 1, after the inputting the code problem and the problem code into a code processing model to obtain an initial repair code, further comprising: performing a function detection on the initial repair code to obtain a function detection result; the testing the initial repair code by using a test code to obtain a target repair code of the code problem in a case where the test is passed, comprising: in a case where the function detection result is a function detection pass, testing the initial repair code by using a test code to obtain a target repair code of the code problem in a case where the test is passed.

5. The method of claim 1 or 4, the testing the initial repair code by using a test code, comprising: running the test code to obtain a test running log of the test code, and running the initial repair code to obtain an initial running log of the initial repair code, wherein the test running log comprises a test code problem of the test code; in a case where the test code problem does not appear in the initial running log, determining a test result of the initial repair code as a test pass.

6. The method of claim 1, the inputting the code problem and the problem code into a code processing model to obtain an initial repair code, comprising: inputting the positioning prompt information, the code problem and the problem code into the code processing model to obtain to-be-repaired code in the problem code; inputting the patching prompt information and the to-be-repaired code into the code processing model to obtain patch code; replacing the to-be-repaired code in the problem code with the patch code to obtain initial repair code.

7. The method of claim 1, wherein determining the problem code of the target project according to the code problem and a code knowledge graph of the target project comprises: constructing a code processing subgraph according to the code problem and the code knowledge graph of the target project, wherein the code processing subgraph comprises a plurality of processing paths; filtering a target processing path from the plurality of processing paths according to the code problem; filtering the problem code of the target project from project code of the target project according to the target processing path.

8. The method of claim 7, wherein filtering the target processing path from the plurality of processing paths according to the code problem comprises: respectively finding leaf nodes corresponding to the plurality of processing paths in the code knowledge graph; calculating a similarity index between the leaf nodes and the code problem; filtering the target processing path from the plurality of processing paths according to the similarity index.

9. The method of claim 7, wherein filtering the problem code of the target project from the project code of the target project according to the target processing path comprises: generating code retrieval information according to the code problem and the target processing path; retrieving a candidate code snippet from the project code of the target project according to the code retrieval information; inputting the code problem and the candidate code snippet into a code positioning model to obtain problem code position information; extracting the problem code from the project code according to the problem code position information.

10. The method of claim 1, wherein before determining the problem code of the target project according to the code problem and the code knowledge graph of the target project, the method further comprises: obtaining project code of the target project; performing syntax analysis on the project code to determine a plurality of code entities; constructing a code hierarchy tree according to context relationships of the plurality of code entities; adding directed edges in the code hierarchy tree according to reference relationships between the plurality of code entities to obtain the code knowledge graph of the target project.

11. A code repair testing method, comprising: obtaining a code problem of a target project and initial repair code, wherein the initial repair code is obtained by a code processing model based on the code problem and problem code, the problem code is obtained based on the code problem and a code knowledge graph of the target project, and the code knowledge graph is used to represent code context relationships and code reference relationships of the target project. The initial repair code is tested by using test code, and in a case where the test is passed, target repair code of the code problem is obtained, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

12. A code processing method applied to a task platform, comprising: receiving a code problem of a target project sent by a client; determining problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is used to represent code context relationship and code reference relationship of the target project; inputting the code problem and the problem code into a code processing model to obtain initial repair code; testing the initial repair code by using test code, and in a case where the test is passed, target repair code of the code problem is obtained, wherein the test code is obtained based on the code problem, and the test code is used to reproduce the code problem.

13. The method of claim 12, before the inputting the code problem and the problem code into the code processing model to obtain the initial repair code, further comprising: determining the code processing model from a plurality of processing models based on a model request, wherein the model request comprises at least one of scene identification of a target scene, scene input data of the target scene, and model specification parameters.

14. The method of claim 13, wherein the model request comprises the scene identification of the target scene; the determining the code processing model from the plurality of processing models based on the model request comprises: finding the code processing model adapted to the target scene from a model library based on the scene identification of the target scene, wherein the model library stores a plurality of processing models adapted to different task scenes.

15. The method of claim 13, wherein the model request comprises the scene input data of the target scene; the determining the code processing model from the plurality of processing models based on the model request comprises: determining an initial processing model adapted to the target scene from the plurality of processing models; training the initial processing model based on the scene input data of the target scene to obtain the code processing model.

16. The method of claim 13, wherein the model request comprises the model specification parameters; the determining the code processing model from the plurality of processing models based on the model request comprises: finding a corresponding code processing model from a model library based on the model specification parameters, wherein the model library stores a plurality of processing models with different model specification parameters.

17. A task platform comprising a request interface and a response unit; the request interface is configured to receive a code problem of a target project sent by a client; The response unit is configured to determine a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein the code knowledge graph is configured to represent a code context relationship and a code reference relationship of the target project; input the code problem and the problem code into a code processing model to obtain an initial repair code; and test the initial repair code by using a test code, and obtain a target repair code of the code problem in a case where the test is passed, wherein the test code is obtained based on the code problem, and the test code is configured to reproduce the code problem.

18. A code processing system comprising a client and a server. The client is configured to send a code problem of a target project to the server. The server is configured to determine a problem code of the target project according to the code problem and a code knowledge graph of the target project, wherein The code knowledge graph is configured to represent a code context relationship and a code reference relationship of the target project; input the code problem and the problem code into a code processing model to obtain an initial repair code; Test the initial repair code by using a test code, and obtain a target repair code of the code problem in a case where the test is passed, wherein the test code is obtained based on the code problem, and the test code is configured to reproduce the code problem; and send the target repair code of the code problem to the client. The client is further configured to receive the target repair code of the code problem sent by the server.

19. A computing device comprising: a memory and a processor; The memory is configured to store computer programs / instructions, and the processor is configured to execute the computer programs / instructions, and the computer programs / instructions are configured to implement the steps of the method of any one of claims 1 to 16 when executed by the processor.

20. A computer-readable storage medium storing computer programs / instructions, and the computer programs / instructions are configured to implement the steps of the method of any one of claims 1 to 16 when executed by the processor.

21. A computer program product comprising computer programs / instructions, and the computer programs / instructions are configured to implement the steps of the method of any one of claims 1 to 16 when executed by the processor.

Citation Information

Patent Citations

  • Defect positioning method and system based on code knowledge graph

    CN115629760A

  • Code repairing method and device, computer equipment and storage medium

    CN117055950A

  • Test processing method and system

    CN118051429A

  • Advanced vulnerability mining and automatic testing method and testing system based on large language model

    CN118171288A

  • Code odor detection and reconstruction guide technology based on large model

    CN118210729A