Search

CN-122018863-A - Code component generation method, device, equipment, medium and product

CN122018863ACN 122018863 ACN122018863 ACN 122018863ACN-122018863-A

Abstract

The invention relates to the technical field of computer software and discloses a method, a device, equipment, a medium and a product for generating a code component, wherein the method comprises the steps of obtaining a target text and a data asset matched with the target text; when at least one target data asset is associated with the associated data asset, determining the business priority corresponding to the target data asset according to the source information corresponding to the target data asset, determining the associated business priority corresponding to the associated data asset according to the association relation between the associated data asset and the target data asset and the business priority corresponding to the target data asset, sorting the target data asset and the associated data asset according to the business priority and the associated business priority to obtain a sorting result, inputting the target data asset and the associated data asset into a code assembly generating model according to the sorting result to obtain a code assembly corresponding to a target text, and solving the problem that the code assembly generated by the model in visual programming has lower accuracy.

Inventors

  • LI WENYUE
  • ZHAO YUSEN
  • CAI YAN
  • HAN QICHEN
  • RUAN JIALI
  • Ou xuan

Assignees

  • 杭州网易智企科技有限公司

Dates

Publication Date
20260512
Application Date
20251217

Claims (15)

  1. 1. A method of generating a code component, the method comprising: in response to an input operation on a visual interface, acquiring a target text and data assets matched with the target text, wherein the number of the data assets is multiple; identifying whether an associated data asset exists in the data assets that has an association with the data asset; when at least one target data asset is associated with the associated data asset, determining a business priority corresponding to the target data asset according to source information corresponding to the target data asset, and determining an associated business priority corresponding to the associated data asset according to an association relationship between the associated data asset and the target data asset and the business priority corresponding to the target data asset, wherein the source information is used for representing a matching source corresponding to the data asset, and the target data asset is any data asset with the associated data asset in a plurality of data assets; sorting the target data asset and the associated data asset according to the service priority corresponding to the target data asset and the associated service priority corresponding to the associated data asset to obtain a sorting result; and inputting the target data asset and the associated data asset into a code assembly generation model according to the sorting result to obtain the code assembly corresponding to the target text.
  2. 2. The method of claim 1, wherein determining the traffic priority corresponding to the target data asset based on the source information corresponding to the target data asset comprises: Acquiring weight calculation strategies corresponding to the source information; Determining sub-service priorities of the target data asset under the target source information according to the weight calculation strategy corresponding to the target source information aiming at any one piece of target source information in the source information, so as to obtain a plurality of sub-service priorities; And fusing the sub-service priorities to obtain the service priorities corresponding to the target data assets.
  3. 3. The method of claim 2, wherein if the target source information characterizes recall results of the target data asset derived from a data asset library; The determining the sub-business priority of the target data asset under the target source information based on the weight calculation strategy corresponding to the target source information comprises the following steps: acquiring a matching degree corresponding to the target data asset during recall and a first weight corresponding to the target data asset; Determining a first preset priority corresponding to the target data asset based on the target source information; and obtaining the sub-service priority based on the matching degree, the fusion result of the first weight and the first preset priority.
  4. 4. The method of claim 2, wherein if the target source information characterizes that the target data asset is derived from a custom or an association between the target data asset and logic; The determining the sub-business priority of the target data asset under the target source information based on the weight calculation strategy corresponding to the target source information comprises the following steps: determining a second preset priority corresponding to the target data asset based on the target source information; Acquiring a second weight corresponding to the target data asset; And obtaining the sub-service priority based on the fusion result of the second weight and the second preset priority.
  5. 5. The method of claim 2, wherein the determining the associated business priority corresponding to the associated data asset based on the association between the associated data asset and the target data asset and the business priority corresponding to the target data asset comprises: determining a third weight corresponding to the associated data asset based on the association relationship; And determining the associated service priority corresponding to the associated data asset based on the fusion result of the service priority and the third weight.
  6. 6. The method of claim 1, wherein when a plurality of the data assets include the associated data asset corresponding to the target data asset; The method further comprises the steps of, before the sorting result is obtained, sorting the target data asset and the associated data asset according to the service priority corresponding to the target data asset and the associated service priority corresponding to the associated data asset: And taking the sum of the business priority corresponding to the associated data asset and the associated business priority corresponding to the associated data asset as the final business priority of the associated data asset, and executing the deduplication operation on the associated data asset.
  7. 7. The method of claim 1, wherein said inputting the target data asset and the associated data asset into a code component generation model according to the ranking result to obtain the code component corresponding to the target text comprises: Acquiring a prompt word template; Adding the target data asset and the associated data asset to the prompt word template according to the sequencing result to obtain prompt information; Guiding a generation process of the code component generation model by using the prompt information to obtain an initial code component characterized in a first programming language form; the initial code component is converted to the code component characterized in a second programming language.
  8. 8. The method of claim 7, wherein said converting said initial code component into said code component characterized in a second programming language form comprises: Analyzing the code structure and semantic information of the initial code component to generate an abstract syntax tree; converting the contents represented by each node in the abstract syntax tree into target contents represented by the second programming language to obtain a target abstract syntax tree; and splicing the target content represented by each node in the target abstract syntax tree to generate the code component.
  9. 9. The method of claim 1, wherein obtaining the data asset corresponding to the target text comprises: Vectorizing the target text to obtain a target text vector corresponding to the target text; vectorizing annotation information corresponding to each data asset under any one target asset type in a plurality of asset types included in a pre-constructed data asset library to obtain annotation information text vectors corresponding to each data asset; matching the target text vector with each annotation information text vector under the target asset type to obtain a plurality of matching degrees; and selecting a preset number of data assets under the target asset type based on the plurality of matching degrees, so as to obtain a plurality of data assets.
  10. 10. The method of claim 9, wherein the process of constructing the database of data assets comprises: acquiring historical application data assets in a pre-constructed initial data asset library; obtaining logic identification information corresponding to the target text; Determining a target application corresponding to the target text and an application data asset corresponding to the target application based on the logic identification information; comparing the application data asset with the historical application data asset to obtain a comparison result; And if the comparison result represents that the difference data asset exists, updating the difference data asset to the initial data asset library to obtain the data asset library.
  11. 11. The method of claim 9, wherein said matching the target text vector with each of the annotation information text vectors for the target asset type results in a plurality of matching degrees, comprising: determining vector similarity between the target text vector and each annotation information text vector to obtain a plurality of similarity values; Acquiring a time difference between the change time and the current time of the data asset according to the data asset corresponding to any annotation information text vector; if the time difference meets a preset condition, determining that a fourth weight of the data asset is a first preset value, and obtaining the matching degree of the data asset based on a fusion result of the first preset value and the similarity value; And if the time difference does not meet the preset condition, determining that the fourth weight of the data asset is a second preset value, and obtaining the matching degree of the data asset based on a fusion result of the second preset value and the similarity value, wherein the first preset value is larger than the second preset value.
  12. 12. A code component generating apparatus, the apparatus comprising: the acquisition module is used for responding to input operation on the visual interface and acquiring target text and data assets matched with the target text, wherein the number of the data assets is multiple; the identification module is used for identifying whether the data asset has an association relationship with the data asset or not; A determining module, configured to determine, when there is at least one target data asset associated with the associated data asset, a service priority corresponding to the target data asset according to source information corresponding to the target data asset, and determine, according to an association relationship between the associated data asset and the target data asset and the service priority corresponding to the target data asset, an associated service priority corresponding to the associated data asset, where the source information is used to characterize a matching source corresponding to the data asset, and the target data asset is any of the data assets having the associated data asset; the sorting module is used for sorting the target data asset and the associated data asset according to the service priority corresponding to the target data asset and the associated service priority corresponding to the associated data asset to obtain a sorting result; and the generation module is used for inputting the target data asset and the associated data asset into a code assembly generation model according to the sorting result to obtain the code assembly corresponding to the target text.
  13. 13. An electronic device, comprising: a memory and a processor communicatively coupled to each other, the memory having stored therein computer instructions that, upon execution, perform the method of generating a code component of any of claims 1 to 11.
  14. 14. A computer-readable storage medium, having stored thereon computer instructions for causing a computer to perform the method of generating a code component according to any of claims 1 to 11.
  15. 15. A computer program product comprising computer instructions for causing a computer to perform the method of generating a code component according to any one of claims 1 to 11.

