Code repairing method and device, equipment and medium

By combining real-time monitoring and machine learning models with rule libraries to automatically identify and repair hard coding, the problem of hard coding in the front-end development of medical information systems has been solved, the efficiency and accuracy of identification and repair have been improved, and the development quality has been enhanced.

CN120631390APending Publication Date: 2025-09-12PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510535457.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In existing technologies, hard-coding problems in the front-end development of medical information systems lead to high maintenance costs, great security risks, and low identification and repair efficiency, making it difficult to achieve automated processing.

Method used

By real-time monitoring of code update events, combining hard-coded identification training models and preset rule libraries, generating prompt templates and inputting repair strategy generation models, hard-coded identification and repair can be automatically identified and repaired.

Benefits of technology

It achieves real-time automated identification and repair of hard-coded issues in incremental code, improves the efficiency and accuracy of identification and repair, and enhances development efficiency and quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631390A_ABST
    Figure CN120631390A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a code repairing method and device, equipment and a medium, and the method comprises the steps: monitoring an update event triggered by a user for a current version code in real time, recognizing a to-be-detected code corresponding to the update event, and carrying out hard code recognition training through a model subjected to hard code recognition training in combination with a preset rule base; performing hard code identification on the to-be-detected code to obtain an identification result, determining a target to-be-repaired code according to the identification result, generating a prompt template according to the to-be-detected code and the programming grammar corresponding to the to-be-detected code, and inputting the target to-be-repaired code and the prompt template into a model which is subjected to repair strategy generation training to obtain a repair strategy, and repairing the target to-be-repaired code according to the repairing strategy to obtain a repaired code. The method can be applied to a development and maintenance scene of a medical system, and the hard code recognition and repair efficiency and accuracy are improved, so that the development efficiency and quality are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the medical field, with the deep integration of information technology and medical business, medical information systems are playing an increasingly important role in improving medical service efficiency and ensuring medical quality. Front-end development is a key link in user interaction of medical information systems, and its development quality directly affects the system's usability and user experience. However, in the front-end development process of medical information systems, there is a phenomenon of hard coding. Hardcoding involves writing fixed data (such as medical terms, disease names, drug names, API keys, database connection paths, etc.) directly into front-end code. In the early stages of medical information system development, this approach may have been adopted for its simplicity and directness. However, as medical information systems expand in scale, business complexity increases, and security requirements rise, the limitations of hardcoding are becoming increasingly apparent. On the one hand, changes to hardcoded data require developers to manually modify multiple code locations, significantly increasing maintenance costs. On the other hand, if sensitive data such as patients' personal privacy information, medical diagnosis information, treatment records, and drug prescriptions are hardcoded into front-end code, they face significant security risks if the code is leaked or attacked by malicious actors. Furthermore, hardcoding is often written for a specific environment, and when the system is deployed to production or other different environments, the code may not function properly due to environmental differences. Existing technologies often rely on manual identification to identify and repair hardcoded data during development, but manual identification is inefficient and prone to missed detections or misjudgments due to human error.

[0003] Therefore, how to automatically identify and repair hard coding in code development and improve the efficiency of identification and repair has become an urgent problem to be solved. Summary of the Invention

[0004] The present invention provides a code repair method, apparatus, computer equipment and medium to solve the problem of how to automatically identify and repair hard coding in code development and improve the efficiency of identification and repair.

[0005] In a first aspect, a code repair method is provided, comprising: Monitor in real time the update events of the current version code triggered by the user, and identify the code to be detected corresponding to the update event; Using a model that has been trained for hard-coded recognition and a preset rule library, hard-coded recognition is performed on the code to be detected to obtain a recognition result; Determine the target code to be repaired according to the recognition result, and generate a prompt template according to the code to be detected and the programming syntax corresponding to the code to be detected; The target code to be repaired and the prompt template are input into a model that has been trained to generate a repair strategy to obtain a repair strategy. The target code to be repaired is repaired according to the repair strategy to obtain a repaired code.

