Code programming auxiliary method and device, electronic equipment and storage medium

By obtaining user interface operations, determining code text, generating auxiliary requirements options, and requesting auxiliary content from large language models, the problem of inefficient code writing in the existing technology is solved and more efficient code writing is achieved.

CN120215904APending Publication Date: 2025-06-27SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311797729.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-25
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

Existing code programming auxiliary methods cannot meet the needs of users when writing code, resulting in inefficient writing code.

Method used

By obtaining the user's interface operation in the code operation interface, determining the code text to be assisted, generating auxiliary requirements options, requesting auxiliary content from the large language model, and displaying it on the code operation interface for users to confirm. Finally, the auxiliary code text is processed according to the auxiliary content confirmed by the user to obtain the target code text.

Benefits of technology

Meet the needs of users when writing code and improve the efficiency of code writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120215904A_ABST
    Figure CN120215904A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a code programming assisting method which comprises the following steps: when a preset auxiliary plug-in is started, acquiring an interface operation of a user in a code operation interface; determining a to-be-assisted code text in the code operation interface based on the interface operation; auxiliary demand options of the to-be-assisted code text are generated through a preset auxiliary plug-in according to the to-be-assisted code text; on the basis of the selected auxiliary demand option, auxiliary content of the to-be-assisted code text is requested from the large language model through a preset auxiliary plug-in, and the auxiliary content is displayed on the code operation interface, so that the auxiliary content is confirmed in the code operation interface; and based on the confirmed auxiliary content, performing auxiliary processing on the to-be-assisted code text through a preset auxiliary plug-in to obtain a target code text. By means of the method, auxiliary processing is directly conducted on the to-be-assisted code text in the code operation interface, various requirements of a user in the code writing process are met, and the code writing efficiency of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of code programming, and in particular, to a code programming assistance method, apparatus, electronic device, and storage medium. Background Art

[0002] With the continuous development of artificial intelligence technology, large language models are increasingly widely used in the field of code programming. In the existing code programming assistance technology, when users use large language models for code assistance, they often need to switch between the integrated development environment and the large language model, and need to manually input the code provided by the large language model into the development environment. Therefore, the existing code programming assistance methods have the problem of being unable to meet the needs of users when writing code, resulting in low code writing efficiency. Summary of the Invention

[0003] An embodiment of the present invention provides a code programming assistance method, aiming to solve the problem that the existing code programming assistance methods cannot meet the needs of users when writing code, resulting in low code writing efficiency. By obtaining the interface operations of the user in the code operation interface, determining the code text to be assisted, and generating auxiliary requirement options for the text, and requesting auxiliary content from the large language model according to the auxiliary requirement options through a preset auxiliary plugin, and displaying the auxiliary content on the code operation interface for the user to confirm, and performing auxiliary processing on the code text to be assisted according to the auxiliary content confirmed by the user to obtain the target code text. By performing auxiliary processing on the code text to be assisted through the above method, the needs of users when writing code can be met, thereby improving the efficiency of writing code.

[0004] In a first aspect, an embodiment of the present invention provides a code programming assistance method, the method comprising the following steps:

[0005] When the preset auxiliary plugin is enabled, obtain the interface operations of the user in the code operation interface;

[0006] Based on the interface operations, determine the code text to be assisted in the code operation interface;

[0007] Generate auxiliary requirement options for the code text to be assisted through the preset auxiliary plugin according to the code text to be assisted;

[0008] Based on the auxiliary requirement options selected by the user, request the auxiliary content of the code text to be assisted from the large language model through the preset auxiliary plugin, and display the auxiliary content on the code operation interface, so that the user can confirm the auxiliary content in the code operation interface;

[0009] Based on the auxiliary content after user confirmation, use the preset auxiliary plugin to perform auxiliary processing on the code text to be assisted, and obtain the target code text.

[0010] Optionally, the interface operation includes the position and operation type of the text indicator. Based on the interface operation, determining the code text to be assisted in the code operation interface includes:

[0011] Based on the position and operation type of the text indicator, determine the operation area of the user in the code interface;

[0012] Extract the code text within the operation area to obtain the code text to be assisted.

[0013] Optionally, generating the auxiliary requirement options for the code text to be assisted by the preset auxiliary plugin includes:

[0014] Perform content scanning on the code text to be assisted through the preset auxiliary plugin to determine the code logic of the code text to be assisted;

[0015] Generate the auxiliary requirement options for the code text to be assisted based on the code logic of the code text to be assisted.

[0016] Optionally, based on the auxiliary requirement options selected by the user, use the preset auxiliary plugin to request the auxiliary content of the code text to be assisted from the large language model, and display the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface, including:

[0017] Based on the auxiliary requirement options selected by the user, send the prompt text of the auxiliary requirement options to the large language model through the preset auxiliary plugin. The prompt text of the auxiliary requirement options includes the code text to be assisted and the indicator words corresponding to the auxiliary requirement options;

[0018] Obtain the auxiliary content returned from the large language model through the preset auxiliary plugin. The auxiliary content is the processing result obtained by the large language model according to the indicator words corresponding to the auxiliary requirement options and processing the content of the code text to be assisted;

[0019] Display the auxiliary content of the code text to be assisted in the code operation interface through the preset auxiliary plugin so that the user can confirm the auxiliary content in the code operation interface.

[0020] Optionally, for obtaining the auxiliary content returned from the large language model through the preset auxiliary plugin, the method further includes:

[0021] Performing assembly feature extraction on the code text to be assisted and the historical code text through the preset auxiliary plug-in to obtain the user's assembly behavior. The historical code text is the code text to be assisted that has undergone code programming assistance operations;

