Design draft transcoding method and device, medium and program product

By introducing prompt templates and pre-trained models, the node names in the design draft that do not have actual meaning are converted into semantic node names, which solves the problem that node names do not have meaning in the design draft transcoding, and improves the readability and maintainability of the front-end code.

CN120029603AActive Publication Date: 2025-05-23TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510227148.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-05-23
Estimated Expiration
2045-02-27

AI Technical Summary

Technical Problem

The node names in the design draft do not have actual meaning, making the converted front-end code difficult to read and maintain.

Method used

By introducing prompt templates and pre-trained models, the original node names in the design draft that do not have actual meaning are converted into semantic node names. The specific steps include obtaining the original front-end code, embedding the preset prompt template, inputting the pretrained model for semantic processing, and replacing the original node name.

Benefits of technology

Improves the readability and maintainability of front-end code, making node names have practical meanings and are easy for developers to understand and maintain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029603A_ABST
    Figure CN120029603A_ABST
Patent Text Reader

Abstract

The invention discloses a design draft transcoding method and device, a medium and a program product, and relates to the field of design draft transcoding, and the method comprises the steps: obtaining an original front-end code corresponding to a target design draft; embedding the original front-end code into a preset position in a preset prompt template to construct and obtain a target prompt; the preset prompt template comprises a semantic conversion example; inputting the target prompt into a target pre-training model so as to guide the target pre-training model to perform semantic processing on an original node name in the original front-end code by utilizing a semantic transformation example in the target prompt to obtain a corresponding semantic node name; and replacing the corresponding original node name in the original front-end code by using the semantic node name to obtain a target front-end code. According to the method and the device, the prompt template and the pre-training model are introduced, so that the original node name without the actual meaning in the design draft is converted into the semantic node name in the front-end code, and the readability and the maintainability of the front-end code are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of design draft transcoding, and in particular to a design draft transcoding method, device, medium and program product. Background Art

[0002] In the field of design to code (D2C), since each node in the design draft has a corresponding node name, in general, the node name will be automatically given by the software that makes the design draft in the form of node type + random value. Such node names have no actual meaning, that is, they are not semantic. However, when the design draft is converted into front-end code, since the node names in the design draft have no actual meaning, the node names in the converted front-end code also have no actual meaning. This makes it difficult for developers to read and later maintain the converted front-end code.

[0003] In this case, one way is to extract key information from the text contained in the node as the node name when converting the design draft into the front-end code; although the node name in the front-end code has actual meaning at this time, that is, the node name is a semantic node name, but because the nodes in the design draft do not necessarily contain text, and it is possible that the same text belongs to multiple nodes, this will cause the node names of multiple nodes to be the same. Therefore, how to convert the node names that do not have actual meaning in the design draft into semantic node names in the front-end code is a problem that needs to be solved. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a design draft transcoding method, device, medium and program product, which can convert the original node names that have no actual meaning in the design draft into semantic node names in the front-end code by introducing prompt templates and pre-trained models, thereby improving the readability and maintainability of the front-end code. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a design draft transcoding method, comprising:

[0006] Get the original front-end code corresponding to the target design draft;

[0007] The original front-end code is embedded into a preset position in a preset prompt template to construct a target prompt; wherein the preset prompt template includes a semantic conversion example;

[0008] Inputting the target prompt into a target pre-trained model, so as to guide the target pre-trained model to semantically process the original node names in the original front-end code using the semantic conversion examples in the target prompt, so as to obtain corresponding semantic node names;

[0009] The semantic node name is used to replace the corresponding original node name in the original front-end code to obtain the target front-end code corresponding to the target design draft.

[0010] Optionally, the preset prompt template is further configured with first prompt information for a preset output format;

[0011] Among them, the first prompt information is used to instruct the target pre-trained model to output the semantic node name based on the preset output format to obtain a model output result in a corresponding format.

[0012] Optionally, the model output result includes each of the original node names and the corresponding semantic node names;

[0013] Correspondingly, the use of the semantic node name to replace the corresponding original node name in the original front-end code to obtain the target front-end code corresponding to the target design draft includes:

