Intelligent code generation method, system and equipment based on artificial intelligence and medium
By using an AI-native gateway based on a service mesh architecture, the complexity and security issues of AI model integration in low-code development are resolved, enabling an efficient, reliable, and secure intelligent code generation process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG INSPUR SCI RES INST CO LTD
- Filing Date
- 2025-12-11
- Publication Date
- 2026-05-15
AI Technical Summary
In existing technologies, low-code development and intelligent code generation suffer from single-point performance bottlenecks, complex integration of heterogeneous AI models, lack of security control, low development efficiency, and poor system reliability.
An AI-native gateway based on a service mesh architecture is adopted. Through intelligent routing and a dynamic policy engine, it achieves protocol conversion and data standardization, combines multiple AI models for code generation, and performs automated testing and deployment.
It achieves efficient integration and unified security management of heterogeneous AI models, improves development efficiency and system reliability, and ensures that the end-to-end process from requirements to deployment is secure and controllable.
Smart Images

Figure CN122044571A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of program development technology, specifically relating to an intelligent code generation method, system, device, and medium based on artificial intelligence. Background Technology
[0002] In the field of low-code development and intelligent code generation, existing technologies typically rely on centralized API gateways or direct calls to single AI model services. Traditional gateways suffer from single-point performance bottlenecks and rigid routing strategies, failing to intelligently schedule based on AI task semantics and real-time model load. Furthermore, different AI model service interfaces use varying protocols and data formats, leading to high integration costs and fragile connections. In addition, the processes from requirements understanding and code generation to testing and deployment are often fragmented, lacking unified security controls and protocol adaptation layers, making it difficult to achieve secure, efficient, and end-to-end automated software production, thus hindering development efficiency and system reliability. Summary of the Invention
[0003] In view of the above-mentioned shortcomings of the prior art, the present invention provides an intelligent code generation method, system, device and medium based on artificial intelligence to solve the above-mentioned technical problems.
[0004] In a first aspect, the present invention provides an intelligent code generation method based on artificial intelligence, comprising: The system receives natural language input from users and routes the input to a natural language understanding model for processing via an AI-native gateway. The AI native gateway performs protocol conversion and data standardization on the results returned by the natural language understanding model to generate a structured task graph; According to the task graph, code generation requests are initiated to multiple target AI models through the AI native gateway. The AI native gateway performs protocol conversion and data standardization on the requests and related responses to obtain front-end code snippets and back-end API code snippets respectively. The generated front-end code snippets and back-end API code snippets are then assembled with the base project template; The assembled code is subjected to automated testing, and after the test is passed, the deployment instructions in the code are converted into the protocol format required by the target deployment environment through the AI native gateway to perform automated deployment.
[0005] In one optional implementation, the AI native gateway is a distributed gateway system based on a service mesh architecture, including a control plane and a data plane; The data plane consists of lightweight sidecar proxies deployed on each AI model service instance, used to perform request routing, protocol conversion, security policy enforcement, and traffic management; The control plane is used for unified management, policy configuration, and intelligent decision-making of all Sidecar agents.
[0006] In one optional implementation, a natural language request input by a user is received, and the request is routed to a natural language understanding model for processing via an AI-native gateway, including: The AI-native gateway receives natural language request requests in a standardized format; The dynamic policy engine in the AI native gateway dynamically selects a target instance from multiple available natural language understanding model instances based on the content characteristics of the natural language request, real-time performance data, and business context. The AI-native gateway converts the natural language request it receives into the specific protocol and data format required by the target instance, and forwards it to the target instance for processing; The dynamic strategy engine has a built-in machine learning model, and the step of dynamically selecting target instances includes: The content features of the natural language demand request, the real-time performance data of each model instance, and the predefined business context are used as joint input features and input into the machine learning model. The machine learning model outputs the optimal model instance selection result for the current natural language demand request, wherein the content features are obtained by parsing the natural language instructions in the request, and the real-time performance data includes at least latency, error rate and resource utilization indicators.
[0007] In one optional implementation, the AI-native gateway performs protocol conversion and data standardization on the results returned by the natural language understanding model to generate a structured task graph, including: The AI-native gateway receives initial result data returned by the natural language understanding model that conforms to the model's service interface protocol; The data standardization engine within the AI native gateway calls a pre-built task graph parser to parse the initial result data and extract entity and operation information from it. The extracted entity and operation information is populated into a predefined task graph pattern to generate a structured task graph object containing project type, core tasks, entity list, user interface component list, and backend service list.
[0008] In one optional implementation, based on the task graph, code generation requests are initiated to multiple target AI models through the AI-native gateway, including: Parse the structured task graph to obtain the list of user interface components and the list of backend services; For each component in the user interface component list, its standardized description is converted into a corresponding model hint word through the AI native gateway and routed to the selected front-end code generation model; for each service in the back-end service list, its standardized description is converted into a corresponding model hint word through the AI native gateway and routed to the selected back-end code generation model; wherein, the AI native gateway performs specific protocol conversions required to initiate requests to different models; The system receives code responses from each target AI model and performs syntax verification and structured encapsulation on the code responses using the code parser within the AI native gateway, extracting metadata to form standardized code snippets.
[0009] In one optional implementation, the generated front-end code snippets and back-end API code snippets are assembled with a base project template, including: The platform's code assembler is invoked, and the code assembler selects the corresponding basic project template according to the project type specified in the task graph; Integrate the front-end code snippets and back-end API code snippets into the corresponding directory structure of the selected basic project template; Based on the project type and integrated code snippets, automatically generate the configuration files required for project building and deployment; During the assembly and configuration file generation process, the security interception module of the AI native gateway performs static security checks on the code content that is about to be written to the file system.
[0010] In an optional implementation, the AI-native gateway converts deployment instructions in the code into the protocol format required by the target deployment environment to perform automated deployment, including: The deployment optimization agent preparation includes a deployment package containing verified code and project configuration files, and generates standardized internal deployment instructions; When the internal deployment instruction is initiated through the AI native gateway, the gateway's security interception module starts an audit process based on the target deployment environment; for production environment deployments, it triggers and waits for administrator approval. After obtaining permission, the protocol conversion module of the AI native gateway converts the standardized internal deployment instructions into the specific application programming interface protocol format required by the target cloud platform or container orchestration platform. Send instructions to the target deployment environment in the converted protocol format, execute automated deployment, and receive deployment status feedback.
[0011] Secondly, the present invention provides an intelligent code generation system based on artificial intelligence, comprising: The request routing module is used to receive natural language requests input by the user and route the requests to the natural language understanding model for processing through the AI native gateway; The graph generation module is used to perform protocol conversion and data standardization on the results returned by the natural language understanding model from the AI native gateway, and generate a structured task graph. The code generation module is used to initiate code generation requests to multiple target AI models through the AI native gateway based on the task graph. The AI native gateway performs protocol conversion and data standardization on the requests and related responses to obtain front-end code snippets and back-end API code snippets respectively. The code assembly module is used to assemble the generated front-end code snippets and back-end API code snippets with the base project template; The code deployment module is used to perform automated testing on the assembled code. After the test is passed, the deployment instructions in the code are converted into the protocol format required by the target deployment environment through the AI native gateway to perform automated deployment.
[0012] Thirdly, a device is provided, comprising: Memory used to store AI-based intelligent code generation programs; A processor is configured to implement the steps of the AI-based intelligent code generation method provided in the first aspect when executing the AI-based intelligent code generation program.
[0013] Fourthly, a computer-readable medium is provided, on which an artificial intelligence-based intelligent code generation program is stored, wherein when the artificial intelligence-based intelligent code generation program is executed by a processor, it implements the steps of the artificial intelligence-based intelligent code generation method provided in the first aspect.
[0014] The beneficial effects of this invention are as follows: the AI-based intelligent code generation method, system, device, and medium provided by this invention achieve significant benefits by introducing an AI-native gateway based on a service mesh as an intelligent hub: the protocol conversion and data standardization modules embedded in the gateway automatically adapt to heterogeneous AI model services, greatly reducing integration complexity and maintenance costs; its intelligent routing and dynamic policy engine, combined with real-time performance and semantic understanding, achieves optimal resource scheduling and utilization, improving overall processing efficiency and response speed; at the same time, the entire chain integrates unified authentication, security interception, and structured auditing, ensuring the end-to-end process from requirements to deployment is secure and controllable; finally, through multi-agent collaboration and automated testing and deployment closed loop, low-code development is upgraded from template assembly to an efficient, reliable, and secure intelligent software production line. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.
[0017] Figure 2 This is a schematic diagram illustrating the principle of a method according to an embodiment of the present invention.
[0018] Figure 3 This is a schematic block diagram of a system according to an embodiment of the present invention.
[0019] Figure 4 This is a schematic diagram of the structure of a device provided in an embodiment of the present invention. Detailed Implementation
[0020] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
[0022] The AI-based intelligent code generation method provided in this embodiment of the invention is executed by a computer device, and correspondingly, the AI-based intelligent code generation system runs on the computer device.
[0023] Figure 1 This is a schematic flowchart illustrating a method according to an embodiment of the present invention. Wherein, Figure 1 The executing entity can be an AI-based intelligent code generation system. Depending on different needs, the order of steps in this flowchart can be changed, and some can be omitted.
[0024] like Figure 1 As shown, the method includes: S1. Receive the user's input natural language request, and route the request to the natural language understanding model for processing through the AI native gateway; S2. The AI native gateway performs protocol conversion and data standardization on the results returned by the natural language understanding model to generate a structured task graph; S3. Based on the task graph, code generation requests are initiated to multiple target AI models through the AI native gateway, wherein the AI native gateway performs protocol conversion and data standardization on the requests and related responses to obtain front-end code snippets and back-end API code snippets respectively; S4. Assemble the generated front-end code snippets and back-end API code snippets with the basic project template; S5. Perform automated testing on the assembled code, and after the test passes, convert the deployment instructions in the code into the protocol format required by the target deployment environment through the AI native gateway to perform automated deployment.
[0025] Please refer to Figure 2 The routing strategy adopted by the AI-native gateway in this invention includes dynamically allocating requests based on task type (such as natural language understanding → semantic parsing model, code generation → code generation model), rather than the fixed path forwarding of traditional gateways. For example, when a demand understanding agent submits natural language input, the gateway automatically routes to the optimal semantic parsing LLM (such as selecting GPT-4 or a self-developed model based on historical accuracy and response time).
[0026] The AI-native gateway is a distributed gateway system based on a service mesh architecture, comprising a control plane and a data plane. The data plane consists of a series of lightweight sidecar agents. Each sidecar agent is deployed as a container alongside an AI model service instance (e.g., an NLU model Pod or a code generation model Pod), forming an independent service mesh unit. These sidecar agents are responsible for performing all traffic governance tasks flowing into and out of their companion service instances, specifically including: receiving requests from upstream agents or gateway control planes, performing protocol conversions (such as converting internal gRPC requests to HTTP / 1.1 requests for backend model services), enforcing security policies (such as mTLS-based authentication and OPA-based authorization checks), collecting real-time performance metrics, and managing local semantic caches.
[0027] The control plane, acting as the system's brain, is an independent service cluster. It is responsible for unified policy management and configuration distribution to all Sidecar proxies in the data plane. At its core is a dynamic policy engine with a built-in lightweight machine learning model (e.g., gradient boosting trees). Its decision-making is multi-dimensional: first, it automatically identifies the task type (e.g., NLU, code generation) by analyzing request content (e.g., extracting keywords from natural language instructions); second, it aggregates performance data reported by each Sidecar in real time (e.g., P99 latency, error rate, GPU utilization); and finally, it combines preset business contexts (e.g., cost constraints, request priorities). Based on these joint input features, the policy engine can dynamically select the optimal target model service instance for each request. For example, for a request to "generate Python web crawler code," the engine intelligently routes the request to instance A by combining historical data (CodeLlama has a 95% accuracy rate on web crawler tasks) and the current load (its instance A's GPU utilization is only 30%), rather than using traditional round-robin or static hashing strategies.
[0028] In one embodiment of the present invention, based on step S1, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0029] First, a natural language request, encapsulated in standard JSON format by the platform frontend or intelligent agent, is sent to the accompanying AI-native gateway, Sidecar. This request contains at least the original natural language instruction text and necessary metadata.
[0030] The Sidecar agent then submits the request to the gateway control plane's dynamic policy engine to initiate a routing decision. This dynamic policy engine is the core of intelligent routing and integrates a lightweight machine learning model (e.g., a trained gradient boosting tree model). The decision engine performs the following operations to complete the model instance selection: Feature Extraction and Assembly: The engine parses the natural language instructions in the request and extracts content features through keyword recognition or simple embedding (e.g., identifying the task intent as "interface generation" or "data query"). Simultaneously, the engine obtains real-time performance data for all available NLU model instances from the monitoring system, including but not limited to P99 latency, recent error rate, and GPU / CPU utilization for each instance. Furthermore, the engine loads the business context associated with the current request, such as project priority ("urgent" / "normal") or cost control strategy ("prefer internal models").
[0031] Model Inference and Decision-Making: The engine combines the three features mentioned above (content features, real-time performance data, and business context) into a joint feature vector, which is then input into the built-in machine learning model. This model performs real-time inference based on historical training data (such as the quality of service of models under different performance states for different task types) and outputs an optimal model instance selection result for the current request. For example, the model might determine that for the current "generate statistics page" instruction, although instance A has a high historical accuracy, its current latency has reached a threshold; therefore, instance B, with a lighter load and more stable performance, should be selected.
[0032] Finally, after obtaining the target instance address, the Sidecar proxy that initiated the request activates its protocol conversion module. This module, based on the API specifications exposed by the target NLU model service instance (which could be gRPC, RESTful HTTP, or other custom protocols), converts the received internally standardized JSON request into the specific protocol format and data structure required by the target instance in real time. After conversion, the Sidecar proxy accurately forwards the request to the selected target NLU model instance for processing, thus completing an intelligent request routing and protocol adaptation process.
[0033] In one embodiment of the present invention, based on step S2, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0034] First, after the target NLU model instance processes the request, it returns its output to the AI native gateway Sidecar proxy that initiated the request, according to its own interface protocol (such as JSON in OpenAIAPI format or a custom Protobuf message).
[0035] Subsequently, the data normalization engine within the Sidecar agent begins operation. This engine invokes a pre-built task graph parser (e.g., built based on rule templates and a lightweight natural language processing library) to parse the received initial result data. This parser is able to identify key information in unstructured text; for example, from the text description returned by the model "create an employee attendance statistics page that supports filtering by department and date and supports Excel export," it can extract entity information (such as "EmployeeAttendance") and operation information (such as "filter by department" and "export to Excel").
[0036] Finally, the data normalization engine populates this extracted discrete information into a predefined and extensible JSON Schema. This schema defines the standard structure fields of the task graph, thereby automatically generating a structured task graph object. This object serves as the authoritative blueprint for all subsequent code generation activities, and its typical structure is shown below: {"projectType": "Web Application", "coreTask": "Generate statistics page", "entities": ["EmployeeAttendance"], "uiComponents": [ { "type": "DataTable", "properties": {"dataSource": "attendanceList"}}, { "type": "FilterBar", "properties": {"filters": ["department", "dateRange"]}}], "backendServices": [ { "name": "getAttendanceList", "type": "API_GET", "params": ["department", "startDate", "endDate"]}]}.
[0037] The generated structured task graph object is then returned to the upstream demand understanding agent and persisted to the platform's model-driven knowledge repository for use in subsequent stages.
[0038] In one embodiment of the present invention, based on step S3, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0039] First, the code generation agent parses the generated structured task graph object and extracts its uiComponents and backendServices lists. These two lists constitute the specific work items for code generation.
[0040] Subsequently, for each item in the list, the code-generating agent initiates a code generation request through its accompanying AI-native gateway, Sidecar. This process demonstrates the gateway's core coordination and adaptation capabilities: Request Transformation and Routing: For a component in the uiComponents list (e.g., a DataTable), the gateway's data normalization engine converts its normalized description (e.g., {"type": "DataTable", "properties":{...}}) into specific prompts required by the target code generation model. For example, this translates to a CodeLlama-oriented instruction: "Generate a Vue 3 DataTable component that accepts attendanceList as its data source and includes filtering functionality for department and date range." Simultaneously, the gateway's dynamic strategy engine intelligently selects the optimal target from multiple front-end code generation model instances based on the component type ("DataTable") and real-time load. The protocol converter then automatically converts the internal request to a protocol accepted by the target instance (e.g., converting an internal HTTP / 2 request to a gRPC request for the target model service) and forwards it. The generation process for backend API services is similar, involving transformation and routing based on service descriptions in the backendServices list.
[0041] Post-response processing and standardization: Each target AI model typically returns raw code text. Upon receiving these responses, the gateway invokes an integrated code parser (such as Tree-sitter) to perform syntax validation on the code snippets, ensuring their basic correctness. Next, the parser extracts metadata, such as identifying the generated Vue component names, defined props, and imported dependencies. Finally, the gateway encapsulates the validated code and extracted metadata into a standardized JSON structure and returns it, which may have the following format: {"componentType": "Vue3_DataTable", "sourceCode": " <template>...", "metadata": { "props": ["dataSource", "filters"], "imports": ["ref", "onMounted"], "language": "vue"}}.
[0042] Through the above process, this invention achieves automated and high-quality conversion from abstract task graphs to specific, verifiable, and semantically rich standardized code snippets.
[0043] In one embodiment of the present invention, based on step S4, the following will provide a possible embodiment and describe its specific implementation in a non-limiting manner.
[0044] First, the code generation agent invokes the platform's built-in code assembler. This assembler reads the projectType field (e.g., "Web Application") from the structured task graph and selects the corresponding template (e.g., a pre-defined "Vue 3 + Flask" full-stack project skeleton) from the platform's maintained basic project template library based on this type.
[0045] Then, the code assembler performs the integration operation. It parses the metadata (such as component type and language) carried in each standardized code snippet, and according to the predefined directory structure rules of the template, places the front-end code snippets (such as Vue components) in the src / components / directory of the front-end project, and places the back-end API code snippets (such as Flask routes) in the app / api / directory of the back-end project, thus forming a complete project workspace.
[0046] During code integration, the code assembler automatically generates the configuration files necessary for project building and deployment. For example, for front-end projects, it automatically generates a package.json file containing all dependency declarations; for back-end projects, it generates requirements.txt and a Dockerfile. The initial content of these configuration files is preset according to the project type and will be dynamically adjusted according to the specific code snippets being integrated (for example, adding specific npm packages that the code snippets depend on to package.json).
[0047] Throughout the assembly and file generation process, the AI-native gateway's security interception module is proactively invoked to perform static application security testing. This module scans all code files about to be written to the file system, utilizing a predefined security rule base to detect potential vulnerabilities (such as SQL injection patterns), sensitive information (such as hard-coded credentials), or dangerous function calls (such as insecure `eval`). Any detected high-risk code is flagged and written to the system, while a security report is generated and fed back to the intelligent agent, triggering a regeneration or manual review process to ensure the security of the final assembled product.
[0048] In one embodiment of the present invention, based on step S5, a possible embodiment will be given below, and its specific implementation will be described in a non-limiting manner.
[0049] First, the test verification agent initiates the automated testing process. It invokes the platform-integrated testing framework (such as Jest or Pytest) to execute test cases created by the test generation model, validating key functions and API endpoints. After test execution, a structured report (including pass rate, failed test cases, and code coverage) is generated and fed back through the AI-native gateway. If a test fails, the agent analyzes the cause of the failure and may trigger the regeneration and retesting of specific problematic code snippets, forming a local optimization loop. Only projects that pass all tests are considered deployable artifacts.
[0050] Once the project is validated, the deployment optimization agent begins its work. It packages all code, configuration files, and build artifacts into a deployment package (such as a Docker image or archive file) and generates a standardized deployment instruction within the platform (e.g., a JSON object containing information such as image identifier, target namespace, and resource requests).
[0051] Security Audit and Approval: When the standardized deployment command initiates a call to the external environment through the AI-native gateway, the gateway's security interception module immediately initiates an audit process. This module checks the target environment identifier (such as "staging" or "production"). For "production environment," this operation is identified as high-risk, and the gateway automatically triggers a pre-defined secondary approval workflow. For example, it sends an approval request link containing deployment details to a designated administrator through an integrated office collaboration system (such as WeChat Work, DingTalk, or Slack). The gateway will pause the deployment request, wait and poll the approval status, and only release it after receiving an "approval" instruction.
[0052] Protocol Conversion and Command Execution: After secure access is granted, the gateway's protocol conversion module begins operation. This module, based on the target environment type (e.g., AWS ECS, Alibaba Cloud ACK, or a self-built Kubernetes cluster), converts internally standardized JSON deployment commands into the specific API format required by the target platform in real time. For example, it converts them into a YAML manifest for calling the Kubernetes API to create a Deployment, or into a specific parameter format for calling Alibaba Cloud ROS (Resource Orchestration Service).
[0053] Finally, the gateway sends the deployment instructions to the API endpoint of the target cloud platform or container orchestration system in the converted protocol format, triggering an automated deployment process (such as starting containers, configuring services, and binding load balancers). The gateway continuously receives and forwards deployment status feedback from the target environment (such as "in progress," "success," and "failure"), ultimately completing a fully automated closed loop from code generation to secure deployment.
[0054] In some embodiments, the AI-based intelligent code generation system may include multiple functional modules composed of computer program segments. The computer programs of each program segment in the AI-based intelligent code generation system may be stored in the memory of a computer device and executed by at least one processor to perform (see details). Figure 1 (Description) A function for intelligent code generation based on artificial intelligence.
[0055] In this embodiment, the AI-based intelligent code generation system can be divided into multiple functional modules according to the functions it performs, such as... Figure 3 As shown. The module referred to in this invention is a series of computer program segments that can be executed by at least one processor and perform a fixed function, and is stored in memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0056] The request routing module is used to receive natural language requests input by the user and route the requests to the natural language understanding model for processing through the AI native gateway; The graph generation module is used to perform protocol conversion and data standardization on the results returned by the natural language understanding model from the AI native gateway, and generate a structured task graph. The code generation module is used to initiate code generation requests to multiple target AI models through the AI native gateway based on the task graph. The AI native gateway performs protocol conversion and data standardization on the requests and related responses to obtain front-end code snippets and back-end API code snippets respectively. The code assembly module is used to assemble the generated front-end code snippets and back-end API code snippets with the base project template; The code deployment module is used to perform automated testing on the assembled code. After the test is passed, the deployment instructions in the code are converted into the protocol format required by the target deployment environment through the AI native gateway to perform automated deployment.
[0057] Figure 4 The AI-based intelligent code generation method provided in the embodiments of this application can be applied to devices. Those skilled in the art will understand that the device structures involved in the embodiments of this invention do not constitute a limitation on the device. A device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. In the embodiments of this invention, the device includes, but is not limited to, laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of this application described and / or claimed herein.
[0058] The device 400 may include a processor 410, a memory 420, and a communication unit 430. These components communicate via one or more buses. Those skilled in the art will understand that the server structure shown in the figure does not constitute a limitation of the present invention. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0059] The memory 420 can be used to store execution instructions of the processor 410. The memory 420 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. When the execution instructions in the memory 420 are executed by the processor 410, the device 400 is able to perform some or all of the steps in the above method embodiments.
[0060] The processor 410 serves as the control center of the storage device, connecting various parts of the electronic device via various interfaces and lines. It executes software programs and / or modules stored in the memory 420, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 410 may consist only of a central processing unit (CPU). In this embodiment of the invention, the CPU may have a single processing core or include multiple processing cores.
[0061] The communication unit 430 is used to establish a communication channel, enabling the storage device to communicate with other devices. It can receive user data sent by other devices or send user data to other devices.
[0062] The present invention also provides a computer medium, wherein the computer medium may store a program, which, when executed, may include some or all of the steps provided in the embodiments of the present invention. The medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0063] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a medium such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other medium capable of storing program code. It includes several instructions to cause a computer device (which may be a personal computer, a server, or a second device, network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0064] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
[0065] In the embodiments provided by this invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or modules may be electrical, mechanical, or other forms.
[0066] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0067] In addition, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0068] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the present invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should also be covered within the protection scope of the present invention.< / template>
Claims
1. An intelligent code generation method based on artificial intelligence, characterized in that, include: The system receives natural language input from users and routes the input to a natural language understanding model for processing via an AI-native gateway. The AI native gateway performs protocol conversion and data standardization on the results returned by the natural language understanding model to generate a structured task graph; According to the task graph, code generation requests are initiated to multiple target AI models through the AI native gateway. The AI native gateway performs protocol conversion and data standardization on the requests and related responses to obtain front-end code snippets and back-end API code snippets respectively. The generated front-end code snippets and back-end API code snippets are then assembled with the base project template; The assembled code is subjected to automated testing, and after the test is passed, the deployment instructions in the code are converted into the protocol format required by the target deployment environment through the AI native gateway to perform automated deployment.
2. The method according to claim 1, characterized in that, The AI native gateway is a distributed gateway system based on a service mesh architecture, including a control plane and a data plane; The data plane consists of lightweight sidecar proxies deployed on each AI model service instance, used to perform request routing, protocol conversion, security policy enforcement, and traffic management; The control plane is used for unified management, policy configuration, and intelligent decision-making of all Sidecar agents.
3. The method according to claim 1, characterized in that, The system receives natural language input from the user and routes the input to a natural language understanding model for processing via an AI-native gateway, including: The AI-native gateway receives natural language request requests in a standardized format; The dynamic policy engine in the AI native gateway dynamically selects a target instance from multiple available natural language understanding model instances based on the content characteristics of the natural language request, real-time performance data, and business context. The AI-native gateway converts the natural language request it receives into the specific protocol and data format required by the target instance, and forwards it to the target instance for processing; The dynamic strategy engine has a built-in machine learning model, and the step of dynamically selecting target instances includes: The content features of the natural language demand request, the real-time performance data of each model instance, and the predefined business context are used as joint input features and input into the machine learning model. The machine learning model outputs the optimal model instance selection result for the current natural language demand request, wherein the content features are obtained by parsing the natural language instructions in the request, and the real-time performance data includes at least latency, error rate and resource utilization indicators.
4. The method according to claim 1, characterized in that, The AI-native gateway performs protocol conversion and data standardization on the results returned by the natural language understanding model to generate a structured task graph, including: The AI-native gateway receives initial result data returned by the natural language understanding model that conforms to the model's service interface protocol; The data standardization engine within the AI native gateway calls a pre-built task graph parser to parse the initial result data and extract entity and operation information from it. The extracted entity and operation information is populated into a predefined task graph pattern to generate a structured task graph object containing project type, core tasks, entity list, user interface component list, and backend service list.
5. The method according to claim 1, characterized in that, Based on the task graph, code generation requests are initiated to multiple target AI models through the AI-native gateway, including: Parse the structured task graph to obtain the list of user interface components and the list of backend services; For each component in the user interface component list, its standardized description is converted into a corresponding model hint word through the AI native gateway and routed to the selected front-end code generation model; for each service in the back-end service list, its standardized description is converted into a corresponding model hint word through the AI native gateway and routed to the selected back-end code generation model; wherein, the AI native gateway performs specific protocol conversions required to initiate requests to different models; The system receives code responses from each target AI model and performs syntax verification and structured encapsulation on the code responses using the code parser within the AI native gateway, extracting metadata to form standardized code snippets.
6. The method according to claim 1, characterized in that, The generated front-end code snippets and back-end API code snippets are assembled with the base project template, including: The platform's code assembler is invoked, and the code assembler selects the corresponding basic project template according to the project type specified in the task graph; Integrate the front-end code snippets and back-end API code snippets into the corresponding directory structure of the selected basic project template; Based on the project type and integrated code snippets, automatically generate the configuration files required for project building and deployment; During the assembly and configuration file generation process, the security interception module of the AI native gateway performs static security checks on the code content that is about to be written to the file system.
7. The method according to claim 1, characterized in that, The AI-native gateway converts deployment instructions in the code into the protocol format required by the target deployment environment to perform automated deployment, including: The deployment optimization agent preparation includes a deployment package containing verified code and project configuration files, and generates standardized internal deployment instructions; When the internal deployment instruction is initiated through the AI native gateway, the gateway's security interception module starts an audit process based on the target deployment environment; for production environment deployments, it triggers and waits for administrator approval. After obtaining permission, the protocol conversion module of the AI native gateway converts the standardized internal deployment instructions into the specific application programming interface protocol format required by the target cloud platform or container orchestration platform. Send instructions to the target deployment environment in the converted protocol format, execute automated deployment, and receive deployment status feedback.
8. An intelligent code generation system based on artificial intelligence, characterized in that, include: The request routing module is used to receive natural language requests input by the user and route the requests to the natural language understanding model for processing through the AI native gateway; The graph generation module is used to perform protocol conversion and data standardization on the results returned by the natural language understanding model from the AI native gateway, and generate a structured task graph. The code generation module is used to initiate code generation requests to multiple target AI models through the AI native gateway based on the task graph. The AI native gateway performs protocol conversion and data standardization on the requests and related responses to obtain front-end code snippets and back-end API code snippets respectively. The code assembly module is used to assemble the generated front-end code snippets and back-end API code snippets with the base project template; The code deployment module is used to perform automated testing on the assembled code. After the test is passed, the deployment instructions in the code are converted into the protocol format required by the target deployment environment through the AI native gateway to perform automated deployment.
9. An intelligent code generation device based on artificial intelligence, characterized in that, include: Memory used to store AI-based intelligent code generation programs; A processor, configured to implement the steps of the AI-based intelligent code generation method as described in any one of claims 1-7 when executing the AI-based intelligent code generation program.
10. A computer-readable medium storing a computer program, characterized in that, The readable medium stores an AI-based intelligent code generation program, which, when executed by a processor, implements the steps of the AI-based intelligent code generation method as described in any one of claims 1-7.