Code generation method and device, equipment, medium and program product
By automatically converting front-end and back-end code using solution generation and code generation models, the problems of high manual costs and low efficiency in existing technologies are solved, and efficient front-end and back-end code conversion is achieved.
Patent Information
- Application Number
- CN202512029128.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
Current technologies for converting page code using a hybrid front-end and back-end approach require significant manual labor and are inefficient.
The system employs a solution generation model and a code generation model. By acquiring target code information and prompt information, it generates a conversion solution and automatically converts the target code information into front-end page information and back-end interface information. It also uses a multimodal model to learn the front-end and back-end separation rules and updates the conversion solution in real time to improve the conversion success rate.
It reduces the cost of front-end and back-end separation, improves conversion efficiency, and enables automatic conversion of code information and efficient front-end and back-end separation.
Smart Images

Figure CN121832965A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, specifically to a code generation method, apparatus, device, medium, and program product. Background Technology
[0002] During the system upgrade and transformation process, it is necessary to manually convert the mixed front-end and back-end page code to generate front-end page information including front-end code content and back-end interface information including back-end code content, so as to transform the system into a front-end and back-end separated system.
[0003] However, in related technologies, converting the code of a hybrid front-end and back-end page requires a lot of manual labor, and the conversion of the hybrid front-end and back-end page code in related technologies is inefficient. Summary of the Invention
[0004] In view of the above problems, this application provides methods, apparatus, devices, media and program products for improving code generation.
[0005] According to a first aspect of this application, a code generation method is provided, comprising: obtaining target code information and prompt information, wherein the prompt information includes at least one set of code sample pairs, each code sample pair including associated code information and corresponding front-end page information and back-end interface information, the code information having a type label, and the type label of the associated code information being the same as the type label of the target code information; using a scheme generation model to generate a conversion scheme based on the prompt information, the conversion scheme being used to convert the target code information into front-end page information and back-end interface information; and using the code generation model to convert the target code information according to the conversion scheme, thereby generating target front-end page information and target back-end interface information corresponding to the target code information.
[0006] According to embodiments of this application, obtaining target code information and prompt information includes: obtaining multiple pieces of code information, including at least one piece of code information to be processed and at least one piece of processed code information, wherein the processed code information has corresponding front-end page information and back-end interface information; determining the association relationship between the multiple pieces of code information based on at least one of page style information, input / output data, and back-end interaction interface information; setting the same type label for the code information with the association relationship; and determining prompt information based on the processed code information whose type label is the same as the type label of the target code information in response to selecting target code information from at least one piece of code information to be processed.
[0007] According to an embodiment of this application, the method further includes: in response to an error message generated during the conversion of target code information according to the conversion scheme, using a scheme update model to process the error message and the conversion scheme to obtain an updated conversion scheme.
[0008] According to an embodiment of this application, the solution generation model is a multimodal model; using the solution generation model to generate a conversion solution based on the prompt information includes: obtaining the running interface image corresponding to the associated code information in at least one set of code sample pairs; and using the solution generation model to process the prompt information and the running interface image to obtain the conversion solution.
[0009] According to an embodiment of this application, the method further includes: obtaining multiple conversion schemes generated by the scheme generation model based on the prompt information of the associated code information of different type tags, and front-end page information and back-end interface information generated by the code generation model based on the multiple conversion schemes; using a summary model, generating supplementary scheme content based on the prompt information and the front-end page information and back-end interface information generated based on the prompt information; and adding the supplementary scheme content to the multiple conversion schemes.
[0010] According to an embodiment of this application, the method further includes: generating negative sample data based on the conversion scheme and prompt information that generated the error information; generating positive sample data based on the updated conversion scheme and prompt information; and adjusting the parameters of the scheme generation model according to the positive sample data and the negative sample data.
[0011] A second aspect of this application provides a code generation apparatus, comprising: an acquisition module for acquiring target code information and prompt information, the prompt information including at least one set of code sample pairs, each code sample pair including associated code information and corresponding front-end page information and back-end interface information, the code information having a type label, the type label of the associated code information being the same as the type label of the target code information; a scheme generation module for generating a conversion scheme based on the prompt information using a scheme generation model, the conversion scheme being used to convert the target code information into front-end page information and back-end interface information; and a code generation module for converting the target code information based on the conversion scheme using a code generation model, thereby generating target front-end page information and target back-end interface information corresponding to the target code information.
[0012] According to an embodiment of this application, the acquisition module includes a prompt information acquisition submodule, which is used to: acquire multiple code information, including at least one code information to be processed and at least one processed code information, wherein the processed code information has corresponding front-end page information and back-end interface information; determine the association relationship between the multiple code information based on at least one of the page style information, input / output data, and back-end interaction interface information of the multiple code information; set the same type label for the code information with the association relationship; and in response to selecting target code information from at least one code information to be processed, determine a prompt information based on the processed code information whose type label is the same as the type label of the target code information.
[0013] According to an embodiment of this application, the apparatus further includes a scheme update module, configured to: in response to an error message generated during the conversion of target code information according to the conversion scheme, process the error message and the conversion scheme using a scheme update model to obtain an updated conversion scheme.
[0014] According to an embodiment of this application, the solution generation model is a multimodal model; the solution generation module uses the solution generation model to generate a conversion solution based on the prompt information in the following manner: obtain the running interface image corresponding to the associated code information in at least one set of code sample pairs; use the solution generation model to process the prompt information and the running interface image to obtain the conversion solution.
[0015] According to an embodiment of this application, the apparatus further includes a summary and supplement module, configured to: obtain multiple conversion schemes generated by the scheme generation model based on the prompt information of the associated code information of different type tags, and front-end page information and back-end interface information generated by the code generation model based on the multiple conversion schemes; use the summary model to generate supplementary scheme content based on the prompt information and the front-end page information and back-end interface information generated based on the prompt information; and add the supplementary scheme content to the multiple conversion schemes.
[0016] According to an embodiment of this application, the device further includes a parameter adjustment module, configured to: generate negative sample data based on the conversion scheme and prompt information that generated the error information; generate positive sample data based on the updated conversion scheme and prompt information; and adjust the parameters of the scheme generation model according to the positive sample data and the negative sample data.
[0017] A third aspect of this application provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0018] A fourth aspect of this application also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0019] The fifth aspect of this application also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method. Attached Figure Description
[0020] The above-mentioned contents, other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0021] Figure 1 The illustrations depict application scenarios of code generation methods, apparatus, devices, media, and program products according to embodiments of this application.
[0022] Figure 2 A flowchart illustrating a code generation method according to an embodiment of this application is shown schematically;
[0023] Figure 3 A schematic diagram illustrating the structure of a code generation apparatus according to an embodiment of this application is shown; and
[0024] Figure 4 A block diagram schematically illustrates an electronic device suitable for implementing a code generation method according to an embodiment of this application. Detailed Implementation
[0025] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.
[0026] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0027] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0028] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0029] With the development of financial institutions and software engineering, financial institutions' systems need to be updated according to the development of coding technology. For example, to conform to the trend of decoupled software development, the system's code structure needs to be changed from a non-separated front-end and back-end code structure to a separated front-end and back-end code structure, in order to improve the system's development efficiency and optimize the coding of the system development team.
[0030] Converting a non-separated front-end and back-end code structure into a separated front-end and back-end code structure can be simply referred to as front-end / back-end separation. In the process of front-end / back-end separation, it is necessary to separate the development resources, development content, development concepts, and technology stacks of the front-end and back-end.
[0031] However, related technologies primarily rely on manual operation for front-end and back-end separation, resulting in high labor costs. Furthermore, these technologies fail to utilize existing front-end and back-end separation solutions related to the front-end and back-end page code to be separated, leading to low efficiency in the process.
[0032] Based on this, embodiments of this application provide a code generation method. For target code information that requires front-end and back-end separation, a scheme generation model is implemented to obtain a transformation scheme for front-end and back-end separation of the target code information. The code generation model is then used to perform front-end and back-end separation of the target code information according to the transformation scheme, thereby obtaining the target front-end page information and target back-end interface information corresponding to the target code information. This achieves automatic conversion of code information, improves the effect of front-end and back-end separation, and reduces the cost of front-end and back-end separation.
[0033] It should be noted that the code generation method, apparatus, electronic device, and storage medium specified in this disclosure can be used in the fields of artificial intelligence technology and fintech technology, and can also be used in a variety of fields other than artificial intelligence technology and fintech technology. The application fields of the code generation method, apparatus, electronic device, and storage medium provided in the embodiments of this disclosure are not limited.
[0034] In the technical solution disclosed herein, the user information (including but not limited to user personal information, user image information, user device information, such as location information) and data (including but not limited to data used for analysis, stored data, and displayed data) involved are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse.
[0035] In scenarios where personal information is used for automated decision-making, the code detection method, device, and system provided in this disclosure all offer users corresponding operation entry points, allowing them to choose to agree to or reject the automated decision-making result; if the user chooses to reject, the process proceeds to the expert decision-making stage. Here, "automated decision-making" refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests, or economic, health, and credit status through computer programs, and then making a decision. Here, "expert decision-making" refers to the activity of making decisions by personnel who specialize in a particular field, possess specialized experience, knowledge, and skills, and have reached a certain level of professional expertise.
[0036] Figure 1 The illustrations depict application scenarios of the code generation method, apparatus, device, medium, and program product according to embodiments of this application.
[0037] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0038] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0039] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0040] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0041] It should be noted that the code generation method provided in this application embodiment can generally be executed by server 105. Correspondingly, the code generation device provided in this application embodiment can generally be located in server 105. The code generation method provided in this application embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the code generation device provided in this application embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0042] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0043] The following will be based on Figure 1 The described scene, through Figure 2 The code generation method according to the embodiments of this application will be described in detail.
[0044] Figure 2 A flowchart illustrating a code generation method according to an embodiment of this application is shown schematically.
[0045] like Figure 2 As shown, the code generation method of this embodiment includes operations S210 to S230.
[0046] In operation S210, target code information and prompt information are obtained. The prompt information includes at least one set of code sample pairs. The code sample pairs include associated code information and the front-end page information and back-end interface information corresponding to the associated code information. The code information has a type label, and the type label of the associated code information is the same as the type label of the target code information.
[0047] The target code information is the code information of the front-end and back-end that are not yet separated.
[0048] The front-end page information is the front-end code obtained after the front-end and back-end are separated. It includes information used to display the front-end page, such as element information, style information, and routing information included in the front-end page.
[0049] Backend interface information refers to the interface information obtained after frontend and backend separation, which may include data interfaces, backend processing logic information, data access information, and security authentication logic information.
[0050] The associated code information is the code information that has been separated into front-end and back-end. The front-end page information and back-end interface information corresponding to the associated code information are the front-end code and back-end code obtained after separating the associated code information into front-end and back-end.
[0051] When operating S220, the solution generation model is used to generate a conversion solution based on the prompt information. The conversion solution is used to convert the target code information into front-end page information and back-end interface information.
[0052] The solution generation model can be a large language model. The input to the solution generation model can include prompts and a first prompt template. The output is the conversion solution.
[0053] It should be understood that the conversion scheme can be used not only to convert target code information, but also to convert other code information with the same type label as the associated code information.
[0054] When operating S230, the code generation model is used to transform the target code information according to the transformation scheme, generating the target front-end page information and target back-end interface information corresponding to the target code information.
[0055] The code generation model can be a large language model. After obtaining the conversion scheme, the input to the code generation model can include target code information, the conversion scheme, and a second prompt template. The output of the code generation model can include the front-end page information and back-end interface information corresponding to the target code information.
[0056] After the code generation model generates the target front-end page information and target back-end interface information corresponding to the target code information, it can provide administrators with corresponding operation entry points to allow them to choose to agree or reject the automated decision results. That is, after the code generation model generates the target front-end page information and target back-end interface information corresponding to the target code information, it can obtain instructions from administrators to agree or reject the processing / decision through the corresponding operation entry points. If the administrator agrees to the processing / decision, the generated target front-end page information and target back-end interface information will be used to build a front-end / back-end separation system. If the administrator refuses to process / decide, the process will proceed to the expert decision-making process.
[0057] The solution generation model and code generation model can be encapsulated within a front-end / back-end separated intelligent agent. The input to this agent is target code information and prompt information, while the output is the target front-end page information and target back-end interface information corresponding to the target code information. Within the front-end / back-end separated intelligent agent, the transformation scheme generated by the solution generation model is transmitted to the code generation model, enabling the code generation model to generate the front-end page information and back-end interface information based on the target code information and the transformation scheme.
[0058] By leveraging a solution generation model, based on code sample pairs in the prompt information, the model learns from associated code information and its corresponding front-end page and back-end interface information. It summarizes the conversion rules for code information with the same type tags as associated code information, thus obtaining generalizable front-end and back-end conversion rules. Furthermore, using the code generation model, based on the extracted conversion rules, it processes target code information with the same type tags as associated code information, generating corresponding front-end page and back-end interface information. This automatically separates the target code information into front-end and back-end components, reducing the manual cost required for this process and improving its efficiency.
[0059] The type labels for target code information and associated code information can be determined based on the system's code structure. For example, if two pieces of code information are in the same package, then the label types for the two pieces of code information are determined to be the same.
[0060] Furthermore, the type labels for target code information and associated code information can be determined from a knowledge graph constructed based on the code information.
[0061] According to embodiments of this application, obtaining target code information and prompt information includes: obtaining multiple pieces of code information, including at least one piece of code information to be processed and at least one piece of processed code information, wherein the processed code information has corresponding front-end page information and back-end interface information; determining the association relationship between the multiple pieces of code information based on at least one of page style information, input / output data, and back-end interaction interface information; setting the same type label for the code information with the association relationship; and determining prompt information based on the processed code information whose type label is the same as the type label of the target code information in response to selecting target code information from at least one piece of code information to be processed.
[0062] Multiple code information entries can refer to the code information included in the target system project that requires front-end and back-end separation. The code information to be processed refers to code information that is not yet separated into front-end and back-end, and for which corresponding front-end page information and back-end interface information do not exist. The processed code information can be code information for which corresponding front-end page information and back-end interface information were obtained based on expert experience.
[0063] It should be understood that if the target front-end page information and target back-end interface information are generated based on the target code information, the target code information can be added to the prompt information as associated code information.
[0064] Page style information can be used to indicate whether there is a relationship of inclusion display, jump display, or side-by-side display between page information. Input and output data can be used to determine whether there is a data transfer relationship between multiple code pieces of information. Backend interaction interface information is used to determine whether there is a relationship of backend data call between multiple code pieces of information, or whether there is a relationship of calling the same interface.
[0065] Code information can be used as nodes, and the relationships between multiple pieces of code information can be used as edges to construct a knowledge graph, in order to determine whether there are direct or indirect connections between multiple pieces of code information.
[0066] Multiple code pieces with interconnected relationships within the knowledge graph can be labeled with the same type of tag. These multiple code pieces with the same tag can include both code pieces to be processed and code pieces already processed. In response to identifying target code pieces requiring front-end / back-end separation within the code pieces to be processed, the processed code pieces in the knowledge graph connected to the target code pieces can be used as associated code pieces. These associated code pieces, along with their corresponding front-end page information and back-end interface information, can be used as code sample pairs in the prompt message.
[0067] By leveraging the correlations between multiple code pieces of information, clustering is performed to identify multiple code pieces with the same type of label, enabling in-depth analysis of the dependencies between code information in the target system. This allows the pattern generation model to learn from the front-end and back-end separation results of related code pieces within the same scenario, improving the model's learning effectiveness.
[0068] In addition, during the process of the code generation model transforming the target code information according to the transformation scheme to obtain the front-end page information and back-end interface information, there are cases where the code generation model fails to perform the front-end and back-end separation operation and generates error information.
[0069] According to an embodiment of this application, the code generation method further includes: responding to an error message generated during the conversion of target code information according to the conversion scheme, using a scheme update model to process the error message and the conversion scheme to obtain an updated conversion scheme.
[0070] The scheme update model can be a large language model pre-trained based on a knowledge base, which can include a training set consisting of multiple conversion schemes, error messages, and corresponding adjusted conversion schemes.
[0071] In response to errors generated during the processing of target code information using the transformation scheme by the code generation model, the transformation scheme and the generated error information are input into the scheme update model to obtain the adjusted transformation scheme, which is then used as the updated transformation scheme.
[0072] After determining the updated conversion scheme, the code generation model is used to re-convert the target code information according to the conversion scheme, so as to improve the probability of the code generation module successfully converting the target code information.
[0073] By using a scheme update model to update the conversion scheme in real time based on the generated error information during the conversion of target code information based on the existing conversion scheme in the code generation module, the success rate of code conversion using the conversion scheme is improved.
[0074] In addition, the conversion scheme used to generate the error message and the optimized conversion scheme can be used as training samples for the scheme generation model to perform secondary training on the scheme generation model.
[0075] According to an embodiment of this application, the code generation method further includes: generating negative sample data based on the conversion scheme and prompt information that generated the error information; generating positive sample data based on the updated conversion scheme and prompt information; and adjusting the parameters of the scheme generation model according to the positive sample data and the negative sample data.
[0076] The accumulated negative and positive sample data can be divided separately to obtain the training and test sets.
[0077] Using a training set that includes some negative sample data and some positive sample data, the scheme generation model is trained a second time. During the training process, the parameters in the model are fine-tuned so that the scheme generation model can generate the corresponding conversion scheme in the positive sample data according to the prompt information, and avoid generating the corresponding conversion scheme in the negative sample data. This optimizes the scheme generation model and reduces the probability of the scheme generation model generating incorrect conversion schemes.
[0078] The test set can be used to test and evaluate the fine-tuned scheme generation model after secondary training, and to determine the pass rate of the fine-tuned scheme generation model. If the pass rate is greater than the preset pass rate threshold, it is determined that the scheme generation model has completed parameter adjustment.
[0079] In addition, the solution generation model can be adjusted to a multimodal model, and images can be added as input to the solution generation model.
[0080] According to an embodiment of this application, a conversion scheme is generated based on prompt information using a scheme generation model, including: obtaining the running interface image corresponding to the associated code information in at least one set of code sample pairs; and processing the prompt information and running interface image using the scheme generation model to obtain the conversion scheme.
[0081] It should be understood that the runtime interface image can be a screenshot of the runtime interface associated with the code information, or a screenshot of the runtime interface of the front-end page information corresponding to the associated code information.
[0082] In addition to learning front-end / back-end separation solutions based on associated code information, corresponding front-end page information, and back-end interface information, the solution generation model also learns the color style and layout characteristics of code information under that type of tag based on color information and page layout information in the running interface image. For example, if the solution generation model detects that the colors of the running interface image of associated code information are consistent, the generated conversion solution will include setting the color information of the front-end page information to be consistent with the color of the running interface image. As another example, if the target components in the running interface image of the building materials market associated code information all appear in the same position, the generated conversion solution will include placing the target components in the same position as the target components in the running interface image when it is detected that they need to be generated.
[0083] By setting the scheme generation model as a multimodal model and setting the prompt information to include code sample pairs and the running interface image of the associated code information in the code sample pairs, the generated conversion scheme can not only include a scheme that can convert the target code information into front-end page information and back-end interface information, but also include information to optimize the target code information, so that the color style and layout features of the front-end page information generated by the target code information can match the front-end page information of other associated code information in the target system.
[0084] Multiple front-end and back-end separated intelligent agents, including scheme generation models and code generation models, can be set up to perform parallel operations on target code information of multiple different types of tags to generate schemes, front-end page information, and back-end interface information.
[0085] In addition, a coordinating agent can be set up, which includes a summary model to summarize and generalize the transformation schemes, front-end page information and back-end interface information generated by each front-end and back-end separate agent.
[0086] According to an embodiment of this application, the code generation method further includes: obtaining multiple conversion schemes generated by the scheme generation model based on the prompt information of the associated code information of different type tags, and front-end page information and back-end interface information generated by the code generation model based on the multiple conversion schemes; using a summary model, generating supplementary scheme content based on the prompt information and the front-end page information and back-end interface information generated based on the prompt information; and adding the supplementary scheme content to the multiple conversion schemes.
[0087] Different front-end and back-end separated intelligent agents are used to process target code information of different types of tags. It can obtain the transformation schemes generated by the scheme generation model in multiple front-end and back-end separated intelligent agents, and use them as multiple transformation schemes generated by the scheme generation model according to the prompt information of the associated code information of different types of tags.
[0088] Furthermore, the front-end page information and back-end interface information generated by the code generation model in multiple front-end and back-end separated intelligent agents are used as the front-end page information and back-end interface information generated according to multiple conversion schemes respectively.
[0089] Using a summary model, we summarize and analyze multiple transformation schemes and the front-end page information and back-end interface information generated based on each transformation scheme, and generate supplementary scheme content applicable to all front-end and back-end separated intelligent agents.
[0090] By adding the generated supplementary solutions to each front-end and back-end separated intelligent agent, the conversion schemes in each front-end and back-end separated intelligent agent are continuously optimized, thereby improving the conversion efficiency of the code generated using the conversion schemes.
[0091] Based on the above code generation method, this application also provides a code generation apparatus. The following will combine... Figure 3 The device is described in detail.
[0092] Figure 3 A schematic block diagram of a code generation apparatus according to an embodiment of this application is shown.
[0093] like Figure 3 As shown, the code generation device 300 of this embodiment includes an acquisition module 310, a scheme generation module 320, and a code generation module 330.
[0094] The acquisition module 310 is used to acquire target code information and prompt information. The prompt information includes at least one set of code sample pairs. The code sample pairs include associated code information and the front-end page information and back-end interface information corresponding to the associated code information. The code information has a type label, and the type label of the associated code information is the same as the type label of the target code information.
[0095] The solution generation module 320 is used to generate a conversion solution based on the prompt information using the solution generation model. The conversion solution is used to convert the target code information into front-end page information and back-end interface information.
[0096] The code generation module 330 is used to transform the target code information according to the transformation scheme using the code generation model, and generate the target front-end page information and target back-end interface information corresponding to the target code information.
[0097] According to embodiments of this application, any multiple modules among the acquisition module 310, scheme generation module 320, and code generation module 330 can be merged into one module, or any one of these modules can be split into multiple modules. Alternatively, at least some of the functions of one or more of these modules can be combined with at least some of the functions of other modules and implemented in one module. According to embodiments of this application, at least one of the acquisition module 310, scheme generation module 320, and code generation module 330 can be at least partially implemented as a hardware circuit, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented by any other reasonable means of integrating or packaging the circuit, or implemented in any one of the three methods of software, hardware, and firmware, or in a suitable combination of any of them. Alternatively, at least one of the acquisition module 310, scheme generation module 320, and code generation module 330 can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is run.
[0098] According to an embodiment of this application, the acquisition module 310 includes a prompt information acquisition submodule, which is used to: acquire multiple code information, including at least one code information to be processed and at least one processed code information, wherein the processed code information has corresponding front-end page information and back-end interface information; determine the association relationship between the multiple code information based on at least one of the page style information, input / output data and back-end interaction interface information of the multiple code information; set the same type label for the code information with the association relationship; and in response to selecting target code information from at least one code information to be processed, determine prompt information based on the processed code information whose type label is the same as the type label of the target code information.
[0099] According to an embodiment of this application, the apparatus further includes a scheme update module, configured to: in response to an error message generated during the conversion of target code information according to the conversion scheme, process the error message and the conversion scheme using a scheme update model to obtain an updated conversion scheme.
[0100] According to an embodiment of this application, the solution generation model is a multimodal model; the solution generation module 320 uses the solution generation model to generate a conversion solution based on the prompt information in the following manner: obtain the running interface image corresponding to the associated code information in at least one set of code sample pairs; use the solution generation model to process the prompt information and the running interface image to obtain the conversion solution.
[0101] According to an embodiment of this application, the apparatus further includes a summary and supplement module, configured to: obtain multiple conversion schemes generated by the scheme generation model based on the prompt information of the associated code information of different type tags, and front-end page information and back-end interface information generated by the code generation model based on the multiple conversion schemes; use the summary model to generate supplementary scheme content based on the prompt information and the front-end page information and back-end interface information generated based on the prompt information; and add the supplementary scheme content to the multiple conversion schemes.
[0102] According to an embodiment of this application, the device further includes a parameter adjustment module, configured to: generate negative sample data based on the conversion scheme and prompt information that generated the error information; generate positive sample data based on the updated conversion scheme and prompt information; and adjust the parameters of the scheme generation model according to the positive sample data and the negative sample data.
[0103] Figure 4 A block diagram schematically illustrates an electronic device suitable for implementing a code generation method according to an embodiment of this application.
[0104] like Figure 4As shown, an electronic device 400 according to an embodiment of this application includes a processor 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage portion 408 into a random access memory (RAM) 403. The processor 401 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 401 may also include onboard memory for caching purposes. The processor 401 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this application.
[0105] RAM 403 stores various programs and data required for the operation of electronic device 400. Processor 401, ROM 402, and RAM 403 are interconnected via bus 404. Processor 401 executes various operations of the method flow according to embodiments of this application by executing programs in ROM 402 and / or RAM 403. It should be noted that the programs may also be stored in one or more memories other than ROM 402 and RAM 403. Processor 401 may also execute various operations of the method flow according to embodiments of this application by executing programs stored in said one or more memories.
[0106] According to embodiments of this application, the electronic device 400 may further include an input / output (I / O) interface 405, which is also connected to a bus 404. The electronic device 400 may also include one or more of the following components connected to the input / output (I / O) interface 405: an input section 406 including a keyboard, mouse, etc.; an output section 407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card, modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the input / output (I / O) interface 405 as needed. A removable medium 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 410 as needed so that computer programs read from it can be installed into the storage section 408 as needed.
[0107] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.
[0108] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this application, the computer-readable storage medium may include ROM 402 and / or RAM 403 and / or one or more memories other than ROM 402 and RAM 403 described above.
[0109] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the code generation method provided in the embodiments of this application.
[0110] When the computer program is executed by the processor 401, it performs the functions defined in the system / apparatus of this application embodiment. According to the embodiments of this application, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0111] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via communication section 409, and / or installed from removable medium 411. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0112] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by processor 401, it performs the functions defined in the system of this application embodiment. According to embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0113] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0114] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0115] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.
Claims
1. A code generation method, characterized in that, The method includes: Obtain target code information and prompt information. The prompt information includes at least one set of code sample pairs. Each code sample pair includes associated code information and front-end page information and back-end interface information corresponding to the associated code information. The code information has a type label, and the type label of the associated code information is the same as the type label of the target code information. Using a scheme generation model, a conversion scheme is generated based on the prompt information. The conversion scheme is used to convert the target code information into front-end page information and back-end interface information. Using a code generation model, the target code information is transformed according to the transformation scheme to generate target front-end page information and target back-end interface information corresponding to the target code information.
2. The method according to claim 1, characterized in that, The acquisition of target code information and prompt information includes: Acquire multiple code information, including at least one code information to be processed and at least one processed code information, wherein the processed code information has corresponding front-end page information and back-end interface information; The association between the multiple code information is determined based on at least one of the page style information, input / output data, and backend interaction interface information of the multiple code information. Set the same type label for related code information; In response to selecting target code information from the at least one code information to be processed, the prompt information is determined based on the processed code information whose type label is the same as the type label of the target code information.
3. The method according to claim 1, characterized in that, The method further includes: In response to an error message generated during the conversion of the target code information according to the conversion scheme, the scheme update model is used to process the error message and the conversion scheme to obtain an updated conversion scheme.
4. The method according to claim 2, characterized in that, The scheme generation model is a multimodal model; the process of generating a conversion scheme based on the prompt information using the scheme generation model includes: Obtain the running interface image corresponding to the associated code information in the at least one set of code sample pairs; The model is generated using the aforementioned scheme, and the prompt information and the running interface image are processed to obtain the conversion scheme.
5. The method according to claim 2 or 4, characterized in that, The method further includes: The code generation model generates multiple conversion schemes based on the prompts of the associated code information of different type tags, and generates the front-end page information and the back-end interface information based on the multiple conversion schemes using the code generation model. Using the summary model, supplementary solution content is generated based on the prompt information and the front-end page information and back-end interface information generated based on the prompt information; The supplementary solution content is added to the multiple conversion solutions.
6. The method according to claim 3, characterized in that, The method further includes: Based on the conversion scheme that generated the error information and the prompt information, negative sample data is generated; Based on the updated conversion scheme and the prompt information, positive sample data is generated; The parameters of the scheme generation model are adjusted based on the positive sample data and the negative sample data.
7. A code generation device, characterized in that, The device includes: An acquisition module is used to acquire target code information and prompt information. The prompt information includes at least one set of code sample pairs. Each code sample pair includes associated code information and front-end page information and back-end interface information corresponding to the associated code information. The code information has a type label, and the type label of the associated code information is the same as the type label of the target code information. The solution generation module is used to generate a conversion solution based on the prompt information using a solution generation model. The conversion solution is used to convert the target code information into front-end page information and back-end interface information. The code generation module is used to use a code generation model to transform the target code information according to the transformation scheme, and generate target front-end page information and target back-end interface information corresponding to the target code information.
8. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 6.
