Software code exception handling method and device, equipment, medium and program product

By combining knowledge bases and language models, software code exceptions are handled automatically, solving the problem of low efficiency in manual analysis in existing technologies and realizing an efficient and accurate exception repair process.

CN121743094APending Publication Date: 2026-03-27BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511948258.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

The software code's exception handling is inefficient, relying on manual analysis, which leads to low efficiency and makes it difficult to cope with complex scenarios.

Method used

By using a knowledge base to store historical anomaly causes and handling methods, and combining this with a first language model to parse the anomaly information, processing suggestions are provided. The knowledge base is then updated based on feedback information to achieve automated anomaly handling.

Benefits of technology

It improves the efficiency and accuracy of software code exception handling, realizes an automated process from exception analysis to repair, and reduces manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121743094A_ABST
    Figure CN121743094A_ABST
Patent Text Reader

Abstract

The invention discloses a software code exception handling method and device, equipment, a medium and a program product, and relates to the field of data processing technologies, artificial intelligence technologies, large model technologies and large language models.The method comprises the steps that exception information of software codes uploaded by terminal equipment is obtained; analyzing the abnormal information, and processing an analysis result of the abnormal information through a first language model and a knowledge base to obtain a processing suggestion for the abnormal information, the knowledge base being used for storing historical abnormal reasons and processing modes for the historical abnormal reasons; feeding back the processing suggestion of the abnormal information to the terminal equipment; and receiving feedback information aiming at the processing suggestions, and updating the knowledge base by utilizing the feedback information and the processing suggestions of the abnormal information. The problem that the exception handling efficiency of software codes is low can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, specifically to methods, apparatus, devices, media, and program products for handling exceptions in software code. Background Technology

[0002] In software development and maintenance scenarios, after a software system triggers an anomaly alarm, it is necessary to rely on manual methods to locate and analyze the anomaly in the software code, which results in low efficiency in handling anomalies in the software code. Summary of the Invention

[0003] In view of this, the present disclosure provides a method, apparatus, device, medium and program product for exception handling of software code, so as to solve the problem of low efficiency in exception handling of software code.

[0004] Firstly, this disclosure provides an exception handling method for software code, including: Obtain exception information from the software code uploaded by the terminal device; The abnormal information is parsed, and the parsing results are processed using a first language model and a knowledge base to obtain processing suggestions for the abnormal information. The knowledge base is used to store historical abnormal causes and processing methods for the historical abnormal causes. The processing suggestions for the abnormal information are fed back to the terminal device; The system receives feedback information regarding the processing suggestions and updates the knowledge base using the feedback information and the processing suggestions for the anomaly information.

[0005] Secondly, this disclosure provides an exception handling apparatus for software code, comprising: The data acquisition module is used to acquire abnormal information of the software code uploaded by the terminal device; The data processing module is used to parse the abnormal information and process the parsing results of the abnormal information through a first language model and a knowledge base to obtain processing suggestions for the abnormal information. The knowledge base is used to store historical abnormal causes and processing methods for the historical abnormal causes. The data feedback module is used to feed back the processing suggestions of the abnormal information to the terminal device; The data update module is used to receive feedback information regarding the processing suggestions and to update the knowledge base using the feedback information and the processing suggestions for the anomaly information.

[0006] Thirdly, this disclosure provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the exception handling method of the software code of the first aspect or any corresponding embodiment described above.

[0007] Fourthly, this disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to execute the exception handling method of the software code of the first aspect or any corresponding embodiment described above.

[0008] Fifthly, this disclosure provides a computer program product, including computer instructions for causing a computer to execute the software code of the first aspect or any corresponding embodiment described above, an exception handling method.

[0009] The software code exception handling method provided in this disclosure utilizes a knowledge base to store historical exception causes and corresponding handling methods. Furthermore, when exception information of software code uploaded by a terminal is obtained, the knowledge base can provide reference information for exception handling. The parsing results of the exception information are processed using a first language model and the knowledge base to obtain handling suggestions for the exception information, which are then fed back to the terminal device to improve the efficiency of software code exception handling. The knowledge base is updated using the feedback information on the handling suggestions and the exception information handling suggestions themselves, thereby continuously enriching the knowledge base and improving the accuracy of software code exception handling.

