Code generation method and device, equipment and storage medium

Generate the secondary development code of the low-code platform through large models, solving the problems of low-code platform secondary development code generation efficiency and stability, achieving efficient code generation and compatibility, and ensuring the stability of the platform.

CN119045807APending Publication Date: 2024-11-29CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411102509.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

The secondary development code generation efficiency of existing low-code platforms is low and may affect the stability of low-code platforms. This is mainly due to the large differences between different systems, high cost of getting started, and the compatibility issues between online coding plug-ins and low-code platforms.

Method used

Get the target function description information that the application needs to achieve through a large model, and determine whether it can be implemented through a low-code platform. If it cannot be implemented, determine the target interface and generate the target code. The interface is an interface generated through the interface documents and specifications of the low-code platform. Or a third-party interface with high similarity to ensure that code generation is compatible with the platform.

Benefits of technology

It improves the code generation efficiency of secondary development, reduces the workload of manual coding, supports the conversion and integration of multiple programming languages, and avoids affecting the stability of the low-code platform by isolating the running environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045807A_ABST
    Figure CN119045807A_ABST
Patent Text Reader

Abstract

The invention provides a code generation method and device, equipment and a storage medium. Relates to the technical field of code development. The method comprises the steps that when an application program is constructed through a low-code platform, description information of a target function needing to be achieved by the application program is obtained; inputting the description information of the target function into the large model, and obtaining a target code corresponding to the target function output by the large model; and inputting the target code into a low-code platform, so that the low-code platform fuses the target code with other codes of the application program. According to the method, the code generation efficiency of secondary development is improved, and the stability of a low-code platform is not affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of code development technology, and in particular to a code generation method, apparatus, device and storage medium. Background Art

[0002] A low-code platform is a development platform that allows non-professional developers to quickly build applications through simplification and automation. It uses a visual approach to enable people without professional programming skills to quickly build and deploy applications. As low-code platform technology continues to improve, the demand for low-code platforms from non-professional developers is also growing. If the components in the low-code platform cannot meet user needs, secondary development of the low-code platform is required.

[0003] Existing technologies generally provide a secondary development scaffolding that encapsulates some context classes and is responsible for interacting with the low-code platform. Developers only need to implement their own special logic in the specified place according to the assembled classes. After local debugging, they are packaged and uploaded to the low-code platform and assembled with the application for use. Some low-code platforms integrate online coding plug-ins on the designer, allowing developers to write code on the interface, and also encapsulate some context classes for developers to use.

[0004] However, the secondary development scaffolding varies greatly for different systems, the cost of getting started is very high, and you need to understand the platform's mechanism to write secondary development code; in addition, the plug-ins used in the online coding method need to be embedded in the low-code platform, which will involve compatibility issues between the plug-ins and the low-code platform. Developers not only need to master the use of the low-code platform, but also need to be familiar with the use of integrated coding plug-ins and context classes. When problems occur with the plug-ins, it may also affect the stability of the entire low-code platform; this will lead to very low code generation efficiency for secondary development and affect the stability of the low-code platform. Summary of the invention

[0005] The present application provides a code generation method, apparatus, device and storage medium to solve the problem in the prior art that the code generation efficiency of secondary development is very low and affects the stability of the low-code platform.

[0006] In a first aspect, the present application provides a code generation method, comprising: when building an application through a low-code platform, obtaining description information of a target function that the application needs to implement;

[0007] Inputting the description information of the target function into the large model, and obtaining the target code corresponding to the target function output by the large model;

[0008] Inputting the target code into the low-code platform so that the low-code platform merges the target code with other codes of the application;

[0009] Among them, the big model is used to determine whether the target function can be realized through the low-code platform. If the target function cannot be realized through the low-code platform, the target interface corresponding to the target function is determined, and the target code is generated according to the target interface. The target interface is a first interface generated by the big model according to the interface document and interface specification of the low-code platform, or a third-party interface that can realize the target function, or a third interface in the low-code platform whose similarity with the second interface that can realize the target function exceeds a preset similarity.

[0010] In a possible design, inputting the description information of the target function into the large model and obtaining the target code corresponding to the target function output by the large model includes:

[0011] Determine whether the target function can be implemented through the low-code platform;

[0012] If the target function cannot be realized by the low-code platform, determining whether there is a third-party interface that can realize the target function;

[0013] If the third-party interface that can realize the target function exists, determining the third-party interface as the target interface;

[0014] If the third-party interface that can realize the target function does not exist, then the similarity between each interface in the low-code platform and the second interface that can realize the target function is calculated;

[0015] If the third interface whose similarity exceeds the preset similarity exists in the low-code platform, the third interface is determined as the target interface;