[0014] Traversing the semantic node names corresponding to the original node names in the original front-end code from the model output results;

[0015] The traversed semantic node names are used to replace the corresponding original node names in the original front-end code to obtain the target front-end code corresponding to the target design draft.

[0016] Optionally, the design draft transcoding method further includes:

[0017] Create a regular expression for node name replacement;

[0018] Correspondingly, the semantic node name traversed is used to replace the corresponding original node name in the original front-end code to obtain the target front-end code corresponding to the target design draft, including:

[0019] The traversed semantic node names are used and based on the regular expression to replace the corresponding original node names in the original front-end code to obtain the target front-end code corresponding to the target design draft.

[0020] Optionally, before traversing the semantic node names corresponding to the original node names in the original front-end code from the model output results, the method further includes:

[0021] If there are duplicate semantic node names in the model output result, the semantic node names in the model output result are deduplicated.

[0022] Optionally, the preset prompt template is further configured with second prompt information for data output requirements;

[0023] Among them, the second prompt information is used to instruct the target pre-trained model to generate a corresponding model output result based on the data output requirement.

[0024] Optionally, the data output requirements include that the semantic node names in the model output results must remain intact, and / or each original node name in the model output results must have a corresponding semantic node name.

[0025] In a second aspect, the present application provides an electronic device, including:

[0026] Memory, used to store computer programs;

[0027] A processor is used to execute the computer program to implement the aforementioned design draft transcoding method.

[0028] In a third aspect, the present application provides a computer-readable storage medium for storing a computer program, which implements the aforementioned design draft transcoding method when executed by a processor.

[0029] In a fourth aspect, the present application provides a computer program product, including a computer program / instruction, which implements the aforementioned design draft transcoding method when executed by a processor.

[0030] In this application, the original front-end code corresponding to the target design draft is obtained; the original front-end code is embedded into a preset position in a preset prompt template to construct a target prompt; wherein the preset prompt template includes a semantic conversion example; the target prompt is input into the target pre-training model, so as to guide the target pre-training model to semantically process the original node name in the original front-end code using the semantic conversion example in the target prompt to obtain the corresponding semantic node name; the corresponding original node name in the original front-end code is replaced using the semantic node name to obtain the target front-end code corresponding to the target design draft. It can be seen that this application introduces a prompt template and a pre-training model to combine the original front-end code and the prompt template as the input of the pre-training model, so as to guide the pre-training model to use its own reasoning ability through the semantic conversion example in the prompt template to infer the semantic node name corresponding to the original node name, thereby realizing the semanticization of the node name, thereby converting the original node name that has no actual meaning in the design draft into a semantic node name in the front-end code, and improving the readability and maintainability of the front-end code. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0032] Figure 1 This is a diagram of the design manuscript transcoding system architecture disclosed in this application;

[0033] Figure 2 A flow chart of a design draft transcoding method disclosed in this application;

[0034] Figure 3 A schematic diagram of a model output result disclosed in this application;

[0035] Figure 4 A schematic diagram of a preset prompt template disclosed in this application;

[0036] Figure 5 A schematic diagram of an original front-end code disclosed in this application;

[0037] Figure 6 A schematic diagram of a target front-end code disclosed in this application;

[0038] Figure 7 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] When the design draft is converted into front-end code, since the node names in the design draft have no actual meaning, the node names in the converted front-end code also have no actual meaning, which makes it difficult for developers to read and later maintain the converted front-end code. To this end, the present application provides a design draft transcoding method, which introduces prompt templates and pre-trained models to convert the original node names in the design draft that have no actual meaning into semantic node names in the front-end code, thereby improving the readability and maintainability of the front-end code.

[0041] The system framework used in the design draft transcoding method of this application can be specifically referred to in Figure 1As shown, it may specifically include: a backend server 01 and a user terminal 02 that establishes a connection with the backend server 01 .