[0010] The beneficial effects of exception handling devices, electronic devices, storage media, and program products in software code correspond to the beneficial effects of exception handling methods in software code, and will not be elaborated further here. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram of an optional application scenario according to an embodiment of the present disclosure; Figure 2 This is a flowchart illustrating an exception handling method for software code according to an embodiment of the present disclosure; Figure 3 This is a schematic diagram of a configuration page according to an embodiment of the present disclosure; Figure 4 This is a schematic diagram of another configuration page according to an embodiment of the present disclosure; Figure 5 This is a schematic diagram showing a processing suggestion according to an embodiment of the present disclosure; Figure 6 This is a schematic diagram of an operation page according to an embodiment of the present disclosure; Figure 7 This is a flowchart illustrating another software code exception handling method according to an embodiment of the present disclosure; Figure 8 This is a schematic diagram of a software code processing flow according to an embodiment of the present disclosure; Figure 9 This is a schematic diagram illustrating the updating of a knowledge base according to an embodiment of this disclosure; Figure 10 This is a schematic diagram of a code analysis platform according to an embodiment of the present disclosure; Figure 11 This is a structural block diagram of an exception handling apparatus for software code according to an embodiment of the present disclosure; Figure 12 This is a structural block diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0014] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0015] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0016] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0017] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0018] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0019] In software development and operations scenarios, when a software system triggers an anomaly alert, it's necessary to utilize detection tools, source maps, and knowledge bases for anomaly localization and analysis. Source maps are used to precisely locate the source code of the anomaly, while knowledge bases store historical anomaly information. Additionally, related anomalies can be searched online for further localization and analysis. These methods of anomaly localization and analysis collectively form the technical foundation for anomaly handling in software code. Finally, the code containing the anomaly is modified, and a Merge Request (MR) is created to fix the anomaly in the software code.

[0020] In related technologies, the exception handling process for software code mainly follows the sequence of exception information reporting, exception analysis, exception location, and code modification. This process heavily relies on manual review of local materials or knowledge bases, making it difficult to efficiently handle code exceptions. Furthermore, code commits, merge requests, and code reviews (CR) all require manual operation, and historical fixes also rely on manual accumulation, resulting in poor reusability and low exception handling efficiency, making it difficult to cope with complex scenarios.

[0021] In view of the above, according to the embodiments of this disclosure, an embodiment of an exception handling method for software code is provided. It should be noted that the steps shown in the flowcharts in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0022] As one optional application scenario of this disclosure embodiment, such as Figure 1As shown, the exception handling scenario for the software code includes a terminal device 10 and a server 20. The terminal device 10 connects to the server 20. When the terminal device 10 detects an anomaly in the deployed software code, it sends exception information to the server 20. The server 20 performs exception handling based on the exception information to repair the software code.

[0023] This embodiment provides an exception handling method for software code, which can be used in the aforementioned server 20. Figure 2 This is a flowchart illustrating an exception handling method for software code according to an embodiment of the present disclosure, as shown below. Figure 2 As shown, the process includes the following steps: Step S201: Obtain the exception information of the software code uploaded by the terminal device.

[0024] The exception information includes an exception description. Optionally, the exception information may also include stack traces of the software code.

[0025] See Figure 3 The server displays a configuration page, through which users can configure anomaly analysis tasks for the software code. This includes basic information about the anomaly analysis task and anomaly settings. The basic information includes the title and repair type of the anomaly analysis task; the repair type represents the server's access permissions to the software code.

[0026] like Figure 3 As shown, if the repair type is custom (i.e., the server does not have access to the software code), the exception settings configuration items include configuration items for the exception triggering link and configuration items for the code repository. The corresponding area for the exception triggering link configuration item displays the user documentation. The user documentation records the interface for code exception handling. Users can connect the terminal device containing the software code to be analyzed to this interface according to the user documentation. Thus, when the terminal device detects a software code exception, it can use this interface to transmit the exception information of the software code to the server, allowing the server to obtain the exception information. Simultaneously, users can configure the repository address of the code repository containing the software code through the code repository configuration item to facilitate software code repair.

[0027] like Figure 4As shown, if the repair type is a software platform with permissions (i.e., the server has access to the software code), the server can directly obtain the exception information of the software code. In this case, the exception settings configuration items include configuration items for the code repository and configuration items for the software code. Users can configure the repository address of the code repository containing the software code through the code repository configuration items, and configure the software code to be analyzed in the code repository through the software code configuration items.

[0028] Step S202: The abnormal information is parsed, and the parsing results are processed through the first language model and knowledge base to obtain processing suggestions for the abnormal information. The knowledge base is used to store historical abnormal causes and processing methods for historical abnormal causes.

[0029] Specifically, parsing exception information includes extracting exception description information and stack trace information. The exception description information includes exception metrics for at least one analytical dimension. The stack trace information is used to characterize the exception scenario in the business logic of the software code. Furthermore, exception information may also include the exception triggering link and the exception reporting time, so as to identify the software code corresponding to the exception information through the exception triggering link, and to determine the time of exception occurrence through the exception reporting time.