[0022] Sending the user's assembly behavior to the large language model through the preset auxiliary plug-in, so that the assembly habits and assembly logic of the auxiliary content returned by the large language model are consistent with the user's assembly logic and assembly habits. The auxiliary content output by the large language model is the processing result obtained by the large language model performing assembly behavior processing on the code text to be assisted.

[0023] Optionally, the auxiliary processing includes code copying, code replacement, code insertion, and code update. Based on the auxiliary content after user confirmation, performing auxiliary processing on the code text to be assisted through the preset auxiliary plug-in to obtain the target code text, including:

[0024] Determining at least one operation of code copying, code replacement, code insertion, and code update by the user for the auxiliary content;

[0025] Based on at least one operation of code copying, code replacement, code insertion, and code update by the user for the auxiliary content, performing auxiliary processing on the auxiliary content and the code text to be assisted through the preset auxiliary plug-in to obtain the target code text.

[0026] Optionally, after performing auxiliary processing on the code text to be assisted through the preset auxiliary plug-in to obtain the target code text, the method further includes:

[0027] In a preset self-test environment through the preset auxiliary plug-in, globally self-testing the target code text after replacing the code text to be assisted in the original code to obtain a self-test result;

[0028] Based on the self-test result, determining the feasibility of the target code text;

[0029] If the feasibility of the target code text fails, sending a prompt text for regenerating the auxiliary requirement option to the large language model through the preset auxiliary plug-in, so that the large language model obtains a new target code text according to the regenerated prompt text. The regenerated prompt text includes the code text to be assisted, the original code, and the indicator words corresponding to the auxiliary requirement option;

[0030] If the feasibility of the target code text passes or the feasibility of the new target code text passes, then display the target code text or the new target code text in the code operation interface.

[0031] In a second aspect, an embodiment of the present invention further provides a code programming assistance device, where the code programming assistance device includes:

[0032] A first acquisition module, configured to acquire the interface operations of the user in the code operation interface when a preset assistance plugin is enabled;

[0033] A first determination module, configured to determine the code text to be assisted in the code operation interface based on the interface operations;

[0034] A first generation module, configured to generate assistance requirement options for the code text to be assisted according to the code text to be assisted through the preset assistance plugin;

[0035] A request module, configured to request assistance content for the code text to be assisted from a large language model through the preset assistance plugin based on the selected assistance requirement options by the user, and display the assistance content on the code operation interface so that the user can confirm the assistance content in the code operation interface;

[0036] A second acquisition module, configured to perform assistance processing on the code text to be assisted through the preset assistance plugin based on the assistance content confirmed by the user to obtain a target code text.

[0037] In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, the steps in the code programming assistance method provided by the embodiment of the present invention are implemented.

[0038] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the code programming assistance method provided by the embodiment of the invention are implemented.

[0039] In an embodiment of the present invention, when a preset auxiliary plugin is enabled, the interface operations of the user in the code operation interface are obtained; based on the interface operations, the code text to be assisted is determined in the code operation interface; the preset auxiliary plugin generates auxiliary requirement options for the code text to be assisted according to the code text to be assisted; based on the selected auxiliary requirement options, the preset auxiliary plugin requests auxiliary content for the code text to be assisted from a large language model and displays the auxiliary content on the code operation interface so that the auxiliary content can be confirmed in the code operation interface; based on the confirmed auxiliary content, the preset auxiliary plugin performs auxiliary processing on the code text to be assisted to obtain the target code text. By requesting the requirements of the user when writing code from the large language model and directly displaying the request result on the code operation interface, the requirements of the user when writing code can be met, thereby improving the efficiency of writing code. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0041] Figure 1 is a flowchart of a code programming assistance method provided by an embodiment of the present invention;

[0042] Figure 2 is an editor architecture diagram of a code programming assistance method provided by an embodiment of the present invention;

[0043] Figure 3 is a structural schematic diagram of a code programming assistance device provided in an embodiment of the present invention;

[0044] Figure 4 is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0045] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0046] As Figure 1 shown, Figure 1It is a flowchart of a code programming assistance method provided by an embodiment of the present invention. The code programming assistance method includes the steps:

[0047] 101. When the preset assistance plugin is enabled, obtain the interface operations of the user in the code operation interface.

[0048] In an embodiment of the present invention, the above code programming assistance method can be applied to a code editing platform. The above code editing platform has functions such as code data processing, code data sending and receiving, and code data storage, and can be built based on a server or a server cluster. The above server or server cluster can be an electronic device with work order data processing capabilities. And the above code editing platform includes the above preset assistance plugin, which can detect the selection and operation of the code text by the user, and provide demand assistance content according to the selection of the user's demand options for the code text. The above assistance plugin is applicable to any platform or window for code programming according to the above code programming assistance method.

[0049] The above preset assistance plugin can be a collection of multiple VS Code plugins, and it can support multiple programming languages and platforms. The above VS Code plugins can be a collection of code programming plugins such as Code Snippets, Code Formatter, File Compare, etc., and have corresponding function collections.

[0050] The above code operation interface can be the interface in the above code editing platform. Specifically, it can be the interface for the user to perform code programming, such as the code editing interface of VS, the code editing interface of PyCharm, etc., and can also be the online code editing window of some pages.

[0051] The above interface operations can refer to the operations of the user on the code text. Specifically, it can be the operations of the user using the cursor to select or click on the code text, or the operations of the user using the keyboard to quickly operate on the code text, such as copy and paste.

[0052] In a possible embodiment, after the above preset assistance plugin is started, it can capture the selection of some code text or other interface operations by the user in the code editing area.

[0053] 102. Based on the interface operations, determine the code text to be assisted in the code operation interface.