[0016] If the third interface whose similarity exceeds the preset similarity does not exist in the low-code platform, the target interface is generated according to the interface document and interface specification of the low-code platform;

[0017] According to the target interface, a target code corresponding to the target function is generated.

[0018] In a possible design, generating the target code corresponding to the target function according to the target interface includes:

[0019] When the target interface is the third interface, generating an initial code according to the third interface;

[0020] According to the target function, the initial code is fine-tuned to generate the target code.

[0021] In a possible design, determining whether the target function can be implemented through the low-code platform includes:

[0022] Performing word segmentation processing on the description information of the target function to generate multiple keywords;

[0023] Tag each keyword according to the part of speech and generate a tag array;

[0024] Generate a first vector corresponding to the tag array;

[0025] Based on the first vector, determine whether there is an interface in the low-code platform that matches the first vector.

[0026] In a possible design, after inputting the description information of the target function into the large model and obtaining the target code corresponding to the target function output by the large model, the method further includes:

[0027] The large model is updated and trained according to the target code and the description information of the target function to generate an updated large model.

[0028] In one possible design, inputting the target code into the low-code platform so that the low-code platform merges the target code with other codes of the application includes:

[0029] Sending a confirmation request to a development terminal, wherein the confirmation request is used to request a developer to confirm whether there is a problem with the target code;

[0030] Receiving a response message sent by the developer;

[0031] If the response information indicates that there is no problem with the target code, the target code is input into the low-code platform so that the low-code platform integrates the target code with other codes of the application.

[0032] In a possible design, inputting the description information of the target function into the large model and obtaining the target code corresponding to the target function output by the large model includes:

[0033] If the target function can be realized by the low-code platform, the interface in the low-code platform used to realize the target function is determined as the target interface;

[0034] The target code is generated according to the target interface and the target function.

[0035] In a second aspect, the present application provides a code generation device, comprising:

[0036] An acquisition module, used to obtain description information of target functions that need to be achieved by the application when building the application through the low-code platform;

[0037] An input module, used for inputting the description information of the target function into the large model;

[0038] The acquisition module is further used to acquire the target code corresponding to the target function output by the large model;

[0039] The input module is used to input the target code into the low-code platform so that the low-code platform merges the target code with other codes of the application;

[0040] Among them, the big model is used to determine whether the target function can be realized through the low-code platform. If the target function cannot be realized through the low-code platform, the target interface corresponding to the target function is determined, and the target code is generated according to the target interface. The target interface is a first interface generated by the big model according to the interface document and interface specification of the low-code platform, or a third-party interface that can realize the target function, or a third interface in the low-code platform whose similarity with the second interface that can realize the target function exceeds a preset similarity.

[0041] In a possible design, the acquisition module also includes: a judgment module, a processing module, and a generation module.

[0042] The judgment module is used to determine whether the target function can be achieved through the low-code platform.

[0043] The processing module is used to determine whether there is a third-party interface that can realize the target function if the target function cannot be realized through the low-code platform; if there is a third-party interface that can realize the target function, determine the third-party interface as the target interface; if there is no third-party interface that can realize the target function, calculate the similarity between each interface in the low-code platform and the second interface that can realize the target function; if there is a third interface in the low-code platform whose similarity exceeds the preset similarity, determine the third interface as the target interface; if there is no third interface in the low-code platform whose similarity exceeds the preset similarity, generate the target interface according to the interface document and interface specification of the low-code platform.

[0044] The generating module is used to generate the target code corresponding to the target function according to the target interface.

[0045] In a possible design, the generation module is further used to generate initial code according to the third interface when the target interface is the third interface; and to fine-tune the initial code according to the target function to generate the target code.

[0046] In a possible design, the generation module is further used to perform word segmentation on the description information of the target function to generate multiple keywords; mark each keyword according to the part of speech to generate a tag array; and generate a first vector corresponding to the tag array.

[0047] The judgment module is also used to judge whether there is an interface matching the first vector in the low-code platform based on the first vector.

[0048] In one possible design, the device also includes: a training module, used to update the large model according to the target code and the description information of the target function to generate an updated large model.

[0049] In one possible design, the input module also includes: a confirmation module, used to send a confirmation request to the development terminal, the confirmation request is used to request the developer to confirm whether there is a problem with the target code; receive response information sent by the developer; if the response information indicates that there is no problem with the target code, then input the target code into the low-code platform, so that the low-code platform can integrate the target code with other codes of the application.

[0050] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the code generation method described in the first aspect and various possible designs of the first aspect.

[0051] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the code generation method described in the first aspect and various possible designs of the first aspect is implemented.

[0052] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the code generation method described in the first aspect and various possible designs of the first aspect.

