An Internet of Things project end-to-end automatic generation method and device based on a large language model
Patent Information
- Application Number
- CN202610923926.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-25
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2046-06-25
AI Technical Summary
但这些工具的工作粒度限于代码片段或单个函数,无法让用户便捷地生成包含设备对接、业务逻辑、前后端界面、数据库设计在内的完整可运行IoT项目
[0106] The end-to-end automatic generation method and apparatus for IoT projects based on a large language model provided in this application can automatically complete the entire chain of automation from requirement understanding, IoT capability identification and encoding, code generation to runnable project output based on the natural language requirement description input by the user, without requiring the user to manually write complete code, thus improving project development efficiency.
Smart Images

Figure CN122450466B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the interdisciplinary fields of Internet of Things, artificial intelligence, software engineering, and large language models, and in particular to an end-to-end automatic generation method and apparatus for Internet of Things projects based on large language models. Background Technology
[0002] Currently, the development of Internet of Things (IoT) industry projects mainly relies on the following technical paths:
[0003] Path 1: Traditional manual coding development. Developers need to understand and code to interface with various IoT device protocols (such as ISAPI, OTAP, GB / T 28181, etc.), AI algorithm interfaces, and cloud service application programming interfaces (APIs). The entire development process includes multiple stages such as requirements analysis, architecture design, coding implementation, integration testing, packaging, and deployment, each requiring deep involvement of professional developers. The development cycle for a medium-sized IoT industry project (such as a comprehensive security platform or video inspection system) typically takes several weeks to several months. Path 2: Low-code development platforms. These platforms lower the barrier to application development through visual drag-and-drop and component orchestration. However, these low-code development platforms are mainly geared towards general enterprise management applications (such as forms, approval workflows, and reports), lacking deep integration with vertical domain capabilities such as IoT device protocols and AI algorithms. Developers still need to manually write a large amount of device interface code. Path 3: AI-assisted programming tools. These tools can provide capabilities such as code snippet completion, function-level code generation, and code error correction. However, these tools are limited to code snippets or single functions, making it difficult for users to easily generate complete and functional IoT projects that include device integration, business logic, front-end and back-end interfaces, and database design.
[0004] It is evident that existing IoT industry project development still requires users to manually write complete code, resulting in low development efficiency. Summary of the Invention
[0005] The purpose of this application is to provide a method and apparatus for end-to-end automatic generation of IoT projects based on a large language model, so as to realize the end-to-end conversion of user-input natural language into complete project code, thereby improving the development efficiency of IoT projects. The specific technical solution is as follows:
[0006] In a first aspect of this application, an end-to-end automatic generation method for IoT projects based on a large language model is provided, the method comprising:
[0007] Obtain project requirement text, wherein the project requirement text is used to describe the requirements of the Internet of Things project in natural language;
[0008] The large language model is invoked to parse the project requirement text to obtain the structured requirement information of the Internet of Things project. The structured requirement information is used to represent the project type, the Internet of Things devices involved, the required capabilities, and the execution logic of the Internet of Things project.
[0009] In the preset skill repository, find the skill module that semantically matches the structured requirement information and use it as the target skill module;
[0010] Analyze the compatibility and dependencies between the target skill modules to obtain the calling order of the target skill modules and the data flow between them;
[0011] The target project code for the Internet of Things project is generated by calling the large language model based on the structured requirement information, the calling order, the data flow direction, and the description information of each target skill module.
[0012] Upon receiving a confirmation instruction for the target project code, a version baseline for the IoT project is generated based on the target project code.
[0013] In one possible embodiment, the description information is used to represent the interface specifications and constraints of the skill module, and the description information includes example code snippets;
[0014] The invocation of the large language model, based on the structured requirement information, the invocation order, the data flow direction, and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including:
[0015] The large language model is invoked, and based on the description information of each target skill module, interface code that conforms to the interface specification and the constraints is generated;
[0016] By invoking the large language model, and based on the structured requirement information, the invocation order, and the data flow, the target project code of the IoT project, which integrates the docking code, is generated.
[0017] In one possible embodiment, the method further includes:
[0018] Test the target project code and display the test results;
[0019] Upon receiving modified text, a large language model is invoked to modify the target project code based on the modified text, resulting in new target project code. The modified text is a description of the modification requirements for the target project code in natural language.
[0020] The version baseline cannot be modified after it is generated, and the method further includes:
[0021] Whenever new target project code is generated, a version identifier is set for the newly generated target project code, and the version identifier, a snapshot of the target project code, and the dialogue records during the generation of the target project code are associated. The version identifier set each time is different.
[0022] Upon receiving a rollback instruction, copy the project code identified by the version identifier indicated by the rollback instruction as the new target project code, and configure a new version identifier for the new target project code.
[0023] After generating the version baseline, configure the dialog records associated with the version identifier as read-only.
[0024] In one possible embodiment, the method further includes:
[0025] Determine the text size of the project requirements text, and predict the number of skill modules and project complexity that the IoT project depends on based on the project requirements text.
[0026] A comprehensive score is calculated based on the text size, the number of items, and the project complexity, wherein the comprehensive score is positively correlated with the text size, the number of items, and the project complexity.
[0027] If the overall score is lower than a preset score threshold, the step of calling the large language model to parse the project requirement text and obtain the structured requirement information of the Internet of Things project is executed.
[0028] If the overall score is not lower than the preset score threshold, the target project code for the IoT project is generated in stages through the requirements analysis stage, the solution design stage, and the code generation stage.
[0029] In one possible embodiment, the step of generating the target project code for the IoT project in stages—requirements analysis, solution design, and code generation—includes:
[0030] The large language model is invoked to generate and display a list of questions based on the project requirement text, wherein the list of questions is used to describe the ambiguities and missing items in the project requirement text;
[0031] Get the text of the answer to the question list;
[0032] By calling the large language model and integrating the project requirement text and the answer text, a complete requirement specification text is obtained, wherein the complete requirement specification text is used to describe the requirements of the Internet of Things project;
[0033] The large language model is invoked to generate a solution design text based on the complete requirements specification text, wherein the solution design text is used to describe the functional module division and interaction process design of the Internet of Things project;
[0034] The large language model is invoked to determine the capabilities required to implement the IoT project based on the scheme design text, and a skill module that matches the capability is searched in a preset skill warehouse as the target skill module;
[0035] The large language model is invoked to generate technical design text based on the scheme and determine the technology stack used by the Internet of Things project. The technical design text is used to describe the technical structure, module breakdown and interface design of the Internet of Things project.
[0036] The large language model is invoked, and the text and technology stack are designed based on the technology. The target skill modules are arranged into the target project code of the Internet of Things project. The text generated in each stage enters the next stage after confirmation. If a rollback instruction is received for the text, the previous stage is returned to regenerate the text.
[0037] In one possible embodiment, the method further includes:
[0038] If a mode adjustment instruction is received during execution in Vibe mode or Spec mode, the existing development context is retained and the system switches to Spec mode or Vibe mode to continue generating the target project code for the IoT project.
[0039] Specifically, the Vibe mode is the code generation mode for the target project when the overall score is lower than a preset score threshold, and the Spec mode is the code generation mode for the target project when the overall score is not lower than the preset score threshold.
[0040] In one possible embodiment, each skill module in the preset skill warehouse is preset with a capability type label, a device type label, and a brief description, wherein the capability type label is used to identify the capability type possessed by the skill module, and the device type label is used to identify the device type to which the skill module is applicable;
[0041] The process of finding skill modules that semantically match the structured requirement information, as target skill modules, includes:
[0042] For each capability represented by the structured requirement information, the matching degree between each skill module in the preset skill warehouse and the capability is calculated. The matching degree is positively correlated with the similarity between the capability type tag and the capability, positively correlated with the similarity between the device type tag and the IoT device involved in the capability, and positively correlated with the semantic similarity between the brief description information and the capability.
[0043] Skill modules that meet the preset screening criteria for matching degree with each of the aforementioned abilities are identified as target skill modules.
[0044] In one possible embodiment, the method further includes:
[0045] Obtain prototype projects selected from a preset project prototype library, wherein the project requirement text is used to describe the differences in requirements between the IoT project and the prototype project in natural language;
[0046] The invocation of the large language model, based on the structured requirement information and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including:
[0047] By invoking the large language model, and based on the structured requirement information and the description information of each target skill module, the project code of each target skill module and the prototype project is rearranged into the target project code of the Internet of Things project.
[0048] In one possible embodiment, obtaining the project requirements text includes:
[0049] Receive input raw requirement text, which is used to describe the requirements of the Internet of Things project in natural language;
[0050] Obtain a preset industry scenario template for the IoT project, and use it as the target industry scenario template;
[0051] The large language model is invoked to expand the original requirement text based on the target industry scenario template, thereby obtaining the project requirement text.
[0052] In one possible embodiment, tags are pre-set for various industry scenarios, and the step of obtaining a preset industry scenario template for the IoT project, as the target industry scenario template, includes:
[0053] Determine the matching degree between the original requirement text and the tags of each industry scenario;
[0054] If the maximum value of the matching degree is greater than the preset upper limit threshold, then the industry scenario template preset for the industry scenario with the highest matching degree is obtained as the target industry scenario template.
[0055] If the maximum value of the matching degree is not greater than the preset upper limit threshold, then the preset industry scene templates for each industry scenario are displayed, and upon receiving a selection instruction, the industry scene template selected by the selection instruction is determined as the target industry scene template.
[0056] In a second aspect of this application, an end-to-end automatic generation device for IoT projects based on a large language model is provided, the device comprising:
[0057] A requirement receiving module is used to obtain project requirement text, wherein the project requirement text is used to describe the requirements of the Internet of Things project in natural language;
[0058] The requirement parsing module is used to call the large language model to parse the project requirement text to obtain the structured requirement information of the Internet of Things project. The structured requirement information is used to represent the project type, the Internet of Things devices involved, the required capabilities, and the execution logic of the Internet of Things project.
[0059] The skill matching module is used to search for skill modules in a preset skill repository that semantically match the structured requirement information, and use them as target skill modules.
[0060] The skill orchestration module is used to analyze the compatibility and dependencies between the target skill modules, and to obtain the calling order of the target skill modules and the data flow between the target skill modules.
[0061] The code generation module is used to generate target project code for the Internet of Things project based on the structured requirement information, the calling order, the data flow direction, and the description information of each target skill module.
[0062] The baseline generation module is used to generate a version baseline of the IoT project based on the target project code upon receiving a confirmation instruction for the target project code.
[0063] In one possible embodiment, the description information is used to represent the interface specifications and constraints of the skill module, and the description information includes example code snippets;
[0064] The invocation of the large language model, based on the structured requirement information, the invocation order, the data flow direction, and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including:
[0065] The large language model is invoked, and based on the description information of each target skill module, interface code that conforms to the interface specification and the constraints is generated;
[0066] By invoking the large language model, and based on the structured requirement information, the invocation order, and the data flow direction, the target project code of the IoT project, which integrates the docking code, is generated.
[0067] In one possible embodiment, the device further includes a sandbox running module for testing the target project code and displaying the test results;
[0068] The dialogue iteration module is used to call a large language model to modify the target project code based on the modified text when a modified text is received, so as to obtain a new target project code. The modified text is a modification requirement for the target project code described in natural language.
[0069] In one possible embodiment, the version baseline cannot be modified after it is generated. The device further includes a two-layer version management module, which is used to set a version identifier for the newly generated target project code whenever new target project code is generated, and associate the version identifier, a snapshot of the target project code, and the dialogue records during the generation of the target project code, wherein the version identifier set each time is different.
[0070] Upon receiving a rollback instruction, copy the project code identified by the version identifier indicated by the rollback instruction as the new target project code, and configure a new version identifier for the new target project code.
[0071] After generating the version baseline, configure the dialog records associated with the version identifier as read-only;
[0072] In one possible embodiment, the device further includes a dual-mode scheduling module for determining the text size of the project requirement text and predicting the number of skill modules and project complexity on which the IoT project depends based on the project requirement text.
[0073] A comprehensive score is calculated based on the text size, the number of items, and the project complexity, wherein the comprehensive score is positively correlated with the text size, the number of items, and the project complexity.
[0074] If the overall score is lower than a preset score threshold, the step of calling the large language model to parse the project requirement text and obtain the structured requirement information of the Internet of Things project is executed.
[0075] If the overall score is not lower than the preset score threshold, the target project code for the IoT project is generated in stages through the requirements analysis stage, the solution design stage, and the code generation stage.
[0076] In one possible embodiment, the step of generating the target project code for the IoT project in stages—requirements analysis, solution design, and code generation—includes:
[0077] The large language model is invoked to generate and display a list of questions based on the project requirement text, wherein the list of questions is used to describe the ambiguities and missing items in the project requirement text;
[0078] Get the text of the answer to the question list;
[0079] By calling the large language model and integrating the project requirement text and the answer text, a complete requirement specification text is obtained, wherein the complete requirement specification text is used to describe the requirements of the Internet of Things project;
[0080] The large language model is invoked to generate a solution design text based on the complete requirements specification text, wherein the solution design text is used to describe the functional module division and interaction process design of the Internet of Things project;
[0081] The large language model is invoked to determine the capabilities required to implement the IoT project based on the scheme design text, and a skill module that matches the capability is searched in a preset skill warehouse as the target skill module;
[0082] The large language model is invoked to generate technical design text based on the scheme and determine the technology stack used by the Internet of Things project. The technical design text is used to describe the technical structure, module breakdown and interface design of the Internet of Things project.
[0083] The large language model is invoked, and the text and technology stack are designed based on the technology. The target skill modules are arranged into the target project code of the Internet of Things project. The text generated in each stage enters the next stage after confirmation. If a rollback instruction is received for the text, the previous stage is returned and the text is regenerated.
[0084] In one possible embodiment, the dual-mode scheduling module is further configured to retain the existing development context and switch to Spec mode or Vibe mode to continue generating the target project code of the IoT project when a mode adjustment instruction is received during the execution of Vibe mode or Spec mode;
[0085] Wherein, the Vibe mode is the generation mode of the target project code when the aforementioned comprehensive score is lower than the preset score threshold, and the Spec mode is the generation mode of the target project code when the aforementioned comprehensive score is not lower than the preset score threshold;
[0086] In one possible embodiment, each skill module in the preset skill warehouse is preset with a capability type label, a device type label, and a brief description, wherein the capability type label is used to identify the capability type possessed by the skill module, and the device type label is used to identify the device type to which the skill module is applicable;
[0087] The process of finding skill modules that semantically match the structured requirement information, as target skill modules, includes:
[0088] For each capability represented by the structured requirement information, the matching degree between each skill module in the preset skill warehouse and the capability is calculated. The matching degree is positively correlated with the similarity between the capability type tag and the capability, positively correlated with the similarity between the device type tag and the IoT device involved in the capability, and positively correlated with the semantic similarity between the brief description information and the capability.
[0089] Skill modules that meet the preset screening conditions for matching degree with each of the aforementioned abilities are identified as target skill modules;
[0090] In one possible embodiment, the device further includes a cloning and customization module for acquiring prototype projects selected from a preset project prototype library, wherein the project requirement text is used to describe in natural language the differences in requirements between the IoT project and the prototype project.
[0091] The invocation of the large language model, based on the structured requirement information and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including:
[0092] By invoking the large language model, and based on the structured requirement information and the description information of each target skill module, the project code of each target skill module and the prototype project is rearranged into the target project code of the Internet of Things project;
[0093] In one possible embodiment, obtaining the project requirements text includes:
[0094] Receive input raw requirement text, which is used to describe the requirements of the Internet of Things project in natural language;
[0095] Obtain a preset industry scenario template for the IoT project, and use it as the target industry scenario template;
[0096] The large language model is invoked to expand the original requirement text based on the target industry scenario template, thereby obtaining the project requirement text;
[0097] In one possible embodiment, tags are pre-set for various industry scenarios, and the step of obtaining a preset industry scenario template for the IoT project, as the target industry scenario template, includes:
[0098] Determine the matching degree between the original requirement text and the tags of each industry scenario;
[0099] If the maximum value of the matching degree is greater than the preset upper limit threshold, then the industry scenario template preset for the industry scenario with the highest matching degree is obtained as the target industry scenario template.
[0100] If the maximum value of the matching degree is not greater than the preset upper limit threshold, then the preset industry scene templates for each industry scenario are displayed, and upon receiving a selection instruction, the industry scene template selected by the selection instruction is determined as the target industry scene template.
[0101] In a third aspect of this application, an electronic device is provided, comprising:
[0102] Memory, used to store computer programs;
[0103] When a processor executes a program stored in memory, it implements any of the methods described in the first aspect above.
[0104] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the methods described in the first aspect above.
[0105] Beneficial effects of the embodiments in this application:
[0106] The end-to-end automatic generation method and apparatus for IoT projects based on a large language model provided in this application can automatically complete the entire chain of automation from requirement understanding, IoT capability identification and encoding, code generation to runnable project output based on the natural language requirement description input by the user, without requiring the user to manually write complete code, thus improving project development efficiency.
[0107] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0108] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0109] Figure 1A flowchart illustrating an end-to-end automatic generation method for IoT projects based on a large language model, provided in this application;
[0110] Figure 2 A schematic diagram illustrating the version identification rollback provided in this application;
[0111] Figure 3 A flowchart illustrating another method for automatically generating IoT projects based on a large language model, provided in this application;
[0112] Figure 4 A schematic diagram illustrating the deep cloning and customization methods provided in this application;
[0113] Figure 5 A diagram illustrating the method for generating project requirement texts for this application;
[0114] Figure 6 A schematic diagram of the two-tier version identification management system provided in this application;
[0115] Figure 7 A schematic diagram of the structure of an end-to-end automatic generation device for IoT projects based on a large language model provided in this application;
[0116] Figure 8 A schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0117] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0118] This application provides an end-to-end automatic generation method for large language models in IoT projects, such as... Figure 1 As shown, it includes:
[0119] Step S101: Obtain the project requirement text; Step S102: Call the large language model to parse the project requirement text and obtain the structured requirement information of the IoT project; Step S103: In the preset skill repository, find the skill module (Skill) that semantically matches the structured requirement information as the target skill module; Step S104: Analyze the compatibility and dependency relationships between the target skill modules to obtain the calling order of each target skill module and the data flow between them; Step S105: Call the large language model to generate the target project code for the IoT project based on the structured requirement information, calling order, data flow, and description information of the target skill modules; Step S106: Upon receiving a confirmation instruction for the target project code, generate the version baseline of the IoT project based on the target project code. This system can automatically complete the entire chain from requirement understanding, IoT capability identification and encoding, code generation to runnable project output based on user-input natural language requirement descriptions, eliminating the need for users to manually write complete code and improving project development efficiency.
[0120] The following will explain steps S101 to S106 respectively:
[0121] In step S101 of this embodiment, the project requirement text is used to describe the requirements of the Internet of Things project in natural language. In one possible example, the project requirement text can be "Please generate an inspection project based on all cameras under my account, inspect once every 5 minutes, check whether there is any violation of not wearing a safety helmet in the picture, and automatically take a screenshot and push an alarm notification when a violation is found."
[0122] Project requirement text can be entered directly by the user via voice or keyboard, or it can be expanded by artificial intelligence based on the user's input.
[0123] In step S102 of this embodiment, the large language model can be a large language model of any structure, including but not limited to the General Language Model (GLM), Deepseek, and Generative Pre-trained Transformer (GPT).
[0124] Structured requirements information is used to represent the project type, involved IoT devices, required capabilities, and execution logic of an IoT project, and this information should be represented in a structured data format. For example, the structured information obtained from parsing the project requirements text in the aforementioned example is shown below:
[0125] { "project_type": "Web service", "devices": ["Cameras (all under user account)"], "capabilities_needed": [ "Device list query", "Video stream screenshot", "AI safety helmet detection", "Scheduled task", "Alarm notification push"], "business_logic": "Perform a patrol inspection of all cameras every 5 minutes, call AI to detect whether safety helmets are worn, take screenshots and push alarms when violations occur", "data_storage": "Inspection records, violation records, and screenshot storage"}
[0126] In the example above, "Web service" is the project type, "cameras (all under user account)" is the IoT device involved, "device list query", "video stream screenshot", "AI safety helmet detection", "scheduled task scheduling", "alarm notification push" are the required capabilities, and "perform an inspection of all cameras every 5 minutes, call AI to detect whether safety helmets are worn, take screenshots and push alarms when violations occur" is the execution logic.
[0127] In step S103, the skill modules that semantically match the structured requirements are those that can implement the functions represented in the structured requirements information and are applicable to the devices represented in the structured requirements information. For example, taking the structured requirements information in the aforementioned example as an example, the skill modules that semantically match it are: the Device-List module, the Video-Capture module, and the Helper-Dection module. The Device-List module has the function of querying a device list, the Video-Capture module has the function of taking screenshots of video streams, and the Helper-Dection module has the function of detecting AI safety helmets.
[0128] In step S104, by determining the calling order of the target skill modules and the data flow between them, the orchestration of each target skill module can be realized, preparing for subsequent code generation.
[0129] In step S105, the target project code is the complete project code, including backend services, frontend interface, database, and device integration code. Taking the structured requirement information from the previous example as an example, the backend service code includes: the development framework code, code containing scheduled task handling, device traversal, and skill module call logic; the frontend interface code includes: code related to the inspection record list, violation details viewing, and real-time alarm display; the database includes: the search engine code and code related to the inspection record table and violation record table; and the device integration code includes: API call code based on the Device-List module, Video-Capture module, and Helper-Dection module. How this API call code is generated will be explained below and will not be repeated here.
[0130] In step S106, the confirmation instruction can be entered by the user after browsing the target project code, or it can be entered by the user after testing the target project code, such as sandbox testing, and the test is passed. When the confirmation instruction is received, it can be considered that the user is sufficiently satisfied with the target project code, and therefore a formal version baseline can be generated based on the target project code.
[0131] In one possible embodiment, the description information is used to represent the interface specifications and constraints of the skill module, and includes example code snippets. This description information is pre-written by the user in a markup language, such as Markdown (a lightweight markup language). The interface specifications include: descriptions of the skill module's input parameters and output format; the constraints include: restrictions on skill module invocation, error handling specifications, and example code snippets. To distinguish it from the brief description information used below, the description information here will be referred to as the complete description information. In this example, the aforementioned step S105 includes:
[0132] By invoking a large language model and generating interface code that conforms to interface specifications and constraints based on complete descriptions of each target skill module, and by invoking the large language model again and generating target project code for an IoT project integrating interface code based on structured requirement information, invocation order, and data flow, this embodiment can automatically generate interface code according to interface specifications and constraints using a large language model, thus improving the reliability of the interface code.
[0133] In this embodiment, since the complete description information describes the interface specifications and constraints as well as example code snippets, the large language model can understand these interface specifications and constraints and learn from the code examples during the process of generating interface code. It can then generate interface code that conforms to these interface specifications and constraints based on the learned examples. Because the interface code conforms to the interface specifications and constraints, the possibility of errors in the interface code is low, that is, its reliability is high.
[0134] In one possible embodiment, after generating the target project code, the method further includes:
[0135] The target project code is tested and the test results are displayed. Upon receiving modified text, a large language model is invoked to modify the target project code based on the modified text, resulting in new target project code. Using this embodiment, testing can be performed after the target project code is generated, and users can further control the large language model to modify the project code using natural language based on the test results, making the project code more closely match the user's actual needs.
[0136] In this embodiment, the target project code can be deployed to a sandbox environment for execution, and its correctness can be verified through functional testing, unit testing, and other methods. The modification text is a request for modification to the target project code described in natural language. For example, assuming the generated target project code specifies a check every 10 minutes, and after viewing the test results, the user feels that the 10-minute check interval is too long, they can input the modification text "reduce the check frequency from once every 10 minutes to once every 5 minutes". The modification text can be input by the user after seeing the test results, or it can be input at any stage during the target project code generation process.
[0137] After generating the new target project code, the new first code can be tested again and the test results can be displayed. After receiving new modification text, the target project code can be further modified. This process is repeated until the user is satisfied with the target project code after viewing the test results and enters the confirmation command.
[0138] In one possible embodiment, the version baseline cannot be modified after its generation. Building upon the aforementioned embodiments, the method further includes: whenever new target project code is generated, setting a version identifier for the newly generated target project code and associating the version identifier, the target project code, and the dialogue records during the generation of the target project code; upon receiving a rollback instruction, copying the project code identified by the version identifier indicated by the rollback instruction as the new target project code, and configuring a new version identifier for the new target project code; and configuring the dialogue records associated with the version identifier as read-only after generating the version baseline. Using this embodiment, different version identifiers can be configured for different versions of target project code, while associating the version identifier, dialogue records, and code snapshots. Once the version baseline is generated, the version baseline and the dialogue records associated with the version identifier cannot be changed, facilitating rollback and subsequent retrospective analysis during project development. Furthermore, rollback does not overwrite the original version of the target project code, making it easier for users to manage different versions of target project code, thereby further improving project development efficiency.
[0139] Version identifiers can be a set of progressive numbers. For example, the version identifier for the first generated target project code is Build1, the version identifier for the second generated target project code is Build2, and so on. In this way, users can know which generation of the target project code it is based on the version identifier.
[0140] The rollback command is entered by the user when they need to roll back the version of the target project code. For example, suppose the target project code of Build 1 is the first target project code generated. The target project code stipulates that a check is performed every 10 minutes. After viewing the test results of the target project code of Build 1, the user feels that the 10-minute check interval is too long. So, by modifying the text-driven large language model, the check frequency is increased to once every 5 minutes, resulting in the target project code of Build 2. After viewing the test results of the target project code of Build 1, the user finds that the original 10-minute check is still better. Therefore, the user enters the rollback command to roll back the target project code to Build 1.
[0141] Upon receiving a rollback command, instead of simply using the old version of the target project code as the new version, a copy of the old target project code is made and used as the new version's target project code. Furthermore, a new version identifier is configured for the new target project code, allowing subsequent tracing back to this rollback based on the version identifier. For example, taking the aforementioned rollback command to roll back the target project code to Build 1 as an example, in this case... Figure 2As shown, the target project code of Build 1 will be copied as the target project code of Build 3. If the user continues to make modifications after the rollback, the version numbers of the target project code generated in subsequent iterations will be Build 4, Build 5, and so on.
[0142] In one possible embodiment, the end-to-end automatic generation method for IoT projects based on a large language model provided in this application, such as... Figure 3 As shown, in Figure 1 In addition to what is shown, it also includes:
[0143] Step S107: Determine the text size of the project requirements text and predict the number of skill modules and project complexity required for the IoT project based on the text. Step S108: Calculate a comprehensive score based on the text size, number of modules, and project complexity. If the comprehensive score is lower than a preset score threshold, proceed to step S102. Step S109: If the comprehensive score is not lower than the preset score threshold, generate the target project code for the IoT project in stages, including the requirements analysis stage, solution design stage, and code generation stage. Using this embodiment, the code generation method can be adaptively selected according to the complexity of user requirements. When user requirements are relatively simple, the target project code can be generated quickly and directly in an end-to-end manner. When user requirements are more complex, a more suitable target project code can be generated in a staged manner.
[0144] In step S107 of this embodiment, the text size can refer to the number of words in the project requirement text or the number of pages in the project requirement text. The project complexity depends on whether the project involves multi-terminal interaction, complex database design, or multi-device collaboration. The more of these factors involved, the higher the project complexity.
[0145] In step S108, the overall score is positively correlated with text size, number of items, and project complexity. This can be achieved by first calculating the scores for text size, number of items, and project complexity of the project requirement texts separately, and then weighted and summing these scores to obtain the overall score. For example, when the text size exceeds one A4 page, the text size score is determined as the first score; when the text size is less than one A4 page, the text size score is determined as the second score, where the first score is higher than the second score. Similarly, when the number of items is greater than five, the number score is determined as the third score; when the number of items is less than or equal to five, the number score is determined as the fourth score, where the third score is higher than the fourth score.
[0146] In step S109, the step-by-step approach of requirements analysis, solution design, and code generation allows the large language model to better understand the user's needs. Since a higher overall score indicates that the user's needs are more complex, only by fully understanding the user's needs can project code that meets the user's actual needs be generated. Therefore, in this case, this step-by-step approach is needed to generate the target project code.
[0147] In this paper, the phased approach to generating target project code is referred to as the Spec mode, while the end-to-end code generation mode following steps S102 to S105 is referred to as the Vibe mode. By selecting this embodiment, the Spec mode and Vibe mode can be adaptively recommended to the user, allowing for the generation of code using a mode more suitable for the user.
[0148] In one possible embodiment, the specific implementation of the aforementioned Spec pattern includes:
[0149] Requirements Analysis and Clarification Phase: Using a large language model, generate and display a question list based on the project requirements text. This question list describes any ambiguities or missing items in the project requirements text. Obtain the answer text for the question list input. Using the large language model, integrate the project requirements text and answer text to obtain the complete requirements specification text, which describes the requirements of the IoT project. Solution Design Phase: Using the large language model, generate a solution design text based on the complete requirements specification text. This solution design text describes the functional module division and interaction flow design of the IoT project. Skill Extraction Phase: Using the large language model, determine the skills required to implement the IoT project based on the solution design text. The system identifies the capabilities and searches for matching skill modules in a pre-defined skill repository as target skill modules. The system development scheme design phase and technology stack selection phase involve: calling a large language model to generate technical design text based on the scheme design text and determining the technology stack used in the IoT project. The technical design text describes the technical structure, module breakdown, and interface design of the IoT project. The code generation phase involves calling a large language model to arrange the target skill modules into target project code for the IoT project based on the technical design text and technology stack. Each stage's generated text is confirmed before proceeding to the next stage; if a rollback instruction is received, the system returns to the previous stage to regenerate the text. Using this embodiment, user requirements can be gradually refined through multiple stages to help users generate project code that better meets their actual needs.
[0150] The above example is only one possible implementation. In other possible implementations, the aforementioned skill extraction stage can be skipped, and may also include a device selection stage: analyzing the devices under the user account, identifying devices that semantically match the complete requirements specification document, and listing the identified devices to obtain a device list.
[0151] After each of the aforementioned stages is completed, the user can manually confirm to proceed to the next stage. For example, taking the requirements analysis and clarification stage as an example, after the requirements analysis and clarification stage is completed, the user can automatically proceed to the solution design stage, or the complete requirements specification text can be displayed for the user to browse. After the user browses and confirms, the user can manually control the user to proceed to the solution design stage.
[0152] Furthermore, users can manually return to the previous stage. For example, if a user finds that the complete requirements specification text does not meet their needs after browsing it, they can manually return to the previous stage (i.e., the requirements analysis and clarification stage) to regenerate a new complete requirements specification text.
[0153] In one possible embodiment, users can manually switch between the aforementioned Vibe mode and Spec mode according to their needs. Specifically, in this embodiment, the method further includes: if a mode adjustment instruction is received during the execution of Vibe mode or Spec mode, the existing development context is retained and the system switches to Spec mode or Vibe mode to continue generating the target project code for the IoT project. Choosing this embodiment allows users to manually switch between the two modes, improving the flexibility of target project code generation.
[0154] Understandably, in some cases, user needs are relatively simple. In such cases, as explained above, the target project code will be generated in Vibe mode. However, users may prioritize the reliability of the target project code over efficiency, in which case they can manually switch from Vibe mode to Spec mode. Conversely, in some cases, user needs are more complex. In such cases, as explained above, the target project code will be generated in Spec mode. However, users may prioritize efficiency over reliability, in which case they can manually switch from Spec mode to Vibe mode.
[0155] The development context in this article includes, but is not limited to, the generated code, the user's dialogue records with the large language model during the generation process, and the target project code in previous versions.
[0156] In one possible embodiment, the aforementioned Figure 1Based on the example shown, each skill module in the preset skill repository has preset capability tags, device type tags, and brief description information. The capability type tag identifies the type of capability the skill module possesses, and the device type tag identifies the type of device the skill module is applicable to. In this embodiment, the aforementioned step S103 includes: for each capability represented by the structured requirement information, calculating the matching degree between each skill module in the preset skill repository and the capability. The matching degree is positively correlated with the similarity between the capability type tag and the capability, positively correlated with the similarity between the device type tag and the IoT device involved in the capability, and positively correlated with the semantic similarity between the brief description information and the capability. Skill modules whose matching degree meets the preset screening conditions for each capability are identified as target skill modules. Using this embodiment, by comprehensively screening skill modules based on capability type, device type, and semantics, the accuracy of skill module selection can be effectively improved.
[0157] The capability type label, device type label, brief description information, and the complete description information mentioned above are all attributes of the skill module. A skill module may only have these attributes, or it may have other attributes at the same time. For example, in one possible embodiment, the attributes of the skill module are shown in Table 1 below:
[0158] Table 1. Skill Module Attribute Diagram
[0159] When calculating the matching degree, you can first calculate the similarity between the capability type label and the capability (denoted as s1), the similarity between the device type label and the IoT devices involved in the capability (denoted as s2), and the semantic similarity between the brief description information and the capability (denoted as s3). Then, you can sum the weighted averages of s1, s2, and s3 to obtain the matching degree. Furthermore, the weights used for s1, s2, and s3 in the weighted summation process can be configured according to requirements.
[0160] For each ability, select skill modules that meet the preset screening criteria. Then, deduplicate the selected skill modules to obtain the target skill modules. For example, suppose there are three abilities, denoted as Abilities 1 to 3. The skill module that matches Ability 1 and meets the preset screening criteria is Skill Module 1. The skill modules that match Abilities 2 and 3 and meet the preset screening criteria are Skill Modules 1 and 2, respectively. The target skill modules obtained after deduplication are Skill Module 1 and Skill Module 2.
[0161] The preset filtering criteria can be either the highest matching degree or the highest matching degree that is also higher than a preset threshold. It is understood that in some cases, even if the skill module with the highest matching degree still does not match the ability sufficiently, it may still be unable to achieve the ability, and therefore it may not be selected as the target skill module. Therefore, in one possible embodiment, the skill module with the highest matching degree for each ability can be determined separately, and the skill modules with a matching degree higher than a preset threshold can be selected as the target skill modules.
[0162] In one possible embodiment, after identifying the target skill modules, the compatibility between the target skill modules can be further detected, such as version compatibility and interface compatibility. When incompatibility is detected, the incompatible target skill modules are marked and the user is notified so that the user can manually adjust the target skill modules to eliminate these incompatibilities.
[0163] In one possible embodiment, in Figure 1 Building upon the example shown, the method further includes: acquiring prototype projects selected from a preset project prototype library, where project requirement text is used to describe the differences in requirements between the IoT project and the prototype project in natural language; and invoking a large language model, based on the structured requirement information and the description information of the target skill modules. In this embodiment, step S104 includes: invoking a large language model, based on the structured requirement information and the description information of the target skill modules, and rearranging the project codes of each target skill and the prototype project into the target project code of the IoT project. Using this embodiment allows users to clone and customize prototype projects that have already been developed, making it easier for users to transform prototype projects into the desired IoT projects.
[0164] An example of this embodiment can be found in [reference needed]. Figure 4 The project prototype library stores entities of prototype projects, which include: project name and description, industry scenario tags, project documentation (for large language models to understand the context), complete runnable code package, deployment instructions, and a list of dependent skill modules.
[0165] After the user selects a prototype project from the project prototype library, a deep cloning operation will be performed. At this time, the execution entity of this application will copy the complete code package in the prototype project entity, copy the configuration of the prototype project, load the skill modules that the prototype project depends on and check the version compatibility of these skill modules, and load the project documentation into the context of the large language model.
[0166] After completing the deep cloning operation, the prototype project needs further customization to transform it into an IoT project that meets the user's current needs. At this point, the large language model will understand the project context and, combined with the user-inputted project requirement text describing the differences between the IoT project requirements and the prototype project requirements, automatically handle the compatibility of skill modules and transform the prototype project's code package into the target project's code.
[0167] In one possible embodiment, the aforementioned Figure 1 In the example shown, step S101 includes: receiving input raw requirement text, which describes the requirements of an IoT project in natural language; obtaining a preset industry scenario template for the IoT project as the target industry scenario template; and calling a large language model to expand the raw requirement text based on the target industry scenario template to obtain the project requirement text. By using this embodiment, the user's requirements can be automatically expanded based on the industry scenario template, making the generated project requirement text better understood by the large language model, thereby improving the reliability of the generated target project code.
[0168] The target industry scenario template can be manually selected by the user or automatically determined through intelligent matching. For example, in one possible embodiment, tags are pre-set for each industry scenario. The aforementioned acquisition of the preset industry scenario template for the IoT project, used as the target industry scenario template, includes: determining the matching degree between the original requirement text and the tags of each industry scenario; if the maximum matching degree is greater than a preset upper threshold, then the preset industry scenario template for the industry scenario with the highest matching degree is acquired and used as the target industry scenario template; if the maximum matching degree is not greater than the preset upper threshold, then the preset industry scenario templates for each industry scenario are displayed, and upon receiving a selection instruction, the industry scenario template selected by the selection instruction is determined as the target industry scenario template. Using this embodiment, the target industry scenario template can be automatically determined first through tag matching, and only when the target industry scenario template cannot be automatically determined can the user manually select it, thus minimizing the amount of user operation.
[0169] For example, in one possible embodiment, the process for generating project requirement text is as follows: Figure 5 As shown, it includes:
[0170] Step S501: The user writes the original requirement text;
[0171] Step S502: If the user selects manual mode, a list of preset industry scenario templates for different industry scenarios will be displayed for the user to choose from.
[0172] Step S503: If the user selects the intelligent matching mode, extract the keywords in the original requirement text and perform semantic matching with the tags of the industry scenario templates.
[0173] Step S504: Determine the industry scenario template with the highest matching degree, and determine whether the matching degree of the industry scenario template is greater than the preset matching degree threshold. If so, use the industry scenario template as the target industry scenario template and execute step S505. Otherwise, execute step S502 to allow the user to manually select the target industry scenario template.
[0174] The matching degree is the confidence level of the match between the tags of the industry scenario template and the extracted keywords.
[0175] Step S505: Invoke the large language model to expand the original requirement text based on the industry scenario template;
[0176] Step S506: Display the expanded text for the user to browse and modify. After the user confirms, the final text is determined as the project requirement text.
[0177] In one possible embodiment, after generating a version baseline, the user can perform further iterations based on the generated version baseline to generate new versions of the version baseline. To distinguish different versions of the version baseline, a different version identifier is configured for each generated version baseline. In this example, the target project code is also configured with a version identifier, thus there are two layers of version identifiers (code layer and baseline layer). To better manage the two-layer version identifier, this application provides a two-layer version identifier management system, such as... Figure 6 As shown:
[0178] The first-level version identifier is the version identifier of the target project code, also known as the aforementioned Build identifier. This identifier is used to track the iteration of the target project code during development. With each conversation between the user and the large language model, the version identifier number is automatically added, and each version identifier number is associated with a complete code snapshot and conversation record. Users can roll back to any historical Build version, and the rollback operation will append a new Build version by copying, as shown in the previous example, rather than overwriting the historical Build version.
[0179] The second-level version identifier is the version identifier of the version baseline. In this example, the version identifier consists of the major version number, minor version number, and build version number. Once the version identifier of the version baseline is generated, it cannot be changed, and the associated dialog records will also be converted to readable mode, meaning they cannot be modified. Simultaneously, each time a new version baseline is generated, the changes relative to the previous version baseline will be automatically summarized, and development resources will be reclaimed.
[0180] Corresponding to the aforementioned method, this application also provides an end-to-end automatic generation device for IoT projects based on a large language model, such as... Figure 7 As shown, it includes:
[0181] The requirement receiving module 701 is used to obtain project requirement text, wherein the project requirement text is used to describe the requirements of the Internet of Things project in natural language;
[0182] The requirement parsing module 702 is used to call the large language model to parse the project requirement text to obtain the structured requirement information of the Internet of Things project. The structured requirement information is used to represent the project type, the Internet of Things devices involved, the required capabilities, and the execution logic of the Internet of Things project.
[0183] The skill matching module 703 is used to search for a skill module that semantically matches the structured requirement information in a preset skill warehouse, and use it as the target skill module.
[0184] The skill orchestration module 704 is used to analyze the compatibility and dependencies between the target skill modules, and to obtain the calling order of the target skill modules and the data flow between the target skill modules.
[0185] The code generation module 705 is used to call the large language model and, based on the structured requirement information and the description information of each target skill module, arrange each target skill module into the target project code of the Internet of Things project.
[0186] The baseline generation module 706 is used to generate a version baseline of the Internet of Things project based on the target project code when a confirmation instruction for the target project code is received.
[0187] In one possible embodiment, the description information is used to represent the interface specifications and constraints of the skill module, and the description information includes example code snippets;
[0188] The invocation of the large language model, based on the structured requirement information, the invocation order, the data flow direction, and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including:
[0189] The large language model is invoked, and based on the description information of each target skill module, interface code that conforms to the interface specification and the constraints is generated;
[0190] By invoking the large language model, and based on the structured requirement information, the invocation order, and the data flow direction, the target project code of the IoT project, which integrates the docking code, is generated.
[0191] In one possible embodiment, the device further includes a sandbox running module for testing the target project code and displaying the test results;
[0192] The dialogue iteration module is used to call a large language model to modify the target project code based on the modified text when a modified text is received, so as to obtain a new target project code. The modified text is a modification requirement for the target project code described in natural language.
[0193] In one possible embodiment, the version baseline cannot be modified after it is generated. The device further includes a two-layer version management module, which is used to set a version identifier for the newly generated target project code whenever new target project code is generated, and associate the version identifier, a snapshot of the target project code, and the dialogue records during the generation of the target project code, wherein the version identifier set each time is different.
[0194] Upon receiving a rollback instruction, copy the project code identified by the version identifier indicated by the rollback instruction as the new target project code, and configure a new version identifier for the new target project code.
[0195] After generating the version baseline, configure the dialog records associated with the version identifier as read-only;
[0196] In one possible embodiment, the device further includes a dual-mode scheduling module for determining the text size of the project requirement text and predicting the number of skill modules and project complexity on which the IoT project depends based on the project requirement text.
[0197] A comprehensive score is calculated based on the text size, the number of items, and the project complexity, wherein the comprehensive score is positively correlated with the text size, the number of items, and the project complexity.
[0198] If the overall score is lower than a preset score threshold, the step of calling the large language model to parse the project requirement text and obtain the structured requirement information of the Internet of Things project is executed.
[0199] If the overall score is not lower than the preset score threshold, the target project code for the IoT project is generated in stages through the requirements analysis stage, the solution design stage, and the code generation stage.
[0200] In one possible embodiment, the step of generating the target project code for the IoT project in stages—requirements analysis, solution design, and code generation—includes:
[0201] The large language model is invoked to generate and display a list of questions based on the project requirement text, wherein the list of questions is used to describe the ambiguities and missing items in the project requirement text;
[0202] Get the text of the answer to the question list;
[0203] By calling the large language model and integrating the project requirement text and the answer text, a complete requirement specification text is obtained, wherein the complete requirement specification text is used to describe the requirements of the Internet of Things project;
[0204] The large language model is invoked to generate a solution design text based on the complete requirements specification text, wherein the solution design text is used to describe the functional module division and interaction process design of the Internet of Things project;
[0205] The large language model is invoked to determine the capabilities required to implement the IoT project based on the scheme design text, and a skill module that matches the capability is searched in a preset skill warehouse as the target skill module;
[0206] The large language model is invoked to generate technical design text based on the scheme and determine the technology stack used by the Internet of Things project. The technical design text is used to describe the technical structure, module breakdown and interface design of the Internet of Things project.
[0207] The large language model is invoked, and the text and technology stack are designed based on the technology. The target skill modules are arranged into the target project code of the Internet of Things project. The text generated in each stage enters the next stage after confirmation. If a rollback instruction is received for the text, the previous stage is returned and the text is regenerated.
[0208] In one possible embodiment, the dual-mode scheduling module is further configured to retain the existing development context and switch to Spec mode or Vibe mode to continue generating the target project code of the IoT project when a mode adjustment instruction is received during the execution of Vibe mode or Spec mode;
[0209] Wherein, the Vibe mode is the generation mode of the target project code when the aforementioned comprehensive score is lower than the preset score threshold, and the Spec mode is the generation mode of the target project code when the aforementioned comprehensive score is not lower than the preset score threshold;
[0210] In one possible embodiment, each skill module in the preset skill warehouse is preset with a capability type label, a device type label, and a brief description, wherein the capability type label is used to identify the capability type possessed by the skill module, and the device type label is used to identify the device type to which the skill module is applicable;
[0211] The process of finding skill modules that semantically match the structured requirement information, as target skill modules, includes:
[0212] For each capability represented by the structured requirement information, the matching degree between each skill module in the preset skill warehouse and the capability is calculated. The matching degree is positively correlated with the similarity between the capability type tag and the capability, positively correlated with the similarity between the device type tag and the IoT device involved in the capability, and positively correlated with the semantic similarity between the brief description information and the capability.
[0213] Skill modules that meet the preset screening conditions for matching degree with each of the aforementioned abilities are identified as target skill modules;
[0214] In one possible embodiment, the device further includes a cloning and customization module for acquiring prototype projects selected from a preset project prototype library, wherein the project requirement text is used to describe in natural language the differences in requirements between the IoT project and the prototype project.
[0215] The invocation of the large language model, based on the structured requirement information and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including:
[0216] By invoking the large language model, and based on the structured requirement information and the description information of each target skill module, the project code of each target skill module and the prototype project is rearranged into the target project code of the Internet of Things project;
[0217] In one possible embodiment, obtaining the project requirements text includes:
[0218] Receive input raw requirement text, which is used to describe the requirements of the Internet of Things project in natural language;
[0219] Obtain a preset industry scenario template for the IoT project, and use it as the target industry scenario template;
[0220] The large language model is invoked to expand the original requirement text based on the target industry scenario template, thereby obtaining the project requirement text;
[0221] In one possible embodiment, tags are pre-set for various industry scenarios, and the step of obtaining a preset industry scenario template for the IoT project, as the target industry scenario template, includes:
[0222] Determine the matching degree between the original requirement text and the tags of each industry scenario;
[0223] If the maximum value of the matching degree is greater than the preset upper limit threshold, then the industry scenario template preset for the industry scenario with the highest matching degree is obtained as the target industry scenario template.
[0224] If the maximum matching degree is not greater than the preset upper limit threshold, then the preset industry scenario templates for each industry scenario are displayed, and upon receiving a selection instruction, the industry scenario template selected by the selection instruction is determined as the target industry scenario template.
[0225] This application also provides an electronic device, such as... Figure 8 As shown, it includes:
[0226] Memory 801 is used to store computer programs;
[0227] When processor 802 executes a program stored in memory, it performs the following steps:
[0228] Obtain project requirement text, wherein the project requirement text is used to describe the requirements of the Internet of Things project in natural language;
[0229] The large language model is invoked to parse the project requirement text to obtain the structured requirement information of the Internet of Things project. The structured requirement information is used to represent the project type, the Internet of Things devices involved, the required capabilities, and the execution logic of the Internet of Things project.
[0230] In the preset skill repository, find the skill module that semantically matches the structured requirement information and use it as the target skill module;
[0231] Analyze the compatibility and dependencies between the target skill modules to obtain the calling order of the target skill modules and the data flow between them;
[0232] The target project code for the Internet of Things project is generated by calling the large language model based on the structured requirement information, the calling order, the data flow direction, and the description information of each target skill module.
[0233] Upon receiving a confirmation instruction for the target project code, a version baseline for the IoT project is generated based on the target project code.
[0234] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 802, the communication interface, and the memory 801 communicating with each other via the communication bus.
[0235] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0236] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0237] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0238] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0239] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described methods for the end-to-end automatic generation of IoT projects based on a large language model.
[0240] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the large language model-based end-to-end automatic generation methods for IoT projects described above.
[0241] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.
[0242] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0243] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, embodiments of devices, electronic devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0244] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A method for end-to-end automatic generation of IoT projects based on a large language model, characterized in that, The method includes: Obtain project requirement text, wherein the project requirement text is used to describe the requirements of the Internet of Things project in natural language; The large language model is invoked to parse the project requirement text to obtain the structured requirement information of the Internet of Things project. The structured requirement information is used to represent the project type, the Internet of Things devices involved, the required capabilities, and the execution logic of the Internet of Things project. In the preset skill repository, find the skill module that semantically matches the structured requirement information and use it as the target skill module; Analyze the compatibility and dependencies between the target skill modules to obtain the calling order of the target skill modules and the data flow between them; The target project code for the Internet of Things project is generated by calling the large language model based on the structured requirement information, the calling order, the data flow direction, and the description information of each target skill module. Test the target project code and display the test results; Upon receiving modified text, the large language model is invoked to modify the target project code based on the modified text, resulting in new target project code. The modified text is a modification requirement for the target project code described in natural language. The version baseline cannot be modified after it is generated. Whenever a new target project code is generated, a version identifier is set for the newly generated target project code, and the version identifier, a snapshot of the target project code, and the dialog record during the generation of the target project code are associated. The version identifier set each time is different. Upon receiving a rollback instruction, copy the project code identified by the version identifier indicated by the rollback instruction as the new target project code, and configure a new version identifier for the new target project code. Upon receiving a confirmation instruction for the target project code, a version baseline for the IoT project is generated based on the target project code; after generating the version baseline, the dialogue records associated with the version identifier are configured as read-only.
2. The method according to claim 1, characterized in that, The description information is used to represent the interface specifications and constraints of the skill module, and includes example code snippets. The invocation of the large language model, based on the structured requirement information, the invocation order, the data flow direction, and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including: The large language model is invoked, and based on the description information of each target skill module, interface code that conforms to the interface specification and the constraints is generated; By invoking the large language model, and based on the structured requirement information, the invocation order, and the data flow, the target project code of the IoT project, which integrates the docking code, is generated.
3. The method according to claim 1, characterized in that, The method further includes: Determine the text size of the project requirements text, and predict the number of skill modules and project complexity that the IoT project depends on based on the project requirements text. A comprehensive score is calculated based on the text size, the number of items, and the project complexity, wherein the comprehensive score is positively correlated with the text size, the number of items, and the project complexity. If the overall score is lower than a preset score threshold, the step of calling the large language model to parse the project requirement text and obtain the structured requirement information of the Internet of Things project is executed. If the overall score is not lower than the preset score threshold, the target project code for the IoT project is generated in stages through the requirements analysis stage, the solution design stage, and the code generation stage.
4. The method according to claim 3, characterized in that, The process of generating the target project code for the IoT project through stages—requirements analysis, solution design, and code generation—includes: The large language model is invoked to generate and display a list of questions based on the project requirement text, wherein the list of questions is used to describe the ambiguities and missing items in the project requirement text; Get the text of the answer to the question list; By calling the large language model and integrating the project requirement text and the answer text, a complete requirement specification text is obtained, wherein the complete requirement specification text is used to describe the requirements of the Internet of Things project; The large language model is invoked to generate a solution design text based on the complete requirements specification text, wherein the solution design text is used to describe the functional module division and interaction process design of the Internet of Things project; The large language model is invoked to determine the capabilities required to implement the IoT project based on the scheme design text, and a skill module that matches the capability is searched in a preset skill warehouse as the target skill module; The large language model is invoked to generate technical design text based on the scheme and determine the technology stack used by the Internet of Things project. The technical design text is used to describe the technical structure, module breakdown and interface design of the Internet of Things project. The large language model is invoked, and the text and technology stack are designed based on the technology. The target skill modules are arranged into the target project code of the Internet of Things project. The text generated in each stage enters the next stage after confirmation. If a rollback instruction is received for the text, the previous stage is returned to regenerate the text.
5. The method according to claim 3, characterized in that, The method further includes: If a mode adjustment instruction is received during execution in Vibe mode or Spec mode, the existing development context is retained and the system switches to Spec mode or Vibe mode to continue generating the target project code for the IoT project. Wherein, the Vibe mode is the generation mode for the target project code when the aforementioned comprehensive score is lower than the preset score threshold, and the Spec mode is the generation mode for the target project code when the aforementioned comprehensive score is not lower than the preset score threshold.
6. The method according to claim 1, characterized in that, Each skill module in the preset skill warehouse is preset with a capability type label, a device type label, and a brief description. The capability type label is used to identify the capability type of the skill module, and the device type label is used to identify the device type to which the skill module is applicable. The process of finding skill modules that semantically match the structured requirement information, as target skill modules, includes: For each capability represented by the structured requirement information, the matching degree between each skill module in the preset skill warehouse and the capability is calculated. The matching degree is positively correlated with the similarity between the capability type tag and the capability, positively correlated with the similarity between the device type tag and the IoT device involved in the capability, and positively correlated with the semantic similarity between the brief description information and the capability. Skill modules that meet the preset screening criteria for matching degree with each of the aforementioned abilities are identified as target skill modules.
7. The method according to claim 1, characterized in that, The method further includes: Obtain prototype projects selected from a preset project prototype library, wherein the project requirement text is used to describe the differences in requirements between the IoT project and the prototype project in natural language; The invocation of the large language model, based on the structured requirement information and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including: By invoking the large language model, and based on the structured requirement information and the description information of each target skill module, the project code of each target skill module and the prototype project is rearranged into the target project code of the Internet of Things project.
8. The method according to claim 1, characterized in that, The process of obtaining the project requirements text includes: Receive input raw requirement text, which is used to describe the requirements of the Internet of Things project in natural language; Obtain a preset industry scenario template for the IoT project, and use it as the target industry scenario template; The large language model is invoked to expand the original requirement text based on the target industry scenario template, thereby obtaining the project requirement text.
9. The method according to claim 8, characterized in that, Tags are pre-set for various industry scenarios. The step of obtaining the industry scenario template preset for the IoT project, as the target industry scenario template, includes: Determine the matching degree between the original requirement text and the tags of each industry scenario; If the maximum value of the matching degree is greater than the preset upper limit threshold, then the industry scenario template preset for the industry scenario with the highest matching degree is obtained as the target industry scenario template. If the maximum value of the matching degree is not greater than the preset upper limit threshold, then the preset industry scene templates for each industry scenario are displayed, and upon receiving a selection instruction, the industry scene template selected by the selection instruction is determined as the target industry scene template.
10. An end-to-end automatic generation device for IoT projects based on a large language model, characterized in that, The device includes: A requirement receiving module is used to obtain project requirement text, wherein the project requirement text is used to describe the requirements of the Internet of Things project in natural language; The requirement parsing module is used to call the large language model to parse the project requirement text to obtain the structured requirement information of the Internet of Things project. The structured requirement information is used to represent the project type, the Internet of Things devices involved, the required capabilities, and the execution logic of the Internet of Things project. The skill matching module is used to search for skill modules in a preset skill repository that semantically match the structured requirement information, and use them as target skill modules. The skill orchestration module is used to analyze the compatibility and dependencies between the target skill modules, and to obtain the calling order of the target skill modules and the data flow between the target skill modules. The code generation module is used to generate target project code for the Internet of Things project based on the structured requirement information, the calling order, the data flow direction, and the description information of each target skill module. The sandbox running module is used to test the code of the target project and display the test results; The dialogue iteration module is used to call a large language model to modify the target project code based on the modified text when a modified text is received, so as to obtain a new target project code. The modified text is a modification requirement for the target project code described in natural language. The version baseline cannot be modified after it is generated. The device also includes a two-layer version management module, which is used to set a version identifier for the newly generated target project code whenever new target project code is generated, and associate the version identifier, a snapshot of the target project code, and the dialogue record during the generation of the target project code. The version identifier set each time is different. Upon receiving a rollback instruction, copy the project code identified by the version identifier indicated by the rollback instruction as the new target project code, and configure a new version identifier for the new target project code. The baseline generation module is used to generate a version baseline of the IoT project based on the target project code when a confirmation instruction for the target project code is received; after generating the version baseline, the dialogue records associated with the version identifier are configured as read-only.
11. The apparatus according to claim 10, characterized in that, The description information is used to represent the interface specifications and constraints of the skill module, and includes example code snippets. The invocation of the large language model, based on the structured requirement information, the invocation order, the data flow direction, and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including: The large language model is invoked, and based on the description information of each target skill module, interface code that conforms to the interface specification and the constraints is generated; By invoking the large language model, and based on the structured requirement information, the invocation order, and the data flow, target project code for the IoT project, integrating the interface code, is generated; and / or, After generating the version baseline, configure the dialog records associated with the version identifier as read-only; and / or, The device also includes a dual-mode scheduling module, used to determine the text size of the project requirement text and predict the number of skill modules and project complexity that the IoT project depends on based on the project requirement text. A comprehensive score is calculated based on the text size, the number of items, and the project complexity, wherein the comprehensive score is positively correlated with the text size, the number of items, and the project complexity. If the overall score is lower than a preset score threshold, the step of calling the large language model to parse the project requirement text and obtain the structured requirement information of the Internet of Things project is executed. If the overall score is not lower than the preset score threshold, the target project code for the IoT project is generated stage by stage through the requirements analysis stage, the solution design stage, and the code generation stage; and / or, The process of generating the target project code for the IoT project through stages—requirements analysis, solution design, and code generation—includes: The large language model is invoked to generate and display a list of questions based on the project requirement text, wherein the list of questions is used to describe the ambiguities and missing items in the project requirement text; Get the text of the answer to the question list; By calling the large language model and integrating the project requirement text and the answer text, a complete requirement specification text is obtained, wherein the complete requirement specification text is used to describe the requirements of the Internet of Things project; The large language model is invoked to generate a solution design text based on the complete requirements specification text, wherein the solution design text is used to describe the functional module division and interaction process design of the Internet of Things project; The large language model is invoked to determine the capabilities required to implement the IoT project based on the scheme design text, and a skill module that matches the capability is searched in a preset skill warehouse as the target skill module; The large language model is invoked to generate technical design text based on the scheme and determine the technology stack used by the Internet of Things project. The technical design text is used to describe the technical structure, module breakdown and interface design of the Internet of Things project. The large language model is invoked, and based on the technology design text and the technology stack, the target skill modules are arranged into the target project code of the IoT project. The text generated at each stage proceeds to the next stage after confirmation. Upon receiving a rollback instruction for the text, the process returns to the previous stage and regenerates the text; and / or, The dual-mode scheduling module is also used to retain the existing development context and switch to Spec mode or Vibe mode to continue generating the target project code of the IoT project when a mode adjustment instruction is received during the execution of Vibe mode or Spec mode. Wherein, the Vibe mode is the code generation mode for the target project when the overall score is lower than a preset score threshold, and the Spec mode is the code generation mode for the target project when the overall score is not lower than the preset score threshold; and / or, Each skill module in the preset skill warehouse is preset with a capability type label, a device type label, and a brief description. The capability type label is used to identify the capability type of the skill module, and the device type label is used to identify the device type to which the skill module is applicable. The process of finding skill modules that semantically match the structured requirement information, as target skill modules, includes: For each capability represented by the structured requirement information, the matching degree between each skill module in the preset skill warehouse and the capability is calculated. The matching degree is positively correlated with the similarity between the capability type tag and the capability, positively correlated with the similarity between the device type tag and the IoT device involved in the capability, and positively correlated with the semantic similarity between the brief description information and the capability. Skill modules whose matching degree with each of the aforementioned abilities meets preset screening criteria are identified as target skill modules; and / or, The device also includes a cloning and customization module for acquiring prototype projects selected from a preset project prototype library, wherein the project requirement text is used to describe the differences in requirements between the IoT project and the prototype project in natural language. The invocation of the large language model, based on the structured requirement information and the description information of each target skill module, arranges each target skill module into the target project code of the IoT project, including: By invoking the large language model, and based on the structured requirement information and the description information of each target skill module, the project code of each target skill module and the prototype project is rearranged into the target project code of the IoT project; and / or, The process of obtaining the project requirements text includes: Receive input raw requirement text, which is used to describe the requirements of the Internet of Things project in natural language; Obtain a preset industry scenario template for the IoT project, and use it as the target industry scenario template; The large language model is invoked to expand the original requirement text based on the target industry scenario template, resulting in the project requirement text; and / or, Tags are pre-set for various industry scenarios. The step of obtaining the industry scenario template preset for the IoT project, as the target industry scenario template, includes: Determine the matching degree between the original requirement text and the tags of each industry scenario; If the maximum value of the matching degree is greater than the preset upper limit threshold, then the industry scenario template preset for the industry scenario with the highest matching degree is obtained as the target industry scenario template. If the maximum value of the matching degree is not greater than the preset upper limit threshold, then the preset industry scene templates for each industry scenario are displayed, and upon receiving a selection instruction, the industry scene template selected by the selection instruction is determined as the target industry scene template.
12. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-9.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-9.
Citation Information
Patent Citations
Internet of Things intelligent application method and device based on large language model
CN117055845A
Development method and development platform of low-code application, electronic equipment and storage medium
CN120428960A
Model-based application building method and device, equipment, medium and program product
CN120848870A
Code generation method, device and system based on large model
CN121996220A