[0030] Optionally, the first language model is a large language model (LLM).

[0031] Optionally, the suggestions for handling abnormal information include one or more of the abnormal causes and handling methods related to the parsing results obtained from the knowledge base, and abnormal causes and handling methods related to the parsing results obtained from non-knowledge base methods.

[0032] Step S203: Feedback the handling suggestions for the abnormal information to the terminal device.

[0033] Specifically, the server sends the exception information and handling suggestions back to the terminal device. The terminal device displays a first page, which shows the exception information and handling suggestions. For example... Figure 5 The exception triggering link, exception reporting time, and exception description information are shown. The exception cause and handling method obtained using the knowledge base are shown. The exception cause obtained using non-knowledge base methods are shown.

[0034] In addition, the exception handling method of the software code disclosed herein also includes: obtaining the reference source of the handling suggestion and feeding back the reference source to the terminal device. The terminal device also displays the reference source of the handling suggestion on the first page to improve the credibility of the handling suggestion.

[0035] Step S204: Receive feedback information on the processing suggestions, and update the knowledge base using the feedback information and the processing suggestions for the exception information.

[0036] Specifically, if the feedback indicates that the processing suggestion is adopted, the knowledge base is updated using the processing suggestion. If the feedback indicates that the processing suggestion is not adopted, the knowledge base is not updated.

[0037] See Figure 5 The first page also displays feedback controls, such as controls indicating whether the feedback suggestion is unhelpful or helpful. If the user interacts with a helpful control, the terminal device sends a message to the server indicating that the suggestion is accepted. If the user interacts with a unhelpful control, the terminal device sends a message to the server indicating that the suggestion is not accepted.

[0038] Furthermore, the first page also displays a repair control that users can interact with, causing the terminal device to respond to the interaction and display the second page. See also Figure 6 The second page displays detailed processing suggestions, such as the optimal processing method. It also shows the cause of the exception corresponding to the optimal processing method. If the optimal processing method has corresponding fix code, the fix code can also be displayed on the second page. Furthermore, the second page may display exception description information, exception trigger links, operation logs, etc., to assist users in deciding whether to adopt the optimal processing method. In response to the interaction with the second page, the terminal device sends feedback information to the server to indicate whether the terminal device has adopted the optimal processing method.

[0039] The software code exception handling method provided in this embodiment utilizes a knowledge base to store historical exception causes and corresponding handling methods. Therefore, when exception information of software code uploaded by the terminal is obtained, the knowledge base can provide reference information for exception handling. The parsing results of the exception information are processed using a first language model and the knowledge base to obtain handling suggestions for the exception information, which are then fed back to the terminal device to improve the efficiency of software code exception handling. Furthermore, the knowledge base is updated using the feedback information on the handling suggestions and the exception information handling suggestions themselves, thereby continuously enriching the knowledge base and improving the accuracy of software code exception handling.

[0040] In some optional implementations, the parsing results of the abnormal information using the first language model and knowledge base in step S202 above are processed to obtain processing suggestions for the abnormal information, including: Step a1: If the parsing result includes stack information and exception description information of the software code, then query the knowledge base using the first language model to find the first exception cause related to the parsing result and the handling method for the first exception cause.

[0041] In practical applications, one can use only the first language model to query the knowledge base for the first cause of the anomaly and the handling method for the first cause of the anomaly.

[0042] Step a2: Based on the second language model, stack information, first exception cause, and the handling method of the first exception cause, process the exception description information to obtain the second exception cause corresponding to the exception information, the handling method for the second exception cause, and the first repair code, so as to obtain a processing suggestion. The processing suggestion includes the second exception cause, the handling method for the second exception cause, and the first repair code.

[0043] Optionally, the second language model is a large language model, specifically the large language model upon which the code agent relies.

[0044] Specifically, a first prompt word is generated based on the anomaly information, the first cause of the anomaly, and the handling method for the first cause of the anomaly. The first prompt word instructs the second language model to analyze the anomaly description information in the anomaly information based on the first cause of the anomaly, the handling method for the first cause of the anomaly, and the stack trace information in the anomaly information, to obtain handling suggestions for the anomaly information. The first prompt word is then input into the second language model to obtain handling suggestions for the anomaly information.