[0053] The code generation method, device, equipment and storage medium provided in this application, when building an application through a low-code platform, obtains description information of the target function that the application needs to implement; inputs the description information of the target function into the big model, obtains the target code corresponding to the target function output by the big model; inputs the target code into the low-code platform so that the low-code platform can merge the target code with other codes of the application. With the advantage that the big model can automatically generate code snippets based on user input, the workload of manual coding is reduced, and the big model can support multiple programming languages, helping developers to convert and integrate between different languages; in addition, because the big model can run as an independent service or module, the operating environment of the big model is isolated from other parts of the low-code platform to ensure that even if there is a problem with the big model, it will not directly affect the low-code platform. Therefore, the code generation efficiency of secondary development can be improved without affecting the stability of the low-code platform. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0055] Figure 1 It is an application scenario diagram of the code generation method applicable to the embodiment of the present application;

[0056] Figure 2 Schematic diagram of the code generation method provided in the embodiment of the present application Figure 1 ;

[0057] Figure 3 Schematic diagram of the code generation method provided in the embodiment of the present application Figure 2 ;

[0058] Figure 4 A schematic diagram of the structure of a code generation device provided in an embodiment of the present application;

[0059] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0060] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0061] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0062] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.

[0063] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0064] Terminology explanation:

[0065] Low-code platform: usually contains pre-built modules, components and tools, designed to accelerate the application development process by minimizing manual coding and providing a graphical user interface. It uses a visual approach to enable people without professional programming skills to quickly build and deploy applications.

[0066] Large model: also known as the basic model, refers to a machine learning model with a large number of parameters and complex structure. It can process massive data and complete various complex tasks, such as natural language processing, computer vision, speech recognition, etc.

[0067] The current low-code platform basically implements application development through a graphical user interface. Users can create models and page components by dragging and dropping. Ideally, users hope to achieve all functions through the drag-and-drop operation of the low-code platform, but in reality, the functions achieved by dragging and dropping are very limited. The components and models provided by the low-code platform are all pre-defined. Solidified components and models can only be encapsulations of general functions. When faced with diverse and complex business needs, they lack flexibility and seem to be somewhat powerless. Therefore, secondary development, as an important supplementary capability, has assumed a very important responsibility.

[0068] In order to facilitate developers to carry out secondary development on the low-code platform, a scaffold for secondary development is generally provided. A typical scaffold interface includes configuration files, context classes, user code areas, debugging and packaging scripts. Among them, the context class is responsible for interacting with the low-code platform. Developers only need to implement their own special logic according to the assembled class in the specified place. After local debugging, they are packaged and uploaded to the low-code platform and assembled with the application for use. Since the scaffolds used for secondary development vary greatly between different systems or platforms, these differences may include differences in programming languages, development environments, interfaces, configuration methods, etc., which means that developers cannot simply apply the experience of one system directly to another system. In view of these differences, developers need to spend a lot of time and energy to learn and adapt to the new scaffolding, and also need to have a deep understanding of the internal mechanism and working principle of the low-code platform they rely on in order to write effective secondary development code, which leads to low efficiency in code generation for secondary development.

[0069] In addition, some low-code platforms integrate online coding plug-ins in their graphical designers, so developers can write code directly in the graphical designer interface. In order to simplify the development process, low-code platforms will also encapsulate some context classes or tool classes for developers to use. However, the online coding plug-in used needs to be embedded in the environment of the low-code platform, that is, the online coding plug-in and the low-code platform need to be integrated and interacted. Since the online coding plug-in and the low-code platform are tightly integrated, a problem in one part may affect the entire system. Therefore, if there is a problem with the online coding plug-in, it may affect the stability of the entire low-code platform. Similarly, there may be compatibility issues between the online coding plug-in and the low-code platform. These problems may include interface mismatches, inconsistent data formats, performance bottlenecks, etc. Compatibility issues will affect the normal operation of the online coding plug-in, and thus affect the functionality and stability of the entire low-code platform.

[0070] In response to the above technical problems, the inventors found in the process of studying the problem of secondary development code generation that for low-code platforms, although secondary development codes can be independently coded according to business needs, they ultimately need to be embedded in applications for unified deployment before they can be used. Therefore, secondary development codes must comply with the development specifications of low-code platforms, and low-code platforms generally encapsulate the capabilities that can be developed and expanded to conduct effective management and easier secondary development. Based on the fixed code logic and usage patterns of low-code platforms, the necessary conditions for the access of large models are provided. The inventors consider using the large model's ability to automatically generate code for the secondary development of low-code platforms. As long as the large model is trained and made familiar with the fixed code logic and usage patterns of the low-code platform, developers can input natural language into the large model to generate the required secondary development code, thereby improving the efficiency of code generation for secondary development. The fact that the large model can run as an independent service or module will not affect the stability of the low-code platform.