[0006] In a second aspect, a code repair device is provided, comprising: A monitoring module is used to monitor in real time the update events of the current version code triggered by the user and identify the code to be detected corresponding to the update event; A first recognition module is used to perform hard-coded recognition on the code to be detected by using a model that has been trained for hard-coded recognition in combination with a preset rule library to obtain a recognition result; A template generation module is used to determine the target code to be repaired according to the recognition result, and generate a prompt template according to the code to be detected and the programming syntax corresponding to the code to be detected; The repair module is used to input the target code to be repaired and the prompt template into a model that has been trained to generate a repair strategy to obtain a repair strategy, and repair the target code to be repaired according to the repair strategy to obtain a repaired code.

[0007] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the code repair method of the first aspect when executing the computer program.

[0008] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the code repair method of the first aspect are implemented.

[0009] The solution implemented by the above-mentioned code repair method, device, equipment and medium monitors the update events of the current version of the code triggered by the user in real time, identifies the code to be detected corresponding to the update event, and performs hard-coded identification on the code to be detected through a model that has been trained for hard-coded identification in combination with a preset rule library. Based on the identification result, the target code to be repaired is determined, and a prompt template is generated based on the code to be detected and the programming syntax corresponding to the code to be detected. The target code to be repaired and the prompt template are input into the model that has been trained for repair strategy generation to obtain a repair strategy. According to the repair strategy, the target code to be repaired is repaired to obtain the repaired code.

[0010] Among them, by generating a trained model based on a rule library, a model that has been trained for hard-coding identification, a prompt template, and a repair strategy, the hard-coding in the code to be detected is identified and repaired, realizing real-time automatic identification and repair of hard-coding problems in the monitored incremental code, avoiding the performance bottleneck of identifying and repairing the full amount of code, improving the efficiency and accuracy of hard-coding identification and repair, and thus improving the efficiency and quality of development. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0012] Figure 1 A schematic diagram of an application environment of a code repair method provided in Embodiment 1 of the present invention; Figure 2 A flowchart of a code repair method provided in the second embodiment of the present invention; Figure 3 A flowchart of a code repair method provided in Embodiment 3 of the present invention; Figure 4 A flowchart of a code repair method provided in Embodiment 4 of the present invention; Figure 5 A schematic structural diagram of a code repair device provided in Embodiment 5 of the present invention; Figure 6 A structural diagram of a computer device provided in Example 6 of the present invention. DETAILED DESCRIPTION

[0013] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0014] The code repair method provided in the first embodiment of the present invention can be applied to Figure 1In an application environment, a server communicates with a client, providing code repair services and triggering code repair tasks on the server. Clients include, but are not limited to, PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud computing devices, and personal digital assistants (PDAs). The server's corresponding computing device can be implemented as a standalone server or a server cluster consisting of multiple servers.

[0015] like Figure 2 FIG. 1 is a flow chart of a code repair method provided in Embodiment 2 of the present invention, comprising the following steps: Step S201: monitoring the update events of the current version code triggered by the user in real time, and identifying the code to be detected corresponding to the update event.

[0016] In this embodiment, the time point of real-time monitoring is recorded as the current time point. The current version code may refer to the code running or deployed by the software system or application at the current time point. For example, the current version code may be the development code of the medical information system, the support system code of the telemedicine service, and the implementation code of the patient management system, etc. The update event may refer to the update operation of the current version code triggered by the user. The code to be detected may refer to the incremental code generated by the user's update operation based on the current version code, that is, this part of the incremental code is the code that needs to be hard-coded. For example, the code to be detected may include hard-coded types such as patient sensitive data, medical indicator thresholds, and medical system login passwords.