[0054] In an embodiment of the present invention, the above-mentioned code text to be assisted can be the code text that the user needs to enhance with assisted code. Specifically, it can be the selected code text captured according to the user's interface operations in the above-mentioned code editing area after the above-mentioned preset assisted plug-in is started. For example, it can be the code text obtained according to the user's selection operation in the above-mentioned code editing area, or the code text obtained by automatically connecting the upper and lower code paragraphs according to the code logic for multi-paragraph selection. It should be noted that after the user selects the code text in the above-mentioned code editing area through the cursor anchor point, the relevant code paragraphs with certain code logic can be automatically connected according to the selected code text as the above-mentioned code text to be assisted.

[0055] In a possible embodiment, the above-mentioned code editing platform obtains the above-mentioned code text to be assisted according to the position of the cursor anchor point of the user in the above-mentioned code editing interface and the user's interface operations by the above-mentioned preset assisted plug-in.

[0056] 103. Generate auxiliary requirement options for the code text to be assisted according to the code text to be assisted by a preset assisted plug-in.

[0057] In an embodiment of the present invention, the above-mentioned auxiliary requirement options can be that the above-mentioned preset assisted plug-in analyzes the code logic and code content of the above-mentioned code text to be assisted, so as to generate multiple options that can optimize the above-mentioned code text to be assisted, so that after the above-mentioned code text to be assisted is optimized through the above-mentioned optimized options, the code execution efficiency is higher and the code content is more concise. Generally speaking, the above-mentioned auxiliary requirement options can be code correction, intelligent suggestions, generated code snippets, error detection prompts, code optimization suggestions, refactoring suggestions, type information, comments, etc. The above-mentioned preset assisted plug-in will generate multiple preset auxiliary requirement options according to the preset content or the results after the above-mentioned analysis, or generate multiple auxiliary requirement options that can optimize the code logic and content.

[0058] In a possible embodiment, the above-mentioned preset assisted plug-in analyzes the code logic and code content of the above-mentioned code text to be assisted, and based on the analysis results, generates multiple options that can optimize the above-mentioned code text to be assisted, such as code correction, code refactoring, etc.

[0059] In another possible embodiment, the above-mentioned preset assisted plug-in generates multiple preset auxiliary requirement options according to the preset requirement options, and the user can select the preset auxiliary requirement options to perform operations such as code correction and code refactoring on the above-mentioned code text to be assisted.

[0060] 104. Based on the auxiliary requirement options selected by the user, request the auxiliary content of the code text to be assisted from the large language model through a preset auxiliary plugin, and display the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface.

[0061] In an embodiment of the present invention, the above-mentioned large language model may refer to a deep learning model trained using a large amount of text data, which can generate natural language text or understand the meaning of language text. Specifically, it may be a language model capable of understanding code logic for code editing and generating corresponding optimization strategies. For example, the Codex model, which can be used for code editing and generation.

[0062] The above-mentioned auxiliary content may be the corresponding code optimization strategy generated according to the above-mentioned auxiliary requirement options. For example, when the user selects the auxiliary requirement option of code correction, the code text after code correction for the above-mentioned code text to be assisted will be generated, and the corrected code text will be displayed on the above-mentioned code operation interface.

[0063] In a possible embodiment, the above-mentioned preset auxiliary plugin requests the content of the auxiliary requirement option corresponding to the code text to be assisted from the above-mentioned large language model according to the user's selection of the auxiliary requirement option, and displays the auxiliary content of the corresponding auxiliary requirement option returned by the large language model on the above-mentioned code operation interface so that the user can confirm the auxiliary content in the code operation interface.

[0064] 105. Based on the auxiliary content confirmed by the user, perform auxiliary processing on the code text to be assisted through a preset auxiliary plugin to obtain the target code text.

[0065] In an embodiment of the present invention, the above-mentioned auxiliary processing may be the execution action of the user on the above-mentioned auxiliary content. Specifically, it may be the operation of the user executing the above-mentioned auxiliary content into the content of the above-mentioned code text to be assisted. For example, replacing the above-mentioned auxiliary content into the above-mentioned code text to be assisted, or inserting the above-mentioned auxiliary content at the position of the user's cursor anchor point, etc.

[0066] The above-mentioned target code text may be the optimized code text obtained after the above-mentioned auxiliary processing. Generally speaking, the target code text has better performance in terms of code logic, code content, and code execution efficiency compared to the above-mentioned code text to be assisted.

[0067] In an embodiment of the present invention, when a preset auxiliary plugin is enabled, the interface operations of the user in the code operation interface are obtained; based on the interface operations, the code text to be assisted is determined in the code operation interface; the preset auxiliary plugin generates auxiliary requirement options for the code text to be assisted according to the code text to be assisted; based on the selected auxiliary requirement options, the preset auxiliary plugin requests auxiliary content for the code text to be assisted from a large language model and displays the auxiliary content on the code operation interface so that the auxiliary content can be confirmed in the code operation interface; based on the confirmed auxiliary content, the preset auxiliary plugin performs auxiliary processing on the code text to be assisted to obtain the target code text. By requesting the requirements of the user when writing code from the large language model and directly displaying the request result on the code operation interface, the requirements of the user when writing code can be met, thereby improving the efficiency of writing code.

[0068] Optionally, in the step of determining the code text to be assisted in the code operation interface based on the interface operations, the operation area of the user in the code interface can also be determined based on the position and operation type of the text indicator, and then the code text in the operation area is extracted to obtain the code text to be assisted.

[0069] In an embodiment of the present invention, the above interface operations include the position and operation type of the text indicator, and the text indicator can be any indicator capable of selecting the above code text to be assisted. For example, the above code text to be assisted is selected through the touch point of the touch screen, or the above code text to be assisted is selected through the cursor anchor point. The above operation type can be operations such as selection, click, or box selection of the above code text to be assisted by the user to distinguish different operations that the user can perform on the above code text to be assisted.

