Code updating method and device, equipment, storage medium and program product
By identifying the annotated code and its associated context, and generating and replacing updated code, the problem of low efficiency for users when editing and updating code is solved, achieving more efficient and convenient code modification and retrieval.
Patent Information
- Application Number
- CN202410983123.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-12
AI Technical Summary
In existing technologies, users are inefficient when editing and updating code, and it is difficult to modify code flexibly and conveniently and obtain high-quality services.
By identifying the annotated code based on code annotations, determining its associated context in the target code, and generating updated code based on the associated context and update description information, the annotated code is replaced, thus updating the target code.
It improves the efficiency of code editing and retrieval, enabling users to modify and update code more flexibly and conveniently, thereby improving code quality and efficiency.
Smart Images

Figure CN118939292A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technology such as software engineering, code generation, intelligent recommendation and deep learning, and especially to a method, device, electronic device, computer-readable storage medium and computer program product for updating code. Background Art
[0002] With the development of society, digital technology and computer technology are also making progress. In digital technology and computer technology, users need to rely on editing codes and providing codes to "communicate" with computing devices to instruct computing devices to process the instructed tasks and use computers to provide and obtain corresponding services. In other words, for computing devices, they often rely on the codes provided by users to implement actions and provide services. Therefore, the processing performance, service quality and service efficiency of computing devices are closely related to the editing quality and editing efficiency of codes.
[0003] In this context, how to provide help to users, how to enable users to provide and edit code more flexibly and efficiently, and complete code editing work with higher quality and efficiency, is worthy of attention and an urgent need. Summary of the invention
[0004] The embodiments of the present disclosure provide a method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product for updating a code.
[0005] In a first aspect, an embodiment of the present disclosure proposes a method for updating code, comprising: determining an annotated code in a target code based on code annotation; determining an associated context of the annotated code in the target code; generating an update code for replacing the annotated code based on the associated context and update description information for the annotated code, wherein the update description information is used to indicate an expected update result for the annotated code; and replacing the annotated code with the update code to update the target code to obtain an updated target code.
[0006] In a second aspect, an embodiment of the present disclosure proposes a device for updating code, comprising: an annotated code determination unit, configured to determine the annotated code in the target code based on the code annotation; an associated context determination unit, configured to determine the associated context of the annotated code in the target code; a first update code generation unit, configured to generate an update code for replacing the annotated code based on the associated context and update description information for the annotated code, wherein the update description information is used to indicate an expected update result for the annotated code; and a first target code update unit, configured to replace the annotated code with the update code, update the target code, and obtain an updated target code.
[0007] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can implement the method for updating code as described in any implementation method in the first aspect when executing the instructions.
[0008] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the method for updating code as described in any implementation method of the first aspect when executed.
[0009] In a fifth aspect, an embodiment of the present disclosure provides a computer program product comprising a computer program, which, when executed by a processor, can implement the method for updating code as described in any implementation manner in the first aspect.
[0010] The method, device, electronic device, computer-readable storage medium, and computer program product for updating code provided by the embodiments of the present disclosure determine the annotated code in the target code based on the code annotation, and then determine the associated context of the annotated code in the target code. Then, based on the associated context and the update description information for the annotated code indicating the expected update result of the annotated code, an update code for replacing the annotated code is generated. Next, the annotated code is replaced with the update code, and the target code is updated to obtain the updated target code, so as to implement the update operation of at least part of the original code.
[0011] The present disclosure allows the user to instruct to update part of the code content through instructions, so that the user can modify and update the code more flexibly and conveniently, and improve the efficiency of code editing and acquisition.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0014] Figure 1 is an exemplary system architecture in which the present disclosure may be applied;
[0015] Figure 2 A flowchart of a code updating process provided by an embodiment of the present disclosure;
[0016] Figure 3 A schematic diagram of the effect of a process of providing code annotation provided by an embodiment of the present disclosure in combination with a specific application scenario;
[0017] Figure 4 A flowchart of another process of updating codes provided by an embodiment of the present disclosure;
[0018] Figure 5 A structural block diagram of a device for updating code provided in an embodiment of the present disclosure;
[0019] Figure 6 A schematic diagram of the structure of an electronic device suitable for executing a method for updating codes provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other without conflict.
[0021] In addition, in the technical solutions involved in this disclosure, the acquisition, storage, use, processing, transportation, provision and disclosure of user personal information involved (such as the codes provided by users that may be involved in the subsequent disclosure, etc.) are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0022] Figure 1 An exemplary system architecture 100 is shown to which embodiments of the method, apparatus, electronic device, and computer-readable storage medium for updating codes of the present disclosure can be applied.
[0023] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0024] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. The terminal devices 101, 102, 103 and the server 105 can be installed with various applications for realizing information communication between the two, such as code generation applications, code online editing applications, instant messaging applications, etc.
[0025] Terminal devices 101, 102, 103 and server 105 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.; when terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here. When server 105 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server; when the server is software, it can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here.
[0026] The server 105 can provide various services through various built-in applications. Taking a code generation application that can provide code generation and modification as an example, the server 105 can achieve the following effects when running the code generation application: First, the server 105 communicates with the terminal devices 101, 102, and 103 used by the user (not shown in the figure) through the network 104, and obtains the code annotation for the annotated code in the target code. Accordingly, the server 105 can determine the annotated code of the target code based on the code annotation. Then, the server 105 determines the associated context of the annotated code in the target code. Next, the server 105 generates an update code for replacing the annotated code based on the associated context and the update description information for the annotated code, wherein the update description information is used to indicate the expected update result of the annotated code (for example, the update description information can also be provided by the user). Finally, the server 105 replaces the annotated code with the update code, updates the target code, and obtains the updated target code.
[0027] It should be noted that, in addition to being obtained from the terminal devices 101, 102, 103 through the network 104, the target code and the code annotation can also be pre-stored locally in the server 105 in various ways. Therefore, when the server 105 detects that these data are already stored locally (for example, when starting to process the previously retained code update task, or when the server 105 can be directly used by the user and the target code and the annotated code are stored locally), it can choose to directly obtain these data locally. In this case, the exemplary system architecture 100 may also not include the terminal devices 101, 102, 103 and the network 104.
[0028] Since the code update process involves "generating update codes for replacing the annotated codes", considering that this process may usually require more computing resources and stronger computing power, the code update methods provided in the subsequent embodiments of the present disclosure are generally performed by the server 105 with stronger computing power and more computing resources, and accordingly, the device for updating the code is generally also set in the server 105. However, it should also be pointed out that when the terminal devices 101, 102, and 103 also have computing power and computing resources that meet the requirements, the terminal devices 101, 102, and 103 can also complete the above-mentioned operations that are handed over to the server 105 through the code generation application installed thereon, and then output the same result as the server 105. Especially in the case where there are multiple terminal devices with different computing powers at the same time, but the code generation application determines that the terminal device has stronger computing power and more remaining computing resources, it can allow the terminal device to perform the above-mentioned operations, thereby appropriately reducing the computing pressure of the server 105, and accordingly, the device for updating the code can also be set in the terminal devices 101, 102, and 103. In this case, the exemplary system architecture 100 may also not include the server 105 and the network 104 .
[0029] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0030] Please refer to Figure 2 , Figure 2 A flowchart of a process of updating code provided by an embodiment of the present disclosure, wherein process 200 includes the following steps:
[0031] Step 201: determining the annotated code in the target code based on the code annotation;
[0032] This step is intended to be performed by the execution subject of the method for updating the code (for example Figure 1The server 105 shown in the figure determines the marked code in the target code based on the code annotation. The code annotation can be an identifier or a marker added to the target code to identify and distinguish the marked code from the non-marked code. For example, the user can add an annotation to the "marked code" in the target code by "adding a highlight" code to indicate the "marked code".
[0033] The annotated code is usually the code in the target code that the user wants to operate (e.g., edit, modify, and update). Therefore, the user can interact with the execution subject through the annotations in the code to obtain modification and update services for the annotated code (e.g., using the "generative" code generation service of the execution subject to replace and update parts of the original code), or use the execution subject to provide assistance in the update and modification process of the annotated code.
[0034] Usually, the target code can be the original code that the user desires to modify, for example, it can be the complete code in a code project, or it can be the complete code included in a functional block.
[0035] In some optional implementations of this embodiment, the target code may be uploaded by the user, for example, the user may provide the target code to the execution subject by providing the code file or code characters to the execution subject. Thus, the user may use the execution subject to obtain and assist in editing the code held by the user, thereby improving the user's editing efficiency for the code.
[0036] Alternatively or additionally, when the target code is provided by a target user who uses the execution subject to obtain the code update service, the execution subject may determine the "actual scope of the target code" based on the entire content of the code provided by the target user or according to the user's instructions. For example, when the target user passes in multiple code files or multiple lines of code, the execution subject may determine the "part of the target code" (for example, all of the multiple lines of code, or a part of the multiple lines of code) based on the target user's choice through interaction with the user (for example, directly using the execution subject, or using a terminal device to interact with the execution subject).
[0037] In some optional implementations of this embodiment, in order to further facilitate the use of the target user, enhance the target user's editing experience and reduce user consumption, the target code may also be provided by the execution subject. For example, the target code may be a code that is pre-maintained in a code database and can be obtained by the execution subject. For example, in the case where the code database is maintained locally on the execution subject, the target user can instruct the execution subject (for example, provide the function and unique identifier corresponding to the code) to determine and obtain the target code through a preset type of interaction with the execution subject. As a result, the target user can choose to maintain the code in the execution subject, reduce the target user's modification requirements for code editing and updating operations, and facilitate users to edit and update the code (for example, this allows the target user to potentially communicate with the execution subject through any trusted device to complete the editing and updating of the code).
[0038] It should be noted that the code database can also be stored in a local storage device (such as Figure 1 The non-local storage device may also be any other electronic device configured to store data, such as some terminal devices used by users. In this case, the execution subject may send an acquisition command to the electronic device according to the instruction of the target user to acquire the required target code from the code database.
[0039] In some embodiments, the target code may also be generated "instantly" by the execution entity according to the generation requirements of the target user this time.
[0040] Specifically, when the execution subject has the code generation capability (for example, the execution subject can use the code generation model deployed locally or in other servers or terminal devices to generate code for the target user according to the instructions and needs of the target user), the target user can request the execution subject to "generate target code for the target user in real time" by sending generation description information (for example, describing the applicable operating environment of the desired generated code, the language and form used by the code, the purpose that can be achieved, and the "constraints" imposed on the code such as length, number of lines, etc.) and a code generation request to the execution subject.
[0041] Typically, the generation description information and the code generation request can be independently sent by the target user to the execution subject to instruct the execution subject to generate corresponding code according to the generation description information.
[0042] As an alternative or in addition, the generated description information and the code generation request can be sent in the form of a "single message". Accordingly, the execution subject can determine whether the description information and the code generation request are included based on the content analysis of the "single message". For example, for the single message "Please help me generate code for implementing function B in environment A", the execution subject can determine that the "code for implementing function B in environment A" included therein is the generated description information based on semantic understanding, and determine that the "please help me with the code..." included therein is the "code generation request". In this way, the difficulty constraints on users are reduced and the user's interaction efficiency is improved.
[0043] Accordingly, the execution subject may generate target code for the target user based on the generation description information in response to receiving the generation description information and the code generation request sent by the target user. For example, as discussed above, the target code may be generated for the target user using a code generation model (e.g., a code generation model may be a pre-trained model or neural network that can provide corresponding code to the target user based on the generation description information provided by the user).
[0044] Then, the execution subject can provide the generated target code to the target user for use by the target user. Thus, the execution subject can further simplify the operation requirements for the target user based on the code generation method, that is, the target user is no longer required to fully and realistically provide the "target code" that can be directly used in advance in order to obtain the code update service discussed in the embodiments of the present disclosure.
[0045] Alternatively or additionally, whether uploaded by the target user, determined according to the target user's instructions, or generated according to the target user's instructions, the execution subject can choose to actually present the target code to the target user (for example, using a display component of a terminal device that can be used by the user) after actually obtaining the target code. In this way, the target code can be "visualized" to the target user. Accordingly, in such a context, the target user can add code annotations based on the interaction and operation of the "visualized" target code to indicate the annotated code in the target code to the execution subject.
[0046] For example, the execution subject may provide the target code to the target user in the form of "dialog box information". Accordingly, the target user may provide "code annotation" by, for example, copying and then sending the "annotated code" separately. Accordingly, the user may determine the annotated code in the target code when receiving the "code annotation" in this form.
[0047] Step 202: Determine the associated context of the annotated code in the target code;
[0048] In the embodiment of the present disclosure, based on step 201, this step is intended to determine the association context of the annotated code in the target code based on the content recorded in the target code after the above-mentioned execution subject determines the annotated code that needs to be updated. For example, the association context can be the association relationship of the annotated code with the unannotated part of the code in the target code.
[0049] In other words, the association context may be "non-annotated code" (i.e., code not annotated in the target code) that is connected, dependent, and influenced by the annotated code. For example, the association relationship may be embodied in at least one of the following ways: dependency, call chain, data flow, inheritance and interface implementation, change relationship in version control, documentation and annotations, project structure and modularization, etc.
[0050] In other words, the execution subject can determine the non-annotated code in the target code that has a logical relationship, numerical relationship, etc., and is associated or mutually influential with the annotated code based on the actual content of the annotated code as the "association context" of the annotated code.
[0051] Step 203: Generate update code for replacing the annotated code based on the associated context and the update description information for the annotated code;
[0052] In an embodiment of the present disclosure, based on step 202, this step is intended to be performed by the above-mentioned execution subject, after obtaining the associated context, based on the associated context and the update description information for the annotated code, which is used to indicate the expected update result of the annotated code, to generate an update code for replacing the annotated code.
[0053] The update description information can usually be provided by a user who wishes to update the (annotated) code or update the line (for example, the user who provides the target code and instructs the generation of the target code discussed above). The content form of the update description information can be similar to the generation description information discussed above. The user can use the update description information to indicate the expected update result of the modification to the annotated code (for example, describing the specific content of the modification to the annotated code, such as modifying the parameters included therein, or generating code that can achieve the same function but with different content form, or maintaining the functions that can be achieved by the annotated code but reducing the length of the annotated code, or adding some "new functions" to the annotation, etc.).
[0054] Correspondingly, the execution subject can also similarly utilize the code generation model to process the update description information. Specifically, after determining the update requirements based on the "update description information", the execution subject can generate "update code" based on the analysis of the associated context, which can satisfy and not affect the functional implementation of the associated context, and can satisfy the update requirements indicating the expected update results for the annotated code. For example, in the case where the annotated code in the original target code provides output parameters to the associated context of the code "CCC" whose logic follows the annotated code, the "update code" generated by the execution subject can still use the output parameters of the "update code" for the "CCC" to use, without affecting the original function and code purpose of "CCC".
[0055] In some embodiments, during the training process, the code generation model can be trained by using the "sample association context" as a "constraint". Thus, when the trained code generation model is used to generate code, it can output "(updated) code" that does not affect the functional implementation of the association context and the purpose of the code, and can meet the update requirement indication of the expected update result of the annotated code.
[0056] Step 204: Use the update code to replace the marked code, update the target code, and obtain the updated target code.
[0057] In an embodiment of the present disclosure, based on step 203, after obtaining the update code, the execution subject can update the target code by using the update code to replace the marked code in the target code to obtain the updated target code.
[0058] Alternatively or additionally, the execution entity may also generate a file of a corresponding format (e.g., a file in .txt format, a file in .exe format, etc.) from the target code according to a pre-configuration or according to the instructions of the target user, and directly store and provide the "target code" in the form of a "file".
[0059] The method for updating code provided by the embodiment of the present disclosure determines the associated context of the annotated code in the target code after determining the annotated code in the target code based on the code annotation. Then, based on the associated context and the update description information for the annotated code indicating the expected update result of the annotated code, an update code for replacing the annotated code is generated. Next, the annotated code is replaced with the update code, and the target code is updated to obtain the updated target code, so as to implement the update operation of at least part of the original code. Thus, the user is allowed to indicate the update of part of the code content through instructions, so that the user can modify and update the code more flexibly and conveniently, and improve the efficiency of editing and obtaining the code.
[0060] As discussed above, the execution subject may choose to provide the target code to the target user in a "visual" manner. Therefore, in order to facilitate user operation, the execution subject may also allow the target user to interact with the execution subject more efficiently in the form of a code image (for example, an image obtained by intercepting at least part of the target code) and an identifier added to the code image, so as to provide feedback to the execution subject and provide code annotations. For example, the target user may provide "code annotations" to the execution subject by adding identifiers such as highlight marks, underlines, etc. to the annotated code in the code image. In other words, code annotation is actually an identifier added to the annotated code in the code image that includes the target code.
[0061] Alternatively or additionally, as discussed above, in the process of allowing the provision of annotation information through code images, the execution subject may also allow the target user to provide the "target code" in the form of a code image. For example, after the user provides the code image to the execution subject, the execution subject may determine the "target code" based on the analysis of the content included in the code image (for example, the analysis method of character recognition), and determine the "annotated code" based on the identifier in the code image. As a result, the user can efficiently and conveniently provide the target code by providing an "image" and obtain the subsequent "update" service, further simplifying the code provision operation.
[0062] Furthermore, in some embodiments, when the execution entity chooses to provide the target code to the target user in a "visual" manner, and / or allows the target user to interact in the form of "images", it can also choose to provide some components in the "visual" interface (for example, the "dialog box" discussed above, or an interface including a "dialog box") to facilitate the target user to utilize these components to more conveniently interact with the execution entity (for example, components that can provide functions such as taking a screenshot of the target code to obtain a code image, and adding identifiers to the code image, etc.).
[0063] In some embodiments, the execution entity may choose to provide an image capture control and an image annotation control in a code interface (eg, an interface including a "dialog box") that presents the target code.
[0064] For example, the image capture control may be configured to capture a code image including a target code according to a capture operation instruction of the target user in response to being triggered by the target user.
[0065] For another example, the image annotation control may be configured to add an identifier for the annotated code in the code image in response to being triggered by the target user and according to the annotation operation instruction of the target user.
[0066] Accordingly, the target user can "capture the code image" by using the image capture control, and then "add annotations" by using the image annotation control to provide code annotations. Thus, the image capture control and the image annotation control can reduce the difficulty and cost of the interaction between the user and the execution subject, facilitate the user's use, and improve the user's operating efficiency.
[0067] For easier understanding, you can also refer to Figure 3 . Figure 3 The following is a schematic diagram showing the effect of implementing the process of providing code annotation in accordance with a specific application scenario 300 provided by the embodiment of the present disclosure. Figure 1 An exemplary system architecture 100 is shown for illustration.
[0068] In scenario 300, for example, server 105 can be used as an execution subject of the code updating method to interact with terminal device 101 used by a user (not shown in the figure) to provide a code updating service for the user. Terminal device 101 can provide a visual interactive service for the user through its associated display component (e.g., monitor, screen).
[0069] For example, in scenario 300 , the terminal device 101 may present to the user local interfaces 310 a to 310 d provided to the terminal device 101 by the server 105 through the network 104 in the process of interacting with the user, in the hope that the user will utilize the interfaces presented by the terminal device 101 .
[0070] Specifically, in the interface 310a, the "target code" composed of codes 311 to 314 can be presented to the user. For example, the codes 311 to 314 can be generated by the server 105 using the code generation model according to the generation description information indicated by the user. For example, when the server 105 generates the codes 311 to 314, it can use the interface 310a to provide the codes to the user.
[0071] As discussed above, the server 105 may provide an image capture control 321 and an image annotation control 322 in the interface 310a. The image capture control 321 may capture a code image including a target code according to the capture operation instruction of the user when triggered by the user. For example, the interface 310b may be understood as a situation where the image capture control 321 is triggered. When the image capture control 321 is triggered, the user may use the pointer 332 to select and define the range to be "screenshot" to provide an "interception operation instruction" to capture the image. Exemplarily, the execution subject determines the code image 333 by recording the "capture" action of the user in the interface 310b.
[0072] In some embodiments, in order to identify and facilitate users to understand the use and trigger status of controls, the server 105 may choose to add an indicator mark (e.g., an indicator box 331a) for the triggered control to indicate the trigger status of the control (e.g., an image capture control 321 that is added and presented with an indicator box 331a can be understood as the image capture control 321 being in a triggered state).
[0073] Similarly, after the user obtains the code image 333 using the image capture control 321, the user can choose to trigger the image annotation control 322 to add an identifier and annotate the annotated code in the code image 333. For example, the interface 310c can be understood as a situation where the image annotation control 322 is triggered. When the image capture control 321 is triggered, the user can use the pointer 332 to add an identifier and provide an "annotation operation instruction" to annotate the "annotated code". For example, the user can indicate the "annotated code" by operating the pointer 332 to draw a line (for example, holding down the left mouse button, touching the screen to draw a line). Exemplarily, in the interface 310c, the user determines the code 314 as the "annotated code" by operating the pointer 332. Accordingly, based on the user's operating behavior, an identifier 334 can be added to the code image 333 to indicate that the code 314 is the "annotated code".
[0074] Similarly, when the image annotation control 322 is triggered, the indication box 331 b can also be used to indicate and feedback the triggering state of the image annotation control 322 .
[0075] In some optional implementations of this embodiment, in order to further reduce the complexity and difficulty of user operations, users can be allowed to provide update description information in the form of annotation information associated with identifiers in the code image, without the target user having to provide update description information separately independent of the "code image" provision process.
[0076] For example, the target user can directly provide update description information for the annotated code by adding annotation information in association with the identifier in the code image, without having to provide the code image and then send the "update description information" through a separate message. This can save the user one step of operation, reduce the user's operating costs, and also make it easier for the user to indicate the "annotated code" targeted by the "update description information" (for example, the execution subject can directly read the corresponding relationship between the two through the established association relationship, and the target user does not have to specify the corresponding annotated code in detail in the update description information).
[0077] Accordingly, in some embodiments, the execution subject may also choose to provide an annotation control in the code interface presenting the target code, so as to facilitate the user to understand and use the "annotation function" to provide "update description information" through the annotation control. The annotation control is configured to respond to being triggered by the target user and, according to the annotation operation instruction of the target user, add annotation information in association with the identifier in the code image.
[0078] For example, we can continue to refer to Figure 3 Scene 300 is shown.
[0079] In interfaces 310a to 310d, an annotation control 323 may also be provided. Referring to interface 310d, when the annotation control 323 is triggered, the user may indicate the "annotated code" (e.g., code 314) that needs to be annotated by operating the pointer 332 (e.g., after the operating pointer 322 is moved to the position of the corresponding code, based on a preset operation such as clicking the left button).
[0080] Then, after the code 314 is clicked, the annotation control 323 can provide an annotation column 341 in the code image 333 in association with the position of the code 314. Accordingly, the user can implement "annotation" by "entering content and adding annotations" in the annotation column 341. Accordingly, the execution subject can use the content entered in the annotation column 341 (i.e., "annotation information") as the "update description information" corresponding to the code 314.
[0081] Similarly, when the annotation control 323 is triggered, the indication box 331 c can also be used to indicate and provide feedback on the triggering status of the annotation control 323 .
[0082] Accordingly, subsequent users can directly send a “code image 333 ” including, for example, an identifier 334 and a comment column 341 to the server 105 , thereby instructing the server 105 to replace the code 314 and update the “target code” according to the content recorded in the comment column 341 .
[0083] Therefore, based on the above controls provided by the execution subject, the user can quickly and conveniently capture the code image, and directly use the "code image" as a carrier to provide the execution subject with "annotated code", "update description information" and other content. This not only makes the code update process visual for the user, making it easier for the user to make decisions after understanding the process, but also significantly reduces the user's interaction and operation difficulty, and improves the user's code update efficiency.
[0084] In some embodiments, the target user may indicate two or more annotated codes at the same time (for example, adding identifiers to multiple locations in the target code at the same time) during the process of annotating and indicating the annotated code. In this case, the execution subject may choose to detect the associated context corresponding to each annotated code and determine whether there are annotated codes associated with different associated contexts.
[0085] If there are at least two annotated codes associated with different association contexts, the execution subject may choose to provide a conflict prompt to the target user to prompt the user that there is a conflict and request the target user to determine the updated annotated code targeted this time.
[0086] For details, please refer to Figure 4 , Figure 4 A flowchart of another process of updating code provided by an embodiment of the present disclosure includes process 400. Process 400 specifically includes the following steps:
[0087] Step 401: determining the annotated code in the target code based on the code annotation;
[0088] Step 402: Determine the associated context of the annotated code in the target code;
[0089] The above steps 401 to 402 are the same as those in the above Figure 2 The implementation methods of steps 201 and 202 discussed are similar. For the same parts, please refer to the corresponding description content above and will not be repeated here.
[0090] Step 403: In response to the existence of at least two annotated codes associated with different association contexts, providing conflict prompt information to the target user;
[0091] Specifically, if there are multiple annotated codes, the execution subject may determine the associated contexts corresponding to each annotated code. If there are at least two annotated codes associated with different associated contexts, the execution subject may respond to this by providing the target user with conflict prompt information indicating that there are at least two annotated codes associated with different associated contexts.
[0092] Step 404: in response to the target user returning round indication information in response to the conflict prompt information, determining a first marked code used in the current round from among at least two marked codes based on the round indication information;
[0093] Specifically, based on the above step 403, if the target user returns round indication information in response to the conflict prompt information, that is, the round indication information at least indicates the marked code that needs to be updated in this round (for ease of understanding, it is described as the first marked code), the execution subject responds to this and determines the first marked code used in the current round among at least two marked codes based on the round indication information.
[0094] Step 405: Generate a first update code for replacing the first annotated code in the current round based on the associated context of the first annotated code and the update description information corresponding to the first annotated code;
[0095] Specifically, this step is actually the same as above Figure 2 In the illustrated embodiment, the implementation process described in step 203 is equivalent, and the execution subject chooses to obtain the update code (described as the first update code for convenience of description) used to replace the first annotated code in the current round (or in the current round) based on the associated context corresponding to the first annotated code and the update description information corresponding to the first annotated code. The specific implementation method for this can refer to the discussion and description of step 203 above, which will not be repeated here.
[0096] Step 406: Use the first update code to replace the first marked code to update the target code and obtain an updated target code.
[0097] Specifically, this step is actually the same as above Figure 2 In the illustrated embodiment, the process implemented in step 204 is similar, and the execution subject replaces the first marked code with the first update code determined based on the above step 405 to complete this round of updating the target code and obtain the updated target code.
[0098] As a result, when there is a potential conflict "associated with different associated contexts", the target user will be prompted, and replacement and update will be performed in rounds according to the target user's instructions to ensure the quality of code updates and avoid code errors caused by simultaneously updating potentially conflicting code parts.
[0099] In some optional implementations of this embodiment, the target user may also indicate the processing order between multiple rounds through round indication information. For example, when there are three annotated codes associated with different association contexts (e.g., the first annotated code, the second annotated code, and the third annotated code), the target user may choose to indicate that the first annotated code is updated first, and then the second annotated code and the third annotated code are updated in sequence. That is, the target user indicates that the updates of the first annotated code, the second annotated code, and the third annotated code are completed through three rounds of updates.
[0100] In this case, in the subsequent update round, the execution subject may first detect whether the annotated code has changed due to the update in the previous round. For ease of understanding, the first annotated code is taken as the current round, and the second annotated code is taken as the next round of the current round, and the above process 400 is referred to for explanation.
[0101] Exemplarily, when the round indication information further indicates a second marked code used in the next round of the current round, the process 400 further includes:
[0102] Step 407: in response to the second annotated code not being changed in the updated target code obtained in the current round, based on the updated target code obtained in the current round, re-determining the update association context of the second annotated code in the updated target code obtained in the current round;
[0103] Specifically, if the execution subject detects that the second annotated code of the next round has not changed in the updated target code obtained in the current round, the execution subject can respond to this by redetermining the updated associated context of the second annotated code in the updated target code obtained in the current round based on the updated target code obtained in the current round. This process is actually similar to the method of determining the associated context in the target code discussed above. In fact, it only replaces the "target code" with the "(updated) associated context" corresponding to the "second annotated code" based on the updated target code obtained after the first annotated code is replaced in the current round. In this way, it is possible to avoid the "update error" caused by the "associated context" expiring and becoming unavailable due to the change of the contextual association relationship corresponding to the second annotated code after the replacement of the first annotated code.
[0104] Alternatively or additionally, if the executing entity detects that the second annotated code of the next round has changed in the updated target code obtained in the current round, the executing entity may choose to communicate and provide this situation to the target user to assist the target user in making a decision (for example, considering whether a code update is still needed, redetermining the "second annotated code", etc.).
[0105] Step 408: Generate a second update code for replacing the second annotated code based on the update association context and the update description information corresponding to the second annotated code;
[0106] Step 409: The second marked code is replaced with the second updated code to update the target code after the current round of updates, so as to obtain the target code after the next round of updates.
[0107] The above steps 408 and 409 are actually similar to the generation of update code provided by steps 203 and 204 discussed above, and the use of the update code to perform replacement to complete the update of the target code. The only difference is that the target code to be updated is actually "the target code after the current round and after replacing the first marked code". Therefore, the implementation method and process of steps 408 and 409 can be similarly referred to the contents discussed in steps 203 and 204, and will not be repeated here.
[0108] It should be understood that if there are multiple rounds, for example, in the case where the "current round" is exemplarily the "first round" and the "next round" of the "current round" is the second round, there may be subsequent "third rounds", "fourth rounds", etc. In this case, the execution subject can similarly select the target code updated in the previous round as the "benchmark", and redetermine the update-related context when, for example, the third annotated code has not been changed, and correspondingly perform the "update" of the corresponding round until all rounds of updates are completed to obtain the final target code after all updates are completed. Considering that this process is actually similar to the processing methods of the "current round" and the "next round" of the "current round" discussed above, it can be implemented by referring to the discussion and explanation of the corresponding parts of the above text, and will not be repeated here.
[0109] On the basis of any of the above embodiments, the processing performance and capability of the execution subject can also be improved by introducing and deploying a large language model. For example, in the process of generating a target code for a target user based on the generation description information in response to receiving the generation description information and the code generation request sent by the target user, the execution subject can choose to generate the target code for the target user based on the generation description information using the large language model in response to receiving the generation description information and the code generation request sent by the target user.
[0110] Large Language Model (LLM) is an artificial intelligence model that aims to understand and generate human language, and LLM can perform processing operations accordingly based on the content it understands to obtain corresponding processing results. For example, LLM can be specifically a generative large language model trained based on a model framework of a large language model. LLM can learn a large amount of language knowledge and world knowledge through large-scale pre-training on massive unlabeled data, and has general problem-solving capabilities for multiple tasks through key technologies such as instruction fine-tuning and human alignment. In principle, LLM aims to build a probabilistic generation model for text sequences.
[0111] For example, after obtaining the generated description information, LLM can generate and generate the corresponding target code for the user based on the understanding and instructions of the generated description information. Exemplarily, the "guide words" used to instruct LLM can be constructed with "generated description information" to instruct LLM to complete the task of generating the target code. For example, the guide words can be exemplarily "based on the content indicated by the 'generated description information', generate the corresponding code".
[0112] LLM can be trained on a large amount of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, etc. LLM is characterized by its large scale, and it can usually include a large number of parameters to help them learn complex patterns in language data. These models are usually based on deep learning architectures, such as converters, which help them provide better processing performance on various NLP tasks. In an embodiment of the present disclosure, the execution entity can use LLM as a code generation model to generate corresponding target code for the user based on the acquired generation description information.
[0113] In some scenarios, given the analytical capabilities of LLM, the processing speed of LLM may be able to meet the requirements of generating corresponding target code based on the generated description information without being trained in advance. Accordingly, the execution subject can use the LLM to generate the target code. In this way, the code generation service can be provided to the target user with high efficiency and quality, reducing the user's operating costs.
[0114] In some embodiments, the execution entity may also utilize LLM to generate "update code" for replacing the annotated code. That is, in the process of generating the update code for replacing the annotated code based on the associated context and the update description information for the annotated code, the execution entity may also similarly choose to utilize the large language model to generate the update code for replacing the annotated code based on the associated context and the update description information for the annotated code.
[0115] Specifically, similar to the process of generating the target code, the execution subject may choose to provide the associated context and the update description information for the annotated code to the LLM to instruct the LLM to "generate updated code that satisfies the constraints of the associated context and is used to replace the annotated code." For example, similar to the above discussion, "for the annotated code, without changing its context constraint relationship in the original code, generate new code that satisfies the requirements of the 'update description' information and is used to replace the annotated code" as the guide words to instruct the LLM to generate updated code for replacing the annotated code.
[0116] Therefore, LLM can be used to more efficiently and efficiently generate update code for replacing the annotated code, thereby improving the code update efficiency and update quality.
[0117] In some embodiments, for LLM, it can also be configured by default to at least partially omit the "guide word". For example, for the process of generating the target code, LLM can be configured to determine that the target user has provided "generate description information". LLM can predict its demand as "generate target code" by default configuration, and of course understand the need to "generate target code" based on "generate description information", without the target user explicitly "prompting to generate target code". Thus, by default configuration, LLM can stably and directionally "generate target code" based on "generate description information", further simplifying the user's operation process. Similarly, the execution subject can also adjust the process of generating the update code for replacing the annotated code simultaneously or separately, which will not be repeated here.
[0118] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for updating code, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0119] like Figure 5As shown, the apparatus 500 for updating code in this embodiment may include: an annotated code determining unit 501, an associated context determining unit 502, a first update code generating unit 503, and a first target code updating unit 504. The annotated code determining unit 501 is configured to determine the annotated code in the target code based on the code annotation; the associated context determining unit 502 is configured to determine the associated context of the annotated code in the target code; the first update code generating unit 503 is configured to generate an update code for replacing the annotated code based on the associated context and update description information for the annotated code, wherein the update description information is used to indicate the expected update result of the annotated code; the first target code updating unit 504 is configured to replace the annotated code with the update code, update the target code, and obtain the updated target code.
[0120] In the present embodiment, in the device for updating code 500, the specific processing of the annotated code determining unit 501, the associated context determining unit 502, the first updated code generating unit 503 and the first target code updating unit 504 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of steps 201 - 204 in the corresponding embodiment are not repeated here.
[0121] In some optional implementations of this embodiment, the apparatus 500 further includes: a first code presenting unit configured to present the target code to the target user in response to receiving the target code uploaded by the target user.
[0122] In some optional implementations of this embodiment, the device 500 also includes: a target code generation unit, configured to generate a target code for the target user based on the generation description information in response to receiving the generation description information and the code generation request sent by the target user; and a second code presentation unit, configured to present the target code to the target user.
[0123] In some optional implementations of this embodiment, the target code generation unit is further configured to, in response to receiving the generation description information and the code generation request sent by the target user, generate the target code for the target user based on the generation description information using the large language model.
[0124] In some optional implementations of this embodiment, the code annotation includes: an identifier added to the annotated code in the code image including the target code.
[0125] In some optional implementations of this embodiment, the device 500 also includes: a first control providing unit, configured to provide an image capture control and an image annotation control in a code interface presenting the target code, wherein the image capture control is configured to respond to being triggered by a target user and to capture a code image including the target code according to a capture operation instruction of the target user, and the image annotation control is configured to respond to being triggered by a target user and to add an identifier for the annotated code in the code image according to the annotation operation instruction of the target user.
[0126] In some optional implementations of this embodiment, the update description information is determined based on annotation information associated with the identifier in the code image.
[0127] In some optional implementations of this embodiment, the device 500 also includes: a second control providing unit, configured to provide an annotation control in a code interface presenting the target code, wherein the annotation control is configured to add annotation information in the code image in association with the identifier in response to being triggered by a target user and according to the target user's annotation operation instructions.
[0128] In some optional implementations of the present embodiment, the device 500 also includes: a conflict prompt unit, configured to provide conflict prompt information to the target user in response to the existence of at least two annotated codes associated with different association contexts, wherein the conflict prompt information is used to indicate the existence of at least two annotated codes associated with different association contexts; an annotated code selection unit, configured to determine, in response to the target user returning round indication information in response to the conflict prompt information, a first annotated code used in the current round from among the at least two annotated codes based on the round indication information; and a first update code generation unit 503, further configured to generate a first update code for replacing the first annotated code in the current round based on the association context of the first annotated code and the update description information corresponding to the first annotated code; and a first target code update unit 504, further configured to replace the first annotated code with the first update code to update the target code and obtain an updated target code.
[0129] In some optional implementations of this embodiment, the round indication information also indicates the second annotated code used in the next round of the current round, and the device 500 also includes: an associated context updating unit, configured to, in response to the second annotated code not changing in the updated target code obtained in the current round, redetermine the updated associated context of the second annotated code in the updated target code obtained in the current round based on the updated target code obtained in the current round, wherein the updated associated context is used to generate an updated code to replace the second annotated code; a second update code generating unit, configured to generate a second updated code for replacing the second annotated code based on the updated associated context and the update description information corresponding to the second annotated code; and a second target code updating unit, configured to replace the second annotated code with the second update code to update the updated target code of the current round to obtain the updated target code of the next round.
[0130] In some optional implementations of this embodiment, the first update code generating unit 503 is further configured to generate update code for replacing the annotated code based on the associated context and the update description information for the annotated code using the large language model.
[0131] This embodiment exists as a device embodiment corresponding to the above method embodiment. The device for updating code provided by this embodiment determines the annotated code in the target code based on the code annotation; determines the associated context of the annotated code in the target code; generates an update code for replacing the annotated code based on the associated context and the update description information for the annotated code, wherein the update description information is used to indicate the expected update result of the annotated code; and replaces the annotated code with the update code to update the target code to obtain the updated target code. Thus, the user is allowed to instruct to update part of the code content through instructions, so that the user can modify and update the code more flexibly and conveniently, and improve the efficiency of editing and obtaining the code.
[0132] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0133] Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0134] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0135] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0136] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as a method for updating code. For example, in some embodiments, the method for updating code may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the method for updating code described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute a method for updating code by any other appropriate means (e.g., by means of firmware).
[0137] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0138] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0139] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0140] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0141] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0142] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services. The server can also be divided into a server of a distributed system, or a server combined with a blockchain.
[0143] According to the technical solution of the embodiment of the present disclosure, the annotated code in the target code is determined based on the code annotation; the associated context of the annotated code in the target code is determined; based on the associated context and the update description information for the annotated code, the update code for replacing the annotated code is generated, wherein the update description information is used to indicate the expected update result of the annotated code; the annotated code is replaced with the update code, the target code is updated, and the updated target code is obtained. Thus, the user is allowed to indicate to update part of the code through instructions, so that the user can modify and update the code more flexibly and conveniently, and improve the efficiency of editing and obtaining the code.
[0144] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions provided by this disclosure can be achieved, and this document does not limit this.
[0145] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for updating code, include: Determine annotated code in the target code based on the code annotation; Determining the associated context of the annotated code in the target code; Generate an update code for replacing the annotated code based on the association context and update description information for the annotated code, wherein the update description information is used to indicate an expected update result for the annotated code; The marked code is replaced by the update code, and the target code is updated to obtain an updated target code.
2. The method according to claim 1, further comprising: include: In response to receiving the target code uploaded by the target user, presenting the target code to the target user.
3. The method according to claim 1, further comprising: include: In response to receiving the generation description information and the code generation request sent by the target user, generating the target code for the target user based on the generation description information; The target code is presented to the target user.
4. The method according to claim 3, in, In response to receiving the generation description information and the code generation request sent by the target user, generating the target code for the target user based on the generation description information includes: In response to receiving the generation description information and the code generation request sent by the target user, the target code is generated for the target user based on the generation description information using a large language model.
5. The method according to claim 2 or 3, in, The code annotation includes: adding an identifier for the annotated code in a code image including the target code.
6. The method according to claim 5, further comprising: include: An image capture control and an image annotation control are provided in a code interface presenting the target code, wherein the image capture control is configured to, in response to being triggered by the target user, capture a code image including the target code according to an interception operation instruction of the target user, and the image annotation control is configured to, in response to being triggered by the target user, add an identifier for the annotated code in the code image according to an annotation operation instruction of the target user.
7. The method according to claim 6, in, The update description information is determined based on annotation information associated with the identifier in the code image.
8. The method according to claim 7, further comprising: include: An annotation control is provided in a code interface presenting the target code, wherein the annotation control is configured to add the annotation information in association with the identifier in the code image in response to being triggered by the target user and according to an annotation operation instruction of the target user.
9. The method according to claim 2 or 3, further comprising: include: In response to the existence of at least two annotated codes associated with different association contexts, providing conflict prompt information to the target user, wherein the conflict prompt information is used to indicate the existence of at least two annotated codes associated with different association contexts; In response to the target user returning round indication information in response to the conflict prompt information, determining a first marked code used in the current round from among the at least two marked codes based on the round indication information; and The generating, based on the association context and the update description information for the annotated code, an update code for replacing the annotated code comprises: Generate a first update code for replacing the first annotated code in a current round based on the associated context of the first annotated code and the update description information corresponding to the first annotated code; and The method of replacing the marked code with the update code to update the target code to obtain the updated target code includes: The first marked code is replaced with the first update code to update the target code and obtain an updated target code.
10. The method according to claim 9, in, The round indication information further indicates a second marked code used in a next round of the current round, and further includes: In response to the second annotated code not being changed in the updated target code obtained in the current round, based on the updated target code obtained in the current round, re-determining an update association context of the second annotated code in the updated target code obtained in the current round, wherein the update association context is used to generate an update code that replaces the second annotated code; generating a second update code for replacing the second annotated code based on the update association context and the update description information corresponding to the second annotated code; The second marked code is replaced with the second updated code to update the target code after the current round of updates to obtain the target code after the next round of updates.
11. The method according to claim 1, in, The generating, based on the association context and the update description information for the annotated code, an update code for replacing the annotated code comprises: An update code for replacing the annotated code is generated based on the associated context and the update description information for the annotated code by using a large language model.
12. A device for updating code, include: a marked code determining unit, configured to determine the marked code in the target code based on the code marking; an association context determining unit, configured to determine an association context of the annotated code in the target code; a first update code generating unit, configured to generate an update code for replacing the annotated code based on the associated context and update description information for the annotated code, wherein the update description information is used to indicate an expected update result for the annotated code; The first target code updating unit is configured to replace the marked code with the update code, update the target code, and obtain an updated target code.
13. The device according to claim 12, further comprising: include: The first code presenting unit is configured to present the target code to the target user in response to receiving the target code uploaded by the target user.
14. The device according to claim 12, further comprising: include: a target code generating unit, configured to generate the target code for the target user based on the generation description information in response to receiving the generation description information and the code generation request sent by the target user; A second code presenting unit is configured to present the target code to the target user.
15. The device according to claim 14, in, The target code generation unit is further configured to, in response to receiving the generation description information and the code generation request sent by the target user, generate the target code for the target user based on the generation description information using a large language model.
16. The device according to claim 13 or 14, in, The code annotation includes: adding an identifier for the annotated code in a code image including the target code.
17. The device according to claim 16, further comprising: include: The first control providing unit is configured to provide an image capture control and an image annotation control in a code interface presenting the target code, wherein the image capture control is configured to respond to being triggered by the target user and to intercept a code image including the target code according to an interception operation instruction of the target user, and the image annotation control is configured to respond to being triggered by the target user and to add an identifier for the annotated code in the code image according to an annotation operation instruction of the target user.
18. The device according to claim 17, in, The update description information is determined based on annotation information associated with the identifier in the code image.
19. The device according to claim 18, further comprising: include: The second control providing unit is configured to provide an annotation control in a code interface presenting the target code, wherein the annotation control is configured to add the annotation information in the code image in association with the identifier in response to being triggered by the target user and according to the annotation operation instruction of the target user.
20. The device according to claim 13 or 14, further comprising: include: a conflict prompting unit, configured to provide conflict prompting information to the target user in response to the existence of at least two annotated codes associated with different association contexts, wherein the conflict prompting information is used to indicate the existence of at least two annotated codes associated with different association contexts; a marked code selection unit, configured to, in response to the target user returning round indication information in response to the conflict prompt information, determine a first marked code used in a current round from among at least two marked codes based on the round indication information; and The first update code generating unit is further configured to generate a first update code for replacing the first annotated code in a current round based on the associated context of the first annotated code and the update description information corresponding to the first annotated code; and The first target code updating unit is further configured to update the target code by replacing the first marked code with the first update code to obtain an updated target code.
21. The device according to claim 20, in, The round indication information further indicates a second marked code used in a next round of the current round, and further includes: an association context updating unit, configured to, in response to the second annotated code not being changed in the updated target code obtained in the current round, re-determine an update association context of the second annotated code in the updated target code obtained in the current round based on the updated target code obtained in the current round, wherein the update association context is used to generate an update code that replaces the second annotated code; a second update code generation unit configured to generate a second update code for replacing the second annotated code based on the update association context and the update description information corresponding to the second annotated code; The second target code updating unit is configured to update the target code updated in the current round by replacing the second marked code with the second updated code to obtain the target code updated in the next round.
22. The device according to claim 12, in, The first update code generating unit is further configured to generate an update code for replacing the annotated code based on the associated context and the update description information for the annotated code using a large language model.
23. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method for updating codes according to any one of claims 1 to 11.
24. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method for updating code according to any one of claims 1 to 11.
25. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method for updating code according to any one of claims 1 to 11.
Citation Information
Cited By
Large language model-based code development method and related device
WO2026130394A1