Description

Code component generation method, device, equipment, medium and product Technical Field The invention relates to the technical field of computer software, in particular to a method, a device, equipment, a medium and a product for generating a code component. Background In the field of visual programming, a drag or quick insertion mode is generally adopted, and a prefabricated base component template is inserted into a visual interface to realize visual programming. The visual programming mode has the advantages of complex operation process, repeated configuration, large manual association workload, easy configuration error occurrence, and incapability of generating complex logic, inserting logic combinations and the like at one time. The visual programming is performed by adopting a large model reasoning mode, so that the problems can be solved to a certain extent. However, the code components directly generated by the large model often have logic errors, unreasonable structure and other problems, so that the accuracy of the code components generated by the large model is low. Disclosure of Invention The invention provides a code component generation method, device, equipment, medium and product, which are used for solving the problem of low accuracy of code components generated by a model in visual programming. In a first aspect, the invention provides a code component generating method, which is used for responding to input operation on a visual interface, acquiring target text and data assets matched with the target text, wherein the number of the data assets is multiple, identifying whether associated data assets with an association relationship with the data assets exist in the data assets, when at least one associated data asset exists in association with the target data assets, determining service priorities corresponding to the target data assets according to source information corresponding to the target data assets, determining associated service priorities corresponding to the associated data assets according to association relationship between the associated data assets and the target data assets and the service priorities corresponding to the target data assets, wherein the source information is used for representing matching sources corresponding to the data assets, the target data assets are any data assets with associated data assets in the plurality of data assets, sorting the target data assets and the associated data assets according to the service priorities corresponding to the target data assets, and obtaining sorting results, and inputting the target data assets and the associated data assets into a code component generating model according to the sorting results, and obtaining the code component corresponding to the target text. In a second aspect, the invention provides a code component generating device, which is used for responding to input operation on a visual interface, acquiring target texts and data assets matched with the target texts, wherein the number of the data assets is multiple, identifying a module used for identifying whether associated data assets with an association relationship with the data assets exist in the data assets, determining a service priority corresponding to the target data assets according to source information corresponding to the target data assets when at least one associated data asset exists in association with the associated data assets, determining an associated service priority corresponding to the associated data assets according to the association relationship between the associated data assets and the target data assets and the service priority corresponding to the target data assets, wherein the source information is used for representing a matched source corresponding to the data assets, the target data assets are any data assets with the associated data assets in the plurality of data assets, sorting the target data assets and the associated data assets according to the service priority corresponding to the target data assets and the associated service priority corresponding to the associated data assets to obtain a sorting result, and the generating module is used for inputting the target data assets and the associated code component to the corresponding to the code component generating device. In a third aspect, the present invention provides an electronic device, including a memory and a processor, where the memory and the processor are communicatively connected to each other, and the memory stores computer instructions, and the processor executes the computer instructions, thereby executing the method for generating a code component according to the first aspect or any implementation manner corresponding to the first aspect. In a fourth aspect, the present invention provides a computer-readable storage medium having stored thereon computer instructions for causing a computer to execute the method of generating a code component acco