[0070] The above operation area can refer to the code text area selected by the user in the above code operation interface, that is, the area where code assistance enhancement operations are being performed. For example, when the user uses the cursor anchor point to box out a part of the code paragraph, the boxed code paragraph can be used as the operation area.

[0071] The above extraction of the code text can be obtained by matching the code text in the operation area according to a regular expression. It should be noted that since the code languages are different, the regular expressions used are also different, and different matching regular expressions need to be set according to different code languages.

[0072] In a possible embodiment, the preset auxiliary plugin obtains the operation area selected by the user according to the operations of the user in the code interface, and matches the code text in the operation area through a preset regular expression, thereby obtaining the above code text to be assisted.

[0073] Optionally, in the step of generating auxiliary requirement options for the code text to be assisted by the preset auxiliary plugin based on the code text to be assisted, the preset auxiliary plugin can also scan the content of the code text to be assisted to determine the code logic of the code text to be assisted, and then generate auxiliary requirement options for the code text to be assisted based on the code logic of the code text to be assisted.

[0074] In an embodiment of the present invention, the preset auxiliary plugin can scan the content of the code text to be assisted, extract the code structure in the text content, infer the code logic of the code text to be assisted based on the analysis and processing of the code structure and code content, and finally generate auxiliary requirement options that can optimize the logic or function implementation of the code text to be assisted according to the code logic.

[0075] Specifically, in a possible embodiment, the preset auxiliary plugin will generate the first n auxiliary requirement options that are best for optimizing the logic or function implementation of the code text to be assisted according to the code logic of the code text to be assisted. It should be noted that the above first N types can be preset according to specific implementation schemes. For example, when the preset auxiliary plugin believes that there may be relatively large code writing errors in the code text to be assisted after scanning and analyzing the code text to be assisted, then an auxiliary requirement option for code error correction will be generated, and the auxiliary requirement option for code error correction will be placed first among other auxiliary requirement options.

[0076] In another possible embodiment, the preset auxiliary plugin will display the preset auxiliary requirement options in sequence or, based on the best optimization of the logic or function implementation of the code text to be assisted, select the first N auxiliary requirement options from the preset auxiliary requirement options and display them.

[0077] Optionally, in the step of requesting auxiliary content for the code text to be assisted from a large language model through the preset auxiliary plugin based on the auxiliary requirement options selected by the user and displaying the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface, the preset auxiliary plugin can also send a prompt text of the auxiliary requirement options to the large language model based on the auxiliary requirement options selected by the user, then obtain the auxiliary content returned from the large language model through the preset auxiliary plugin, and finally display the auxiliary content of the code text to be assisted on the code operation interface through the preset auxiliary plugin so that the user can confirm the auxiliary content in the code operation interface.

[0078] In an embodiment of the present invention, after clicking on the above-mentioned auxiliary requirement option, the above-mentioned preset auxiliary plug-in will send a corresponding function request to the above-mentioned large language model according to the function corresponding to the auxiliary requirement option. The prompt text of the above-mentioned auxiliary requirement option includes the text of the code to be assisted and the indicator word corresponding to the auxiliary requirement option. The above-mentioned large language model can process the text of the code to be assisted according to the indicator word corresponding to the auxiliary requirement option in the prompt text. The above-mentioned auxiliary content is the processing result obtained by the large language model processing the content of the code to be assisted according to the indicator word corresponding to the auxiliary requirement option.

[0079] Specifically, the above-mentioned preset auxiliary plug-in takes the above-mentioned auxiliary requirement option, the corresponding function of the auxiliary requirement option, and the text of the code to be assisted as an input request and inputs it into the above-mentioned large language model, so that the large language model can process the text of the code to be assisted according to the function corresponding to the above-mentioned auxiliary requirement option. For example, when the user selects the "code error correction" option, the above-mentioned preset auxiliary plug-in will take the "code error correction" function and the text of the code to be assisted as a request and input it into the large language model, so that the large language model performs "code error correction" processing on the text of the code to be assisted, thereby correcting the code errors in the text of the code to be assisted and returning the corrected text of the code to be assisted to the above-mentioned preset auxiliary plug-in.

[0080] After receiving the corresponding function request sent by the above-mentioned preset auxiliary plug-in, the above-mentioned large language model will process the text of the code to be assisted according to the relevant function. Specifically, the above-mentioned large language model will process the text of the code to be assisted according to the function corresponding to the auxiliary requirement option in the request to obtain auxiliary content that meets the function corresponding to the above-mentioned auxiliary requirement option. For example, when the above-mentioned large language model receives the request from the above-mentioned preset auxiliary plug-in, it processes the text of the code to be assisted according to the function corresponding to the auxiliary requirement option in the request to obtain auxiliary content that meets the above-mentioned function.

[0081] In a possible embodiment, when the user selects the "code error correction" auxiliary requirement option to correct the code of the above-mentioned text of the code to be assisted, the above-mentioned large language model will analyze and judge the code logic in the text of the code to be assisted according to the request sent by the above-mentioned preset auxiliary plug-in, thereby generating a result after code correction. This result is the above-mentioned auxiliary content and is returned to the above-mentioned preset auxiliary plug-in. After receiving the above-mentioned auxiliary content, the above-mentioned preset auxiliary plug-in displays it in the code operation interface of the above-mentioned user, so that the user can confirm the above-mentioned auxiliary content in the operation interface. It should be noted that due to differences in code writing, the above-mentioned auxiliary content may be multiple results with different writing habits but the same code logic in specific implementation schemes.