[0045] The software code exception handling method provided in this embodiment, when the parsing result includes stack information and exception description information of the software code, not only queries the knowledge base for a first exception cause and a handling method for the first exception cause related to the parsing result using a first language model, but also further processes the exception description information based on a second language model, stack information, the first exception cause, and the handling method for the first exception cause to obtain a second exception cause corresponding to the exception information, a handling method for the second exception cause, and a first repair code. Therefore, on the one hand, the second exception cause and its handling method can be used to provide a reference for software code exception repair. On the other hand, when adopting the handling method for the second exception cause, the automatically generated first repair code can be used to quickly repair the exception code in the software code, thereby further improving the repair efficiency of the software code and realizing automated processing from exception analysis to exception repair.

[0046] In some optional implementations, the software code exception handling method of this disclosure further includes: obtaining the repository address of the code repository where the software code is located when the feedback information indicates that the processing method of adopting the second exception cause is adopted; obtaining the software code from the code repository based on the repository address; repairing the software code using the first repair code to obtain the repaired code; and updating the software code in the code repository based on the repaired code.

[0047] Specifically, if the feedback information indicates that the handling method for the second cause of the anomaly has been adopted, the server completely copies the software code from the remote code repository to the local machine. Based on the handling method for the second cause of the anomaly, the server uses the first repair code to repair the software code, obtaining the repaired code. Then, the server updates the software code in the code repository based on the repaired code, thereby achieving automatic repair of the software code.

[0048] The software code exception handling method provided in this embodiment, when the feedback information indicates that the handling method for the second exception cause has been adopted, retrieves the software code from the code repository based on the repository address, and repairs the software code using the first repair code to obtain the repaired code, thereby updating the software code in the code repository. Compared to directly repairing the software code in the code repository, this method avoids the software code becoming unrecoverable due to code repair errors, thus improving the reliability of software code repair.

[0049] In some optional implementations, step S202 above, which involves processing the parsing results of the abnormal information using a first language model and a knowledge base to obtain processing suggestions for the abnormal information, further includes: Step a3: If no first abnormal cause or handling method related to the parsing result is found, the parsing result is processed based on the second language model and stack information to obtain the third abnormal cause corresponding to the abnormal information, the handling method for the third abnormal cause, and the second repair code, so as to obtain processing suggestions. The processing suggestions include the third abnormal cause, the handling method for the third abnormal cause, and the second repair code.

[0050] Specifically, a second prompt word is generated based on the anomaly information. This second prompt word instructs the second language model to analyze the anomaly description information within the anomaly information based on the stack trace information, and to obtain processing suggestions for the anomaly. The second prompt word is then input into the second language model to obtain processing suggestions for the anomaly information.

[0051] The software code exception handling method provided in this embodiment, if no first exception cause related to the parsing result and no handling method for the first exception cause are found, processes the parsing result based on a second language model and stack information to obtain a third exception cause corresponding to the exception information, a handling method for the third exception cause, and second repair code. Therefore, it can be applied to more exception handling scenarios in software code, and when adopting the handling method for the third exception cause, the automatically generated second repair code can be used to quickly repair the exception code in the software code.

[0052] In some optional implementations, the software code exception handling method of this disclosure further includes: obtaining the repository address of the code repository where the software code is located when the feedback information indicates that the handling method for the third exception cause has been adopted; obtaining the software code from the code repository based on the repository address; repairing the software code using the second repair code to obtain the repaired code; and updating the software code in the code repository based on the repaired code.

[0053] In some optional implementations, the parsing results of the abnormal information using the first language model and knowledge base in step S202 above are processed to obtain processing suggestions for the abnormal information, including: Step b1: If the parsing result only includes the exception description information of the software code, then query the knowledge base using the first language model to find the fourth exception cause related to the parsing result and the handling method for the fourth exception cause.

[0054] It should be noted that the query method for the fourth abnormal cause and its handling method can be the same as the query method for the first abnormal cause and its handling method, and will not be elaborated further here.

[0055] Step b2 involves querying and parsing the results of the fifth anomaly and the corresponding handling methods through a third language model and non-knowledge base methods.

[0056] The number of third language models can be one or more.

[0057] The aforementioned non-knowledge base approaches refer to methods other than knowledge bases, such as online searches. This section discusses the fifth anomaly related to the results of online searches and parsing using a third language model, as well as the handling methods for this fifth anomaly.

[0058] In some optional implementations, step b2 above includes: querying candidate anomaly causes and processing methods for candidate anomaly causes in parallel using non-knowledge base methods and multiple third language models. Then, using a fourth language model and the parsing results, the candidate anomaly causes and their processing methods are filtered to obtain a fifth anomaly cause and its processing method.