[0042] In the present application, the backend server 01 is used to execute the steps of the design draft transcoding method, including obtaining the original front-end code corresponding to the target design draft, and embedding the original front-end code into a preset position in a preset prompt template to construct a target prompt; wherein the preset prompt template includes a semantic conversion example; further, the backend server 01 inputs the target prompt into the target pre-trained model so as to use the semantic conversion example in the target prompt to guide the target pre-trained model to perform semantic processing on the original node names in the original front-end code to obtain the corresponding semantic node names; finally, the corresponding original node names in the original front-end code are replaced with the semantic node names to obtain the target front-end code corresponding to the target design draft, and then the target front-end code is output to the user terminal 02 for visual display, so that the front-end developer can view the target front-end code corresponding to the target design draft.

[0043] See also Figure 2 As shown, an embodiment of the present invention discloses a design draft transcoding method, comprising:

[0044] Step S11, obtaining the original front-end code corresponding to the target design draft.

[0045] In this embodiment, the backend server obtains the target design draft required for the development of the web page project, and converts the target design draft into the corresponding original front-end code through local design draft transcoding software; wherein the original front-end code is front-end code such as HTML (Hyper Text Markup Language) / CSS (Cascading Style Sheets).

[0046] Specifically, the backend server parses the layer information and node information in the target design draft through the local design draft transcoding software, and converts the target design draft into the corresponding original front-end code based on the layer information and node information through the preset conversion logic. The preset conversion logic includes steps such as node cleaning, node merging, parent-child relationship, row and column layout, style calculation and code generation.

[0047] Furthermore, for the target design draft, the target design draft required for web page project development can be produced through vector graphics editing software; wherein, the vector graphics editing software can be Figma, and the vector graphics editing software can be located in the background server or in a third-party platform that establishes a communication connection with the background server. If the vector graphics editing software is located in the background server, the background server can obtain the target design draft from the local vector graphics editing software; if the vector graphics editing software is located in a third-party platform, the background server needs to obtain the target design draft from the vector graphics editing software of the third-party platform.

[0048] Step S12: embed the original front-end code into a preset position in a preset prompt template to construct a target prompt; wherein the preset prompt template includes a semantic conversion example.

[0049] In this embodiment, a preset prompt template is pre-configured in the background server, and the preset prompt template includes a semantic conversion example. After obtaining the original front-end code, the background server embeds the original front-end code into a preset position in the preset prompt template, thereby constructing a target prompt. It should be noted that since the preset prompt template includes a semantic conversion example, the target prompt also includes a semantic conversion example.

[0050] Step S13: input the target prompt into the target pre-trained model, so as to use the semantic conversion example in the target prompt to guide the target pre-trained model to semantically process the original node names in the original front-end code to obtain corresponding semantic node names.

[0051] In this embodiment, after obtaining the target prompt, the target prompt is input into the target pre-trained model through a preset input interface, so as to use the semantic conversion examples in the target prompt to guide the target pre-trained model to perform semantic processing on the original node names in the original front-end code, thereby obtaining the corresponding semantic node names.

[0052] Among them, the target pre-training model can use a large model built based on the Transformer architecture. Since the Transformer architecture is good at processing sequence data and can understand the context of the original front-end code through its own attention mechanism, it can more accurately understand the actual meaning of the original front-end code, thereby better semantically processing the original node names in the original front-end code, so that the actual meaning represented by the semantic node names obtained by semantic processing is more accurate.

[0053] It should be noted that the original node name refers to a node name without actual meaning. It can be a node name composed of a node type and a random value, such as node-9, which can only represent node-9. The semantic node name is a node name with actual meaning. It is a node name that can reflect the actual meaning of this part of the code and the actual application scenario of the front-end code. For example, ticket-details-info can reflect that this part of the code is describing the detailed information of the ticket price.

[0054] Furthermore, after obtaining the original front-end code, the target pre-trained model can determine the attribute value of the preset attribute from the original front-end code based on the preset attribute to obtain the original node name, that is, the original node name is the attribute value of the preset attribute. The preset attribute is used to set the style and / or identification for the element in the front-end code, such as the class attribute.

[0055] Furthermore, after obtaining the semantic node name corresponding to the original node name, since the preset prompt template is also configured with the first prompt information for the preset output format, that is, the target prompt is also configured with the first prompt information for the preset output format, therefore, the first prompt information can be used to instruct the target pre-trained model to output the semantic node name based on the preset output format to obtain the model output result in the corresponding format.