[0017] Specifically, based on a preset version management system, user-triggered update events for the current version code can be monitored in real time, the updated version code corresponding to the update event can be determined, the updated version code can be compared with the current version code for differences, and a comparison result can be obtained. Based on the comparison result, the incremental code generated by the update operation based on the current version code, i.e., the code to be tested, can be determined. The updated version code is the code after the current version code is updated, and the comparison result can refer to the result of the difference comparison between the updated version code and the current version code.

[0018] Step S202: Using a model that has been trained for hard-coded recognition and combining it with a preset rule library, hard-coded recognition is performed on the code to be detected to obtain a recognition result.

[0019] In this embodiment, the preset rule library is used to store rules for pattern matching of hard codes, and the recognition result may refer to the result of hard code recognition of the code to be detected.

[0020] Specifically, first, based on the rules in the preset rule library, pattern matching can be performed on the code to be detected to initially determine the potential hard-coded fragments in the code to be detected. Then, the potential hard-coded fragments can be input into the model that has been trained for hard-coded recognition. The model can be used to identify the hard-coded and non-hard-coded potential hard-coded fragments to obtain the hard-coded recognition results of the model.

[0021] Optionally, after obtaining the recognition result, the recognition result may be verified for accuracy to obtain a first verification result, and the model that has been trained for hard-coded recognition may be updated based on the first verification result. The first verification result may refer to the result of the accuracy verification of the recognition result.

[0022] Step S203: Determine the target code to be repaired based on the recognition result, and generate a prompt template based on the code to be detected and the programming syntax corresponding to the code to be detected.

[0023] In this embodiment, the target code to be repaired may be a hard-coded segment to be repaired in the code to be detected, the programming syntax may refer to the syntax corresponding to the programming language used by the code to be detected, and the prompt template may refer to the background prompt information generated based on the code to be detected and the programming syntax corresponding to the code to be detected.

[0024] Specifically, context features of the code to be detected are extracted from the updated version code generated by the user-triggered update operation on the current version code, and the extracted context features and programming syntax are structured to generate a prompt template.

[0025] The extracted context features of the code to be detected may include: the function name, file path, scope, upstream and downstream variable dependencies and call relationships, as well as the AST abstract syntax structure and code block semantic labels of the code to be detected.

[0026] Step S204: input the target code to be repaired and the prompt template into the model that has been trained to generate the repair strategy to obtain the repair strategy. According to the repair strategy, the target code to be repaired is repaired to obtain the repaired code.

[0027] In this embodiment, the repair strategy may refer to a method for repairing the code to be detected.

[0028] Specifically, the target code to be repaired and the prompt template are input into a model that has been trained to generate a repair strategy to obtain a repair strategy. The repair strategy is used to perform hard-coded repair on the target code to obtain the repaired code.

[0029] For example, if the target code to be repaired is a fixed hospital front desk contact information, the repair strategy can be: the hospital front desk contact information can be obtained through the interface, or the online medical information management platform can be used to map and maintain the data, etc. If the target code to be repaired is the login password of the medical system, the repair strategy can be: remove the hard-coded login password from the code to be detected and store it in a configuration file or environment variable.

[0030] Optionally, after inputting the target code to be repaired and the prompt template into a model that has been trained for repair strategy generation to obtain a repair strategy, the repair strategy can be verified for accuracy to obtain a second verification result. Based on the second verification result, the model that has been trained for repair strategy generation can be updated. The second verification result can refer to the result of the accuracy verification of the repair strategy.

[0031] Optionally, the code repair method can be integrated into the browser in the form of a plug-in to identify the incremental code generated by the update event in real time, and the incremental code is used as the code to be detected. Based on the contents of steps S201 to S204 above, the hard-coded parts in the code to be detected are identified and repaired.

[0032] In this embodiment, by generating a trained model based on a rule library, a model that has been trained for hard-coding identification, a prompt template, and a repair strategy, the hard-coding in the code to be detected is identified and repaired, thereby achieving real-time automatic identification and repair of hard-coding problems in the monitored incremental code, avoiding the performance bottleneck of identifying and repairing the entire code, and improving the efficiency and accuracy of hard-coding identification and repair, thereby improving the efficiency and quality of development.