[0059] That is, multiple third-language models are simultaneously initiated to query and parse candidate anomaly causes and corresponding handling methods related to the results through non-knowledge base means (such as online search). Through a fourth-language model, the anomaly cause and its corresponding handling method that best match the anomaly description information are selected from all the queried candidate anomaly causes and their handling methods to obtain the fifth anomaly cause and its handling method.

[0060] Optionally, the third language model is a large language model, and the fourth language model is a thinking model.

[0061] Step b3: Based on the fourth abnormal cause, the fifth abnormal cause, the handling method for the fourth abnormal cause, and the handling method for the fifth abnormal cause, a handling suggestion is obtained.

[0062] The software code exception handling method provided in this embodiment, if the parsing result only includes exception description information of the software code, not only queries the knowledge base related to the parsing result for a fourth exception cause and the handling method for the fourth exception cause through the first language model, but also further queries the knowledge base related to the parsing result for a fifth exception cause and the handling method for the fifth exception cause through the third language model and non-knowledge base methods. By combining the fourth exception cause, the fifth exception cause, the handling method for the fourth exception cause, and the handling method for the fifth exception cause, a processing suggestion is obtained. Therefore, more optional processing methods can be provided through multi-dimensional queries of exception causes and handling methods.

[0063] In some optional implementations, step S204 includes: if the feedback information indicates that a processing suggestion has been adopted, querying the knowledge base to determine the existence of the cause of the anomaly in the processing suggestion. If the cause of the anomaly in the processing suggestion does not exist in the knowledge base, then the knowledge base is updated using the processing suggestion.

[0064] Specifically, when the feedback information represents the adoption of processing suggestions and the processing suggestions are related to anomaly analysis tasks, the existence of the anomaly causes in the processing suggestions in the knowledge base is queried; if the anomaly causes in the processing suggestions do not exist in the knowledge base, the knowledge base is updated using the processing suggestions.

[0065] Optionally, if the knowledge base contains an exception reason as suggested in the processing recommendations, but the processing method for that exception reason in the knowledge base differs from the processing method in the processing recommendations, the knowledge base can be updated using the processing recommendations. For example, the processing method for the exception reason in the processing recommendations can be used to supplement or replace the processing method for the corresponding exception reason in the knowledge base.

[0066] The exception handling method for software code provided in this embodiment only updates the knowledge base using the processing suggestion if the feedback information indicates that the processing suggestion has been adopted and the reason for the exception in the processing suggestion does not exist in the knowledge base. Therefore, it can avoid frequent changes to the knowledge base and avoid unnecessary consumption of computing resources.

[0067] As one specific application example, see Figure 7The terminal device is equipped with a detection tool that detects anomalies in the software code deployed on the terminal device and reports these anomalies to the server. The server parses the anomalies to obtain the parsed software code. Based on the presence of stack trace information in the parsed results, the server has two exception handling methods.

[0068] The exception handling process is as follows: If stack trace information exists in the parsed results, the cause of the exception and the corresponding handling method in the software code are obtained from the knowledge base. Using the second language model and the information from the knowledge base, the parsed results of the exception information are processed to obtain the exception cause, handling method, and repair code, thus generating a handling suggestion for the exception information. This handling suggestion is then fed back to the terminal device. Feedback information regarding the handling suggestion is received. If the feedback information indicates that the handling suggestion is adopted, the software code is repaired using the repair code, and the knowledge base is updated using the exception handling suggestion.

[0069] Another exception handling approach is as follows: If the parsed results do not contain stack trace information, the cause of the software code exception and the corresponding handling method are obtained through the knowledge base and non-knowledge base methods to obtain exception handling suggestions. These suggestions are then fed back to the terminal device. Feedback information regarding the handling suggestions is received, and the knowledge base is updated using the feedback information and the exception handling suggestions.

[0070] As another specific application example, see Figure 8 The above two exception handling methods mainly include the following: If stack traces are present in the parsed results, the relevant cause of the exception and its corresponding handling method are retrieved from the knowledge base. Using the second language model, relevant information from the knowledge base, and the stack trace of the software code in the parsed results, the parsed results are processed to obtain the cause of the exception, the handling method, and the repair code corresponding to the exception information, thus generating a handling suggestion for the exception information. This handling suggestion is then fed back to the terminal device. Feedback information regarding the handling suggestion is received; if the feedback information indicates that the handling suggestion is adopted, the repair code is used to fix the software code.

[0071] If the parsing results do not contain stack information, the system uses non-knowledge base methods and multiple third-language models in parallel to query the anomaly causes and corresponding handling methods related to the parsing results. Using a fourth-language model and the parsing results, the system filters the anomaly causes and handling methods retrieved from the multiple third-language models. The system then retrieves the anomaly causes and corresponding handling methods related to the parsing results from the knowledge base. Based on the anomaly causes and handling methods obtained using the fourth-language model and the knowledge base, the system provides handling suggestions for the anomaly information. These handling suggestions are then fed back to the terminal device.

