CN-121979514-A - Low-code protocol generation method and device, electronic equipment and storage medium
Abstract
The application discloses a low-code protocol generation method, a device, electronic equipment and a storage medium, which belong to the technical field of computers, and the method comprises the steps of obtaining interface representation information, wherein the interface representation information is used for representing interface contents of a designated interface; generating a front end frame code corresponding to a designated interface based on the interface representation information through a large language model, performing rendering processing based on the front end frame code to obtain an interface tree structure corresponding to the designated interface, extracting interface characteristic data corresponding to nodes in the interface tree structure, constructing a low code protocol block corresponding to each node based on the interface characteristic data corresponding to each node, assembling the low code protocol blocks based on the nesting relation of the nodes in the interface tree structure to obtain a low code protocol corresponding to the designated interface, and improving the accuracy of the low code protocol.
Inventors
- LIU YIQI
Assignees
- 杭州网易智企科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251224
Claims (10)
- 1. A method for generating a low code protocol, comprising: Acquiring interface representation information, wherein the interface representation information is used for representing interface contents of a designated interface; generating a front end frame code corresponding to the designated interface based on the interface representation information through a large language model; Rendering processing is carried out based on the front end frame code, so that an interface tree structure corresponding to the designated interface is obtained, and interface characteristic data corresponding to nodes in the interface tree structure are extracted; Constructing a low-code protocol block corresponding to each node based on the interface characteristic data corresponding to each node; And assembling the low-code protocol blocks based on the nesting relation of the nodes in the interface tree structure to obtain the low-code protocol corresponding to the appointed interface.
- 2. The method of claim 1, wherein the nodes include a first node that renders the component on the designated interface and a second node that does not render the component, the interface feature data of the first node including geometry information, style information, and component information, the interface feature data of the second node including geometry information and style information; The extracting the interface characteristic data corresponding to the nodes in the interface tree structure comprises the following steps: extracting geometric information and style information corresponding to a first node and geometric information and style information corresponding to a second node in the interface tree structure; identifying the component type of the component corresponding to the first node; And extracting the component information corresponding to the first node based on the extraction mode corresponding to the component type.
- 3. The method according to claim 2, wherein the method further comprises: selecting a first front end frame corresponding to the component type from a plurality of front end frames; the extracting the component information corresponding to the first node based on the extracting mode corresponding to the component type includes: and extracting the component information corresponding to the first node through the first front end framework based on the extraction mode corresponding to the component type.
- 4. The method according to claim 2, wherein the component type includes at least one of a form type, a chart type, and a text type, and the extracting component information corresponding to the first node based on an extraction manner corresponding to the component type in a case where the component type includes the form type includes: extracting header information of a table corresponding to the first node, and extracting a column structure of the table and a corresponding data cell; Generating a column definition code based on the header information, the column structure and the data cells, creating slot references for the column definition code and slot templates corresponding to the slot references, and obtaining component information corresponding to the first node; and when the component type includes the form type, extracting component information corresponding to the first node based on an extraction manner corresponding to the component type includes: detecting the form layout type of the form corresponding to the first node, setting the maximum width of the label as the value of the cascading style sheet variable, and extracting the mark information of the necessary-to-be-filled field; generating a form container based on the form layout type and the cascading style sheet variable, and generating a child node slot based on the necessary-to-be-filled field marking information to obtain component information corresponding to the first node; and when the component type includes the chart type, extracting component information corresponding to the first node based on an extraction manner corresponding to the component type includes: Generating configuration information and corresponding chart component codes to obtain component information corresponding to the first node; And extracting the component information corresponding to the first node based on the extraction mode corresponding to the component type when the component type includes the text type, including: determining the node position of the first node, processing a prompt text and determining a line feed recognition result; And determining the actual rendering size of the text based on the node position, the processing result of the prompt text and the line feed recognition result, and obtaining the component information corresponding to the first node.
- 5. The method of claim 2, wherein the identifying the component type of the component corresponding to the first node comprises: Judging whether the component type of the component corresponding to the first node is the component type in a basic component or not based on the cascading style sheet class name of the first node; Judging whether the component type of the component corresponding to the first node is the component type in a composite component or not based on the structural characteristics of the first node in the interface tree structure; And judging whether the component type of the component corresponding to the first node is the component type in the special component or not based on the attribute mark of the first node.
- 6. The method according to claim 1, wherein said constructing a low code protocol block corresponding to each of said nodes based on said interface feature data corresponding to each of said nodes comprises: Converting the absolute position information in the interface characteristic data to obtain target interface characteristic data corresponding to the node, wherein the position information in the target interface characteristic data is relative position information; and constructing a low-code protocol block corresponding to the node based on the target interface characteristic data corresponding to the node.
- 7. The method according to any one of claims 1-6, wherein the low-code protocol block includes a slot, and the assembling the low-code protocol block based on the nesting relationship of the nodes in the interface tree structure to obtain the low-code protocol corresponding to the specified interface includes: Determining child nodes of the nodes in the interface tree structure based on the nesting relationship of the nodes in the interface tree structure; and filling the low-code protocol blocks of the child nodes into slots of the nodes to assemble the low-code protocol blocks so as to obtain the low-code protocol corresponding to the designated interface.
- 8. A low code protocol generation apparatus, comprising: the interface display module is used for displaying interface contents of the designated interface; The generation module is used for generating a front end frame code corresponding to the designated interface based on the interface representation information through a large language model; the rendering module is used for performing rendering processing based on the front end frame code to obtain an interface tree structure corresponding to the designated interface, and extracting interface characteristic data corresponding to nodes in the interface tree structure; The construction module is used for constructing a low-code protocol block corresponding to each node based on the interface characteristic data corresponding to each node; And the assembly module is used for assembling the low-code protocol blocks based on the nesting relation of the nodes in the interface tree structure to obtain the low-code protocol corresponding to the appointed interface.
- 9. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions, the processor loading instructions from the memory to perform the steps of the low code protocol generation method of any of claims 1 to 7.
- 10. A computer-readable storage medium, having stored thereon a computer program, the computer program being loaded by a processor to perform the steps of the low code protocol generation method of any of claims 1 to 7.
Description
Low-code protocol generation method and device, electronic equipment and storage medium Technical Field The present application relates to the field of computer technologies, and in particular, to a method and apparatus for generating a low code protocol, an electronic device, and a storage medium. Background The Low-Code Protocol (Low-Code Protocol) refers to structured data describing user interface components, layout, and interaction logic, which may be rendered by a Low-Code platform into an editable user interface. In the conventional technology, the low-code protocol is usually generated manually, which is inefficient. To increase the efficiency of generating low-code protocols, the low-code protocols may be generated by a large language model (Large Language Model, LLM), which refers to a deep learning model trained using large amounts of text data. However, the accuracy of low code protocols generated directly by large language models remains to be improved. Disclosure of Invention The application provides a low-code protocol generation method, a device, electronic equipment and a storage medium, which can improve the accuracy of a low-code protocol. In a first aspect, the present embodiment provides a low code protocol generating method, including: Acquiring interface representation information, wherein the interface representation information is used for representing interface contents of a designated interface; generating a front end frame code corresponding to the specified interface based on the interface representation information through a large language model; rendering processing is carried out based on the front end frame code, so that an interface tree structure corresponding to the appointed interface is obtained, and interface characteristic data corresponding to nodes in the interface tree structure are extracted; Constructing a low-code protocol block corresponding to each node based on the interface characteristic data corresponding to each node; And assembling the low-code protocol blocks based on the nesting relation of the nodes in the interface tree structure to obtain the low-code protocol corresponding to the appointed interface. In a second aspect, the present embodiment provides a low code protocol generating apparatus, including: the interface display module is used for displaying interface contents of the designated interface; the generation module is used for generating a front end frame code corresponding to the specified interface based on the interface representation information through a large language model; The rendering module is used for performing rendering processing based on the front end frame code to obtain an interface tree structure corresponding to the specified interface, and extracting interface characteristic data corresponding to nodes in the interface tree structure; the construction module is used for constructing a low-code protocol block corresponding to each node based on the interface characteristic data corresponding to each node; And the assembly module is used for assembling the low-code protocol blocks based on the nesting relation of the nodes in the interface tree structure to obtain the low-code protocol corresponding to the appointed interface. In a third aspect, an embodiment of the present application further provides an electronic device, including a memory storing a plurality of instructions, where the processor loads the instructions from the memory to execute any one of the low code protocol generating methods provided in the embodiments of the present application. In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a plurality of instructions, where the instructions are adapted to be loaded by a processor to perform any one of the low code protocol generating methods provided by the embodiments of the present application. In the embodiment of the application, interface representation information is acquired and used for representing interface content of a designated interface, a front end frame code corresponding to the designated interface is generated based on the interface representation information through a large language model, rendering processing is carried out based on the front end frame code to obtain an interface tree structure corresponding to the designated interface, interface characteristic data corresponding to nodes in the interface tree structure are extracted, a low code protocol block corresponding to each node is constructed based on the interface characteristic data corresponding to each node, the low code protocol blocks are assembled based on the nesting relation of the nodes in the interface tree structure to obtain a low code protocol corresponding to the designated interface, and the purposes of generating the front end frame code through the large language model and then generating the low code