[0033] like Figure 3 FIG. 1 is a flow chart of a code repair method provided in Embodiment 3 of the present invention. In step S202, the code to be detected is hard-coded identified by using a model that has been trained for hard-coded identification in combination with a preset rule library to obtain an identification result. The method may include the following steps: Step S301: Use hard-coded rules in a preset rule library to perform pattern matching on the code to be detected to obtain a matching result.

[0034] Step S302: Determine the initial code to be repaired based on the matching result, input the initial code to be repaired into a model that has been trained for hard-coded recognition to obtain a recognition result.

[0035] In this embodiment, the hard-coded rule may refer to a rule for hard-coded identification set based on a regular expression. For example, if it is hard-coded for a mobile phone number type, the hard-coded rule may be / \b1[3-9]\d{9}\b / g. If it is hard-coded for a date and time type, the hard-coded rule may be / \b\d{4}-\d{2}-\d{2}\b|\b\d{2}:\d{2}:\d{2}\b / g. The matching result may refer to the result of pattern matching of the code to be detected based on the hard-coded rule. The initial code to be repaired may refer to a potential hard-coded fragment obtained by matching based on the hard-coded rule.

[0036] Specifically, the hard-coded rules in the preset rule library are used to perform pattern matching on the code to be detected. Based on the matching results, the code fragment that successfully matches any hard-coded rule is determined to be the initial code to be repaired. The initial code to be repaired is input into the model that has been trained for hard-coded recognition. The model is used to identify the hard-coded and non-hard-coded initial code to obtain the recognition result.

[0037] In this embodiment, by performing pattern matching on the code to be detected through hard-coded rules in a preset rule library, potential hard-coded fragments can be quickly located as the initial code to be repaired, and then these fragments can be deeply analyzed using the trained hard-coded recognition model. This two-stage method that combines rule matching and machine learning models not only improves the efficiency and accuracy of hard-coded detection, but also effectively identifies complex hard-coded patterns that are difficult to cover by rules, reduces the false alarm rate, and provides a more accurate basis for subsequent repair strategies, ensuring an overall improvement in code quality and maintainability.

[0038] like Figure 4 FIG. 2 is a flow chart of a code repair method provided by a fourth embodiment of the present invention. In step S204, the target code to be repaired and the prompt template are input into a model that has been trained to generate a repair strategy. After the repair strategy is obtained, the following steps may be further included: Step S401: Output and display the code to be repaired and the repair strategy.

[0039] Step S402: monitoring a repair strategy selection event triggered by a user, determining a repair suggestion from the user based on the selection event, and repairing the target code to be repaired based on the repair suggestion and the repair strategy to obtain a repaired code.

[0040] In this embodiment, the selection event may refer to a selection operation of a repair strategy triggered by a user.

[0041] Specifically, after obtaining the repair strategy, the code to be repaired and the repair strategy can be displayed and output, and the user's selection operation on the repair strategy can be monitored in real time. Based on the selection operation, it is determined whether the user adopts the modification strategy and which repair strategy to adopt. In this way, according to the user's repair suggestions and repair strategy, the target code to be repaired is repaired to obtain the repaired code.

[0042] In this embodiment, by outputting and displaying the code to be repaired and the repair strategy, users can flexibly adjust the strategy based on actual needs or business scenarios, avoiding potential deviations that may be introduced by automated repair, and improving the flexibility and accuracy of code repair.