[0072] For example, see one specific application example. Figure 9 The exception handling method in the software code disclosed herein includes the following main steps in the server's knowledge base update process: Obtaining exception information; Creating an exception analysis task; Parsing the exception information and processing the parsing results to obtain processing suggestions; Feeding back the processing suggestions to the terminal device and receiving feedback information regarding the suggestions; Determining whether to adopt the processing suggestions based on the feedback information; If not, the knowledge base update process ends; If yes, it further determines whether the processing suggestions are associated with an exception analysis task. If the processing suggestions are not associated with an exception analysis task, the knowledge base update process ends. If the processing suggestions are associated with an exception analysis task, it determines whether the processing suggestions exist in the knowledge base; otherwise, it updates the knowledge base based on the processing suggestions. If yes, the knowledge base update process ends.

[0073] As one specific application example, see Figure 10 Taking a code analysis platform that applies the exception handling method of the software code disclosed herein as an example, this code analysis platform includes a platform layer, an application side, code processing, and a pipeline. The platform layer interfaces with the terminal device, providing it with the ability to configure basic information for exception analysis tasks and collecting exception information from the software code on the terminal device. After collecting the exception information, the platform layer parses the exception information to obtain the parsing results. Then, the code processing layer retrieves relevant information from the knowledge base and / or queries relevant information from non-knowledge base sources based on the parsing results. The code processing layer then analyzes the parsing results of the exception information using a second language model and the retrieved information to obtain processing suggestions for the exception information. The platform layer then feeds back the processing suggestions to the terminal device. If the terminal device adopts the processing suggestion and the suggestion contains repair code, the code processing layer uses the repair code to repair the software code.

[0074] During the processing of the parsed results by the code processing layer, the language model automatically combines and configures the necessary basic functions from the pipeline layer based on the received information. These configured functions are then used to process exception information, determining the cause of the exception and the corresponding handling method, thus achieving automated software code analysis. Simultaneously, the language model also communicates with external systems by calling the Application Programming Interface (API) and submits repair code to the terminal device or the software code repository to fix the software code, achieving automated software code repair.

[0075] In addition, the software code exception handling method disclosed herein can also screen valid stack traces, exception descriptions, and related objects (such as the software code owner) in the software code based on exception information, the reporting time of the exception information, and exception classification information. The screened information is then submitted to the language model for exception statistics, yielding exception statistics information. This exception statistics information can include the quantity and percentage of various exceptions, as well as the classification and analysis of exception causes. Furthermore, the platform layer, based on the aforementioned business lines or related objects, periodically outputs software code quality reports according to the exception statistics information.

[0076] Because it is possible to build a software code exception automatic repair and knowledge storage platform based on language model (i.e., the code analysis platform mentioned above), by integrating functions such as stack information exception information parsing, language model reasoning, non-knowledge base query and knowledge archiving of the knowledge base, it can realize automated exception handling and reuse of exception handling-related knowledge.

[0077] It is evident that, compared to related technologies, the software code exception handling method disclosed herein can utilize language models to achieve automated analysis, repair, and optimization of software code exceptions, and combine historical knowledge in the knowledge base with knowledge from non-knowledge base sources to improve exception handling efficiency and automation.

[0078] This embodiment also provides an exception handling device for software code, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0079] This embodiment provides an exception handling device for software code, such as... Figure 11 As shown, it includes: The data acquisition module 1101 is used to acquire abnormal information of the software code uploaded by the terminal device.

[0080] The data processing module 1102 is used to parse abnormal information and process the parsing results of abnormal information through a first language model and a knowledge base to obtain processing suggestions for abnormal information. The knowledge base is used to store historical abnormal causes and processing methods for historical abnormal causes.

[0081] The data feedback module 1103 is used to feed back suggestions for handling abnormal information to the terminal device.

[0082] The data update module 1104 is used to receive feedback information on processing suggestions and update the knowledge base using the feedback information and the processing suggestions on anomaly information.

[0083] In some alternative implementations, the data processing module 1102 includes: The first processing unit is used to query the knowledge base related to the first exception cause and the handling method for the first exception cause if the parsing result includes stack information and exception description information of software code, through the first language model.

[0084] The second processing unit is used to process the exception description information based on the second language model, stack information, first exception cause, and processing method of the first exception cause to obtain the second exception cause corresponding to the exception information, the processing method for the second exception cause, and the first repair code, so as to obtain processing suggestions. The processing suggestions include the second exception cause, the processing method for the second exception cause, and the first repair code.

