Low-code application logic generation method and system based on large language model
By using a low-code platform based on a large language model, a snapshot of natural language requirements and operating environment is obtained, a context is constructed, and logical DSL text is retrieved and generated. This solves the problems of low interaction efficiency and poor maintainability of low-code platforms in the development of complex business logic, and realizes an efficient and visual logic development process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-04-14
AI Technical Summary
Existing low-code platforms suffer from low interaction efficiency, high learning curve, lack of context, and poor maintainability when handling complex business logic, making it difficult to meet the complex business needs of enterprises.
A method based on a large language model is adopted. By obtaining the user's natural language needs and operation environment snapshot, a prompting engineering context is constructed. The large language model is used to retrieve logical components, and a logical DSL text is generated in combination with an intelligent agent. The text is then verified in a sandbox environment, and finally a visual logical flow diagram is generated and the application logic is deployed.
It lowers the barrier to logic development, enabling business personnel without coding knowledge to complete complex business development, improving development efficiency, and enhancing code quality and maintainability through visual displays and sandbox verification.
Smart Images

Figure CN121858094A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of low-code logic development technology, and in particular to a method and system for generating low-code application logic based on a large language model. Background Technology
[0002] In the process of enterprise digital transformation, low-code / no-code platforms are widely popular due to their ability to quickly build application interfaces (UIs). However, when it comes to backend business logic (such as complex approval workflows, data cleansing, and cross-system integration), low-code platforms often reveal their limitations. The traditional drag-and-drop connection method becomes a huge spider web when the logic is complex, making it difficult to maintain; while the embedded script method requires users to have programming skills, which goes against the original intention of low-code. Therefore, there is an urgent need for an intelligent solution that can both lower the threshold for logic development and handle complex business needs. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a low-code application logic generation method and system based on a large language model, which can meet complex business needs and reduce the threshold for logic development.
[0004] To achieve the above objectives, the technical solution adopted by the present invention is as follows: In a first aspect, the present invention provides a low-code application logic generation method based on a large language model, comprising: acquiring a user's natural language requirements and an operating environment snapshot, and constructing a prompting engineering context of the large language model based on the natural language requirements and the operating environment snapshot; performing retrieval using the large language model based on the prompting engineering context to obtain logical components; processing the logical components based on a pre-built intelligent agent to generate logical DSL text; parsing and rendering the logical DSL text to obtain a visual logic flow graph, and updating the logical DSL text in response to the user's modification operation on the visual logic flow graph; verifying the application logic corresponding to the logical DSL text in a sandbox environment based on the logical DSL text, and deploying the application logic to the current application after successful verification.
[0005] Optionally, constructing a prompting engineering context for a large language model based on natural language requirements and an operational environment snapshot includes: identifying the context information of the current application based on the operational environment snapshot; wherein the context information includes: data model context, page component context, and environment context; preprocessing the natural language requirements to obtain user intent and business entities; and constructing a prompting engineering context for a large language model based on user intent, business entities, and context information.
[0006] Optionally, based on the context of the prompting project, a large language model is used for retrieval to obtain logical components, including: vectorizing the natural language requirements and performing semantic retrieval based on a pre-built vector knowledge base to obtain a first candidate logical component; performing inverted index retrieval based on keywords of the natural language requirements to obtain a second candidate logical component; and reordering the first and second candidate logical components based on contextual information to obtain a logical component.
[0007] Optionally, the intelligent agents include: an architect intelligent agent, a development intelligent agent, and a test intelligent agent; the logical components are processed based on the pre-built intelligent agents to generate logical DSL text, including: determining the topology of the application logic through the architect intelligent agent based on natural language requirements and logical components; filling the attribute values of each node in the topology of the application logic through the development intelligent agent to generate logical DSL text; checking the logical DSL text through the test intelligent agent, and returning the error information to the development intelligent agent for rewriting after detecting error information.
[0008] Optionally, the logical DSL text is parsed and rendered to obtain a visual logical flow graph, including: converting the logical DSL text into an abstract syntax tree based on the parsing engine; traversing the abstract syntax tree based on the renderer and instantiating the component corresponding to each node according to the node type of the abstract syntax tree; using an automatic layout algorithm to calculate the coordinates of each node and generating a visual logical flow graph based on the coordinates and components of each node.
[0009] Optionally, based on the logical DSL text, the application logic corresponding to the logical DSL text is verified in a sandbox environment, including: scanning the logical DSL text through a rule engine to check the data type, resource dependencies, and logical completeness of the application logic; obtaining the input parameter structure of the application logic based on a large language model and generating test data based on data constraints; loading the test data and executing the application logic in the sandbox environment, and displaying data snapshots of each node in real time and automatically intercepting abnormal operations during the execution process.
[0010] Optionally, it also includes: collecting application logic execution metrics in real time after the application logic goes online; if an application logic error or timeout is detected, obtaining the exception stack and current input data, and sending the exception stack and current input data to the operation and maintenance big language model after anonymizing them; based on the operation and maintenance big language model and the pre-built knowledge base, determining the exception cause of the application logic error or timeout, and generating a repair plan based on the exception cause.
[0011] Secondly, this invention provides a low-code application logic generation system based on a large language model, comprising: a context construction module for acquiring a user's natural language requirements and an operating environment snapshot, and constructing a prompting engineering context of the large language model based on the natural language requirements and the operating environment snapshot; a retrieval module for performing retrieval using the large language model based on the prompting engineering context to obtain logical components; a DSL generation module for processing the logical components based on a pre-built agent to generate logical DSL text; a visualization orchestration module for parsing and rendering the logical DSL text to obtain a visualized logic flow graph, and updating the logical DSL text in response to the user's modification operation on the visualized logic flow graph; and a verification module for verifying the application logic corresponding to the logical DSL text in a sandbox environment based on the logical DSL text, and deploying the application logic to the current application after successful verification.
[0012] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the steps of the method provided in any of the first aspects above.
[0013] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the steps of the method provided in any of the first aspects above.
[0014] This invention brings the following beneficial effects: The low-code application logic generation method and system based on a large language model provided by this invention first acquires a snapshot of the user's natural language requirements and operating environment, and constructs a prompting engineering context of the large language model based on the snapshot. Second, based on the prompting engineering context, the large language model is used for retrieval to obtain logical components. Next, the logical components are processed based on a pre-built intelligent agent to generate logical DSL text. Then, the logical DSL text is parsed and rendered to obtain a visual logic flow graph, and the logical DSL text is updated in response to the user's modification operation on the visual logic flow graph. Finally, based on the logical DSL text, the application logic corresponding to the logical DSL text is verified in a sandbox environment, and after successful verification, the application logic is deployed to the current application. In the above method, users can describe their requirements using natural language and generate a logical DSL that conforms to low-code platform specifications and references the correct context through a large language model. This can improve development efficiency, lower the threshold for logic development, and enable business personnel who do not understand code to complete the development of complex business logic. At the same time, the generated application logic can be visualized and edited, and pre-execution verification can be performed in an isolated sandbox environment before the logic is officially deployed, thereby improving code quality and maintainability.
[0015] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0016] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0017] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating a low-code application logic generation method based on a large language model, provided for embodiments of the present invention; Figure 2 A flowchart of RAG-based component retrieval and generation provided for an embodiment of the present invention; Figure 3 A flowchart of bidirectional synchronization between DSL and visualization is provided as an embodiment of the present invention; Figure 4 A logic runtime self-healing flowchart is provided for an embodiment of the present invention; Figure 5 A schematic diagram of the structure of a low-code application logic generation system based on a large language model provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Currently, the main solutions for low-code logic development are as follows: (1) Pure visual programming is acceptable for simple logic, but when faced with complex logic containing dozens of branches, loops, and exception handling, the visual flowchart becomes extremely large and unreadable (SpaghettiCode). Moreover, mouse drag-and-drop operation is far less efficient than keyboard input, and the cost of modification is high.
[0021] (2) Code Snippet Embedding: Allows users to write JS / Python code within nodes. While flexible, this significantly raises the barrier to entry, making it difficult for business users to get started. Furthermore, this code is often a black box, unable to be parsed, optimized, or reused by the platform.
[0022] (3) Generic Copilot: such as ChatGPT, which directly generates code. However, the generic model does not understand the private components, data models and DSL specifications of the low-code platform. The generated code often calls non-existent libraries or cannot be recognized by the low-code engine, requiring a lot of manual modification to run.
[0023] (4) Template-based generation: Filling in blanks based on preset templates (such as "approval templates"). This method lacks flexibility and cannot meet the ever-changing customized needs of enterprises.
[0024] In summary, existing technologies suffer from core problems such as low interaction efficiency (cumbersome drag-and-drop), high learning threshold (requires programming knowledge), lack of context (AI does not understand platform-specific knowledge), and poor maintainability (generated logic is difficult to edit).
[0025] Based on this, the present invention provides a low-code application logic generation method and system based on a large language model, which can meet complex business needs and reduce the threshold for logic development.
[0026] To facilitate understanding of this embodiment, a low-code application logic generation method based on a large language model, disclosed in this embodiment of the invention, will first be described in detail. This method can be executed by electronic devices, such as smartphones, computers, and tablets. See also Figure 1 The flowchart shown illustrates a low-code application logic generation method based on a large language model, indicating that the method mainly includes the following steps S101 to S105: Step S101: Obtain a snapshot of the user's natural language requirements and operating environment, and construct a prompting engineering context for the large language model based on the snapshot of the natural language requirements and operating environment.
[0027] In one implementation, the system receives user requests described in natural language, i.e., natural language requests. For example, when the order amount exceeds 10,000 yuan and the inventory is sufficient, the system automatically triggers approval and sends an email. At the same time, the system parses the context information of the current application based on the user's operating environment snapshot (including, but not limited to, existing data model schema, page component status, integrated API list, and current user role), and then structurally assembles the natural language requests and the application's context information to construct a Prompt project context containing a complete semantic environment.
[0028] Step S102: Based on the context of the prompting project, use the large language model to perform retrieval and obtain the logical components.
[0029] In one implementation, to enable the Large Language Model (LLM) to accurately utilize the existing atomic capabilities of the low-code platform (such as email sending nodes and database update nodes), this embodiment of the invention constructs a vector knowledge base (e.g., a component library) of the platform's capabilities. Based on this, according to the user's natural language needs, the system combines the constructed prompting engineering context and utilizes the Large Language Model to perform semantic-based vector retrieval (Dense Retrieval) and keyword-based inverted index retrieval (Sparse Retrieval) in parallel to accurately recall relevant logical components from the component library, including but not limited to: logical nodes (Node), API connectors (Connector), and historical similar logical fragments (Snippets), as reference materials for the LLM.
[0030] Step S103: Process the logic components based on the pre-built intelligent agent to generate logic DSL text.
[0031] In one implementation, the system does not directly generate general-purpose programming code (such as Java / JS), but instead generates a logic domain-specific language (DSL) specific to the low-code platform. In this embodiment, a multi-agent collaborative model can be employed. Based on the recalled logical components, the overall process structure is planned, and the parameter configurations of specific nodes are filled in to generate a logical DSL text. The generated logical DSL text is then checked to ensure it conforms to platform specifications. Here, the DSL is a descriptive language that defines the node structure, connection relationships, and data flow of the logical flow.
[0032] Step S104: Parse and render the logical DSL text to obtain a visual logical flow graph, and update the logical DSL text in response to the user's modification operation on the visual logical flow graph.
[0033] In one implementation, the generated logical DSL text can first be converted into an abstract syntax tree (AST) by a parser, and then mapped into a visual logical flowchart conforming to the low-code platform standard by a rendering engine.
[0034] In this embodiment of the invention, the DSL text and the graphic of the visual logic flow diagram are bidirectionally bound, that is, the logic generated by LLM can be directly rendered as a graphic, and users can edit and modify the visual logic flow diagram, that is, drag and drop each logic component on the canvas to modify it. At the same time, the user's modification of the logic can also be written back to update the logic DSL text in real time, thereby ensuring that what you see is what you get and the AI-generated code is editable.
[0035] Step S105: Based on the logical DSL text, verify the application logic corresponding to the logical DSL text in the sandbox environment, and after the verification is passed, deploy the application logic to the current application.
[0036] In one implementation, before the application logic is formally deployed, the system can perform pre-execution verification in an isolated sandbox environment, including static analysis and dynamic simulation. Static analysis checks for issues such as infinite loops, undefined variable references, and API permission problems; dynamic simulation uses mock data to test-run the generated logic flow, captures runtime errors, and verifies whether the business rules meet expectations. After successful verification, the generated application logic can be deployed to the current application.
[0037] The low-code application logic generation method based on a large language model provided in this invention allows users to describe their requirements using natural language and generate a logic DSL that conforms to low-code platform specifications and references the correct context through a large language model. This improves development efficiency, lowers the threshold for logic development, and enables business personnel who do not understand code to complete the development of complex business logic. At the same time, the generated application logic can be visualized and edited, and pre-execution verification can be performed in an isolated sandbox environment before the logic is officially deployed, thereby improving code quality and maintainability.
[0038] In low-code development environments, user needs are often vague and context-dependent. Simply sending query data to the LLM (Low-Level Model) makes it impossible for the model to determine which table or fields the user wants to query. Therefore, constructing accurate context is crucial for generating logic. Based on this, for step S101 mentioned above—that is, when constructing the prompting engineering context of the large language model based on natural language needs and an operational environment snapshot—the following methods, including but not limited to, can be used: First, based on the snapshot of the operating environment, the context information of the current application is identified; the context information includes: data model context, page component context, and environment context.
[0039] In practice, the front-end IDE plugin captures real-time snapshots of the user's operating environment and identifies the current application's context information, including: (1) Data model context: the entities defined in the current application, the relationships between entities (ER diagram), and the field types (e.g., `Order.amount` is of type Decimal).
[0040] (2) Page component context: Input boxes, buttons, etc. contained in the current page, as well as the bound variable names (such as `Input_CustomerName`).
[0041] (3) Environment context: whether it is a development environment or a production environment, the permissions and roles of the currently logged-in user, and the system's default global variables (such as `CurrentUser.Department`).
[0042] Then, the natural language requirements are preprocessed to obtain user intent and business entities.
[0043] In practical implementation, a finely tuned lightweight LLM (such as Llama-3-8B) is used to construct the intent recognition module, which preprocesses the natural language input from the user, including but not limited to: (1) Intent classification: Determine the user's intent, such as: creating new logic, modifying existing logic, explaining the current logic, etc.
[0044] (2) Entity extraction: Extract key business entities from natural language requirements, for example: extract the action `Trigger`="Approval" and the object `Target`="Finance" from "Notify Finance after approval".
[0045] (3) Ambiguity elimination: If the user enters "update status", the system will detect that there are two fields, "order status" and "user status", and will trigger a question-and-answer mechanism to generate multiple rounds of dialogue to guide the user to eliminate ambiguity.
[0046] Finally, based on user intent, business entities, and contextual information, a prompting engineering context for the large language model is constructed.
[0047] In practical implementation, the Prompt Template technology is used to encapsulate user intent, extracted business entities, and operational environment snapshots into a structured Prompt package, for example: `Task: Generate Logic;Context: {Table: Orders, Fields: [id, status]}; UserQuery: "Update orderstatus to paid"`. The structured input provided in this embodiment of the invention can significantly reduce the illusion rate of LLM.
[0048] Considering that low-code platforms typically have hundreds or thousands of atomic components (such as "sending HTTP requests", "Excel import", and "workflow approval") and private APIs, and that the pre-training data of LLM does not contain this private knowledge, this embodiment of the invention can use Retrieval-augmented Generation (RAG) technology for retrieval. Based on this, this embodiment of the invention pre-constructs a vector knowledge base, including: (1) Component Store: The description documents, input and output parameter definitions, and sample code of all atomic nodes of the platform are vectorized and stored in a vector database (such as Milvus / Weaviate).
[0049] (2) Best Practices Library (Snippet Store): Collects high-quality logical flow fragments that have been verified in the history of the platform (such as "Standard Refund Process" and "OAuth2.0 Authentication Process"), and performs anonymization and semantic indexing.
[0050] Furthermore, for the aforementioned step S102, i.e., when retrieving logical components based on the prompting engineering context using a large language model, it can be implemented in ways including but not limited to the following: First, the natural language requirements are vectorized, and semantic retrieval is performed based on a pre-built vector knowledge base to obtain the first candidate logical component.
[0051] In practice, upon receiving a user's request, the system executes a hybrid retrieval strategy, including semantic retrieval and keyword retrieval. Semantic retrieval involves vectorizing the user's natural language input and searching for the first semantically similar logical component in a vector knowledge base. For example, if the user's request is "notify customers," then logical components such as "SendEmail," "Send SMS," and "DingTalk Notify" are retrieved.
[0052] Then, based on the keywords required by natural language, an inverted index retrieval is performed to obtain the second candidate logical component.
[0053] In practice, keyword retrieval includes: based on the keywords requested by the user, using the BM25 algorithm to retrieve terms that precisely match those keywords from the vector knowledge base, thus obtaining second candidate logical components. For example, if a user mentions the specific API name "SAP_CreateOrder", the corresponding connector will be recalled.
[0054] Finally, based on the context information, the first and second candidate logical components are reordered to obtain the logical components.
[0055] In practice, the list of candidate logical components retrieved through the above-mentioned mixed retrieval often contains dozens of items. In this embodiment of the invention, the components can be reordered based on the current context information to obtain the final logical components. For example, if the current application only integrates the application A plugin, then the weight of the "Application A Notification" component will be higher than that of the "Application B Notification" component.
[0056] In addition, the system introduces dynamic API schema injection. If a user's request involves calling a third-party API (such as Salesforce), the system can retrieve the OpenAPI / Swagger definition of that API in real time and use its summary information as part of the context. Therefore, the LLM can not only know which component the user needs, but also accurately know the parameters that need to be filled in for that component (such as the Header and Body structure).
[0057] To ensure that the generated logic is machine-readable and free of syntax errors, this embodiment of the invention generates a logic DSL text in JSON format defined by the platform, which defines the node structure, connection relationships and data flow of the logic flow.
[0058] In this embodiment of the invention, a multi-agent collaborative architecture is adopted to simulate the workflow of a development team to generate logical DSL text. The agents include: an architect agent, a developer agent, and a test agent (QA agent). Specifically, for the aforementioned step S103, i.e., when generating logical DSL text based on pre-built agents processing logical components, it can be implemented in ways including but not limited to the following: First, based on natural language requirements and logical components, the topology of the application logic is determined through the architect's intelligent agent.
[0059] In practical implementation, the architect agent can plan the skeleton of the logic flow (i.e., application logic) based on the user's natural language requirements and the recalled logical components, and output the topology of the application logic. For example, it can determine that the process is divided into three steps: `data acquisition -> condition judgment -> action execution`, and handle complex control flows (such as `ForEach` loops and `Try-Catch` exception handling).
[0060] Then, by developing intelligent agents to populate the attribute values of each node in the topology of the application logic, a logical DSL text is generated.
[0061] In practical implementation, the developed agent is used to populate the specific attributes of each node. The developed agent can deeply understand the DSL specification, transforming the user's natural language description "amount greater than 100" into the DSL expression `expression:"input.amount>100"`, and can also handle data mapping, for example, mapping the output of the previous node `User.email` to the input of the next node `Receiver`.
[0062] Finally, the test agent checks the logical DSL text, and if any errors are found, the error information is returned to the development agent for rewriting.
[0063] In practical implementation, the test agent is used to check for logical vulnerabilities in the generated logical DSL text. For example, it checks whether a "database connection ID" is not configured before an "update database" node, or checks for data type incompatibility (such as attempting to assign a string to an integer field).
[0064] The three agents mentioned above interact in multiple rounds through shared memory. If the testing agent detects an error, it feeds the error information back to the development agent for rewriting. The "generate-critique-correct" closed-loop mechanism provided in this embodiment of the invention can improve the accuracy of the generation logic.
[0065] For ease of understanding, this embodiment of the invention also provides a flowchart of RAG-based component retrieval and generation, see [link / reference]. Figure 2As shown, taking the user's input natural language description as "query orders in the last seven days" as an example, the user input is vectorized and then vector search is performed to obtain a candidate component list A; the user input keywords "orders" and "query" are extracted, and an inverted index query is performed based on the keywords to obtain a candidate component list B; then the candidate component list A and candidate component list B are mixed and reordered, and the TOP-K components are selected as the recalled components; then, the component schema definition, input, and output are obtained, and the component schema and input are assembled to obtain the Prompt, which generates DSL nodes through LLM inference and configures the node attributes: Table=Orders, Date>Today-7.
[0066] In one implementation, step S104, i.e., parsing and rendering the logical DSL text to obtain a visual logical flow graph, can be achieved in ways including but not limited to the following: First, the logical DSL text is converted into an abstract syntax tree based on the parsing engine.
[0067] Then, the abstract syntax tree is traversed based on the renderer, and the component corresponding to each node is instantiated according to the node type of the abstract syntax tree.
[0068] In practice, after the LLM generates the logical DSL text in JSON format, the parsing engine can convert it into an abstract syntax tree (AST); then the renderer traverses the AST and instantiates the front-end Vue / React components according to the node type.
[0069] Finally, an automatic layout algorithm is used to calculate the coordinates of each node, and a visual logic flow diagram is generated based on the coordinates of each node and the components.
[0070] In practical implementation, the DSL generated by LLM typically does not contain coordinate information. In this embodiment of the invention, the system incorporates an automatic layout algorithm based on DAG (Directed Acyclic Graph) (such as the Sugiyama algorithm), which can automatically calculate the (x, y) coordinates of each node on the canvas and generate a visual logic flow graph based on the coordinates of each node and the components, thereby ensuring that the generated visual logic flow graph has a clear layout, non-intersecting lines, and an intuitive logical flow (such as from left to right or from top to bottom).
[0071] In this embodiment of the invention, in addition to the aforementioned forward mapping of the DSL to a graph, a reverse mapping from the graph to the DSL is also provided. This allows users to fine-tune the visual logic flow graph on the canvas, such as dragging lines to change the execution order or modifying the parameters of a node. After listening to user actions, the front-end editor can modify the AST in memory in real time and serialize it back to the logic DSL text.
[0072] Furthermore, to support a hybrid development model where "AI continues generating logic after the user makes partial modifications," this embodiment of the invention also provides an incremental AST merging algorithm. When the user inputs a natural language requirement again (such as "add an approval before sending an email"), the LLM generates a "Patch DSL" instead of overwriting the entire file. The incremental AST merging algorithm identifies insertion points in the AST and grafts the newly generated node subtree onto the existing logic tree, preserving the parameters manually configured by the user. This fine-grained AST manipulation capability enables seamless human-machine collaboration.
[0073] For ease of understanding, this embodiment of the invention also provides a flowchart of bidirectional synchronization between DSL and visualization, see [link / reference]. Figure 3 As shown, the DSL generated by LLM is first converted into an abstract syntax tree, and each node is forward-rendered as an image by traversing the abstract syntax tree. At the same time, an automatic layout algorithm is used to calculate the coordinates (x, y) of each node, and the logic flow graph is displayed on the front-end visual canvas. Then, the user can drag or modify parameters on the front-end visual canvas. The system updates the in-memory AST through the AST modifier according to the operation event flow, and deserializes it to generate a new DSL text. If logic continues to be generated, the new DSL is used as the context, and the logic flow is incrementally generated by LLM, and the in-memory AST is updated with an AST merging algorithm.
[0074] Considering that the generated application logic must be verified before release, this embodiment of the invention constructs a lightweight browser-side sandbox and a server-side sandbox for verifying the generated application logic. Based on this, for the aforementioned step S104, i.e., when verifying the application logic corresponding to the logical DSL text in the sandbox environment based on the logical DSL text, it can be implemented using methods including but not limited to the following: First, the rule engine scans the logical DSL text to check the data type, resource dependencies, and logical completeness of the application logic.
[0075] In practice, static analysis is performed on the code before execution. A rule engine scans the logical DSL text, performing data type checks, resource dependency checks, and logical completeness checks. Data type checks deduce the data type of the entire chain. For example, if node A outputs a String, but node B requires the input to be a Number, the system will issue a type mismatch warning and suggest inserting a "type conversion" node. Resource dependency checks verify the existence and access permissions of database tables and API keys referenced in the logic. Logical completeness checks detect the presence of "dead code" (scores that will never be executed) or "infinite loops."
[0076] Then, the input parameter structure of the application logic is obtained based on the large language model, and test data is generated based on data constraints.
[0077] Finally, test data is loaded and application logic is executed in the sandbox environment, and data snapshots of each node are displayed in real time during the execution process, and abnormal operations are automatically intercepted.
[0078] In practical implementation, to enable users to more intuitively see the execution effect of the logic, this embodiment of the invention introduces intelligent Mock data generation, which uses a large language model for dynamic simulation execution. Specifically, the input parameter structure of the logic flow (such as the `Order` object) is analyzed through LLM, and multiple sets of test data (JSON payload) are automatically generated based on data constraints (such as amount > 0, date format YYYY-MM-DD).
[0079] The sandbox loads the generated mock data and executes the logic flow step by step. During execution, the currently executed node is highlighted, and a snapshot of the input / output data for each node is displayed in real time in the sidebar. If the logic includes high-risk operations such as "deleting the database," the sandbox will automatically intercept the abnormal operation (Dry Run mode) and only return a simulated "success" status to prevent accidental data deletion.
[0080] In this embodiment of the invention, through sandbox verification, users can quickly confirm whether the logic generated by AI conforms to business intent without contaminating real data.
[0081] In one implementation, during application runtime, the system can continuously monitor the execution logs of the logical flow. When an exception or performance bottleneck occurs, the system can automatically extract the error stack and context data and send them back to the LLM for root cause analysis, automatically generating fix patches or optimization suggestions (such as "suggest adding an index to frequently queried fields"), thus enabling the self-healing and evolution of business logic.
[0082] Based on this, the above method also includes: collecting the execution indicators of the application logic in real time after the application logic goes online; if an application logic error or timeout is detected, obtaining the exception stack and current input data, and sending the exception stack and current input data to the operation and maintenance big language model after de-identification processing; based on the operation and maintenance big language model and the pre-built knowledge base, determining the exception cause of the application logic error or timeout, and generating a repair plan based on the exception cause.
[0083] In practice, after the application logic goes live, the system enters a closed-loop operation and maintenance process of "monitoring-diagnosis-optimization". During the operation monitoring phase, the system's underlying Agent probes collect execution metrics of the logic flow in real time, including but not limited to: execution time, memory usage, API call success rate, and branch coverage.
[0084] During the intelligent diagnostic phase, when frequent errors (such as HTTP 500) or timeouts are detected in a certain logical flow, the system automatically captures the exception stack and current input data, and sends the anonymized exception stack and current input data as a Prompt to the operations LLM. The operations LLM then performs root cause analysis using a knowledge base to determine the cause of the anomaly. For example, if the error is found to be caused by "API rate limiting," the LLM will provide a diagnostic conclusion: "The frequency of third-party API calls is too high, triggering the rate limiting threshold of 100 calls per minute."
[0085] During the optimization phase, the operations and maintenance LLM can generate remediation plans based on the diagnostic results (i.e., the causes of the anomalies), including but not limited to: (1) Configuration hot update: If the parameter is incorrect, the system attempts to automatically generate new configuration parameters and hot reload them.
[0086] (2) Logic refactoring suggestions: If it is an architectural problem (such as calling DB in a loop), the system will generate an optimized DSL (such as changing to batch query) and pop up a window in the IDE to prompt the developer: "N+1 query performance problem detected, it is recommended to optimize to batch processing mode with one click".
[0087] (3) Fault tolerance enhancement: Automatically add "Retry Policy" or "Fallback" logic to unstable API nodes.
[0088] The "monitoring-diagnosis-optimization" operation and maintenance mechanism provided by the embodiments of the present invention gives low-code applications vitality, enabling them to continuously evolve and become more robust as they are used.
[0089] For ease of understanding, this embodiment of the invention also provides a logic runtime self-healing flowchart, see [link / reference]. Figure 4 As shown, during the execution of the logical flow, if an exception occurs, the exception context is captured, including: error stack, input data, current node configuration, etc.; then, the diagnostic agent is used to perform root cause analysis, such as: API rate limiting / type error / parameter missing, etc.; if the exception can be automatically repaired, a configuration patch is generated and the application is hot-updated, triggering automatic retry; otherwise, an optimization suggestion report is generated and pushed to the developer.
[0090] The low-code application logic generation method based on a large language model provided in this invention can transform natural language requirements into platform-specific executable logic DSLs through intent recognition, RAG component retrieval, multi-agent collaboration, and an AST conversion engine. It introduces "Schema constraint decoding" technology, which enforces that the output tokens must conform to the DSL's syntax definition and the current application's schema definition (e.g., reference variables must exist) during LLM inference. This eliminates the illusion of syntactically correct but incorrectly referenced code, making the generated logic not only readable but also 100% compileable and executable.
[0091] The system leverages vector retrieval and inverted indexes to retrieve functional nodes from a private component library and dynamically parses component schema definitions to guide the LLM in generating correct input and output parameter configurations. The system not only retrieves API signatures but also analyzes API documentation comments, historical call logs, and associated test cases through web crawling to build an API usage knowledge graph. When the LLM decides to call an internal API, it knows not only the URL but also that the API typically requires a token and a return value code=200 for success, thus generating business logic that truly conforms to enterprise standards.
[0092] By using an abstract syntax tree (AST) as an intermediate layer, the system achieves lossless conversion and incremental merging between code generated from natural language and graphics generated by user drag-and-drop. The system can accurately locate the AST subtree position corresponding to natural language commands, enabling incremental modifications. Even if the user manually shuffles the canvas layout, the AI-generated logic can intelligently insert itself into the correct gaps and automatically rearrange the layout, achieving a perfect fusion of natural language programming and graphical programming.
[0093] An adversarial network is constructed between a generation agent and a review agent. Based on platform specifications and rules, the generated logical structure undergoes static analysis, vulnerability detection, and automatic correction. The generator attempts to fulfill the requirements, while the reviewer verifies the generated result based on the platform's best practice rule base (e.g., "unhandled null pointer exception" or "excessive loop depth"). Through multiple rounds of dialogue and game theory, the generated logical solution is continuously improved. Compared to single Prompt generation, this mechanism significantly improves accuracy for complex logic (such as nested conditions and transaction processing).
[0094] The system captures execution exception contexts of the logic flow in real time, transmits them back to the large model for root cause analysis, and automatically generates configuration patches or refactoring suggestions to fix runtime errors. This embodiment of the invention introduces LLM into the runtime. When logic execution fails, the system not only logs the error but also feeds the error context to the LLM in real time, dynamically generating "temporary fix patches (Hotfix)" or "retry parameters," greatly improving the stability of the production environment.
[0095] In summary, the above methods can reduce complex logic that previously required hours of drag-and-drop configuration to just seconds of natural language generation, significantly improving development efficiency and shortening delivery cycles. Business personnel do not need to learn programming syntax or the usage of complex logic components, lowering the professional skill threshold. Through multi-agent review and RAG best practice retrieval, the generated logic automatically conforms to enterprise coding standards (such as naming conventions and error handling standards), eliminating the arbitrariness of human coding. The generated logic is stored in a structured DSL, supports visual editing, and has good readability. The schema-based generation mechanism allows the logic to automatically adapt to changes in the data model. By transforming fragmented development processes into reusable logical assets, the vector knowledge base becomes richer with increased usage, and the accuracy of AI generation becomes higher, forming a positive cycle.
[0096] In addition to the low-code application logic generation method based on a large language model provided in the foregoing embodiments, this invention also provides a low-code application logic generation system based on a large language model. (See [link to relevant documentation]). Figure 5 The diagram shown illustrates the structure of a low-code application logic generation system based on a large language model, indicating that the system mainly comprises the following parts: The context building module 501 is used to obtain the user's natural language needs and operating environment snapshot, and to build the prompting engineering context of the large language model based on the natural language needs and operating environment snapshot; The retrieval module 502 is used to retrieve logical components based on the prompting engineering context and using a large language model. DSL generation module 503 is used to process logic components based on a pre-built intelligent agent to generate logical DSL text; The visualization orchestration module 504 is used to parse and render the logical DSL text to obtain a visual logical flow diagram, and to update the logical DSL text in response to the user's modification operation of the visual logical flow diagram. The verification module 505 is used to verify the application logic corresponding to the logical DSL text in a sandbox environment based on the logical DSL text, and to deploy the application logic to the current application after the verification is successful.
[0097] The low-code application logic generation system based on a large language model provided in this invention allows users to describe their requirements using natural language and generate a logic DSL that conforms to low-code platform specifications and references the correct context through a large language model. This improves development efficiency, lowers the threshold for logic development, and enables business personnel who do not understand code to complete the development of complex business logic. At the same time, the generated application logic can be visualized and edited, and pre-execution verification can be performed in an isolated sandbox environment before the logic is officially deployed, thereby improving code quality and maintainability.
[0098] It should be noted that the system provided in this embodiment of the invention has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the system embodiment can be referred to the corresponding content in the aforementioned method embodiment. The specific numerical values provided in the implementation of this invention are merely exemplary and are not intended to limit the scope of the invention.
[0099] This invention also provides an electronic device, specifically, the electronic device includes a processor and a storage device; the storage device stores a computer program, and the computer program, when run by the processor, executes the method described in any of the above embodiments.
[0100] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device 100 includes: a processor 60, a memory 61, a bus 62, and a communication interface 63. The processor 60, the communication interface 63, and the memory 61 are connected through the bus 62. The processor 60 is used to execute executable modules, such as computer programs, stored in the memory 61.
[0101] The memory 61 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 63 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.
[0102] Bus 62 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0103] The memory 61 is used to store programs. After receiving an execution instruction, the processor 60 executes the program. The method executed by the device for defining the flow process disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 60 or implemented by the processor 60.
[0104] Processor 60 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 60 or by instructions in software form. Processor 60 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 61. Processor 60 reads the information in memory 61 and, in conjunction with its hardware, completes the steps of the above method.
[0105] The computer program product of the readable storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, please refer to the foregoing method embodiments, which will not be repeated here.
[0106] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0107] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A low-code application logic generation method based on a large language model, characterized in that, include: Obtain the user's natural language requirements and operating environment snapshot, and construct the prompting engineering context of the large language model based on the natural language requirements and operating environment snapshot; Based on the aforementioned prompting engineering context, a large language model is used for retrieval to obtain logical components; The logic components are processed based on a pre-built intelligent agent to generate logical DSL text; The logical DSL text is parsed and rendered to obtain a visual logical flow graph, and the logical DSL text is updated in response to the user's modification operation on the visual logical flow graph; Based on the logical DSL text, the application logic corresponding to the logical DSL text is verified in a sandbox environment, and after the verification is passed, the application logic is deployed to the current application.
2. The method according to claim 1, characterized in that, The prompting engineering context for constructing a large language model based on the natural language requirements and the snapshot of the operating environment includes: Based on the snapshot of the operating environment, the context information of the current application is identified; wherein, the context information includes: data model context, page component context, and environment context; The natural language requirements are preprocessed to obtain user intent and business entities; Based on the user intent, the business entity, and the context information, construct the prompting engineering context of the large language model.
3. The method according to claim 2, characterized in that, Based on the aforementioned prompting engineering context, a large language model is used for retrieval to obtain logical components, including: The natural language requirements are vectorized, and semantic retrieval is performed based on a pre-built vector knowledge base to obtain the first candidate logical component; Based on the keywords of the natural language requirements, an inverted index retrieval is performed to obtain the second candidate logical component; Based on the context information, the first candidate logical component and the second candidate logical component are reordered to obtain a logical component.
4. The method according to claim 1, characterized in that, The intelligent agents include: an architect intelligent agent, a development intelligent agent, and a test intelligent agent; based on the pre-built intelligent agents, the logical components are processed to generate logical DSL text, including: Based on the natural language requirements and the logical components, the topology of the application logic is determined by the architect agent; The development agent fills in the attribute values of each node in the topology of the application logic to generate a logic DSL text. The test agent checks the logical DSL text and, upon detecting errors, returns the error information to the development agent for rewriting.
5. The method according to claim 1, characterized in that, The logical DSL text is parsed and rendered to obtain a visual logical flow graph, including: The logical DSL text is converted into an abstract syntax tree based on the parsing engine; The abstract syntax tree is traversed based on the renderer, and the component corresponding to each node is instantiated according to the node type of the abstract syntax tree. An automatic layout algorithm is used to calculate the coordinates of each node and generate a visual logic flow diagram based on the coordinates of each node and its components.
6. The method according to claim 1, characterized in that, Based on the logical DSL text, the application logic corresponding to the logical DSL text is verified in a sandbox environment, including: The rule engine scans the logical DSL text to check the data type, resource dependencies, and logical completeness of the application logic. The input parameter structure of the application logic is obtained based on the large language model, and test data is generated based on data constraints. The test data is loaded and the application logic is executed in the sandbox environment. During the execution, a data snapshot of each node is displayed in real time and abnormal operations are automatically intercepted.
7. The method according to claim 1, characterized in that, Also includes: After the application logic is launched, the execution metrics of the application logic are collected in real time. If an error or timeout is detected in the application logic, the exception stack and current input data are obtained, and after the exception stack and current input data are anonymized, they are sent to the operation and maintenance big language model. Based on the aforementioned large-scale operation and maintenance language model and the pre-built knowledge base, the abnormal reasons for the application logic errors or timeouts are determined, and a repair plan is generated based on the abnormal reasons.
8. A low-code application logic generation system based on a large language model, characterized in that, include: The context building module is used to obtain the user's natural language requirements and operating environment snapshot, and to build the prompting engineering context of the large language model based on the natural language requirements and the operating environment snapshot; The retrieval module is used to perform retrieval based on the prompting engineering context using a large language model to obtain logical components; A DSL generation module is used to process the logic components based on a pre-built intelligent agent to generate logical DSL text; The visualization orchestration module is used to parse and render the logical DSL text to obtain a visual logical flow diagram, and update the logical DSL text in response to the user's modification operation on the visual logical flow diagram; The verification module is used to verify the application logic corresponding to the logical DSL text in a sandbox environment based on the logical DSL text, and deploy the application logic to the current application after the verification is successful.
9. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the steps of the method described in any one of claims 1 to 7.
Citation Information
Cited By
Intelligent tracing and automatic detection method and system for vulnerability of power information system based on LLM
CN122174245A
Intelligent tracing and automatic detection method and system for vulnerability of power information system based on LLM
CN122174245B
Workflow automatic generation method and system based on multi-agent and sandbox microcirculation
CN122240080A
A Method and System for Automatic Workflow Generation Based on Multi-Agent and Sandbox Micro-Circulation
CN122240080B