[0071] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0072] Figure 1 FIG. 1 is an application scenario diagram of the code generation method applicable to the embodiment of the present application. Figure 1 As shown, the application scenario is implemented based on a low-code platform, which includes four system modules: instruction receiving module, instruction parsing module, code generation module, and application construction module.

[0073] Next, the function of each system module is briefly described.

[0074] The instruction receiving module is responsible for receiving instructions submitted by users through the graphical interface of the low-code platform or other input methods. These instructions may include operations such as dragging and dropping components, configuring properties, and writing scripts, and standardizing the received instructions. The instruction receiving module is a bridge between users and the platform, playing a role of coordination and management in the entire low-code system to ensure that user operations can be correctly understood and executed.

[0075] The instruction parsing module is responsible for parsing the instructions received by the instruction receiving module, which includes understanding the intention of the instruction, the operation object, the operation type, etc., and further analyzing which interfaces and calling parameters are needed to meet user needs. In addition to determining the interfaces that need to be called, the instruction parsing module also needs to parse the parameters required to call these interfaces.

[0076] The code generation module is responsible for generating the corresponding interface call code based on the parsing results of the instruction parsing module, and adding the interface call code to the underlying logic code of the low-code platform to ensure that the interface call code can be correctly called and executed in the operating environment of the low-code platform; among them, the interface call code may include front-end code, back-end code, and database scripts.

[0077] The application building module is responsible for binding the final underlying logic code obtained through the code generation module with the corresponding application to ensure that the newly generated functions or modifications can be correctly integrated into the application. The low-code platform usually has a modular architecture, so that newly generated functions can be seamlessly integrated into existing applications.

[0078] Exemplarily, the natural language instruction "Expand the query method of model A to realize the process of searching according to time intervals" sent by the user is obtained through the instruction receiving module. Expanding the query method of model A means adding or modifying the query function on the basis of model A so that it can search according to time intervals. The natural language instruction is parsed by the instruction parsing module to obtain two core contents, namely model A and the default query method of model A. At the same time, the part that needs to be expanded is identified, and which interfaces can realize the expanded part are analyzed. Among them, the expanded part can be realized by inheriting the interface or combining the interfaces, or by creating a new interface, which realizes the function of searching according to time intervals; the corresponding interface code is generated by the code generation module, and the interface code is integrated with the corresponding code of the low-code platform, and then the integrated code is bound to the application through the application construction module to realize user needs.

[0079] In addition, after the code is embedded and integrated, it can also be tested and verified to ensure that the new functions or modifications can work properly. Low-code platforms usually provide built-in testing tools and debugging functions to help developers find and fix problems; when the new functions or modifications pass the test, they can be deployed and released. Low-code platforms usually support one-piece deployment and automated release, so that new functions can be quickly launched.

[0080] based on Figure 1 In the application scenario shown, an embodiment of the present application also provides a code generation method. Figure 2 Schematic diagram of the code generation method provided in the embodiment of the present application Figure 1 .like Figure 2 As shown, the code generation method includes:

[0081] S201. When building an application through a low-code platform, obtain descriptive information about the target functions that the application needs to achieve.

[0082] In this step, the application is developed and customized on the existing low-code platform, combined with the secondary development related specifications provided by the low-code platform, and natural language dialogue is conducted with the user through the large model to understand the user's needs and expectations, that is, to obtain the description information of the target function that the application needs to achieve. Among them, the target function is the specific function and feature that the user wants the application to achieve, and the description information of the target function is the basis for the low-code platform to carry out secondary development. It can be understood that the secondary development related specifications refer to a series of standards and guidelines that need to be followed when expanding, modifying or customizing the development on the basis of the low-code platform. The secondary development related specifications usually include development environment settings, coding specifications, architecture design, interfaces and integration, security specifications, testing and quality assurance, deployment and operation and maintenance, documentation and training, version management, laws and compliance, etc. The secondary development related specifications belong to the existing technical content and will not be repeated here.

[0083] Specifically, users can send natural language instructions to the big model on the low-code platform in a variety of ways. For example, the low-code platform may provide pre-built chat components, and users can implement natural language interaction with the big model through the chat dialog box; some low-code platforms may also provide voice input components, and users can configure these components to send voice instructions; users can also add a text input box on the low-code platform and configure a submit button to send the input natural language instructions to the big model; or they can collect the natural language instructions entered by users through a multi-step form and send all inputs to the big model in the last step.