[0082] Optionally, in the step of obtaining the auxiliary content returned by the large language model through the preset auxiliary plug-in, the preset auxiliary plug-in can also extract the assembly features of the code text to be assisted and the historical code text to obtain the user's assembly behavior, and then send the user's assembly behavior to the large language model through the preset auxiliary plug-in, so that the assembly habits and assembly logic of the auxiliary content returned by the large language model according to the user's assembly behavior obtained through the preset auxiliary plug-in are consistent with the user's assembly logic and assembly habits. The auxiliary content output by the large language model is the processing result obtained by the large language model performing assembly behavior processing on the code text to be assisted.

[0083] In the embodiment of the present invention, the above historical code text can be the code text to be assisted that has undergone code programming assistance operations, or the code text that already exists in the above code operation interface and has been successfully compiled before the code programming assistance operations are performed.

[0084] When the large language model processes the content of the code text to be assisted, it will also analyze the assembly features of the code text to be assisted. The above assembly features can refer to the ways and features of the code executed on the underlying hardware, including instruction sets, register usage, memory access patterns, etc. The large language model will analyze the code text to be assisted and the above historical code text to determine which registers are frequently used, which memory is frequently read and written, and the writing syntax habits, etc., so as to obtain the user's assembly behavior when writing code. Specifically, before the large language model processes the text content of the code to be assisted, it is necessary to input the code text to be assisted, the historical code text, and the indication of assembly feature extraction to the large language model, so that the large language model can perform assembly feature extraction processing on the code text to be assisted and the historical code text according to the input indication of assembly feature extraction, and obtain the assembly features of the code text to be assisted and the historical code text. The above assembly behavior can include but is not limited to assembly habits and assembly logic. Generally speaking, when a user performs code programming for a long time, a set of his own assembly behaviors will be formed, and the assembly behaviors can include the code logic and code writing habits of the user during the code programming process.

[0085] Before the large language model corrects the auxiliary content according to the above assembly features, the above assembly behavior and auxiliary content can be input to the large language model, so that the large language model can correct the auxiliary content according to the assembly behavior and obtain the corrected auxiliary content.

[0086] In a possible embodiment, the above-mentioned preset auxiliary plug-in generates a hint text for the purpose of obtaining the same behavior attribute as the above-mentioned assembly behavior according to the above-mentioned assembly behavior, and sends the hint text to the above-mentioned large language model, so that the above-mentioned large language model can perform assembly behavior processing on the above-mentioned auxiliary content according to the hint text, so that the generated auxiliary content can be corrected according to the user's assembly behavior, so that the auxiliary content returned to the above-mentioned preset auxiliary plug-in can be consistent with the user's own assembly behavior in terms of code editing and code logic, avoiding the introduction of new error codes.

[0087] Optionally, in the step of performing auxiliary processing on the code text to be assisted by the preset auxiliary plug-in based on the auxiliary content after user confirmation to obtain the target code text, it is also possible to determine at least one of the operations of code copying, code replacement, code insertion, and code update by the user for the auxiliary content, and then based on at least one of the operations of code copying, code replacement, code insertion, and code update by the user for the auxiliary content, the preset auxiliary plug-in performs auxiliary processing on the auxiliary content and the code text to be assisted to obtain the target code text.

[0088] In the embodiment of the present invention, the above-mentioned auxiliary processing includes but is not limited to operations such as code copying, code replacement, code insertion, and code update. In a possible embodiment, the auxiliary processing can be set for custom processing according to the user's own needs.

[0089] In a possible embodiment, after the user confirms the above-mentioned auxiliary content in the above-mentioned code operation interface, according to the selected code area or according to the area where the above-mentioned code text to be assisted is located, at least one corresponding auxiliary processing operation is selected, and the above-mentioned preset auxiliary plug-in embeds the obtained auxiliary content into the above-mentioned code text to be assisted according to the user's selection to obtain the target code text.

[0090] Optionally, after the preset auxiliary plug-in performs auxiliary processing on the auxiliary code text to obtain the target code text, the preset auxiliary plug-in can also replace the target code text with the auxiliary code text in the original code in a preset self-test environment, and then perform a global self-test to obtain a self-test result, and then determine the feasibility of the target code text based on the self-test result. If the feasibility of the target code text does not pass, the preset auxiliary plug-in sends the regenerated prompt text of the auxiliary requirement option to the large language model, so that the preset auxiliary plug-in obtains the new target code text obtained from the large language model according to the regenerated prompt text, and the preset auxiliary plug-in replaces the auxiliary code text in the original code in a preset self-test environment. After that, a global self-test is performed to obtain a new self-test result, and the feasibility of the new target code text is determined based on the new self-test result. If the feasibility of the target code text passes or the feasibility of the new target code text passes, the target code text or the new target code text is displayed in the code operation interface.

[0091] Replace the target code text to the position to be assisted and perform a global self-test to confirm the feasibility of the target code text. If the feasibility of the target code text fails, the target code text will not be displayed in the code operation interface, and the target code text will be regenerated for a global self-test; if the feasibility of the target code text passes, the target code text will be displayed in the code operation interface.

[0092] In the embodiment of the present invention, in order to improve the efficiency of code development, it is often necessary to test the new code after generating it. The above-mentioned preset self-test environment can be a virtual machine, or the integrated deployment environment that comes with the above-mentioned preset auxiliary plug-in, etc. Generally speaking, the self-built environment that can be isolated from the production environment and perform UAT testing can be used as the above-mentioned preset self-test environment, that is, the environment that does not affect the actual program development can be used as the above-mentioned preset self-test environment.

[0093] The regenerated prompt text includes but is not limited to the code text to be assisted, the original code and the indicator words corresponding to the auxiliary requirement options. Generally speaking, the large language model can reprocess the code to be assisted according to the regenerated prompt text to obtain a new target code, and the content of the new target code is different from the content of the target code that did not pass the feasibility test before.

[0094] The feasibility of the above-mentioned target code text may mean that after the above-mentioned target code text is replaced to the position of the above-mentioned auxiliary code text, global compilation can pass and the function of the global code can be realized.