[0085] In some optional embodiments, the exception handling apparatus of the software code of this disclosure further includes: The address acquisition module is used to obtain the repository address of the code repository where the software code is located when the feedback information indicates that the handling method of the second abnormal reason has been adopted.

[0086] The code retrieval module is used to retrieve software code from a code repository based on the repository address.

[0087] The code repair module is used to repair the software code using the first repair code, resulting in the repaired code.

[0088] The code update module is used to update the software code in the code repository based on the fixed code.

[0089] In some alternative implementations, the data processing module 1102 includes: The third processing unit is used to process the parsing result based on the second language model and stack information if no first abnormal cause or processing method related to the parsing result is found, to obtain the third abnormal cause corresponding to the abnormal information, the processing method for the third abnormal cause, and the second repair code, so as to obtain processing suggestions. The processing suggestions include the third abnormal cause, the processing method for the third abnormal cause, and the second repair code.

[0090] In some alternative implementations, the data processing module 1102 includes: The fourth processing unit is used to query the knowledge base related to the parsing result and the processing method for the fourth exception cause if the parsing result only includes the exception description information of the software code.

[0091] The fifth processing unit is used to query and parse the results of the fifth anomaly and the processing method for the fifth anomaly through the third language model and non-knowledge base methods.

[0092] The sixth processing unit is used to obtain processing suggestions based on the fourth abnormal cause, the fifth abnormal cause, the processing method of the fourth abnormal cause, and the processing method of the fifth abnormal cause.

[0093] In some alternative implementations, the fifth processing unit includes: The search subunit is used to query and parse candidate anomaly causes and processing methods related to candidate anomaly causes in parallel through non-knowledge base methods and multiple third language models.

[0094] The filtering subunit is used to filter candidate anomaly causes and their handling methods based on the fourth language model and the parsing results, to obtain the fifth anomaly cause and its handling method.

[0095] In some alternative implementations, the data update module 1104 includes: The query unit is used to query the existence of the anomaly cause in the processing suggestion in the knowledge base, given that the feedback information represents the adoption and processing suggestion.

[0096] The data update unit is used to update the knowledge base using the processing suggestions if the reason for the exception in the processing suggestions does not exist in the knowledge base.

[0097] The software code exception handling device provided in this disclosure can execute the software code exception handling method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method. The exception handling device of this disclosure utilizes a knowledge base to store historical exception causes and processing methods for those causes. Furthermore, when obtaining exception information of software code uploaded by the terminal, the knowledge base can be used to provide reference information for exception information processing. The parsing results of the exception information are processed through a first language model and the knowledge base to obtain processing suggestions for the exception information and feed them back to the terminal device, thereby improving the efficiency of software code exception handling. The knowledge base is updated using the feedback information on the processing suggestions and the processing suggestions for the exception information, thereby continuously enriching the knowledge base and improving the accuracy of software code exception handling.

[0098] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0099] Figure 12 This is a structural block diagram of an electronic device provided in an embodiment of the present disclosure.

[0100] The following is a detailed reference. Figure 12 The diagram illustrates a structural block diagram suitable for implementing an electronic device according to embodiments of the present disclosure. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 1201, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1202 or a program loaded from memory 1208 into random access memory (RAM) 1203. Various programs and data required for the operation of the electronic device are also stored in RAM 1203. The processor 1201, ROM 1202, and RAM 1203 are interconnected via bus 1204. An input / output (I / O) interface 1205 is also connected to bus 1204.

[0101] Typically, the following devices can be connected to I / O interface 1205: input devices 1206 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 1207 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; memory 1208 including, for example, magnetic tape, hard disk, etc.; and communication devices 1209. Communication device 1209 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 12 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0102] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1209, or installed from memory 1208, or installed from ROM 1202. When the computer program is executed by processor 1201, the functions defined above in the exception handling method of the software code of embodiments of this disclosure are performed.

[0103] Figure 12 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0104] This disclosure also provides a computer-readable storage medium in which the methods described in this disclosure can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded over a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the exception handling methods of the software code shown in the above embodiments.