[0084] Understandably, in order to accurately build applications that meet user needs, the big model must be able to correctly understand and process the natural language instructions sent by users. This requires the selected big model to have strong natural language processing capabilities, be able to understand the intent and semantics of natural language instructions, and be able to handle spelling errors and grammatical errors in user input. When user instructions cannot be understood, clear error instructions and suggestions should be provided. In addition, the big model should ensure that the natural language instructions entered by users are properly protected, comply with relevant privacy laws and regulations, and limit the operations that users can perform based on their permissions to prevent unauthorized operations.

[0085] In order to ensure that the big model can correctly understand the natural language instructions sent by the user, before this step, the big model can be trained to understand the natural language instructions. The specific steps are as follows:

[0086] Step a1: Collect natural language instruction data from different fields and scenarios.

[0087] Among them, natural language instruction data may include dialogue data, command data, question and answer data, etc., while ensuring the quality of the data, including correct grammar, clear semantics and clear annotations.

[0088] Step a2: clean the collected natural language instruction data.

[0089] Among them, data cleaning includes denoising and standardization. Denoising is used to remove noise in the data, such as spelling errors, duplicate data and irrelevant information, and standardization is used to standardize the data, such as unifying the format, restoring the word form and removing stop words.

[0090] Step a3: label the cleaned data.

[0091] For example, the user's intention may be determined for each instruction data, or key information in the instruction may be extracted and annotated.

[0092] Step a4: Select a suitable pre-trained model for language modeling training.

[0093] S202. Input the description information of the target function into the large model, and obtain the target code corresponding to the target function output by the large model.

[0094] In this embodiment, after obtaining the description information of the target function based on the large model, Figure 1 The instruction parsing module shown instructs the big model to continue analyzing the description information to determine whether the target function can be implemented through the low-code platform through the big model. In one possible implementation method, the process specifically includes the following steps:

[0095] Step b1, performing word segmentation processing on the description information of the target function to generate multiple keywords;

[0096] Among them, word segmentation processing is to decompose the description information into smaller units so that the model can better understand and process it. Specifically, word segmentation processing can include character-level segmentation (decomposing into single characters), word-level segmentation (decomposing into words or phrases), and word-level segmentation (decomposing into sub-word units).

[0097] Furthermore, the large model will select a tokenizer that is suitable for its training data and application scenarios, and use the selected tokenization algorithm to tokenize the description information, generate multiple keywords, and store these keywords in an array, namely the tokenization array.

[0098] Step b2: Mark each keyword according to its part of speech and generate a marking array;

[0099] It can be understood that the purpose of marking the word segmentation data is to provide richer grammatical, syntactic and semantic information. In addition to marking the word segmentation array according to parts of speech (such as verbs, nouns, adjectives, etc.), the word segmentation array can also be marked by entity recognition (such as names of people, places, organization names, etc.), sentiment labeling (such as positive, negative, neutral, etc.), etc., and special tags (such as separator tags, end tags) can also be added to the word segmentation array.

[0100] Step b3, generating a first vector corresponding to the tag array;

[0101] In one possible implementation, the token array is converted into an index in the vocabulary, which can be passed as input to the embedding layer of the large model. The embedding layer converts these indexes into corresponding words and incorporates them into the vector, i.e., the first vector. The vocabulary is a list created by the large model during the training process, which contains all the words that the large model can recognize and process, and each word has a unique position in this list. The index of the vocabulary refers to the unique identifier of each word in the vocabulary; the embedding layer is a lookup table that can map each index to a high-dimensional vector.

[0102] In another possible implementation, the first vector can be input into the database of the large model, and then the large model will encode the first vector. Specifically, it can be understood that the first vector is converted into another form of representation through the large model. This process may involve feature extraction and dimensionality reduction, etc.; the encoded first vector can better represent the characteristics of the data.

[0103] Step b4: Based on the first vector, determine whether there is an interface in the low-code platform that matches the first vector.

[0104] Specifically, if the target function cannot be realized through the low-code platform, the target interface corresponding to the target function is determined; wherein the target interface is a first interface generated by the large model according to the interface document and interface specification of the low-code platform, or a third-party interface that can realize the target function, or a third interface in the low-code platform whose similarity with the second interface that can realize the target function exceeds a preset similarity. It can be understood that if the target function cannot be realized through the low-code platform, and there is a third-party interface that can realize the target function in other platforms or systems, the third-party interface is determined as the target interface, that is, the third-party interface of other platforms or systems is called for use by the low-code platform. If there is no interface that can realize the target function on the low-code platform and other platforms or systems, the similarity between each interface in the low-code platform and the second interface that can realize the target function is calculated, wherein the second interface refers to an interface that can match the target function under ideal circumstances. If there is a third interface in the low-code platform whose similarity exceeds the preset similarity, the third interface is determined as the target interface, that is, the third interface in the low-code platform whose similarity exceeds the preset similarity is selected to realize the target function. If there is no third interface in the low-code platform whose similarity exceeds the preset similarity, a target interface is generated according to the interface document and interface specification of the low-code platform, that is, a new target interface is created in the low-code platform to implement the target function.