[0043] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0044] like Figure 5 As shown in FIG, a code repair device provided by the fifth embodiment of the present invention corresponds to the code repair method in the above embodiment. Figure 5 As shown, the code repair device includes a monitoring module 51, a first identification module 52, a template generation module 53 and a repair module 54. The functional modules are described in detail as follows: The monitoring module 51 is used to monitor in real time the update events of the current version code triggered by the user and identify the code to be detected corresponding to the update event; The first recognition module 52 is configured to perform hard-coded recognition on the code to be detected by using a model that has been trained for hard-coded recognition and combining it with a preset rule library to obtain a recognition result; A template generation module 53 is configured to determine a target code to be repaired based on the recognition result, and to generate a prompt template based on the code to be detected and the programming syntax corresponding to the code to be detected; The repair module 54 is used to input the target code to be repaired and the prompt template into a model that has been trained to generate a repair strategy to obtain a repair strategy, and repair the target code to be repaired according to the repair strategy to obtain a repaired code.

[0045] Optionally, the first identification module 52 includes: A rule matching unit, configured to perform pattern matching on the code to be detected using hard-coded rules in the preset rule library to obtain a matching result; The second recognition unit is used to determine an initial code to be repaired based on the matching result, and input the initial code to be repaired into the model that has been trained for hard-coded recognition to obtain the recognition result.

[0046] Optionally, the monitoring module 51 includes: A determination unit, configured to monitor in real time, based on a preset version management system, an update event of a current version code triggered by a user, and determine an updated version code corresponding to the update event; The comparison unit is used to compare the updated version code with the current version code to obtain a comparison result, and determine the code to be detected based on the comparison result.

[0047] Optionally, the template generation module 53 includes: An extraction unit, configured to extract context features of the code to be detected from the updated version code; The structuring unit is used to perform structural processing on the context feature and the programming grammar to generate the prompt template.

[0048] Optionally, the code repairing device further includes: A display module, configured to output and display the code to be repaired and the repair strategy; The interactive module is used to monitor the selection event of the repair strategy triggered by the user, determine the user's repair suggestion based on the selection event, and repair the target code to be repaired according to the repair suggestion and the repair strategy to obtain the repaired code.

[0049] Optionally, the code repairing device further includes: A first updating module is configured to verify the accuracy of the recognition result to obtain a first verification result, and update the model that has been trained for hard-coded recognition based on the first verification result; The second updating module is used to verify the accuracy of the repair strategy to obtain a second verification result, and update the model that has been trained to generate the repair strategy based on the second verification result.

[0050] The specific definition of the code repair device can be found in the definition of the code repair method above and will not be repeated here. Each module in the above-mentioned code repair device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each of the above modules.

[0051] like Figure 6 FIG. 1 is a schematic diagram of a computer device according to a sixth embodiment of the present invention. The computer device according to this embodiment includes: at least one processor ( Figure 6Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps of any of the above-mentioned code repair method embodiments are implemented.

[0052] The computer device may include, but is not limited to, a processor and a memory. It will be understood by those skilled in the art that Figure 6 The above is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.

[0053] The processor may be a CPU, other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0054] Memory includes readable storage media, internal memory, and the like. Internal memory can be the internal memory of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage medium. The readable storage medium can be the computer device's hard drive. In other embodiments, it can also be an external storage device, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, or a flash memory card. Furthermore, memory can include both the computer device's internal storage unit and external storage devices. Memory is used to store the operating system, application programs, boot loaders, data, and other programs, such as the program code of computer programs. Memory can also be used to temporarily store data that has been output or is about to be output.

[0055] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process steps in the above-described method embodiments by instructing the relevant hardware through a computer program. The computer program may be stored in a computer-readable storage medium. When executed by a processor, the computer program implements the steps of the above-described method embodiments. The computer program includes computer program code, which may be in source code form, object code form, executable file, or some intermediate form. Computer-readable media may include at least: any entity or device capable of carrying computer program code, recording media, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunications signals, and software distribution media. Examples include USB flash drives, removable hard drives, magnetic disks, or optical disks. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunications signals.

[0056] The present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing it.

[0057] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0058] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0059] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer equipment and methods can be implemented in other ways. For example, the apparatus / computer equipment embodiments described above are merely schematic. For example, the division of modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of the apparatus or unit, which can be electrical, mechanical or other forms.

