Page generation method and device based on large language model and electronic equipment
By using the large language model to generate page code and render it, the problem of low page development efficiency is solved, the function of generating pages in natural language is realized, the development efficiency is improved and the development threshold is lowered.
Patent Information
- Application Number
- CN202411899215.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-18
AI Technical Summary
In the process of front-end page development, how to improve page development efficiency is an urgent problem to be solved.
By obtaining the page description information in the page generation request sent by the client, the page code is generated using the target large language model, and the generated page code is sent to the client for rendering to generate the target page.
It realizes the generation of pages through natural language, thereby improving page development efficiency and reducing the threshold for use of development platforms.
Smart Images

Figure CN119847519A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, in particular to artificial intelligence fields such as large language models, deep learning, and natural language processing, and specifically to a page generation method, device, and electronic device based on a large language model. Background Art
[0002] In the process of front-end page development, it is usually necessary to develop and design pages of various types and functions. How to improve the efficiency of page development is an urgent problem to be solved. Summary of the invention
[0003] The present application provides a page generation method, device and electronic device based on a large language model.
[0004] According to one aspect of the present application, a page generation method based on a large language model is provided, comprising:
[0005] Obtaining a page generation request sent by a client; wherein the page generation request includes page description information, and the page description information is used to describe the page generation requirement;
[0006] Generate page code using a target large language model according to the page description information;
[0007] The page code is sent to the client, so that the client performs rendering according to the page code to generate a target page.
[0008] According to another aspect of the present application, a page generation method based on a large language model is provided, comprising:
[0009] In response to obtaining the input page description information, a page generation request is sent to the server; wherein the page generation request includes the page description information, and the page description information is used to describe the page generation requirement;
[0010] Obtaining a page code sent by the server; wherein the page code is generated by using a target large language model according to the page description information;
[0011] Rendering is performed according to the page code to generate a target page.
[0012] According to another aspect of the present application, a page generation device based on a large language model is provided, comprising:
[0013] A first acquisition module is used to acquire a page generation request sent by a client; wherein the page generation request includes page description information, and the page description information is used to describe the page generation requirement;
[0014] A generation module, used to generate page code according to the page description information using a target large language model;
[0015] The sending module is used to send the page code to the client, so that the client renders according to the page code to generate a target page.
[0016] According to another aspect of the present application, a page generation device based on a large language model is provided, comprising:
[0017] A sending module, used for sending a page generation request to a server in response to obtaining the input page description information; wherein the page generation request includes the page description information, and the page description information is used to describe the page generation requirement;
[0018] An acquisition module, used for acquiring the page code sent by the server; wherein the page code is generated by using a target large language model according to the page description information;
[0019] The generation module is used to render according to the page code to generate a target page.
[0020] According to another aspect of the present application, there is provided an electronic device, including:
[0021] at least one processor; and
[0022] a memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor so that the at least one processor can perform the method described in the above embodiment.
[0024] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to the above embodiment.
[0025] According to another aspect of the present application, a computer program product is provided, including a computer program, wherein the computer program implements the steps of the method described in the above embodiment when executed by a processor.
[0026] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0028] Figure 1 A schematic diagram of a flow chart of a page generation method based on a large language model provided in an embodiment of the present application;
[0029] Figure 2 A language interaction interface provided in the embodiment of the present application Figure 1 ;
[0030] Figure 3 A schematic diagram of a flow chart of a page generation method based on a large language model provided in another embodiment of the present application;
[0031] Figure 4 A schematic diagram of a flow chart of a page generation method based on a large language model provided in another embodiment of the present application;
[0032] Figure 5 A language interaction interface provided in the embodiment of the present application Figure 2 ;
[0033] Figure 6 A schematic diagram of a flow chart of a page generation method based on a large language model provided in another embodiment of the present application;
[0034] Figure 7 A schematic diagram of a management page provided in an embodiment of the present application;
[0035] Figure 8 A schematic diagram of the structure of a page generation device based on a large language model provided in an embodiment of the present application;
[0036] Fig. 9 A schematic diagram of the structure of a page generation device based on a large language model provided in another embodiment of the present application;
[0037] Fig.10 It is a block diagram of an electronic device used to implement the page generation method based on a large language model in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0039] The following describes a page generation method, device, electronic device, and storage medium based on a large language model according to an embodiment of the present application with reference to the accompanying drawings.
[0040] Figure 1A schematic diagram of a flow chart of a page generation method based on a large language model provided in an embodiment of the present application.
[0041] The page generation method based on a large language model in the embodiment of the present application can be executed by the page generation device based on a large language model in the embodiment of the present application, and the device can be configured in an electronic device.
[0042] The electronic device may be a device with computing capability, such as a server.
[0043] like Figure 1 As shown, the page generation method based on the large language model includes:
[0044] Step 101, obtaining a page generation request sent by a client; wherein the page generation request includes page description information.
[0045] In this application, the user can enter page description information in the language interaction interface of the client with page development function. After the client obtains the page description information, it can send a page generation request to the server, so that the server can obtain the page generation request sent by the client.
[0046] The page generation request may include page description information, and the page description information may be used to describe the page generation requirement.
[0047] For example, the page description information is "Generate a form including the following fields: name, gender, photo, attachment".
[0048] Step 102: Generate page code based on the page description information using the target large language model.
[0049] The target large language model has the function of generating page codes, and the target large language model may be a model obtained by fine-tuning the general large language model.
[0050] In the present application, the prompt template for guiding the generation of page code can be filled in according to the page description information to obtain prompt information, and the prompt information can be input into the target large language model for processing to obtain the page code output by the large language model.
[0051] For example, the prompt message is "Generate an amis configuration based on the description: a form containing title, education, address, articles, email, phone number, rating, and photos."
[0052] Step 103: Send the page code to the client, so that the client renders according to the page code to generate a target page.
[0053] In this application, after generating the page code, the server can send the page code to the client, and the client renders according to the page code to generate the target page.
[0054] for example, Figure 2 In the interactive interface of the development assistant, the user enters "generate a form, including the following fields: name, gender, photo, attachment", the server generates page code based on the input information, the client renders the page code, and generates the corresponding form in the interactive interface.
[0055] The page generation method based on the large language model in the embodiment of the present application can apply a low-code platform to improve page development efficiency.
[0056] In the embodiment of the present application, the target large language model is used to generate page code based on the page description information in the page generation request sent by the client, and then sent to the client, and the client renders according to the page code to generate the target page. In this way, the page can be generated by natural language based on the large language model, which can not only improve the efficiency of page development, but also reduce the threshold for using the development platform.
[0057] Figure 3 A flowchart of a page generation method based on a large language model provided in another embodiment of the present application.
[0058] like Figure 3 As shown, the page generation method based on the large language model includes:
[0059] Step 301, obtaining a page generation request sent by a client; wherein the page generation request includes page description information.
[0060] In the present application, step 301 can be implemented in any of the embodiments of the present application, so it will not be described in detail here.
[0061] Step 302: Use the target large language model to identify the page description information to determine the target components and attribute information of the target components included in the page to be generated.
[0062] In the present application, the prompt template used to guide the generation of page code can be filled in according to the page description information to obtain prompt information, and the prompt information can be input into the target large language model. The target large language model can identify the page description information to determine the target components and attribute information of the target components contained in the page to be generated.
[0063] The attribute information of the target component may include but is not limited to the attributes, appearance, events, layout, etc. of the target component.
[0064] In addition, the target component may be one or more, and there is no limitation to this.
[0065] For example, if the page description information is "generate a button, and open a pop-up window when clicked", it can be determined through identification that the components of the page to be generated include "button", "pop-up window", etc. The attribute information of "button" can include events such as click, and the attribute information of "pop-up window" can include default hiding, display behavior, closing behavior and other event behaviors. Since the appearance of the "button" is not specified in the page description information, the default size, color, dimension and other appearances can be used. The page description information also does not specify the appearance of the "pop-up window", and the default appearance can also be used.
[0066] Step 303: Generate page code according to the attribute information and code language specification.
[0067] In this application, page code that complies with the code language specification can be generated based on the attribute information through the target large language model.
[0068] Exemplarily, component codes of target components that comply with code language specifications may be generated based on attribute information and through a target large language model, and page codes may be generated based on component codes of each component.
[0069] Since a page may include multiple components, the same component may have different positions, so the page layout may also be different. Based on this, for example, if there are multiple target components, the page layout information of the page to be generated may be determined, and based on the attribute information and the page layout information, the target large language model may be used to generate page code that complies with the code language specification.
[0070] The page layout information of the page to be generated may refer to the layout of multiple target components in the page to be generated.
[0071] Therefore, by generating page code based on attribute information and page layout information, combined with code language specifications, and using a target large language model, the accuracy and quality of the page code can be improved.
[0072] Since different pages of the same type may contain the same components, for example, reference pages can be pre-stored, and similar pages of the to-be-generated page can be determined from the reference pages based on multiple target components. Then, based on the position information of the multiple target components in the similar pages, the page layout information of the to-be-generated page can be determined.
[0073] Exemplarily, the relative relationship of multiple components in similar pages can be determined according to the positions of multiple target components in similar pages, and based on the relative relationship, the page layout information of the page to be generated can be determined.
[0074] Therefore, by referring to the location information of multiple target components in similar pages, the page layout of the page to be generated can be determined, which can not only improve the efficiency of page development, but also ensure that the layout style of the page to be generated is consistent with the existing page, enhance the consistency and stability of the user experience, and better meet the expectations and needs of users, thereby improving user satisfaction.
[0075] Exemplarily, the character position information of the target component in the page description information may also be determined, and the page position information of the target component may be determined based on the character position information, and then the page layout information of the page to be generated may be determined based on the page position information of multiple target components.
[0076] The character position information may refer to the position information of the target component in the page description information. For example, in the page description information, "generate a form, including the following fields: name, gender, photo, attachment, the form includes four fields, each field is a component, take "name" as an example, "name" is the 15th and 16th characters in the page description information, then the character position information of "name" in the page description information is the 15th to 16th characters.
[0077] The page location information of the target component may refer to the location information of the target component in the page to be generated.
[0078] For example, in the page description information, "generate a form, including the following fields: name, gender, photo, attachments" can be used to determine the order of each component in the page description information based on the character position information of "name", "gender", "photo", and "attachments" in the page description information. Based on the order of each component in the page description information, the order of each component in the page to be generated can be determined. For example, from top to bottom on the page to be generated, they are name, gender, photo, and attachments. This allows the page layout information of the page to be generated to be determined.
[0079] Thus, the page layout of the to-be-generated page can be determined based on the character position information of the target component in the page description information, so that the layout of the to-be-generated page is more in line with the development requirements.
[0080] Step 304: Send the page code to the client, so that the client renders according to the page code to generate a target page.
[0081] In the present application, step 304 can be implemented in any of the embodiments of the present application, so it will not be described in detail here.
[0082] In an embodiment of the present application, page description information is identified through a large language model to determine the target components and attribute information of the target components included in the page to be generated, and page code is generated based on the attribute information in combination with the code language specification, so that page code that meets the requirements of the code language specification can be generated, thereby improving the accuracy and quality of the page code, and further improving the accuracy of the generated page.
[0083] Figure 4 A flowchart of a page generation method based on a large language model provided in another embodiment of the present application.
[0084] like Figure 4 As shown, the page generation method based on the large language model includes:
[0085] Step 401, obtaining a page generation request sent by a client; wherein the page generation request includes page description information.
[0086] Step 402: Generate page code based on the page description information using the target large language model.
[0087] Step 403: Send the page code to the client, so that the client renders according to the page code to generate a target page.
[0088] In the present application, steps 401 to 403 may be implemented in any of the embodiments of the present application, and thus will not be described in detail herein.
[0089] Step 404: Obtain the page modification request sent by the client.
[0090] There may be a need to modify the generated target page. In this regard, the user can enter modification description information in the client's language interaction interface. After obtaining the input modification description information, the client can send a page modification request to the server, so that the server can obtain the page modification request sent by the client.
[0091] The page modification request may include modification description information, and the modification description information may be used to describe the modification requirements.
[0092] For example, for Figure 2 In the form generated in, modify the description information to "Address changed to common address".
[0093] Step 405 : modify the page code using the target large language model according to the modification description information to obtain a modified page code.
[0094] In the present application, the server can fill in the prompt model used to guide page modification according to the modification description information, obtain corresponding prompt information, and input the prompt information into the target large language model. The target large language model uses the prompt information to guide the modification of the page code to obtain the modified page code.
[0095] For example, the target large language model can be used to identify the modification description information to determine the component to be modified and the modification information corresponding to the component to be modified, and according to the modification information corresponding to the component to be modified, the attribute information of the component to be modified in the page code is modified to obtain the modified page code. In this way, not only the accuracy and efficiency of the modification can be improved, but also different modification requirements can be met.
[0096] The modification information may include the attribute to be modified and the attribute value after the attribute to be modified is modified. For example, the component to be modified is a button, and the modification information is to change the color to gray.
[0097] Step 406: Send the modified page code to the client, so that the client updates the target page according to the modified page code.
[0098] In this application, the server can send the modified page code to the client, and the client can re-render according to the modified page code, thereby updating the target page.
[0099] In an embodiment of the present application, the page code is modified by using the target large language model according to the modification description information in the page modification request, and the modified page code is sent to the client for re-rendering, so that the page modification can be implemented based on natural language, meeting different page development requirements and improving page development efficiency.
[0100] In one embodiment of the present application, in order to improve the efficiency of page modification, the user can select the component to be modified in the target page displayed by the client, and enter the corresponding component modification information. The client sends a component modification request to the server, and the page modification request may include the identifier of the component to be modified and the component modification information. Among them, the identifier of the component to be modified can be the name of the component to be modified or other unique identifier, which is not limited to this.
[0101] The server can modify the code of the component to be modified in the page code using the target large language model according to the component modification information, obtain the modified code of the component to be modified, and send the modified code of the component to be modified to the client. The client renders according to the modified code and regenerates the component to be modified, that is, generates the modified component.
[0102] The user can trigger the replacement control to replace the component selected to be modified in the target page with the modified component, thereby modifying the target page.
[0103] For example, for Figure 2 In the form generated in the example above, you can select the "Attachment" component, and then Figure 5 As shown, enter the modification description information "Change the label to my file" in the language interaction interface and generate the modified component. Figure 5 The "Replace Selected Component" control shown in the figure can replace the selected "Attachment" component in the target page with the modified component. Optionally, the user can also trigger Figure 5 Click the "Regenerate" control in the toolbar to regenerate the modified results.
[0104] In this way, the server can modify the code of the selected component that needs to be modified according to the component modification information, and send the modified code to the client for rendering and replacement. This not only improves the page modification efficiency, but also saves resources by sending only the modified code to the client.
[0105] Since the generated page may not satisfy the user, in order to meet the user's needs, based on this, in one embodiment of the present application, the client can display a regeneration control associated with the page, and the user can regenerate the target page by triggering the regeneration control associated with the target page.
[0106] In this application, if the server obtains a request to regenerate the target page sent by the client, it can regenerate the page code based on the page description information and use the target large language model, and send the regenerated page code to the client, so that the client can render according to the regenerated page code and regenerate the target page.
[0107] Exemplarily, the server may generate prompt information according to the page description information and based on a prompt template for guiding the regeneration of the page code, input the prompt information into the target large language model, and regenerate the page code using the target large language model.
[0108] Exemplarily, the regeneration request may include page adjustment information, which may be used to describe the page adjustment requirements. The page adjustment information may be used to update the page description information to obtain updated page description information, and the page code may be regenerated based on the updated page description information using the target large language model.
[0109] For example, the page description information is "generate a button, open a pop-up window when clicked", and the page adjustment information is "generate a blue button", then the updated page description information may be "generate a blue button, open a pop-up window when clicked".
[0110] Therefore, the page description information can be updated based on the page adjustment information, and the page can be regenerated using the updated page description information, thereby achieving targeted regeneration of the page, thereby meeting different development requirements.
[0111] In an embodiment of the present application, when a request for regeneration of a target page is obtained, the page code is regenerated according to the page description information using the target large language model, and the page is regenerated based on the regenerated page code, thereby realizing page regeneration based on natural language, meeting different page development requirements, and improving page development efficiency.
[0112] In one embodiment of the present application, the target large language model can be trained through the following steps: obtaining training samples, where the training samples may include sample description information and sample codes corresponding to the sample description information, and the training samples can be input into the initial large language model to obtain the probability of the sample code output by the initial large language model, and the initial large language model can be trained according to the probability of the sample code to obtain the target large language model.
[0113] The sample description information may be exemplary page description information that is used to describe page generation requirements and can be acquired in advance.
[0114] The sample code may refer to the page code corresponding to the sample description information.
[0115] The probability of the sample code may refer to the probability of the sample code being output by the initial large language model after the sample description information is input into the initial large language model.
[0116] In the present application, the parameters of the initial large language model can be adjusted according to the probability of the sample code so that the probability of the large language model output becomes larger and larger until the training end condition is met to obtain the target large language model.
[0117] Among them, the training end condition may refer to the probability of the large language model output being greater than a preset probability threshold, or the model loss being less than a preset threshold, or the model accuracy being greater than a corresponding threshold, or other training end conditions, which are not limited to this.
[0118] Since the front-end low-code framework can support multiple components, in order to make the generated results cover various scenarios, illustratively, training samples can be obtained in the following ways: the description information of each component and the sample code of the component can be extracted from the target document, and the enumeration set of each attribute dimension of the component is determined according to the description information, and the sample description information is determined according to the enumeration values in the enumeration set of each attribute dimension, and the code corresponding to the enumeration value of the target attribute dimension is extracted from the sample code, and the sample code is determined according to the code corresponding to the enumeration value of the target attribute dimension, and then the training sample is determined according to the sample description information and the sample code.
[0119] The target document may be a document related to a front-end low-code framework. For example, the front-end low-code framework may be amis, which is a framework for quickly building front-end pages. It defines page layouts and components through JSON configuration, and can extract description information of each component, sample code of the component, etc. from the amis document.
[0120] The attribute dimension may include, but is not limited to, attributes, appearance, event behavior, layout, etc. Each attribute dimension has a corresponding enumeration set, and the enumeration set includes at least one enumeration value.
[0121] The sample description information may include the target attribute dimension and the enumeration value of the target attribute dimension.
[0122] Exemplarily, for each attribute dimension, the enumeration values in the enumeration set can be traversed, and the corresponding sample description information can be determined according to each enumeration value, and then the sample code when the value of the attribute dimension is the enumeration value can be extracted from the sample code of the component as the sample code. In addition, the enumeration values in the enumeration sets of different attribute dimensions can be arranged and combined to determine the sample description information, and then the code corresponding to the enumeration value of the target attribute dimension can be extracted from the sample code as the sample code.
[0123] Exemplarily, the training samples can be generated by executing the script using the above method.
[0124] It can be understood that a training sample can be regarded as a question-answer pair, where the question refers to the sample description information and the answer refers to the sample code.
[0125] Therefore, by extracting the description information and sample code of each component from the target document and arranging and combining the enumeration sets in the enumeration sets of the attribute dimensions of each component, training samples can be generated so that the training samples can cover various scenarios. Then, by using the training samples to train the large language model, the generation results of the target large language model can also cover various scenarios and meet different development needs.
[0126] In an embodiment of the present application, the initial large language model is trained by inputting training samples into the initial large language model based on the probability of the sample code output by the initial large language model, so as to obtain a large language model capable of generating pages based on natural language through supervised fine-tuning, and then the page can be generated through the large language model.
[0127] In order to implement the above embodiment, the embodiment of the present application also proposes a page generation method based on a large language model.
[0128] The page generation method based on a large language model in the embodiment of the present application can be executed by the page generation device based on a large language model in the embodiment of the present application, and the device can be configured in an electronic device.
[0129] Among them, the electronic device can be a device with computing capabilities, such as a personal computer, a mobile terminal, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.
[0130] Exemplarily, the page generation method based on a large language model may be executed by a client.
[0131] Figure 6 A flowchart of a page generation method based on a large language model provided in another embodiment of the present application.
[0132] like Figure 6 As shown, the page generation method based on the large language model includes:
[0133] Step 601, in response to obtaining the input page description information, a page generation request is sent to the server.
[0134] In this application, the user can input page description information in the language interaction interface of the client with page development function. If the client obtains the page description information input by the user, it can send a page generation request to the server.
[0135] The page generation request may include page description information, and the page description information may be used to describe the page generation requirement.
[0136] Step 602, obtaining the page code sent by the server.
[0137] In this application, the server can generate a page code using the target large language model according to the page description information, and send it to the client, so that the client can obtain the page code sent by the server. The detailed explanation of generating the page code using the target large language model according to the page description information can be found in the above embodiment, so it will not be repeated here.
[0138] Step 603: Render according to the page code to generate a target page.
[0139] In this application, the client can render according to the page code and generate a target page in the language interaction interface.
[0140] for example, Figure 2 In the language interaction interface, the user enters "generate a form, including the following fields: name, gender, photo, attachment", and generates the corresponding form.
[0141] In an embodiment of the present application, if the client obtains the input page description information, it sends a page generation request to the server, so that the server generates page code based on the page description information in the page generation request using the target large language model, and returns it to the client. The client renders according to the page code to generate the target page, thereby realizing page generation through natural language, which can not only improve the efficiency of page development, but also lower the threshold for using the development platform.
[0142] In one embodiment of the present application, a user can modify or set the generated target page through a management page on a client. The target page is displayed on the management page. If the client detects a trigger operation on a target control on the management page, the page code can be displayed on the management page. The target control can refer to a control for displaying the page code.
[0143] Thus, the user can view the target page and the page code corresponding to the target page on the management page, which can be convenient for subsequent use.
[0144] Optionally, the management page may further include configuration parameters of the target page. For example, the user may display the configuration parameters of the target page on the management page by triggering controls related to displaying the configuration parameters on the management page.
[0145] Take the generated form as an example, Figure 7 As shown, the page code can be displayed in the left area of the management page, the form can be displayed in the middle area, and the configuration parameters such as properties, appearance, events, etc. can be displayed in the right area.
[0146] If the client detects a modification operation on the target configuration parameter, the page code and the target page can be updated according to the parameter value of the modified target configuration parameter, thereby making the modification of the target page more flexible and convenient.
[0147] The target configuration parameters may refer to parameters contained in the page code, such as the title of the target page.
[0148] In addition, the configuration parameters of the target page may also include submission setting parameters, local cache parameters, etc. of the target page.
[0149] Optionally, if the client detects a trigger operation on a control for folding page code, the page code on the management page can be hidden. Optionally, if the client detects a trigger operation on a control for folding configuration parameters of a target page, the configuration parameters of the target page on the management page can be hidden.
[0150] In one embodiment of the present application, a user can input modification description information in the language interaction interface of the client, and if the input modification description information is obtained, a page modification request can be sent to the server, wherein the page modification request includes the modification description information, and the modification description information is used to describe the modification requirements, so that the server modifies the page code according to the modification description information in the page modification request to obtain the modified page code, and returns the modified page code to the client. The client obtains the modified page code sent by the server, and then updates the target page according to the modified page code.
[0151] In an embodiment of the present application, if the input modification description information is obtained, a page modification request is sent to the server, so that the server modifies the page code according to the modification description information in the page modification request using the target large language model, and the client re-renders according to the modified page code and updates the target page, thereby realizing page modification based on natural language, meeting different page development requirements, and improving page development efficiency.
[0152] Optionally, the user can select the component to be modified in the target page displayed by the client and enter the corresponding component modification information. The client sends a component modification request to the server, which may include the identifier of the component to be modified and the component modification information. The server modifies the code of the component to be modified in the page code based on the component modification information and the target large language model, obtains the modified code of the component to be modified, and sends the modified code of the component to be modified to the client. The client renders according to the modified code and regenerates the component to be modified.
[0153] The user can replace the component by triggering the replacement control associated with the regenerated component to be modified. If the client detects the triggering operation of the replacement control, it can replace the selected component to be modified in the target page with the regenerated component to be modified, that is, replace it with the modified component, thereby modifying the target page.
[0154] In one embodiment of the present application, if the client detects a trigger operation for regenerating a control for a target page, it sends a regeneration request to the server so that the server regenerates the page code according to the page description information. The client obtains the regenerated page code sent by the server, and renders it according to the regenerated page code to regenerate the target page.
[0155] Exemplarily, the regeneration request may include page adjustment information input by the user, and the page adjustment information may be used to describe the page adjustment requirement, so that the server may regenerate the page code according to the page description information combined with the page adjustment information.
[0156] Therefore, the page can be regenerated based on natural language to meet different page development requirements and improve page development efficiency.
[0157] In order to implement the above embodiment, the embodiment of the present application also proposes a page generation device based on a large language model. Figure 8 A schematic diagram of the structure of a page generation device based on a large language model provided in one embodiment of the present application.
[0158] like Figure 8 As shown, the page generation device 800 of the large language model includes:
[0159] The first acquisition module 810 is used to acquire a page generation request sent by a client; wherein the page generation request includes page description information, and the page description information is used to describe the page generation requirement;
[0160] A generating module 820, configured to generate page code according to the page description information and using a target large language model;
[0161] The sending module 830 is used to send the page code to the client, so that the client renders according to the page code to generate a target page.
[0162] Optionally, the generating module 820 is used to:
[0163] Using the target large language model to identify the page description information, so as to determine the target component included in the page to be generated and the attribute information of the target component;
[0164] The page code is generated according to the attribute information and the code language specification.
[0165] Optionally, there are multiple target components, and the generating module 820 is used to:
[0166] Determining the page layout information of the page to be generated;
[0167] The page code is generated according to the attribute information, the page layout information and the code language specification using the target large language model.
[0168] Optionally, the generating module 820 is used to:
[0169] Determining similar pages from reference pages according to the plurality of target components;
[0170] The page layout information is determined according to the location information of the plurality of target components in the similar pages.
[0171] Optionally, the generating module 820 is used to:
[0172] Determine character position information of the target component in the page description information;
[0173] Determining page position information of the target component according to the character position information;
[0174] The page layout information is determined according to the page position information.
[0175] Optionally, the first acquisition module 810 is further used to acquire a page modification request sent by the client; wherein the page modification request includes modification description information, and the modification description information is used to describe the modification requirement;
[0176] The device further includes a first modification module, configured to modify the page code using the target large language model according to the modification description information to obtain the modified page code;
[0177] The sending module 830 is further configured to send the modified page code to the client, so that the client updates the target page according to the modified page code.
[0178] Optionally, the first modification module is used to:
[0179] Using the target large language model to identify the modification description information to determine the component to be modified and the modification information corresponding to the component to be modified;
[0180] According to the modification information corresponding to the component to be modified, the attribute information of the component to be modified in the page code is modified to obtain the modified page code.
[0181] Optionally, the first acquisition module 810 is further configured to acquire a component modification request sent by the client; wherein the component modification request includes an identifier of the component to be modified and component modification information of the component to be modified;
[0182] The device may further include a second modification module, configured to modify the code of the component to be modified by using the target large language model according to the component modification information, so as to obtain the modified code of the component to be modified;
[0183] The sending module 830 is further used to send the modified code of the component to be modified to the client, so that the client renders according to the modified code of the component to be modified and regenerates the component to be modified.
[0184] Optionally, the generating module 820 is further configured to, in response to obtaining a regeneration request for the target page sent by the client, regenerate page code according to the page description information and using the target large language model;
[0185] The sending module 830 is further configured to send the regenerated page code to the client, so that the client performs rendering according to the regenerated page code to regenerate the target page.
[0186] Optionally, the generating module 820 is used to:
[0187] Using the page adjustment information to update the page description information to obtain updated page description information;
[0188] According to the updated page description information, the page code is regenerated using the target large language model.
[0189] Optionally, the device further comprises:
[0190] A second acquisition module is used to acquire a training sample; wherein the training sample includes sample description information and a sample code corresponding to the sample description information;
[0191] A third acquisition module, used for inputting the training sample into an initial large language model to obtain the probability of the sample code output by the initial large language model;
[0192] The training module is used to train the initial large language model according to the probability of the sample code to obtain the target large language model.
[0193] Optionally, the second acquisition module is used to:
[0194] Extracting description information of each component and sample code of the component from the target document;
[0195] Determine an enumeration set of attribute dimensions of the component according to the description information of the component;
[0196] The sample description information is determined by arranging and combining the enumeration values in the enumeration set of each attribute dimension; wherein the sample description information includes the target attribute dimension and the enumeration value of the target attribute dimension;
[0197] Extracting the code corresponding to the enumeration value of the target attribute dimension from the sample code;
[0198] Determining the sample code according to the code corresponding to the enumeration value of the target attribute dimension;
[0199] The training sample is determined according to the sample description information and the sample code.
[0200] It should be noted that the explanation of the aforementioned server-side large language model-based page generation method embodiment is also applicable to the large language model-based page generation device of this embodiment, so it will not be repeated here.
[0201] In the embodiment of the present application, the target large language model is used to generate page code based on the page description information in the page generation request sent by the client, and then sent to the client, and the client renders according to the page code to generate the target page. In this way, the page can be generated by natural language based on the large language model, which can not only improve the efficiency of page development, but also reduce the threshold for using the development platform.
[0202] In order to implement the above embodiment, the embodiment of the present application also proposes a page generation device based on a large language model. Fig. 9 A schematic diagram of the structure of a page generation device based on a large language model provided in another embodiment of the present application.
[0203] like Fig. 9 The page generation device 900 based on the large language model includes:
[0204] The sending module 910 is used to send a page generation request to the server in response to obtaining the input page description information; wherein the page generation request includes the page description information;
[0205] The acquisition module 920 is used to acquire the page code sent by the server; wherein the page code is generated by using the target large language model according to the page description information, and the page description information is used to describe the page generation requirements;
[0206] The generating module 930 is used to render according to the page code to generate a target page.
[0207] Optionally, the sending module 910 is further used to send a page modification request to the server in response to obtaining the input modification description information; wherein the page modification request includes the modification description information, and the modification description information is used to describe the modification requirement;
[0208] The acquisition module 920 is further used to acquire the modified page code sent by the server;
[0209] The device further includes: an updating module, configured to update the target page according to the modified page code.
[0210] Optionally, the sending module 910 is further configured to send a regeneration request to the server in response to detecting a triggering operation for regenerating a control on the target page;
[0211] The acquisition module 920 is further used to acquire the regenerated page code sent by the server;
[0212] The generating module 930 is further used to render according to the regenerated page code to regenerate the target page.
[0213] Optionally, the sending module 910 is further configured to, in response to detecting a selection operation on the component to be modified in the target page and obtaining the input component modification information of the component to be modified, send a component modification request to the server; wherein the component modification request includes an identifier of the component to be modified and the component modification information;
[0214] The acquisition module 920 is further used to acquire the modified code of the component to be modified sent by the server;
[0215] The generation module 930 is further used to render according to the modified code and regenerate the component to be modified.
[0216] Optionally, the device may further include a replacement module, configured to replace the component to be modified in the target page with the regenerated component to be modified in response to detecting a triggering operation on a replacement control.
[0217] Optionally, the device may further include a display module, configured to display the page code on the management page in response to detecting a triggering operation on a target control on the management page; wherein the target page is displayed on the management page.
[0218] Optionally, the management page also includes configuration parameters of the target page. The device may further include an update module for updating the page code and the target page according to the modified parameter values of the target configuration parameters in response to detecting a modification operation on the target configuration parameters.
[0219] It should be noted that the explanation of the above-mentioned embodiment of the page generation method based on the large language model on the client side is also applicable to the page generation device based on the large language model of this embodiment, so it will not be repeated here.
[0220] In an embodiment of the present application, if the client obtains the input page description information, it sends a page generation request to the server, so that the server generates page code based on the page description information in the page generation request using the target large language model, and returns it to the client. The client renders according to the page code to generate the target page, thereby realizing page generation through natural language, which can not only improve the efficiency of page development, but also lower the threshold for using the development platform.
[0221] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.
[0222] Fig.10 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0223] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 1002 or a computer program loaded from a storage unit 1008 to a RAM (Random Access Memory) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An I / O (Input / Output) interface 1005 is also connected to the bus 1004.
[0224] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0225] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as a page generation method based on a large language model. For example, in some embodiments, the page generation method based on a large language model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the page generation method based on the large language model described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform the page generation method based on the large language model in any other appropriate manner (e.g., by means of firmware).
[0226] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0227] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0228] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0229] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0230] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0231] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0232] According to an embodiment of the present application, the present application also provides a computer program product. When an instruction processor in the computer program product executes, the page generation method based on the large language model proposed in the above embodiment of the present application is executed.
[0233] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0234] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A page generation method based on a large language model, comprising: Obtaining a page generation request sent by a client; wherein the page generation request includes page description information, and the page description information is used to describe the page generation requirement; Generate page code using a target large language model according to the page description information; The page code is sent to the client, so that the client performs rendering according to the page code to generate a target page.
2. The method of claim 1, wherein: The step of generating page code according to the page description information and using a target large language model includes: Using the target large language model to identify the page description information, so as to determine the target component included in the page to be generated and the attribute information of the target component; The page code is generated according to the attribute information and the code language specification.
3. The method of claim 2, wherein: There are multiple target components, and generating the page code according to the attribute information and the code language specification includes: Determining the page layout information of the page to be generated; The page code is generated according to the attribute information, the page layout information and the code language specification using the target large language model.
4. The method of claim 3, wherein: The determining the page layout information of the page to be generated includes: Determining similar pages from reference pages according to the plurality of target components; The page layout information is determined according to the location information of the plurality of target components in the similar pages.
5. The method of claim 3, wherein: The determining the page layout information of the page to be generated includes: Determine character position information of the target component in the page description information; Determining page position information of the target component according to the character position information; The page layout information is determined according to the page position information.
6. The method of claim 1, further comprising: Obtaining a page modification request sent by the client; wherein the page modification request includes modification description information, and the modification description information is used to describe the modification requirement; According to the modification description information, modify the page code using the target large language model to obtain the modified page code; The modified page code is sent to the client, so that the client updates the target page according to the modified page code.
7. The method of claim 6, wherein: The step of modifying the page code by using the target large language model according to the modification description information to obtain the modified page code includes: Using the target large language model to identify the modification description information to determine the component to be modified and the modification information corresponding to the component to be modified; According to the modification information corresponding to the component to be modified, the attribute information of the component to be modified in the page code is modified to obtain the modified page code.
8. The method of claim 1, further comprising: In response to obtaining a regeneration request for the target page sent by the client, regenerate page code according to the page description information and using the target large language model; The regenerated page code is sent to the client, so that the client renders according to the regenerated page code to regenerate the target page.
9. The method of claim 8, wherein: The regeneration request also includes page adjustment information, and the regeneration of page code based on the page description information and using the target large language model includes: Using the page adjustment information to update the page description information to obtain updated page description information; According to the updated page description information, the page code is regenerated using the target large language model.
10. The method of claim 1, further comprising: Acquire a component modification request sent by the client; wherein the component modification request includes an identifier of the component to be modified and component modification information of the component to be modified; According to the component modification information, using the target large language model, modify the code of the component to be modified to obtain the modified code of the component to be modified; The modified code of the component to be modified is sent to the client, so that the client renders according to the modified code of the component to be modified and regenerates the component to be modified.
11. The method of claim 1, wherein: The target large language model is trained by the following steps: Acquire a training sample; wherein the training sample includes sample description information and a sample code corresponding to the sample description information; Inputting the training sample into an initial large language model to obtain the probability of the sample code output by the initial large language model; The initial large language model is trained according to the probability of the sample code to obtain the target large language model.
12. The method of claim 11, wherein: The obtaining of the training sample comprises: Extracting description information of each component and sample code of the component from the target document; Determine an enumeration set of attribute dimensions of the component according to the description information of the component; The sample description information is determined by arranging and combining the enumeration values in the enumeration set of each attribute dimension; wherein the sample description information includes the target attribute dimension and the enumeration value of the target attribute dimension; Extracting the code corresponding to the enumeration value of the target attribute dimension from the sample code; Determining the sample code according to the code corresponding to the enumeration value of the target attribute dimension; The training sample is determined according to the sample description information and the sample code.
13. A page generation method based on a large language model, comprising: In response to obtaining the input page description information, a page generation request is sent to the server; wherein the page generation request includes the page description information, and the page description information is used to describe the page generation requirement; Obtaining a page code sent by the server; wherein the page code is generated by using a target large language model according to the page description information; Rendering is performed according to the page code to generate a target page.
14. The method of claim 13, further comprising: In response to obtaining the input modification description information, sending a page modification request to the server; wherein the page modification request includes the modification description information, and the modification description information is used to describe the modification requirement; Obtaining the modified page code sent by the server; The target page is updated according to the modified page code.
15. The method of claim 13, further comprising: In response to detecting a triggering operation for regenerating a control on the target page, sending a regeneration request to the server; Obtaining the regenerated page code sent by the server; Rendering is performed according to the regenerated page code to regenerate the target page.
16. The method of claim 13, further comprising: In response to detecting a selection operation on a component to be modified in the target page and obtaining the input component modification information of the component to be modified, sending a component modification request to the server; wherein the component modification request includes an identifier of the component to be modified and the component modification information; Obtaining the modified code of the component to be modified sent by the server; Rendering is performed according to the modified code to regenerate the component to be modified.
17. The method of claim 16, further comprising: In response to detecting a triggering operation on a replacement control, the component to be modified in the target page is replaced by the regenerated component to be modified.
18. The method of claim 13, further comprising: In response to detecting a triggering operation on a target control on a management page, displaying the page code on the management page; wherein the target page is displayed on the management page.
19. The method of claim 18, wherein: The management page also includes configuration parameters of the target page, and the method further includes: In response to detecting a modification operation on a target configuration parameter, the page code and the target page are updated according to the modified parameter value of the target configuration parameter.
20. A page generation device based on a large language model, comprising: A first acquisition module is used to acquire a page generation request sent by a client; wherein the page generation request includes page description information, and the page description information is used to describe the page generation requirement; A generation module, used to generate page code according to the page description information using a target large language model; The sending module is used to send the page code to the client, so that the client renders according to the page code to generate a target page.
21. A page generation device based on a large language model, comprising: A sending module, used for sending a page generation request to a server in response to obtaining the input page description information; wherein the page generation request includes the page description information, and the page description information is used to describe the page generation requirement; An acquisition module, used for acquiring the page code sent by the server; wherein the page code is generated by using a target large language model according to the page description information; The generation module is used to render according to the page code to generate a target page.
22. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-12, or to execute the method of any one of claims 13-19.
23. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-12, or to execute the method according to any one of claims 13-19.
24. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 12, or implements the steps of the method according to any one of claims 13 to 19.
Citation Information
Cited By
Visual code generation method and device for business travel service page
CN121050722A