[0056] It should be noted that the preset output format can adopt JSON (JavaScript Object Notation) format, where JSON format is easy for front-end developers to read and write, and is also easy for machines to parse and generate. In addition, the model output results include each original node name and the corresponding semantic node name, thereby forming a corresponding relationship between the original node name and the semantic node name.

[0057] In the process of using the first prompt information to instruct the target pre-trained model to output the semantic node name based on the preset output format to obtain the model output result in the corresponding format, since the preset prompt template is also configured with the second prompt information for the data output requirements, that is, the target prompt is also configured with the second prompt information for the data output requirements, therefore, the second prompt information can be used to instruct the target pre-trained model to generate the corresponding model output result based on the data output requirements; that is, the format of the model output result generated by the target pre-trained model is the preset output format, and the model output result generated by the target pre-trained model meets the data output requirements.

[0058] Among them, the data output requirements include that the semantic node names in the model output results must remain intact, and / or each original node name in the model output results must have a corresponding semantic node name. Of course, the data output requirements may also include other requirements, which are not given in too many examples here.

[0059] Specifically, in one specific embodiment, the second prompt information is used to indicate that the target pre-trained model generates a corresponding model output result based on the data output requirement that the semantic node names in the model output result must remain intact, that is, the semantic node names in the model output result actually generated by the target pre-trained model are all complete. In another specific embodiment, the second prompt information is used to indicate that the target pre-trained model generates a corresponding model output result based on the data output requirement that each original node name in the model output result must have a corresponding semantic node name, that is, each original node name in the model output result actually generated by the target pre-trained model has a corresponding semantic node name. In yet another specific embodiment, the second prompt information is used to indicate that the target pre-trained model generates a corresponding model output result based on the data output requirement that each original node name in the model output result must have a corresponding semantic node name and the semantic node name must remain intact, that is, each original node name in the model output result actually generated by the target pre-trained model has a corresponding semantic node name and each semantic node name is complete.

[0060] If, in the process of using the second prompt information to instruct the target pre-trained model to generate corresponding model output results based on the data output requirements, it is found that some node names do not meet the data output requirements, for example, some semantic node names are incomplete, or some original node names do not have corresponding semantic node names, then the semantic conversion examples in the target prompt can be used to redirect the target pre-trained model to perform semantic processing on the original node names in the original front-end code to regenerate the corresponding semantic node names.

[0061] Step S14: Use the semantic node name to replace the corresponding original node name in the original front-end code to obtain the target front-end code corresponding to the target design draft.

[0062] In this embodiment, after obtaining the semantic node names corresponding to the original node names through the target pre-training model, the semantic node names can be used to replace the corresponding original node names in the original front-end code to obtain the target front-end code corresponding to the target design draft.

[0063] Since the model output result generated by the target pre-trained model contains the original node names and the corresponding semantic node names, the semantic node names corresponding to the original node names in the original front-end code can be traversed from the model output result, and the traversed semantic node names can be used to replace the corresponding original node names in the original front-end code, so that after traversing the semantic node names in the model output result, the target front-end code corresponding to the target design draft is obtained. Among them, if the original node name in the original front-end code is not traversed to the corresponding semantic node name in the model output result, the original node name can be retained in the original front-end code.

[0064] For the replacement of original node names, a regular expression for node name replacement can be created in advance, so that the semantic node names in the model output results and based on the regular expression, the corresponding original node names in the original front-end code can be replaced, and after the replacement is completed, the target front-end code corresponding to the target design draft can be obtained.

[0065] It should be noted that before traversing the semantic node names corresponding to the original node names in the original front-end code from the model output results, it is necessary to first determine whether there are repeated semantic node names in the model output results. If there are no repeated semantic node names in the model output results, the above-mentioned step of traversing the semantic node names corresponding to the original node names in the original front-end code from the model output results is triggered; if there are repeated semantic node names in the model output results, the semantic node names in the model output results are first deduplicated, and the semantic node names corresponding to the original node names in the original front-end code are traversed from the deduplicated model output results.