[0105] The preset similarity is a threshold used to determine whether two interfaces are similar enough. If the similarity of two interfaces exceeds this threshold, they are considered similar. By traversing all available interfaces in the low-code platform, the similarity between each interface and the second interface is calculated. The similarity calculation method can be based on the interface's functional description, parameters, return value and other features, and can be calculated using a variety of methods, such as cosine similarity based on feature vectors, Euclidean distance, etc., and the similarity calculation method between interfaces is not restricted here.

[0106] Furthermore, after determining the target interface for implementing the target function, the target code corresponding to the target function is generated through the large model. Exemplarily, first, the large model generates a code template based on the definition of the target interface. This template contains the basic structure and syntax required to call the target interface, such as function definition, parameter passing, error handling and other basic code structures. Secondly, fill in the specific business logic in the code template, which includes setting the parameters for calling the target interface, processing the results returned by the target interface, and other operations required to implement the target function. After that, according to the specific requirements of the target function, configure the parameters required by the target interface to ensure that all necessary parameters are correctly passed to the target interface; finally, combine the code template and the filled logic to generate a complete target code.

[0107] It is worth noting that when the function implemented by a certain interface in the low-code platform is similar to the target function, that is, when the target interface is the third interface, at this time, the third interface can be regarded as an existing code snippet or module, which has implemented part or most of the target function. Therefore, the initial code can be generated based on the third interface. The initial code is extracted from the code corresponding to the third interface, and it contains the basic part for implementing the target function. Next, according to the specific target function, the initial code is fine-tuned. This step is to ensure that the initial code fully meets the requirements of the target function. The fine-tuning process includes adding new logic, modifying existing logic, optimizing performance, etc. The code after fine-tuning is the final target code.

[0108] In addition, if the target function can be achieved only through the low-code platform, that is, there is no need to call a third-party interface or fine-tune the interface of the low-code platform, then the interface in the low-code platform used to achieve the target function is determined as the target interface, and the target code is generated based on the target interface and target function.

[0109] It is understandable that in order for the big model to generate higher quality code that better meets the requirements, the big model needs to be continuously updated and trained. Specifically, the description information of the target code and target function can be stored in the database, and then the stored data can be used to update and train the big model to obtain the updated big model.

[0110] S203. Input the target code into the low-code platform so that the low-code platform can integrate the target code with other codes of the application.

[0111] Specifically, before the target code is input into the low-code platform, a confirmation request needs to be sent to the development terminal, the purpose of which is to allow the developer to check whether there are any problems with the target code. The development terminal refers to the working environment or tools used by the developer, such as the integrated development environment, code editor, developer console, etc. After receiving the confirmation request, the developer needs to check and verify the target code, which may include code review, functional testing, performance testing, etc. After the developer completes the inspection, a response message will be sent to feedback whether there are any problems with the target code and whether it can continue to be input into the low-code platform. If the response information indicates that there is no problem with the target code, the target code is input into the low-code platform so that the target program is integrated with other codes of the application in the low-code platform to complete the binding with the application. After the target code is input into the low-code platform, the low-code platform needs to be restarted, or the integrated code needs to be reloaded to ensure the normal operation of the low-code platform. Furthermore, by binding action events through interface operations, the final application can be displayed, previewed, debugged on the low-code platform, and support download and deployment to the running state.

[0112] Figure 3 Schematic diagram of the code generation method provided in the embodiment of the present application Figure 2 This embodiment is based on the above embodiment and describes in detail the process of building an application through a low-code platform based on the description information of the target function. Figure 3 As shown, the method includes: the business personnel input the corresponding natural language instruction through the operation interface. Next, the big model receives the natural language instruction and performs the instruction parsing operation, and determines whether the parsed natural language instruction is supported, that is, confirms whether the parsed natural language instruction can be understood by the big model. If the big model does not support the parsed natural language instruction, the user is guided to input more detailed natural language instructions through the big model. If the big model supports the parsed natural language instruction, a series of instruction escape operations such as word segmentation, tagging, and vector generation are performed to obtain the target code corresponding to the target function. Further, the target code is input into the low-code platform and merged with other codes of the application. The fused code is decoded by the low-code platform, that is, the low-code platform is restarted or the fused code is reloaded to obtain the corresponding secondary development code. The secondary development code is bound to the application, and the application is run after the binding is completed. Among them, the target code can also be dropped into the database, the target code is stored in the database, and then the stored data is used to update and train the big model, and the updated big model is obtained.