[0095] In a possible embodiment, after obtaining the above-mentioned target code text, the above-mentioned preset auxiliary plug-in replaces the above-mentioned target code text at the position of the above-mentioned code to be assisted in the above-mentioned preset self-test environment, and compiles the global code. If the compilation is successful and the function of the above-mentioned global code can be implemented, the above-mentioned target code text is displayed in the above-mentioned code operation interface for the user to confirm. If the compilation is successful but the function of the above-mentioned global code cannot be implemented, the target code text is not displayed in the code operation interface, and the target code text is regenerated for global self-test until the above-mentioned global code is compiled successfully and can implement the function of the above-mentioned global code. If the compilation fails, the target code text is not displayed in the code operation interface, and the target code text is regenerated for global self-test until the above-mentioned global code is compiled successfully and can implement the function of the above-mentioned global code.

[0096] In another possible embodiment, code self-testing can be performed according to the above-mentioned large language model. First, the replaced full-scale code and the results corresponding to the original full-scale code can be input to the large language model so that the self-tested results output by the large language model correspond to the results corresponding to the above-mentioned original full-scale code, avoiding the introduction of new error codes. The above-mentioned large language model can process the replaced global code according to the above-mentioned input, output the results of the replaced global code, and display them to the user so that the user can confirm whether the output results are consistent with the results corresponding to the original full-scale code.

[0097] As Figure 2 shown, Figure 2 Figure 10 is the code editor architecture of a code programming assistance method provided by an embodiment of the present invention. The code editor includes: a code editing area and a Webview plug-in;

[0098] Among them, the above-mentioned code editing area can store the assisted and enhanced code segments selected by the user with the mouse, and can display the code effects presented after the user selects and executes the operation buttons. The above-mentioned Webview plug-in can display the function buttons for the code to be enhanced, such as code correction buttons, code optimization buttons, etc. After clicking the corresponding function button, the above-mentioned Webview plug-in can also display the results after analyzing the above-mentioned code segment according to GPT, and display the results in the above-mentioned Webview plug-in in the form of a pop-up window.

[0099] Specifically, the process can be that the user selects the code snippet to be assisted and enhanced in the above code editing area by using the mouse, then selects the function button for enhancing the code in the above Webview plugin, enables GPT to analyze the code snippet according to the selected function button, displays the analysis result in the form of a pop-up window in the above Webview plugin, selects the execution operation button for the above analysis result in the above Webview plugin, and finally displays the execution result in the above code editing area.

[0100] As Figure 3 shown, an embodiment of the present invention further provides a code programming assistance device, and the code programming assistance device includes:

[0101] A first acquisition module 301, configured to acquire the interface operation of the user in the code operation interface when a preset assistance plugin is enabled;

[0102] A first determination module 302, configured to determine the code text to be assisted in the code operation interface based on the interface operation;

[0103] A first generation module 303, configured to generate an auxiliary requirement option for the code text to be assisted according to the code text to be assisted through the preset assistance plugin;

[0104] A request module 304, configured to request the auxiliary content of the code text to be assisted from a large language model through the preset assistance plugin based on the auxiliary requirement option selected by the user, and display the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface;

[0105] A second acquisition module 305, configured to perform auxiliary processing on the code text to be assisted through the preset assistance plugin based on the auxiliary content confirmed by the user to obtain a target code text.

[0106] Optionally, the above first determination module 302 includes:

[0107] A first determination sub-module, configured to determine the operation area of the user in the code interface based on the position and operation type of the text indicator;

[0108] A first acquisition sub-module, configured to extract the code text in the operation area to obtain the code text to be assisted.

[0109] Optionally, the above first generation module 303 includes:

[0110] A second determination sub-module, configured to perform content scanning on the code text to be assisted through the preset assistance plugin to determine the code logic of the code text to be assisted;

[0111] A first generation sub-module for generating auxiliary requirement options for the to-be-assisted code text based on the code logic of the to-be-assisted code text.

[0112] Optionally, the above request module 304 includes:

[0113] A request sub-module for sending, based on the auxiliary requirement options selected by the user, a prompt text of the auxiliary requirement options to the large language model through a preset auxiliary plug-in, where the prompt text of the auxiliary requirement options includes the to-be-assisted code text and an indicator word corresponding to the auxiliary requirement options;

[0114] A first display sub-module for obtaining, through the preset auxiliary plug-in, auxiliary content returned by the large language model, where the auxiliary content is a processing result obtained by the large language model processing the content of the to-be-assisted code text according to the indicator word corresponding to the auxiliary requirement options;

[0115] A second display sub-module for displaying, through the preset auxiliary plug-in, the auxiliary content of the to-be-assisted code text in a code operation interface, so that the user can confirm the auxiliary content in the code operation interface.

[0116] Optionally, the above device further includes:

[0117] An extraction module for performing assembly feature extraction on the to-be-assisted code text and historical code text through the preset auxiliary plug-in to obtain the user's assembly behavior, where the historical code text is the to-be-assisted code text that has undergone code programming assistance operations, and the assembly behavior includes assembly habits and assembly logic;

[0118] A correction module for sending, through the preset auxiliary plug-in, the user's assembly behavior to the large language model, so that the assembly habits and assembly logic of the auxiliary content returned by the large language model are consistent with the user's assembly logic and assembly habits, and the auxiliary content output by the large language model is a processing result obtained by the large language model performing assembly behavior processing on the to-be-assisted code text.

[0119] Optionally, the above second acquisition module 305 includes:

[0120] A third determination sub-module for determining at least one operation of code copying, code replacement, code insertion, and code update by the user for the auxiliary content;

