Agent-based component generation method, device, system, and related products
By generating and parsing the general interface source code of workcard templates using intelligent agents, the problem of low efficiency in manually building workcard templates is solved, and efficient and accurate generation of custom rule components is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BAIDU (CHINA) CO LTD
- Filing Date
- 2026-03-19
- Publication Date
- 2026-07-21
Smart Images

Figure CN122431675A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, particularly to the fields of intelligent office, intelligent agents, and large models, specifically to a method, apparatus, system, device, medium, and product for generating components based on intelligent agents. Background Technology
[0002] In front-end development, a card is a common user interface (UI) component used to display information in an independent, modular way.
[0003] In corporate office settings, a work card is a dynamic and interactive card used for rapid task flow and processing. Summary of the Invention
[0004] This disclosure provides a method, apparatus, system, device, medium, and product for generating components based on intelligent agents.
[0005] According to one aspect of this disclosure, a component generation method based on an intelligent agent is provided, comprising: using an intelligent agent to generate a general interface source code for the target component based on description information of the target component; parsing the general interface source code to obtain general description data of the target component; mapping the general description data to basic description data conforming to a custom rule based on a preset mapping relationship; obtaining target description data of the target component conforming to the custom rule based on the basic description data; and generating the target component conforming to the custom rule based on the target description data.
[0006] According to another aspect of this disclosure, an agent-based component generation apparatus is provided, comprising: a source code generation module, configured to generate general interface source code of the target component using an agent based on description information of the target component; a parsing module, configured to parse the general interface source code to obtain general description data of the target component; a mapping module, configured to map the general description data to basic description data conforming to custom rules based on a preset mapping relationship; an acquisition module, configured to acquire target description data of the target component conforming to the custom rules based on the basic description data; and a component generation module, configured to generate the target component conforming to the custom rules based on the target description data.
[0007] According to another aspect of this disclosure, a component generation system based on an intelligent agent is provided, comprising: an intelligent agent for generating general interface source code of the target component based on description information of the target component; a parser for parsing the general interface source code to obtain general description data of the target component; a mapper for mapping the general description data to basic description data conforming to custom rules according to a preset mapping relationship; a binder for obtaining target description data of the target component conforming to the custom rules based on the basic description data; and a generator for generating the target component conforming to the custom rules based on the target description data.
[0008] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to said at least one processor; wherein the memory stores instructions executable by said at least one processor, said instructions being executed by said at least one processor to enable said at least one processor to perform the method as described in any of the foregoing aspects.
[0009] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method according to any of the preceding aspects.
[0010] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method according to any of the preceding aspects.
[0011] According to embodiments of this disclosure, target components conforming to custom rules can be generated efficiently.
[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0013] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0014] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;
[0015] Figure 2 This is a schematic diagram according to the second embodiment of the present disclosure;
[0016] Figure 3 This is a schematic diagram of a dialogue process provided according to an embodiment of this disclosure;
[0017] Figure 4 This is a schematic diagram of the composition of an intelligent agent according to an embodiment of the present disclosure;
[0018] Figure 5 This is a schematic diagram of the overall process for generating a workcard template according to the embodiments of this disclosure;
[0019] Figure 6 This is a schematic diagram according to the third embodiment of the present disclosure;
[0020] Figure 7 This is a schematic diagram according to the fourth embodiment of the present disclosure;
[0021] Figure 8 This is a schematic diagram of an electronic device used to implement the agent-based component generation method of the present disclosure embodiments. Detailed Implementation
[0022] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0023] An intelligent agent is an entity capable of perceiving its environment and autonomously taking actions to achieve specific goals. It can be software, hardware, or a system. An intelligent agent is not merely a simple tool, but an intelligent agent that proactively adapts to its environment and learns to optimize its strategies. Current development of intelligent agents is based on large models, such as the Large Language Model (LLM), as its core intelligent foundation. Its architecture typically includes modules for memory, planning, tool usage, and action execution.
[0024] Large Language Models (LLMs) are deep learning models trained on massive amounts of text data. They are capable of generating natural language text or understanding the meaning of language text, and their parameter scale typically reaches billions to trillions. LLMs can perform operations based on prompts.
[0025] Prompts are text instructions entered by the user into the LLM (Large Model for Learning) to guide the model in generating specific, accurate, or expected outputs. They are the core way humans interact with large models, determining the direction in which the model understands the task and generates content. Specifically, they can include tasks, which explicitly tell the model what to do; context, which provides relevant information to help the model understand the scenario or conditions in which the task occurs; examples, which indicate the expected format or style of input and output; and roles, which indicate the role the model should play.
[0026] The intelligent agent disclosed herein is mainly used to generate source code and can be called a source code intelligent agent. The source code intelligent agent generates general interface source code of the target component based on the description information of the target component input by the user. For example, it can generate React source code by using its integrated LLM. React source code is a general front-end interface source code. It is a source code file written using the React framework to build the interface and includes interface structure, components, layout, style and interaction logic.
[0027] Work cards can be specifically applied in instant messaging (IM) software in enterprise scenarios. They push tasks in the form of cards, such as schedule work cards for performing scheduled tasks and approval work cards for performing approval tasks.
[0028] Typically, work cards are rendered based on work card templates. The task initiator can generate business data according to actual needs, which is then passed into the work card template by the rendering engine for rendering, resulting in the work card. For example, a schedule work card template may contain a date field. During rendering, the specific date entered by the task initiator is passed into the date field, thus generating a schedule work card containing that specific date.
[0029] In related technologies, users can build workcard templates on a visual platform by dragging and dropping components. To ensure the best results, users need to understand the constraints of the workcard template.
[0030] Work card templates typically use a Domain Specific Language (DSL) to define constraint rules. DSL is a custom language, not the common HyperText Markup Language (HTML), so it requires a certain learning curve.
[0031] In other words, manually creating a work card template that conforms to DSL rules requires a high learning curve and is also inefficient.
[0032] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure. This embodiment provides a component generation method based on an intelligent agent. Figure 1 As shown, the method includes:
[0033] 101. Using an intelligent agent, based on the description information of the target component, generate the general interface source code of the target component.
[0034] 102. Parse the source code of the general interface to obtain the general description data of the target component.
[0035] 103. Based on the preset mapping relationship, the general description data is mapped to basic description data that conforms to the custom rules.
[0036] 104. Based on the basic description data, obtain the target description data of the target component that conforms to the custom rules.
[0037] 105. Based on the target description data, generate the target component that conforms to the custom rules.
[0038] The target component refers to the component to be generated, such as the work card template mentioned above, a work card containing specific information, or other UI components.
[0039] Description information can be input into the intelligent agent by the target object (such as a user) to describe the functional information of the target component, such as "generate schedule workcard template".
[0040] After receiving the above description information, the agent can use its integrated large model, such as the Large Language Model (LLM), to generate code and obtain the source code of a general interface, for example, the source code of a "calendar work card template".
[0041] General-purpose interface source code refers to common, standard front-end interface source code, rather than custom source code.
[0042] For example, it could be React source code.
[0043] React source code is the source code file used to build the interface, written using the React framework. It includes the interface structure, components, layout, styles, and interaction logic.
[0044] Furthermore, the React source code can contain style class names provided by Tailwind, where Tailwind is a style tool used to describe styles and layouts.
[0045] In other words, the general interface source code can indicate which elements (such as buttons, text, etc.) are contained in the target component, the hierarchical relationship between elements (such as parent-child relationship, nesting relationship, etc.), the style and layout information of the elements (such as button color, position, etc.).
[0046] Due to its versatility, large models have good generation results, thus enabling the generation of accurate general-purpose interface source code based on description information.
[0047] Conversely, if a large model is used to directly generate the final target component that conforms to the custom rules based on the description information, the quality of the generated target component will be poor because the large model has a poor understanding of the custom rules. In particular, the layout and style information usually do not meet the requirements.
[0048] In this embodiment, a large model is used to generate general interface source code. In this process, the large model does not need to understand the custom rules and has mature generation technology, so it can obtain general interface source code that accurately matches the description information.
[0049] After obtaining the source code of the general interface, it is parsed to obtain the general description data of the target component.
[0050] Description data is used to describe the target component. For example, it describes which sub-components (such as buttons, input boxes, text, and images) are contained in the target component (such as a work card template), the layout information of the sub-components (such as the position and hierarchy of the sub-components), and the style information (such as size and color).
[0051] General description data refers to the description data obtained after parsing the source code of a general interface. It conforms to general rules. For example, after parsing using the Abstract Syntax Tree (AST) tool, the general description data with an AST structure is obtained.
[0052] After obtaining general description data that conforms to common rules, it is mapped to basic description data according to a preset mapping relationship. The basic description data conforms to custom rules.
[0053] Basic description data refers to description data that conforms to custom rules.
[0054] Custom rules refer to rules defined using a custom language (such as a DSL), for example, custom rules are JSON data.
[0055] During mapping, mapping can be performed based on preset mapping relationships. The sub-components before and after mapping are the same, only the format of the description data is different. For example, after parsing the source code, we obtain description data for 3 sub-components. After mapping, we still obtain description data for 3 sub-components, but the format of the description data for each sub-component needs to be mapped from conforming to general rules to conforming to custom rules.
[0056] Rules (general rules and custom rules) are used to constrain the format of the corresponding descriptive data. The format can specifically include structure, field names, etc.
[0057] For example, if field names in a general rule do not contain underscores, while custom rules do, then the mapping relationship between these two rules can be pre-configured. This allows the same field to be mapped from not containing underscores to containing underscores. Specifically, if a field name in a general rule is `margintop`, after mapping, this field name will be mapped to `margin_top` in a custom rule.
[0058] That is, the general interface source code contains the description data of the target component (source code format); after the source code is parsed, general description data (such as AST format) is obtained; after mapping, basic description data conforming to custom rules (such as JSON format) is obtained.
[0059] After obtaining the basic description data, the target description data is obtained based on the basic description data, and the target description data also conforms to the custom rules.
[0060] Specifically, when the target component does not contain dynamic content (e.g., the target component is a specific workcard), the basic description data can be used as the target description data; or,
[0061] When the target component contains dynamic content (such as a workcard template), you can add description data of the dynamic content to the basic description data to obtain the target description data.
[0062] For details regarding dynamic content, please refer to the subsequent related explanations.
[0063] After obtaining the target description data of the target component, the target component is generated based on the target description data. Since the target description data conforms to the custom rules, the target component also conforms to the custom rules.
[0064] For example, if the target description data is JSON data, a final description file, such as an XML file, can be generated based on the JSON data. Specifically, preset configuration information (such as the rendering engine name, identifier, etc.) can be added to the JSON data to obtain the XML file. Then, the rendering engine parses the XML file according to the built-in custom rules (which are consistent with the custom rules corresponding to the description data) to obtain the target component that conforms to the custom rules.
[0065] In this embodiment, by parsing the general interface source code, general description data of the target component is obtained. This general description data is then mapped to basic description data conforming to custom rules. Furthermore, target description data is obtained based on this basic description data, and the target component is generated based on the target description data. This achieves automated generation of the target component, improving efficiency and accuracy compared to manual construction. Additionally, using an intelligent agent to generate general interface source code based on description information leverages the agent's mature generation technology for general interface source code, efficiently and accurately obtaining the general interface source code. Component generation is then based on this source code, resulting in more accurate target components compared to directly generating components from large models based on description information.
[0066] Figure 2 This is a schematic diagram based on the second embodiment of the present disclosure. This embodiment provides a component generation method based on an intelligent agent. This embodiment further explains the relevant steps.
[0067] like Figure 2 As shown, the method includes:
[0068] 201. Employ an intelligent agent to engage in dialogue with the target object, and generate the general interface source code of the target component based on the description information of the target component.
[0069] The target object refers to the object that initiates the component generation process, such as a user.
[0070] Taking a user as an example, the general interface source code of the target component (such as a work card template) can be obtained through the dialogue process between the user and the intelligent agent. This source code can include the style class names provided by Tailwind.
[0071] In this embodiment, the general interface source code of the target component is obtained through the dialogue process between the intelligent agent and the target object. Multiple rounds of dialogue can be executed according to actual needs to obtain the source code of the component that meets the requirements of the target object.
[0072] Furthermore, this step may specifically include:
[0073] An intelligent agent is used to receive the description information input by the target object and generate initial source code based on the description information;
[0074] The initial source code is rendered to display the initial components to the target object;
[0075] Using the aforementioned intelligent agent, when the initial components fail to meet the requirements, new source code is regenerated based on the new description information input by the target object;
[0076] The new source code is rendered to generate and display new components;
[0077] The source code corresponding to the new component that meets the requirements shall be used as the general interface source code.
[0078] In this case, the rendering can be performed using a common rendering engine corresponding to the common interface source code. For example, the common rendering engine is the runtime of the React framework.
[0079] For example, see Figure 3 , Figure 3 This is a schematic diagram of a dialogue process provided according to an embodiment of the present disclosure.
[0080] like Figure 3 As shown, the user inputs the description information of the target component into the agent 301. The agent 301 generates React source code based on the description information. Then, a general rendering framework, such as React Runtime, can be used to render the React source code, generate and display the corresponding component. Initially, the generated source code and component can be referred to as the initial source code and initial component, respectively.
[0081] After rendering, the user can determine whether the rendered component meets their requirements and provide feedback to the agent. If it meets the requirements, the user can confirm it, and the agent will use the source code corresponding to the confirmed component as the general interface source code for subsequent use. If it does not meet the requirements, the user can re-enter new description information, and the agent will regenerate the source code based on the new description information to obtain new source code. The agent will then re-render based on the new source code and display the new component to the user until a component that meets the requirements is obtained. The source code corresponding to the component that meets the requirements will be used as the general interface source code for subsequent use.
[0082] In this embodiment, by rendering the source code, the corresponding component is displayed to the target object. The target object can intuitively judge whether the component meets the requirements, thereby intuitively and efficiently obtaining the general interface source code that meets the needs.
[0083] By using a general-purpose rendering engine, it can be adapted to general-purpose interface source code, ensuring that the corresponding components are successfully displayed after the source code is rendered.
[0084] Furthermore, regarding source code generation, refer to... Figure 4 , Figure 4 This is a schematic diagram of the composition of an intelligent agent provided according to an embodiment of the present disclosure.
[0085] like Figure 4 As shown, the agent 400 may include: a Retrieval-Augmented Generation (RAG) module, a constraint information construction module, a multi-turn context management module, a prompt information construction module, and a large model.
[0086] The RAG module can pre-configure a candidate sub-component library. The candidate sub-component library records the description information and source code of each candidate sub-component. A candidate sub-component refers to a sub-component that can be selected to form a target component. For example, in the work card template scenario, candidate sub-components can include sub-components (such as buttons, input boxes, etc.) that can be selected from various types of work card templates (such as schedules, approvals, etc.).
[0087] After receiving the description information, the agent can obtain the candidate sub-component related to the description information as the target sub-component based on the similarity between the description information and the description information of each candidate sub-component, and then call the target sub-component in the general interface source code generated by the large model.
[0088] Furthermore, the candidate child component can be a custom child component. That is, the source code of a custom child component that conforms to custom rules can be written in advance and encapsulated. In this way, when the rendering engine calls the custom child component in the future, it can render based on the encapsulated custom source code to conform to the custom rules and achieve successful rendering of the interface.
[0089] The constraint information construction module is used to build constraint information. This constraint information can specifically relate to constraints on sub-components, styles, and layouts within the template, such as limiting the size of the template's top margin. The specific content can be set according to actual needs. Additionally, constraint information can also constrain selected sub-components, meaning it can identify the target sub-component from a set of candidate sub-components, avoiding the selection of sub-components that the interface does not support.
[0090] The multi-turn context management module is used to obtain context information about the dialogue process between the user and the agent.
[0091] The prompt message construction module is used to construct prompt messages. Specifically, the prompt message can include the description information of the target component, the source code of the target sub-component, the constraint information, and the context information. In addition, the prompt message can also include preset instructions, such as instructions to generate source code.
[0092] The large model is used to generate source code based on the above prompts, such as generating the React source code of the workcard template based on the description information of the workcard template, the source code of the target sub-component, the constraint information, and the context information.
[0093] Therefore, through the above modules, a general interface source code can be generated by the intelligent agent.
[0094] 202. Use a preset AST parsing tool to parse the general interface source code to obtain the general description data of the target component.
[0095] Among them, AST parsing tools include, for example, the Babel tool, which is an AST parsing tool.
[0096] Specifically, a preset AST parsing tool can be used to parse the general interface source code to obtain an AST; the AST can be traversed to obtain the description data of the sub-components in the target component; and the general description data can be generated based on the description data of the sub-components.
[0097] For example, by using AST parsing tools, you can obtain the AST corresponding to the source code (such as the React source code). The AST is a tree structure that includes multiple nodes. By traversing each node, you can extract the information of each child component in the target component. For example, if the AST contains JSXElement, each JSXElement is treated as information of a child component. Then, the information of each child component is combined to form the general description data of the target component.
[0098] In this embodiment, an AST parsing tool is used to parse the general interface source code, which can efficiently obtain general description data.
[0099] By traversing the AST, we can obtain the description data of the sub-components. Based on the description data of the sub-components, we can obtain general description data, which can improve the completeness and accuracy of the general description data, thereby improving the accuracy of component generation.
[0100] 203. Based on the preset mapping relationship, the general description data is mapped to basic description data that conforms to the custom rules.
[0101] Among them, the mapping relationship between general rules and custom rules can be pre-configured. Based on this mapping relationship, general description data can be mapped to basic description data, such as mapping AST data to JSON data.
[0102] 204. Add dynamic content description data to the basic description data to obtain target description data of the target component that conforms to the custom rules.
[0103] Specifically, this may include: determining the dynamic content in the target component; generating description data of the dynamic content based on the custom rules; and adding the description data of the dynamic content to the basic description data to obtain the target description data.
[0104] After obtaining the basic description data, you can add (bind) description data of dynamic content to it to obtain the target description data.
[0105] Dynamic content can include variables and events.
[0106] A variable is an attribute whose content can be changed. Generally speaking, child components of a target component can include various attributes, and attributes whose content can be changed are variables.
[0107] For example, the target component is a work card template, and a sub-component is a date field. The attributes of this field may include style attributes and content attributes. Style attributes are used to represent style information such as size and color, and are usually fixed values. Content attributes are used to represent the value of this field, that is, the specific date. Since the specific date is variable, the content attributes are variables.
[0108] Similarly, the content attribute of the title field is also a variable.
[0109] An event refers to an event associated with a child component, such as a submit event or a navigation event. For example, a submit button is a child component of a workcard template. The specific event could be the interaction logic after clicking the submit button, i.e., performing the submit operation.
[0110] The descriptive data for dynamic content can be obtained from custom rules. For example, if a custom rule records dynamic content using a occupant symbol (such as $), then the descriptive data for a specific dynamic content is the aforementioned occupant symbol.
[0111] After obtaining the description data of the dynamic content, it is added to the basic description data to obtain the target description data.
[0112] In this embodiment, by adding dynamic content description data to the basic description data to obtain the target description data, the completeness of the target description data can be improved, thereby improving the completeness and accuracy of the target component.
[0113] Furthermore, for events, each event can be treated as dynamic content. That is, description data conforming to custom rules can be generated for each event and added to the basic description data.
[0114] Regarding variables, each property of a child component can be treated as a variable. However, to improve effectiveness, an agent can be used to determine the variable among multiple properties.
[0115] Taking the date field mentioned above as an example, this field has multiple attributes (such as style attributes and content attributes). Each attribute can be treated as a variable (i.e., both style attributes and content attributes are variables). Alternatively, an agent can be used to determine the variable among multiple attributes, such as determining the content attribute as a variable while the style attribute is not.
[0116] That is, the intelligent agent can be used to analyze multiple attributes of the sub-components in the target component in order to determine the variable among the multiple attributes.
[0117] For example, the basic description data contains information about each sub-component, and the attribute information of each sub-component can be pre-configured. Then, the attribute information of each sub-component is input into the agent, which analyzes it and determines the variables.
[0118] In this embodiment, using an agent to determine variables among multiple attributes can improve the effectiveness of variables, thereby improving the accuracy of the target component.
[0119] In addition, if specific dynamic content needs to be generated, such as a work card as the final target component, which contains specific dynamic content, such as a date field containing a specific date, then the target object (such as a user) can interact with the agent to trigger the agent to add specific dynamic content to the basic description data, such as adding a specific date, and thus obtain the target component containing specific dynamic content, thereby generating a schedule work card containing a specific date.
[0120] 205. Based on the target description data, generate the target component that conforms to the custom rules.
[0121] The target component can be generated by using a rendering engine with built-in custom rules that renders based on the target description data.
[0122] Specifically, after obtaining the target description data, the final description file can be generated based on the target description data. For example, if the target description data is JSON data, the final description file is an XML file. Preset configuration information (such as rendering engine name, identifier, etc.) can be added to the JSON data to obtain the XML file. Then, the rendering engine parses the XML file according to the built-in custom rules (which are consistent with the custom rules corresponding to the description data) to obtain the target components that conform to the custom rules, such as obtaining a workcard template that conforms to the DSL rules.
[0123] In this embodiment, a rendering engine based on built-in custom rules renders target description data that conforms to the custom rules, which can automatically, efficiently and intuitively obtain template components that conform to the custom rules.
[0124] Furthermore, the target component can be a workcard template. This enables the automatic generation of workcard templates, solving the problems of low efficiency and high cost caused by manual template creation.
[0125] Furthermore, business data corresponding to the dynamic content in the work card template can also be obtained;
[0126] The business data is input into the work card template using the built-in custom rule rendering engine to generate the work card.
[0127] The work card template is reusable and editable. That is, the rendering engine can pass different business data into the work card template to render different work cards. For example, if the business data includes dates, the schedule work card template can be rendered based on different dates to generate schedule work cards containing different dates.
[0128] In this embodiment, by inputting business data into the work card template, work cards that meet the needs of different scenarios can be obtained.
[0129] Based on the above, refer to Figure 5 , Figure 5 This is a schematic diagram of the overall process for generating a workcard template according to an embodiment of this disclosure.
[0130] like Figure 5 As shown, the agent generates React source code based on the description information of the workcard template input by the user, performs AST parsing on the React source code to obtain AST data (general description data); uses a preset mapping relationship to map the AST data to basic description data (JSON data) that conforms to custom rules; adds dynamic content description data to the basic description data to obtain target description data (also JSON data); then, generates the final description file (XML file) of the workcard template based on the target description data (JSON data), and uses a rendering engine to parse the final description file based on built-in custom rules to obtain the workcard template.
[0131] Figure 6 The schematic diagram is based on the third embodiment of the present disclosure. This embodiment provides a component generation device based on an intelligent agent. The device 600 includes: a source code generation module 601, a parsing module 602, a mapping module 603, an acquisition module 604, and a component generation module 605.
[0132] The source code generation module 601 is used to generate a general interface source code for the target component based on the description information of the target component using an intelligent agent; the parsing module 602 is used to parse the general interface source code to obtain the general description data of the target component; the mapping module 603 is used to map the general description data to basic description data conforming to custom rules based on a preset mapping relationship; the acquisition module 604 is used to acquire the target description data of the target component conforming to the custom rules based on the basic description data; and the component generation module 605 is used to generate the target component conforming to the custom rules based on the target description data.
[0133] In this embodiment, by parsing the general interface source code, general description data of the target component is obtained. This general description data is then mapped to basic description data conforming to custom rules. Furthermore, target description data is obtained based on this basic description data, and the target component is generated based on the target description data. This achieves automated generation of the target component, improving efficiency and accuracy compared to manual construction. Additionally, using an intelligent agent to generate general interface source code based on description information leverages the agent's mature generation technology for general interface source code, efficiently and accurately obtaining the general interface source code. Component generation is then based on this source code, resulting in more accurate target components compared to directly generating components from large models based on description information.
[0134] In some embodiments, the source code generation module 601 is further configured to:
[0135] An intelligent agent is used to engage in dialogue with the target object in order to generate the general interface source code based on the description information.
[0136] In this embodiment, the general interface source code of the target component is obtained through the dialogue process between the intelligent agent and the target object. Multiple rounds of dialogue can be executed according to actual needs to obtain the source code of the component that meets the requirements of the target object.
[0137] In some embodiments, the source code generation module 601 is further configured to:
[0138] An intelligent agent is used to receive the description information input by the target object and generate initial source code based on the description information;
[0139] The initial source code is rendered to display the initial components to the target object;
[0140] Using the aforementioned intelligent agent, when the initial components fail to meet the requirements, new source code is regenerated based on the new description information input by the target object;
[0141] The new source code is rendered to generate and display new components;
[0142] The source code corresponding to the new component that meets the requirements shall be used as the general interface source code.
[0143] In this embodiment, by rendering the source code, the corresponding component is displayed to the target object. The target object can intuitively judge whether the component meets the requirements, thereby intuitively and efficiently obtaining the general interface source code that meets the needs.
[0144] In some embodiments, the source code generation module 601 is further configured to:
[0145] The initial source code is rendered using the general rendering engine corresponding to the general interface source code.
[0146] By using a general-purpose rendering engine, it can be adapted to general-purpose interface source code, ensuring that the corresponding components are successfully displayed after the source code is rendered.
[0147] In some embodiments, the parsing module 602 is further configured to:
[0148] A pre-defined AST parsing tool is used to parse the general interface source code to obtain general description data of the target component.
[0149] In this embodiment, an AST parsing tool is used to parse the general interface source code, which can efficiently obtain general description data.
[0150] In some embodiments, the parsing module 602 is further configured to:
[0151] The source code of the general interface is parsed using a preset AST parsing tool to obtain the AST;
[0152] The AST is traversed to obtain the description data of the sub-components in the target component;
[0153] The general description data is generated based on the description data of the sub-components.
[0154] By traversing the AST, we can obtain the description data of the sub-components. Based on the description data of the sub-components, we can obtain general description data, which can improve the completeness and accuracy of the general description data, thereby improving the accuracy of component generation.
[0155] In some embodiments, the acquisition module 603 is further configured to:
[0156] Determine the dynamic content in the target component;
[0157] Based on the custom rules, description data for the dynamic content is generated;
[0158] The description data of the dynamic content is added to the basic description data to obtain the target description data.
[0159] In this embodiment, by adding dynamic content description data to the basic description data to obtain the target description data, the completeness of the target description data can be improved, thereby improving the completeness and accuracy of the target component.
[0160] In some embodiments, the dynamic content includes: variables; the acquisition module 603 is further configured to:
[0161] The agent is used to analyze multiple attributes of the sub-components in the target component in order to determine the variable among the multiple attributes.
[0162] In this embodiment, using an agent to determine variables among multiple attributes can improve the effectiveness of variables, thereby improving the accuracy of the target component.
[0163] In some embodiments, the component generation module 605 is further configured to:
[0164] The target component is generated by rendering using a rendering engine with built-in custom rules based on the target description data.
[0165] In this embodiment, a rendering engine based on built-in custom rules renders target description data that conforms to the custom rules, which can automatically, efficiently and intuitively obtain template components that conform to the custom rules.
[0166] In some embodiments, the target component includes:
[0167] Work card template.
[0168] This enables the automatic generation of work card templates, solving the problems of low efficiency and high cost caused by manual template creation.
[0169] In some embodiments, the device further includes:
[0170] The workcard generation module is used to obtain the business data corresponding to the dynamic content in the workcard template; and to use the rendering engine with the built-in custom rules to input the business data into the workcard template to generate a workcard.
[0171] In this embodiment, by inputting business data into the work card template, work cards that meet the needs of different scenarios can be obtained.
[0172] Figure 7This is a schematic diagram according to the fourth embodiment of the present disclosure. This embodiment provides a component generation system based on an intelligent agent. The system 700 includes: an intelligent agent 701, a parser 702, a mapper 703, a binder 704, and a generator 705.
[0173] The intelligent agent 701 generates a general interface source code for the target component based on its description information; the parser 702 parses the general interface source code to obtain general description data for the target component; the mapper 703 maps the general description data to basic description data conforming to custom rules according to a preset mapping relationship; the binder 704 obtains target description data conforming to the custom rules for the target component based on the basic description data; and the generator 705 generates the target component conforming to the custom rules based on the target description data.
[0174] It is understood that the same or similar content in different embodiments of this disclosure can be referred to each other.
[0175] It is understood that the terms "first" and "second" in the embodiments of this disclosure are only used for distinction and do not indicate the degree of importance or the order of events.
[0176] It is understandable that, unless otherwise specified, the order of steps in the process indicates that the temporal relationship between these steps is not limited.
[0177] The collection, storage, use, processing, transmission, provision, and disclosure of any type of information, such as user personal information, in this technical solution comply with relevant laws and regulations and do not violate public order and good morals.
[0178] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0179] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device 800 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0180] like Figure 8As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0181] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of displays, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0182] The computing unit 801 can be a variety of general-purpose and / or proprietary processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various proprietary artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as agent-based component generation methods. For example, in some embodiments, the agent-based component generation method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the agent-based component generation method described above can be performed. Alternatively, in other embodiments, computing unit 801 may be configured to perform an agent-based component generation method by any other suitable means (e.g., by means of firmware).
[0183] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), proprietary integrated circuits (ASICs), proprietary standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a proprietary or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0184] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, a dedicated computer, or other programmable task processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0185] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0186] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, 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 sound input, voice input, or tactile input).
[0187] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0188] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0189] 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 described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0190] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand 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 disclosure should be included within the scope of protection of this disclosure.
Claims
1. A component generation method based on an intelligent agent, comprising: An intelligent agent is used to generate the general interface source code of the target component based on the description information of the target component; The source code of the general interface is parsed to obtain the general description data of the target component; Based on a preset mapping relationship, the general description data is mapped to basic description data that conforms to custom rules; Based on the basic description data, obtain the target description data of the target component that conforms to the custom rules; Based on the target description data, the target component that conforms to the custom rules is generated.
2. The method according to claim 1, wherein, The step of employing an intelligent agent to generate the generic interface source code of the target component based on the description information of the target component includes: An intelligent agent is used to engage in dialogue with the target object in order to generate the general interface source code based on the description information.
3. The method according to claim 2, wherein, The method of employing an intelligent agent to engage in dialogue with the target object to generate the general interface source code based on the description information includes: An intelligent agent is used to receive the description information input by the target object and generate initial source code based on the description information; The initial source code is rendered to display the initial components to the target object; Using the aforementioned intelligent agent, when the initial components fail to meet the requirements, new source code is regenerated based on the new description information input by the target object; The new source code is rendered to generate and display new components; The source code corresponding to the new component that meets the requirements shall be used as the general interface source code.
4. The method according to claim 3, wherein, The rendering of the initial source code includes: The initial source code is rendered using the general rendering engine corresponding to the general interface source code.
5. The method according to claim 1, wherein, The step of parsing the general interface source code to obtain the general description data of the target component includes: A pre-defined AST parsing tool is used to parse the general interface source code to obtain general description data of the target component.
6. The method according to claim 5, wherein, The step involves using a pre-defined AST parsing tool to parse the general interface source code to obtain general description data of the target component, including: The source code of the general interface is parsed using a preset AST parsing tool to obtain the AST; The AST is traversed to obtain the description data of the sub-components in the target component; The general description data is generated based on the description data of the sub-components.
7. The method according to claim 1, wherein, The step of obtaining target description data of the target component that conforms to the custom rules based on the basic description data includes: Determine the dynamic content in the target component; Based on the custom rules, description data for the dynamic content is generated; The description data of the dynamic content is added to the basic description data to obtain the target description data.
8. The method according to claim 7, wherein, The dynamic content includes: variables; Determining the dynamic content in the target component includes: The agent is used to analyze multiple attributes of the sub-components in the target component in order to determine the variable among the multiple attributes.
9. The method according to any one of claims 1-8, wherein, The step of generating the target component that conforms to the custom rules based on the target description data includes: The target component is generated by rendering using a rendering engine with built-in custom rules based on the target description data.
10. The method according to claim 9, wherein, The target component includes: Work card template.
11. The method of claim 10, further comprising: Obtain the business data corresponding to the dynamic content in the work card template; The business data is input into the work card template using the built-in custom rule rendering engine to generate the work card.
12. A component generation device based on an intelligent agent, comprising: The source code generation module is used to generate the general interface source code of the target component based on the description information of the target component using an intelligent agent. The parsing module is used to parse the general interface source code to obtain the general description data of the target component; The mapping module is used to map the general description data into basic description data that conforms to custom rules based on a preset mapping relationship. The acquisition module is used to acquire target description data of the target component that conforms to the custom rules based on the basic description data; The component generation module is used to generate the target component that conforms to the custom rules based on the target description data.
13. A component generation system based on intelligent agents, comprising: An intelligent agent is used to generate the generic interface source code of the target component based on the description information of the target component. A parser is used to parse the general interface source code to obtain general description data of the target component; A mapper is used to map the general description data into basic description data that conforms to custom rules according to a preset mapping relationship; A binder is used to obtain target description data of the target component that conforms to the custom rules based on the basic description data; A generator is used to generate the target component that conforms to the custom rules based on the target description data.
14. 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 to enable the at least one processor to perform the method of any one of claims 1-11.
15. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-11.
16. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-11.