[0105] A portion of this disclosure can be applied to computer program products, such as computer program instructions, which, when executed by a computer, can invoke or provide methods and / or technical solutions according to this disclosure through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, and installation package files. Accordingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions; the computer compiling the instructions and then executing the corresponding compiled program; the computer reading and executing the instructions; or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0106] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for exception handling in software code, characterized in that, include: Obtain exception information from the software code uploaded by the terminal device; The abnormal information is parsed, and the parsing results are processed using a first language model and a knowledge base to obtain processing suggestions for the abnormal information. The knowledge base is used to store historical abnormal causes and processing methods for the historical abnormal causes. The processing suggestions for the abnormal information are fed back to the terminal device; The system receives feedback information regarding the processing suggestions and updates the knowledge base using the feedback information and the processing suggestions for the anomaly information.

2. The method according to claim 1, characterized in that, The step of processing the parsing results of the abnormal information using a first language model and a knowledge base to obtain processing suggestions for the abnormal information includes: If the parsing result includes stack information and exception description information of the software code, then the first language model is used to query the knowledge base for the first exception cause related to the parsing result and the handling method for the first exception cause. Based on the second language model, the stack information, the first exception cause, and the handling method of the first exception cause, the exception description information is processed to obtain the second exception cause corresponding to the exception information, the handling method for the second exception cause, and the first repair code, so as to obtain the processing suggestion, which includes the second exception cause, the handling method for the second exception cause, and the first repair code.

3. The method according to claim 2, characterized in that, Also includes: If the feedback information indicates that the handling method for the second abnormal cause is adopted, the repository address of the code repository where the software code is located is obtained; The software code is obtained from the code repository based on the repository address; The software code is repaired using the first repair code to obtain the repaired code; The software code in the code repository is updated based on the repaired code.

4. The method according to claim 2, characterized in that, The step of processing the parsing results of the abnormal information using a first language model and a knowledge base to obtain processing suggestions for the abnormal information also includes: If no first anomaly cause or handling method related to the parsing result is found, the parsing result is processed based on the second language model and the stack information to obtain a third anomaly cause corresponding to the anomaly information, a handling method for the third anomaly cause, and a second repair code, so as to obtain the processing suggestion, which includes the third anomaly cause, the handling method for the third anomaly cause, and the second repair code.

5. The method according to claim 1, characterized in that, The step of processing the parsing results of the abnormal information using a first language model and a knowledge base to obtain processing suggestions for the abnormal information includes: If the parsing result only includes the abnormal description information of the software code, then the first language model is used to query the knowledge base for a fourth abnormal cause related to the parsing result and the processing method for the fourth abnormal cause; The fifth anomaly cause related to the parsing result and the handling method for the fifth anomaly cause are queried through a third language model and non-knowledge base methods. Based on the fourth abnormal cause, the fifth abnormal cause, the handling method for the fourth abnormal cause, and the handling method for the fifth abnormal cause, the handling suggestion is obtained.

6. The method according to claim 5, characterized in that, The method of querying the fifth anomaly cause related to the parsing result through a third language model and non-knowledge base methods, and the processing method for the fifth anomaly cause, includes: Using the non-knowledge base approach and multiple third language models, candidate anomaly causes related to the parsing results and processing methods for the candidate anomaly causes are queried in parallel. Using the fourth language model and the parsing results, the candidate anomaly causes and their processing methods are filtered to obtain the fifth anomaly cause and its processing method.

7. The method according to claim 1, characterized in that, The method of updating the knowledge base using the feedback information and the processing suggestions for the anomaly information includes: If the feedback information indicates that the processing suggestion is adopted, query the existence of the anomaly cause in the processing suggestion in the knowledge base. If the knowledge base does not contain the abnormal cause mentioned in the processing suggestion, then the knowledge base is updated using the processing suggestion.

8. An exception handling device for software code, characterized in that, include: The data acquisition module is used to acquire abnormal information of the software code uploaded by the terminal device; The data processing module is used to parse the abnormal information and process the parsing results of the abnormal information through a first language model and a knowledge base to obtain processing suggestions for the abnormal information. The knowledge base is used to store historical abnormal causes and processing methods for the historical abnormal causes. The data feedback module is used to feed back the processing suggestions of the abnormal information to the terminal device; The data update module is used to receive feedback information regarding the processing suggestions and to update the knowledge base using the feedback information and the processing suggestions for the anomaly information.

9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the exception handling method of the software code according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the exception handling method of the software code according to any one of claims 1 to 7.

11. A computer program product, characterized in that, It includes computer instructions for causing a computer to execute the exception handling method of the software code according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Abnormal code repairing method and device based on large language model, equipment and medium

    CN117609032A

  • Code analysis method and device, equipment and storage medium

    CN118708472A

  • Abnormal data processing method and device, equipment and storage medium

    CN119149296A

  • Abnormity detection method, device and equipment based on large model and storage medium

    CN119583309A

  • Intelligent management assistant system and method based on large model

    CN120634471A