[0121] A processing sub-module, configured to perform auxiliary processing on the auxiliary content and the code text to be assisted through the preset auxiliary plug-in based on at least one of the user's operations of code copying, code replacement, code insertion, and code update on the auxiliary content, so as to obtain a target code text.

[0122] Optionally, the above device further includes:

[0123] A first feasibility confirmation module, configured to perform global self-testing on the target code text after replacing the code text to be assisted in the original code through the preset auxiliary plug-in in a preset self-test environment, so as to obtain a self-test result;

[0124] A first self-test module, configured to determine the feasibility of the target code text based on the self-test result;

[0125] A second feasibility confirmation module, configured to, if the feasibility of the target code text fails, send a prompt text for regenerating the auxiliary requirement option to the large language model through the preset auxiliary plug-in, so that the large language model obtains a new target code text according to the regenerated prompt text, where the regenerated prompt text includes the code text to be assisted, the original code, and an indicator word corresponding to the auxiliary requirement option;

[0126] A third feasibility determination module, configured to, if the feasibility of the target code text passes or the feasibility of the new target code text passes, display the target code text or the new target code text in the code operation interface.

[0127] As Figure 4 shown, an embodiment of the present invention further provides an electronic device, including a processor, and the above processor can execute any one of the above code programming assistance methods.

[0128] Specifically, it includes a processor 401, a memory 402, and a computer program for executing the code programming assistance method stored in the memory 402 and capable of running on the processor 401, where:

[0129] The processor 401 runs the calculator program of the code programming assistance method stored in the memory 402 and executes the following steps:

[0130] When the preset auxiliary plug-in is turned on, obtain the interface operation of the user in the code operation interface;

[0131] Based on the interface operation, determine the code text to be assisted in the code operation interface;

[0132] Generate an auxiliary requirement option for the code text to be assisted through the preset auxiliary plug-in according to the code text to be assisted;

[0133] Based on the auxiliary requirement options selected by the user, request the auxiliary content of the code text to be assisted from the large language model through the preset auxiliary plug-in, and display the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface;

[0134] Based on the auxiliary content confirmed by the user, perform auxiliary processing on the code text to be assisted through the preset auxiliary plug-in to obtain the target code text.

[0135] Optionally, the processor 401 executes the interface operation including the position and operation type of the text indicator. Based on the interface operation, determining the code text to be assisted in the code operation interface includes:

[0136] Based on the position and operation type of the text indicator, determine the operation area of the user in the code interface;

[0137] Extract the code text in the operation area to obtain the code text to be assisted.

[0138] Optionally, the processor 401 executes the preset auxiliary plug-in to generate the auxiliary requirement options for the code text to be assisted, including:

[0139] Perform content scanning on the code text to be assisted through the preset auxiliary plug-in to determine the code logic of the code text to be assisted;

[0140] Based on the code logic of the code text to be assisted, generate the auxiliary requirement options for the code text to be assisted.

[0141] Optionally, the processor 401 executes the operation of requesting the auxiliary content of the code text to be assisted from the large language model through the preset auxiliary plug-in based on the auxiliary requirement options selected by the user, and displaying the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface, including:

[0142] Based on the auxiliary requirement options selected by the user, send the prompt text of the auxiliary requirement options to the large language model through the preset auxiliary plug-in. The prompt text of the auxiliary requirement options includes the code text to be assisted and the indicator words corresponding to the auxiliary requirement options;

[0143] Obtain the auxiliary content returned from the large language model through the preset auxiliary plug-in. The auxiliary content is the processing result obtained by the large language model processing the content of the code text to be assisted according to the indicator words corresponding to the auxiliary requirement options;

[0144] The auxiliary content of the code text to be assisted is displayed in the code operation interface through the preset auxiliary plugin, so that the user can confirm the auxiliary content in the code operation interface.

[0145] Optionally, the processor 401 executes obtaining, through the preset auxiliary plugin, the auxiliary content returned by the large language model, and the method further includes:

[0146] Performing assembly feature extraction on the code text to be assisted and the historical code text through the preset auxiliary plugin to obtain the user's assembly behavior, where the historical code text is the code text to be assisted that has undergone code programming assistance operations, and the assembly behavior includes assembly habits and assembly logic;

[0147] Sending the user's assembly behavior to the large language model through the preset auxiliary plugin, so that the assembly habits and assembly logic of the auxiliary content returned by the large language model are consistent with the user's assembly logic and assembly habits, and the auxiliary content output by the large language model is the processing result obtained by the large language model performing assembly behavior processing on the code text to be assisted.

[0148] Optionally, the processor 401 further executes that the auxiliary processing includes code copying, code replacement, code insertion, and code update. Based on the auxiliary content after user confirmation, performing auxiliary processing on the code text to be assisted through the preset auxiliary plugin to obtain a target code text, including:

[0149] Determining at least one operation of code copying, code replacement, code insertion, and code update by the user for the auxiliary content;

[0150] Based on at least one operation of code copying, code replacement, code insertion, and code update by the user for the auxiliary content, performing auxiliary processing on the auxiliary content and the code text to be assisted through the preset auxiliary plugin to obtain a target code text.

[0151] Optionally, after the processor 401 executes obtaining the target code text by performing auxiliary processing on the code text to be assisted through the preset auxiliary plugin, the method further includes:

[0152] In a preset self-test environment through the preset auxiliary plugin, globally self-testing the target code text after replacing the code text to be assisted in the original code to obtain a self-test result;

[0153] Determining the feasibility of the target code text based on the self-test result;

[0154] If the feasibility of the target code text fails, the preset auxiliary plugin is used to send the regenerated prompt text of the auxiliary requirement option to the large language model, so that the large language model obtains a new target code text according to the regenerated prompt text. The regenerated prompt text includes the code text to be assisted, the original code, and the indicator words corresponding to the auxiliary requirement option;