[0066] For deduplication processing, one way is to retain one of the repeated semantic node names and delete the other semantic node names in the repeated semantic node names; it should be noted that the retained semantic node name can be the first semantic node name in the repeated semantic node names or any semantic node name in the repeated semantic node names, and there is no limitation here. Another way is to determine the original node names corresponding to the repeated semantic node names from the model output results, and reuse the semantic conversion examples in the target prompt to guide the target pre-trained model to perform semantic processing on these original node names in the original front-end code, thereby obtaining new semantic node names.

[0067] by Figure 3Taking the model output result shown as an example, the model output result includes the original node names and the corresponding semantic node names. For example, icon-5, img-2, node-1, etc. are all original node names, and ticket-icon-info, concert-image, concert-info, etc. are all semantic node names. It can be found that the semantic node names corresponding to the four original node names of node-9, node-20, node-25 and node-28 are repeated, all of which are ticket-details-info. Therefore, it is necessary to deduplicate the semantic node names corresponding to the four original node names of node-9, node-20, node-25 and node-28 in the model output result.

[0068] by Figure 4 Taking the preset prompt template shown as an example, the preset prompt template includes a semantic conversion example, a first prompt information for a preset output format, and a second prompt information for data output requirements. Among them, the semantic conversion example is based on the content contained in the three roles of role: `system`, role: `user` and role: `assistant`. Through role-playing and semantic conversion examples, the target pre-trained model is guided to semantically process the original node names in the original front-end code, which helps to better define the behavior of the target pre-trained model and ensure that the semantic node names obtained after semantic processing meet the semantic requirements. The first prompt information for the preset output format can be "the output content only contains JSON format", that is, the target pre-trained model needs to generate model output results based on JSON format. The second prompt information for data output requirements can be "make sure the answer content is complete, and each class must have a corresponding converted value", that is, the original node name of each class attribute in the model output result generated by the target pre-trained model must have a corresponding semantic node name, and the semantic node names must be complete. In addition, the preset position where the original front-end code is embedded in the preset prompt template can be represented by "---${html}---"; and the preset prompt template needs to use separators reasonably. By using separators reasonably, the target pre-trained model can better understand the preset prompt template, so as to better semantically process the original node names in the original front-end code according to the prompts, so that the semantic node names obtained after semantic processing are more accurate.

[0069] by Figure 5 The original front-end code shown and Figure 6Taking the target front-end code shown as an example, the backend server embeds the original front-end code corresponding to the target design draft into the preset position in the preset prompt template to construct the target prompt; since the preset prompt template includes a semantic conversion example, the target prompt also includes a semantic conversion example. After constructing the target prompt, the backend server inputs the target prompt into the target pre-training model, so as to use the semantic conversion example in the target prompt to guide the target pre-training model to determine the attribute value of the class attribute from the original front-end code to obtain the original node name, and understand the context of the original front-end code through the attention mechanism to semantically process the original node name, so as to obtain the corresponding semantic node name, and finally replace the corresponding original node name in the original front-end code with the semantic node name to obtain the target front-end code corresponding to the target design draft.

[0070] In addition, the present application can also export the entire target design draft as a picture and input the exported picture into the target pre-trained model so that the target pre-trained model can understand and infer the picture, such as identifying node information and layer information from the picture, and then semantically process the original node names in the target design draft based on the node information and layer information to directly generate the target front-end code containing the semantic node names.

[0071] It can be seen that this application introduces prompt templates and pre-trained models to combine the original front-end code and the prompt template as the input of the pre-trained model, so as to guide the pre-trained model to use its own reasoning ability through the semantic conversion examples in the prompt template to infer the semantic node names corresponding to the original node names, thereby realizing the semanticization of the node names, thereby converting the original node names that have no actual meaning in the design draft into semantic node names in the front-end code, thereby improving the readability and maintainability of the front-end code.