[0113] The code generation method provided in this application obtains the description information of the target function that the application needs to implement when building an application through a low-code platform; the description information of the target function is input into the large model, and the target interface that can realize the target function is determined based on the large model, and the target code corresponding to the target function is generated. It can be seen that with the advantage of the large model that can automatically generate code snippets according to user input, the workload of manual coding is reduced, and the large model can support multiple programming languages ​​to help developers convert and integrate between different languages. After the target code is generated, the target code is input into the low-code platform and merged with other codes of the application in the low-code platform to achieve the target function. Since the large model can run as an independent service or module, the operating environment of the large model is isolated from other parts of the low-code platform to ensure that even if there is a problem with the large model, it will not directly affect the low-code platform. Therefore, the code generation efficiency of secondary development can be improved without affecting the stability of the low-code platform.

[0114] Figure 4 This is a schematic diagram of the structure of the code generation device provided in the embodiment of the present application. Figure 4 As shown, the code generation device includes: an acquisition module 401 and an input module 402;

[0115] Among them, the acquisition module 401 is used to obtain description information of the target function that needs to be achieved by the application when building the application through the low-code platform;

[0116] An input module 402, used to input the description information of the target function into the large model;

[0117] The acquisition module 401 is further used to acquire the target code corresponding to the target function output by the large model;

[0118] The input module 402 is used to input the target code into the low-code platform so that the low-code platform merges the target code with other codes of the application;

[0119] Among them, the big model is used to determine whether the target function can be realized through the low-code platform. If the target function cannot be realized through the low-code platform, the target interface corresponding to the target function is determined, and the target code is generated according to the target interface. The target interface is a first interface generated by the big model according to the interface document and interface specification of the low-code platform, or a third-party interface that can realize the target function, or a third interface in the low-code platform whose similarity with the second interface that can realize the target function exceeds a preset similarity.

[0120] In some embodiments, the acquisition module 401 further includes: a determination module 403 , a processing module 404 , and a generation module 405 .

[0121] The judgment module 403 is used to determine whether the target function can be implemented through the low-code platform.

[0122] The processing module 404 is used to determine whether there is a third-party interface that can realize the target function if the target function cannot be realized through the low-code platform; if there is a third-party interface that can realize the target function, the third-party interface is determined as the target interface; if there is no third-party interface that can realize the target function, the similarity between each interface in the low-code platform and the second interface that can realize the target function is calculated; if there is a third interface in the low-code platform whose similarity exceeds the preset similarity, the third interface is determined as the target interface; if there is no third interface in the low-code platform whose similarity exceeds the preset similarity, the target interface is generated according to the interface document and interface specification of the low-code platform.

[0123] The generating module 405 is used to generate the target code corresponding to the target function according to the target interface.

[0124] In a possible design, the generation module 405 is further used to generate initial code according to the third interface when the target interface is the third interface; and to fine-tune the initial code according to the target function to generate the target code.

[0125] In a possible design, the generation module 405 is further used to perform word segmentation processing on the description information of the target function to generate multiple keywords; mark each keyword according to the part of speech to generate a tag array; and generate a first vector corresponding to the tag array.

[0126] The judgment module 403 is also used to judge whether there is an interface matching the first vector in the low-code platform based on the first vector.

[0127] In one possible design, the device also includes: a training module 406, which is used to update the large model according to the target code and the description information of the target function to generate an updated large model.

[0128] In one possible design, the input module 402 also includes: a confirmation module 407, which is used to send a confirmation request to the development terminal, and the confirmation request is used to request the developer to confirm whether there is a problem with the target code; receive a response message sent by the developer; if the response message indicates that there is no problem with the target code, then input the target code into the low-code platform, so that the low-code platform can integrate the target code with other codes of the application.

[0129] It should be understood that the acquisition module 401 can be implemented as Figure 1 The instruction receiving module shown in the figure can be implemented as Figure 1 The instruction parsing module shown in the figure can be implemented as Figure 1 The code generation module shown in the figure can be implemented as Figure 1 The application building blocks shown.

[0130] The code generation device provided in the embodiment of the present application can be used to execute the technical solution of the code generation method in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0131] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the input module 402 can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above input module 402. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0132] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device may include: a transceiver 51 , a processor 52 , and a memory 53 .

[0133] The processor 52 executes the computer execution instructions stored in the memory, so that the processor 52 executes the scheme in the above embodiment. The processor 52 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0134] The memory 53 is connected to the processor 52 via a system bus and completes communication between them. The memory 53 is used to store computer program instructions.