[0155] If the feasibility of the target code text passes or the feasibility of the new target code text passes, the target code text or the new target code text is displayed in the code operation interface.

[0156] The embodiment of the present invention also provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, it realizes each process of the code programming assistance method or the application-side code programming assistance method provided by the embodiment of the present invention, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0157] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.

[0158] The above-disclosed are only the preferred embodiments of the present invention. Of course, the scope of the rights of the present invention cannot be limited by this. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.

Claims

1. A code programming assistance method, characterized in that, The method includes the following steps: When a preset auxiliary plugin is enabled, obtain the interface operations of the user in the code operation interface; Based on the interface operations, determine the code text to be assisted in the code operation interface; Through the preset auxiliary plugin, generate auxiliary requirement options for the code text to be assisted according to the code text to be assisted; Based on the auxiliary requirement options selected by the user, request the auxiliary content of the code text to be assisted from the large language model through the preset auxiliary plugin, and display the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface; Based on the auxiliary content after the user's confirmation, perform auxiliary processing on the code text to be assisted through the preset auxiliary plugin to obtain the target code text.

2. The code programming assistance method according to claim 1, wherein The interface operations include the position and operation type of the text indicator. Based on the interface operations, determining the code text to be assisted in the code operation interface includes: Based on the position and operation type of the text indicator, determine the operation area of the user in the code interface; Extract the code text within the operation area to obtain the code text to be assisted.

3. The code programming assistance method according to claim 1, wherein The step of generating auxiliary requirement options for the code text to be assisted through the preset auxiliary plugin according to the code text to be assisted includes: Through the preset auxiliary plugin, perform content scanning on the code text to be assisted to determine the code logic of the code text to be assisted; Based on the code logic of the code text to be assisted, generate auxiliary requirement options for the code text to be assisted.

4. The code programming assistance method according to claim 1, wherein The step of, based on the auxiliary requirement options selected by the user, requesting the auxiliary content of the code text to be assisted from the large language model through the preset auxiliary plugin and displaying the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface includes: Based on the auxiliary requirement options selected by the user, send the prompt text of the auxiliary requirement options to the large language model through the preset auxiliary plugin. The prompt text of the auxiliary requirement options includes the code text to be assisted and the indicator words corresponding to the auxiliary requirement options; Obtain the auxiliary content returned from the large language model through the preset auxiliary plugin. The auxiliary content is the processing result obtained by the large language model processing the content of the code text to be assisted according to the indicator words corresponding to the auxiliary requirement options; Through the preset auxiliary plugin, display the auxiliary content of the code text to be assisted in the code operation interface so that the user can confirm the auxiliary content in the code operation interface.

5. The code programming assistance method according to claim 4, wherein Regarding the step of obtaining the auxiliary content returned from the large language model through the preset auxiliary plugin, the method further includes: Through the preset auxiliary plugin, perform assembly feature extraction on the code text to be assisted and the historical code text to obtain the assembly behavior of the user. The historical code text is the code text to be assisted that has undergone code programming assistance operations. The assembly behavior includes assembly habits and assembly logic; Send the user's assembly behavior to the large language model through the preset auxiliary plugin, so that the assembly habits and assembly logic of the auxiliary content returned by the large language model according to the user's assembly behavior are consistent with the user's assembly logic and assembly habits. The auxiliary content output by the large language model is the processing result obtained by the large language model performing assembly behavior processing on the code text to be assisted.

6. The code programming assistance method according to claim 1, characterized in that, The auxiliary processing includes code copying, code replacement, code insertion, and code updating. Based on the auxiliary content after user confirmation, perform auxiliary processing on the code text to be assisted through the preset auxiliary plugin to obtain the target code text, including: Determine at least one operation of the user for code copying, code replacement, code insertion, and code updating of the auxiliary content; Based on at least one operation of the user for code copying, code replacement, code insertion, and code updating of the auxiliary content, perform auxiliary processing on the auxiliary content and the code text to be assisted through the preset auxiliary plugin to obtain the target code text.

7. The code programming assistance method according to claim 4, wherein After obtaining the target code text by performing auxiliary processing on the code text to be assisted through the preset auxiliary plugin, the method further includes: In a preset self-test environment through the preset auxiliary plugin, globally self-test the target code text after replacing the code text to be assisted in the original code to obtain a self-test result; Based on the self-test result, determine the feasibility of the target code text; If the feasibility of the target code text fails, send a prompt text for regenerating the auxiliary requirement option to the large language model through the preset auxiliary plugin, so that the large language model obtains a new target code text according to the regenerated prompt text. The regenerated prompt text includes the code text to be assisted, the original code, and the indicator word corresponding to the auxiliary requirement option; If the feasibility of the target code text passes or the feasibility of the new target code text passes, display the target code text or the new target code text in the code operation interface.

8. A code programming assistance device, characterized in that, The code programming assistance device includes: A first acquisition module, configured to acquire the interface operation of the user in the code operation interface when the preset auxiliary plugin is enabled; A first determination module, configured to determine the code text to be assisted in the code operation interface based on the interface operation; A first generation module, configured to generate an auxiliary requirement option for the code text to be assisted through the preset auxiliary plugin according to the code text to be assisted; A request module, configured to request the auxiliary content of the code text to be assisted from the large language model through the preset auxiliary plugin based on the auxiliary requirement option selected by the user, and display the auxiliary content on the code operation interface so that the user can confirm the auxiliary content in the code operation interface; A second acquisition module, configured to obtain the target code text by performing auxiliary processing on the code text to be assisted through the preset auxiliary plugin based on the auxiliary content after user confirmation.

9. An electronic device, characterized in that, Including: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the code programming assistance method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the code programming assistance method according to any one of claims 1 to 7 are implemented.