CN-122018755-A - Method and device for generating visual interface, electronic equipment and storage medium
Abstract
The application relates to the technical field of artificial intelligence and computer graphics and discloses a method, a device, electronic equipment and a storage medium for generating a visual interface, wherein the method comprises the steps of responding to the selection operation of a target object, determining source data, inputting the source data into a layout generation model to obtain an abstract semantic layout tree, wherein nodes of the abstract semantic layout tree are used for representing the types of interface elements; the method comprises the steps of determining interface elements corresponding to nodes and attribute information of the interface elements based on types represented by the nodes, determining layout information of the interface elements corresponding to the nodes based on hierarchical relations among the nodes, generating interface configuration information based on the attribute information and the layout information of the interface elements, and rendering the interface configuration information to obtain a visual interface which is used for displaying a data analysis report corresponding to source data. By implementing the method of the application, the problems of disordered visual interface layout and non-uniform style generated by a large language model can be solved.
Inventors
- Dang Renning
- XIE BIN
- KE LINGHONG
- PAN QIANYI
- ZHENG XIAOPING
- SUN HAOJIE
- ZHANG WENHAO
Assignees
- 顺丰科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251230
Claims (10)
- 1. A method for generating a visual interface, the method comprising: Determining source data in response to a selection operation of a target object, and inputting the source data into a layout generation model to obtain an abstract semantic layout tree, wherein nodes of the abstract semantic layout tree are used for representing types of interface elements, the abstract semantic layout tree comprises hierarchical relations among the nodes, and the layout generation model is configured to determine the types of the interface elements based on the source data; Determining the interface element corresponding to the node and attribute information of the interface element based on the type represented by the node; determining layout information of the interface elements corresponding to the nodes based on the hierarchical relationship among the nodes; generating interface configuration information based on the attribute information and the layout information of the interface element; And rendering the interface configuration information to obtain a visual interface, wherein the visual interface is used for displaying a data analysis report corresponding to the source data.
- 2. The method of claim 1, wherein the layout information includes a target width and a target height, wherein the determining layout information of the interface element corresponding to the node based on the hierarchical relationship between the nodes includes: determining whether a target interface element corresponding to a target node is a container or not, wherein the target node and a root node of the abstract semantic layout tree are in a parent-child relationship; if the target interface element is a non-container, taking the preset height in the attribute information of the target interface element as the target height of the target interface element; and taking the preset interface width of the visual interface as the target width of the target interface element.
- 3. The method according to claim 2, wherein the method further comprises: If the target interface element is a container, the interface width is used as the target width of the target interface element; determining whether all sub-interface elements corresponding to the sub-nodes of the target node are containers; if all the sub-interface elements are non-containers, taking the preset height in the attribute information of the sub-interface elements as the target height of the sub-interface elements; determining a target width of the sub-interface element based on the target width of the target interface element; and determining the target height of the target interface element based on the target height of the sub-interface element.
- 4. The method of claim 3, wherein the determining the target width of the sub-interface element based on the target width of the target interface element comprises: acquiring a preset width in the attribute information of the sub-interface element; obtaining a first width based on the sum of all the preset widths, and obtaining a total width based on the sum of a preset width total interval and the first width; if the total width is larger than the target width of the target interface element, carrying out row separation processing on all the sub-interface elements, and determining the target width of the sub-interface elements in each row; And if the total width is smaller than the target width of the target interface element, adjusting the preset width of the sub-interface element based on the difference between the total width and the target width of the target interface element to obtain the target width of the sub-interface element.
- 5. The method of claim 3, wherein the determining the target height of the target interface element based on the target height of the sub-interface element comprises: Selecting the sub-interface element with the largest target height from each row as a reference sub-interface element; Determining an initial height of the target interface element based on a sum of target heights of the reference sub-interface elements; and obtaining the target height of the target interface element based on the sum of the initial height of the target interface element and the preset total height interval.
- 6. A method according to claim 3, characterized in that the method further comprises: If all the sub-interface elements are the containers, determining the residual width based on the difference value between the target width of the target interface element and the preset total width interval; Determining an initial width of each sub-interface element based on a ratio of the remaining width to a total number of the sub-interface elements; adjusting the initial width of the sub-interface element based on the target width of the interface element contained in the sub-interface element to obtain the target width of the sub-interface element; And determining the target height of the sub-interface element based on the target height of the interface element contained in the sub-interface element.
- 7. The method of claim 2, wherein the layout information includes target coordinates, and wherein the determining of the target coordinates of the target interface element corresponding to the target node includes: Acquiring a first reference coordinate and a reference height of a reference interface element, wherein the first reference coordinate is a corner coordinate of the reference interface element, and the reference interface element is adjacent to the target interface element in the height direction; determining a second reference coordinate of the reference interface element based on a fusion result of the first reference coordinate and the reference height; Acquiring a first width subinterval and a first height subinterval, wherein the first width subinterval is the distance between the target interface element and a target boundary line, the target boundary line is the boundary line adjacent to the target interface element in the visual interface, and the first height subinterval is the distance between the target interface element and the reference interface element in the height direction; Determining the target coordinates of the target interface element using the second reference coordinates, the first width subinterval, and the first height subinterval.
- 8. A visual interface generating apparatus, the apparatus comprising: The system comprises an acquisition module, a layout generation module and a layout generation module, wherein the acquisition module is used for responding to the selection operation of a target object, determining source data and inputting the source data into the layout generation module to obtain an abstract semantic layout tree, nodes of the abstract semantic layout tree are used for representing the types of interface elements, the abstract semantic layout tree comprises hierarchical relations among the nodes, and the layout generation module is used for determining the types of the interface elements based on the source data; The first determining module is used for determining the interface element corresponding to the node and attribute information of the interface element based on the type represented by the node; a second determining module, configured to determine layout information of the interface elements corresponding to the nodes based on a hierarchical relationship between the nodes; the generation module is used for generating interface configuration information based on the attribute information and the layout information of the interface element; the rendering module is used for rendering the interface configuration information to obtain a visual interface, and the visual interface is used for displaying a data analysis report corresponding to the source data.
- 9. An electronic device, comprising: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the method of generating a visual interface according to any one of claims 1 to 7.
- 10. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method of generating a visual interface according to any one of claims 1 to 7.
Description
Method and device for generating visual interface, electronic equipment and storage medium Technical Field The invention relates to the technical field of artificial intelligence and computer graphics, in particular to a method and a device for generating a visual interface, electronic equipment and a storage medium. Background With the rapid development of artificial intelligence technologies such as large language models (Large Language Model, LLM), the generation of user interfaces (AIGC for UI) corresponding to the natural language of users based on large language models has become a popular research direction. For example, a user may input "help me generate a data analysis report for the courier industry" to a large language model, which may automatically generate an interface code corresponding to the data analysis report. However, because the large language model lacks accurate understanding of geometric space, a visual interface is rendered by using interface codes generated by the large language model, and the problem of disordered layout among interface elements in the visual interface easily occurs. Moreover, the visual interface directly generated by the large language model is easy to have the problem that the visual interface is not uniform with the style of interface elements in the existing visual interface. Disclosure of Invention The invention provides a method, a device, electronic equipment and a storage medium for generating a visual interface, which are used for solving the problems of disordered layout and non-uniform style of the visual interface generated by a large language model. The invention provides a method for generating a visual interface, which comprises the steps of responding to selection operation of a target object, determining source data, inputting the source data into a layout generation model to obtain an abstract semantic layout tree, wherein nodes of the abstract semantic layout tree are used for representing types of interface elements, the abstract semantic layout tree comprises hierarchical relations among the nodes, the layout generation model is configured to determine the types of the interface elements based on the source data, determine the interface elements corresponding to the nodes and attribute information of the interface elements based on the types of the node representations, determine the layout information of the interface elements corresponding to the nodes based on the hierarchical relations among the nodes, generate interface configuration information based on the attribute information and the layout information of the interface elements, and render the interface configuration information to obtain a visual interface which is used for displaying a data analysis report corresponding to the source data. According to the method for generating the visual interface, the obtained source data are input into the layout generation model, so that interface elements required by a data analysis report corresponding to the source data are planned by the layout generation model, the types of the interface elements are output in the form of an abstract semantic layout tree, the interface elements corresponding to all nodes and the attribute information and layout information of the interface elements are determined by means of the abstract semantic layout tree, and therefore the more accurate attribute information and layout information can be obtained. And generating interface configuration information by utilizing the attribute information and layout information of the interface elements, and rendering the interface configuration information to obtain a visual interface, so that the visual interface with accurate layout and uniform style can be obtained, and the problems of disordered layout and non-uniform style of the visual interface generated by the large language model are solved. In an alternative implementation mode, the layout information comprises a target width and a target height, the layout information of the interface elements corresponding to the nodes is determined based on the hierarchical relation among the nodes, the layout information comprises the steps of determining whether the target interface elements corresponding to the target nodes are containers or not, wherein the target nodes and the root nodes of the abstract semantic layout tree are father-son relations, if the target interface elements are non-containers, the preset height in the attribute information of the target interface elements is used as the target height of the target interface elements, and the interface width of the preset visual interface is used as the target width of the target interface elements. When the target interface element corresponding to the target node is a non-container, the interface width of the visual interface is taken as the target width of the target interface element, so that the target interface element fills the whole visual interface in th