[0072] Furthermore, the present application also discloses an electronic device. Figure 7 This is a structural diagram of an electronic device 10 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0073] Figure 7 A schematic diagram of the structure of an electronic device 10 provided in an embodiment of the present application. The electronic device 10 may specifically include: at least one processor 11, at least one memory 12, a power supply 13, a communication interface 14, an input / output interface 15, and a communication bus 16. The memory 12 is used to store a computer program, which is loaded and executed by the processor 11 to implement the relevant steps in the design draft transcoding method disclosed in any of the aforementioned embodiments. In addition, the electronic device 10 in this embodiment may specifically be an electronic computer.

[0074] In this embodiment, the power supply 13 is used to provide working voltage for each hardware device on the electronic device 10; the communication interface 14 can create a data transmission channel between the electronic device 10 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 15 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0075] In addition, the memory 12, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 121, a computer program 122, etc., and the storage method can be temporary storage or permanent storage.

[0076] The operating system 121 is used to manage and control the hardware devices and computer programs 122 on the electronic device 10, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the design manuscript transcoding method performed by the electronic device 10 disclosed in any of the aforementioned embodiments, the computer program 122 can further include a computer program that can be used to complete other specific tasks.

[0077] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed design draft transcoding method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.

[0078] Furthermore, the present application also discloses a computer program product, including a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the aforementioned disclosed design draft transcoding method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiment, and will not be repeated here.

[0079] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0080] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0081] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0082] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0083] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A design manuscript transcoding method, characterized in that: include: Get the original front-end code corresponding to the target design draft; The original front-end code is embedded into a preset position in a preset prompt template to construct a target prompt; wherein the preset prompt template includes a semantic conversion example; Inputting the target prompt into a target pre-trained model, so as to guide the target pre-trained model to semantically process the original node names in the original front-end code using the semantic conversion examples in the target prompt, so as to obtain corresponding semantic node names; The semantic node name is used to replace the corresponding original node name in the original front-end code to obtain the target front-end code corresponding to the target design draft.

2. The design manuscript transcoding method according to claim 1, characterized in that: The preset prompt template is also configured with first prompt information for a preset output format; Among them, the first prompt information is used to instruct the target pre-trained model to output the semantic node name based on the preset output format to obtain a model output result in a corresponding format.

3. The design manuscript transcoding method according to claim 2, characterized in that: The model output result includes each of the original node names and the corresponding semantic node names; Correspondingly, the use of the semantic node name to replace the corresponding original node name in the original front-end code to obtain the target front-end code corresponding to the target design draft includes: Traversing the semantic node names corresponding to the original node names in the original front-end code from the model output results; The traversed semantic node names are used to replace the corresponding original node names in the original front-end code to obtain the target front-end code corresponding to the target design draft.

4. The design manuscript transcoding method according to claim 3, characterized in that: Also includes: Create a regular expression for node name replacement; Correspondingly, the semantic node name traversed is used to replace the corresponding original node name in the original front-end code to obtain the target front-end code corresponding to the target design draft, including: The traversed semantic node names are used and based on the regular expression to replace the corresponding original node names in the original front-end code to obtain the target front-end code corresponding to the target design draft.

5. The design manuscript transcoding method according to claim 3, characterized in that: Before traversing the semantic node names corresponding to the original node names in the original front-end code from the model output results, the method further includes: If there are duplicate semantic node names in the model output result, the semantic node names in the model output result are deduplicated.

6. The design manuscript transcoding method according to any one of claims 2 to 5, characterized in that: The preset prompt template is also configured with second prompt information for data output requirements; Among them, the second prompt information is used to instruct the target pre-trained model to generate a corresponding model output result based on the data output requirement.

7. The design manuscript transcoding method according to claim 6, characterized in that: The data output requirements include that the semantic node names in the model output results must remain intact, and / or each original node name in the model output results must have a corresponding semantic node name.

8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, used to execute the computer program to implement the design draft transcoding method as described in any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the design draft transcoding method as described in any one of claims 1 to 7.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the design draft transcoding method described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device for directly generating UI codes from visual draft

    CN112181416A

  • Automatic visual chart code generation method based on machine learning

    CN113553055A

  • Code automatic generation method and system, computer equipment and storage medium

    CN117111909A

  • Decompilation result optimization method and system based on large language model

    CN117421010A

  • Semantic learning in a federated learning system

    US20220083904A1