[0135] The transceiver 51 may be used to communicate with other devices.

[0136] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0137] The electronic device provided in the embodiment of the present application may be the terminal device of the above embodiment.

[0138] The electronic device provided in the embodiment of the present application is used to execute the technical solution of the code generation method in the above embodiment.

[0139] An embodiment of the present application also provides a chip for executing instructions, which is used to execute the technical solution of the code generation method in the above embodiment.

[0140] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the code generation method in the above embodiment.

[0141] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the code generation method in the above embodiment can be implemented.

[0142] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0143] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0144] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0145] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0146] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0147] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0148] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0149] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0150] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0151] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A code generation method, characterized in that: include: When building an application through a low-code platform, obtain description information of the target functions that the application needs to achieve; Inputting the description information of the target function into the large model, and obtaining the target code corresponding to the target function output by the large model; Inputting the target code into the low-code platform so that the low-code platform merges the target code with other codes of the application; Among them, the big model is used to determine whether the target function can be realized through the low-code platform. If the target function cannot be realized through the low-code platform, the target interface corresponding to the target function is determined, and the target code is generated according to the target interface. The target interface is a first interface generated by the big model according to the interface document and interface specification of the low-code platform, or a third-party interface that can realize the target function, or a third interface in the low-code platform whose similarity with the second interface that can realize the target function exceeds a preset similarity.

2. The method according to claim 1, characterized in that The step of inputting the description information of the target function into the large model and obtaining the target code corresponding to the target function output by the large model comprises: Determine whether the target function can be implemented through the low-code platform; If the target function cannot be realized by the low-code platform, determining whether there is a third-party interface that can realize the target function; If the third-party interface that can realize the target function exists, determining the third-party interface as the target interface; If the third-party interface that can realize the target function does not exist, then the similarity between each interface in the low-code platform and the second interface that can realize the target function is calculated; If the third interface whose similarity exceeds the preset similarity exists in the low-code platform, the third interface is determined as the target interface; If the third interface whose similarity exceeds the preset similarity does not exist in the low-code platform, the target interface is generated according to the interface document and interface specification of the low-code platform; According to the target interface, a target code corresponding to the target function is generated.

3. The method according to claim 2, characterized in that The step of generating a target code corresponding to the target function according to the target interface includes: When the target interface is the third interface, generating an initial code according to the third interface; According to the target function, the initial code is fine-tuned to generate the target code.

4. The method according to claim 2 or 3, characterized in that: The determining whether the target function can be implemented through the low-code platform includes: Performing word segmentation processing on the description information of the target function to generate multiple keywords; Tag each keyword according to the part of speech and generate a tag array; Generate a first vector corresponding to the tag array; Based on the first vector, determine whether there is an interface in the low-code platform that matches the first vector.

5. The method according to any one of claims 1 to 3, characterized in that: After inputting the description information of the target function into the large model and obtaining the target code corresponding to the target function output by the large model, the method further includes: The large model is updated and trained according to the target code and the description information of the target function to generate an updated large model.

6. The method according to any one of claims 1 to 3, characterized in that: The inputting the target code into the low-code platform so that the low-code platform merges the target code with other codes of the application program includes: Sending a confirmation request to a development terminal, wherein the confirmation request is used to request a developer to confirm whether there is a problem with the target code; Receiving a response message sent by the developer; If the response information indicates that there is no problem with the target code, the target code is input into the low-code platform so that the low-code platform integrates the target code with other codes of the application.

7. The method according to claim 2, characterized in that: The step of inputting the description information of the target function into the large model and obtaining the target code corresponding to the target function output by the large model comprises: If the target function can be realized by the low-code platform, the interface in the low-code platform used to realize the target function is determined as the target interface; The target code is generated according to the target interface and the target function.

8. A code generating device, characterized in that: include: An acquisition module is used to obtain description information of target functions that need to be achieved by the application when building the application through the low-code platform; An input module, used for inputting the description information of the target function into the large model; The acquisition module is further used to acquire the target code corresponding to the target function output by the large model; The input module is used to input the target code into the low-code platform so that the low-code platform merges the target code with other codes of the application; Among them, the big model is used to determine whether the target function can be realized through the low-code platform. If the target function cannot be realized through the low-code platform, the target interface corresponding to the target function is determined, and the target code is generated according to the target interface. The target interface is a first interface generated by the big model according to the interface document and interface specification of the low-code platform, or a third-party interface that can realize the target function, or a third interface in the low-code platform whose similarity with the second interface that can realize the target function exceeds a preset similarity.

9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.

Citation Information

Cited By

  • Method and apparatus for determining call relationship of generated code, and storage medium

    WO2026144483A1