[0060] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0061] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application. The non-company software tools or components that appear in the embodiments of the present application are merely examples and do not represent actual use.

Claims

1. A code repair method, characterized in that: include: Monitor in real time the update events of the current version code triggered by the user, and identify the code to be detected corresponding to the update event; Using a model that has been trained for hard-coded recognition and a preset rule library, hard-coded recognition is performed on the code to be detected to obtain a recognition result; Determine the target code to be repaired according to the recognition result, and generate a prompt template according to the code to be detected and the programming syntax corresponding to the code to be detected; The target code to be repaired and the prompt template are input into a model that has been trained to generate a repair strategy to obtain a repair strategy. The target code to be repaired is repaired according to the repair strategy to obtain a repaired code.

2. The code repair method according to claim 1, wherein: The hard-coded recognition model that has been trained is combined with a preset rule library to perform hard-coded recognition on the code to be detected to obtain a recognition result, including: Using the hard-coded rules in the preset rule library, pattern matching is performed on the code to be detected to obtain a matching result; An initial code to be repaired is determined based on the matching result, and the initial code to be repaired is input into the model that has been trained for hard-coded recognition to obtain the recognition result.

3. The code repair method according to claim 1, wherein: The real-time monitoring of the update event of the current code triggered by the user and identifying the code to be detected corresponding to the update event includes: Based on the preset version management system, real-time monitoring of user-triggered update events for the current version code is performed to determine the updated version code corresponding to the update event; The updated version code is compared with the current version code to obtain a comparison result, and the code to be detected is determined based on the comparison result.

4. The code repair method according to claim 3, wherein: The step of generating a prompt template according to the code to be detected and the programming grammar corresponding to the code to be detected includes: Extracting context features of the code to be detected from the updated version code; The context feature and the programming grammar are structurally processed to generate the prompt template.

5. The code repair method according to claim 1, wherein: After inputting the target code to be repaired and the prompt template into a model that has been trained to generate a repair strategy to obtain a repair strategy, the method further includes: Outputting and displaying the code to be repaired and the repair strategy; The method monitors a selection event of the repair strategy triggered by a user, determines a repair suggestion of the user according to the selection event, and repairs the target code to be repaired according to the repair suggestion and the repair strategy to obtain the repaired code.

6. The code repair method according to claim 1, wherein: After the hard-coded recognition model that has been trained is used to perform hard-coded recognition on the code to be detected in combination with a preset rule library to obtain a recognition result, the method further includes: Performing an accuracy check on the recognition result to obtain a first check result, and updating the model that has been trained for hard-coded recognition based on the first check result; After inputting the target code to be repaired and the prompt template into a model that has been trained to generate a repair strategy to obtain a repair strategy, the method further includes: The repair strategy is verified for accuracy to obtain a second verification result, and the trained model generated by the repair strategy is updated according to the second verification result.

7. A code repair device, characterized in that: include: A monitoring module is used to monitor in real time the update events of the current version code triggered by the user and identify the code to be detected corresponding to the update event; A first recognition module is used to perform hard-coded recognition on the code to be detected by using a model that has been trained for hard-coded recognition in combination with a preset rule library to obtain a recognition result; A template generation module is used to determine the target code to be repaired according to the recognition result, and generate a prompt template according to the code to be detected and the programming syntax corresponding to the code to be detected; The repair module is used to input the target code to be repaired and the prompt template into a model that has been trained to generate a repair strategy to obtain a repair strategy, and repair the target code to be repaired according to the repair strategy to obtain a repaired code.

8. The code repairing device according to claim 7, wherein: The first identification module includes: A rule matching unit, configured to perform pattern matching on the code to be detected using hard-coded rules in the preset rule library to obtain a matching result; The second recognition unit is used to determine an initial code to be repaired based on the matching result, and input the initial code to be repaired into the model that has been trained for hard-coded recognition to obtain the recognition result.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the code repair method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the code repair method according to any one of claims 1 to 6 are implemented.