Coding task routing method and electronic device
Patent Information
- Application Number
- CN202611183039.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-11-24
AI Technical Summary
当待处理的任务中包含敏感数据(如个人隐私信息、商业机密或特定源代码)时,若直接将其路由到不具备相应合规属性(例如不允许处理该类数据或数据区域不匹配)的模型中,将导致严重的数据安全风险和合规违规问题
Smart Images

Figure CN123159261A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home technology, and in particular to a coding task routing method and electronic device. Background Technology
[0002] With the rapid development of large language model technology, assisted programming tools have been widely used in code generation, completion, and optimization. To meet the needs of different business scenarios, enterprises often need to integrate multiple different models to achieve better performance or cost-effectiveness. In practical enterprise applications, data compliance is a red line that must be strictly adhered to. Different countries and regions have different legal and regulatory requirements regarding data storage location (data residency), privacy protection levels (such as the processing of sensitive personal information), and security certifications for specific industries. This requires enterprises to ensure that the models used to process tasks possess the compliant qualifications to handle the data for that specific task when calling upon them.
[0003] In related technologies, model scheduling or routing is typically based on technical indicators such as model response speed, processing capacity, load status, or cost. This performance-oriented routing strategy lacks a mechanism to perceive the data compliance of the requested task content itself. When a task contains sensitive data (such as personal privacy information, trade secrets, or specific source code), directly routing it to a model that does not possess the corresponding compliance attributes (e.g., is not allowed to process such data or the data region is mismatched) will lead to serious data security risks and compliance violations.
[0004] Therefore, there is an urgent need for a method that can dynamically and intelligently route between multiple tools based on task characteristics and compliance requirements, so as to balance task execution efficiency and data compliance and security. Summary of the Invention
[0005] The purpose of this application is to provide a coding task routing method and electronic device. By constructing a dynamic routing mechanism driven by multi-dimensional task characteristics and sensitive data, it realizes the overall scheduling of multiple models in terms of capability, load and compliance attributes, taking into account both task execution efficiency and data security and compliance.
[0006] This application provides a method for routing encoding tasks, including: The process involves: acquiring a coding task to be processed; extracting task features from the coding task to obtain task feature information; identifying sensitive data in the coding task to obtain sensitive data identification results; the task feature information including task type and task complexity; selecting at least one candidate model that meets compliance requirements from multiple candidate models based on the sensitive data identification results and a preset model compliance capability matrix; maintaining the compliance attributes of each candidate model based on the task feature information and preset enterprise-defined routing rules; and encapsulating the coding task to be processed into a calling instruction corresponding to the target model through a protocol adaptation layer and sending it to the target model.
[0007] Optionally, the step of performing sensitive data identification on the encoding task to be processed to obtain sensitive data identification results includes: performing a preliminary scan of the encoding task to be processed using regular expressions to obtain a regular expression matching score; when the regular expression matching score is greater than a preset threshold, performing a deep parsing of the encoding task to be processed using an abstract syntax tree to obtain an abstract syntax tree complexity score; and performing a weighted calculation based on the regular expression matching score and the abstract syntax tree complexity score to determine whether the encoding task to be processed contains sensitive data of the source code type, so as to generate the sensitive data identification results.
[0008] Optionally, the step of identifying sensitive data in the encoding task to be processed to obtain sensitive data identification results further includes: using predefined regular expression pattern matching rules to identify at least one of personal information and credential information in the encoding task to be processed; and using a lightweight text classification model to perform semantic analysis on the encoding task to be processed to identify trade secrets in the encoding task to be processed; wherein the personal information includes at least one of email address, phone number, ID card number, passport number, and bank card number; and the credential information includes at least one of application programming interface key, key, token, and password.
[0009] Optionally, the step of selecting at least one candidate model that meets the compliance requirements from multiple candidate models based on the sensitive data identification results and a preset model compliance capability matrix includes: obtaining the data sensitivity level and the data region of the coding task to be processed contained in the sensitive data identification results; matching the data sensitivity level and the data region with the compliance attributes of each candidate model in the model compliance capability matrix; the compliance attributes include at least one of the following: allowed data region, security authentication level, allowed data category, and data processing method; and selecting the candidate model that meets the matching requirements of the data sensitivity level and the data region as the at least one candidate model that meets the compliance requirements.
[0010] Optionally, determining the target model from the at least one candidate model based on the task feature information and preset enterprise-defined routing rules includes: acquiring multiple enterprise-defined routing rules, each of which includes a priority, a conditional judgment condition, and an action execution instruction; matching the task feature information sequentially using the conditional judgment condition according to the priority from high to low; executing the corresponding action execution instruction when the task feature information meets the conditional judgment condition; the action execution instruction includes at least one of the following: forcibly specifying a data region, excluding a specified model, increasing the model priority, forcibly specifying capability requirements, and masking the data; and determining the target model from the updated at least one candidate model after traversing all the enterprise-defined routing rules.
[0011] Optionally, determining the target model from the updated at least one candidate model includes: when the number of the updated at least one candidate model is greater than 1, obtaining the task complexity of the coding task to be processed; based on a preset five-factor scheduling scoring model, weighting each candidate model on five dimensions: capability matching degree, load status, response speed, cost-effectiveness, and enterprise strategy matching degree, and calculating the comprehensive score of each candidate model in combination with the task complexity; and selecting the candidate model with the highest comprehensive score as the target model.
[0012] Optionally, obtaining the task complexity of the coding task to be processed includes: extracting request features, code context features, dependency features, semantic features, and historical data features of the coding task to be processed; and performing a weighted calculation on the request features, code context features, dependency features, semantic features, and historical data features to obtain the task complexity.
[0013] Optionally, the method further includes: generating a compliance audit log; wherein the compliance audit log records the sensitive data identification results, the screening process of at least one candidate model that meets the compliance requirements, the execution chain of the enterprise-defined routing rules, and the final determination result of the target model.
[0014] Optionally, the step of encapsulating the coding task to be processed into a calling instruction corresponding to the target model through the protocol adaptation layer includes: calling the adapter in the protocol adaptation layer that matches the target model; converting the coding task to be processed into a data format that conforms to the Model Context Protocol (MCP) standard through the adapter, or converting the coding task to be processed into a data format that conforms to the private interface protocol of the target model through the adapter.
[0015] This application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the coded task routing method as described above.
[0016] This application also provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the above-described coding task routing methods.
[0017] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the coded task routing method described above.
[0018] The coding task routing method and electronic device provided in this application acquire a coding task to be processed; extract task features from the coding task to obtain task feature information; and identify sensitive data from the coding task to obtain sensitive data identification results. The task feature information includes task type and task complexity. Based on the sensitive data identification results and a preset model compliance capability matrix, at least one candidate model that meets compliance requirements is selected from multiple candidate models. The model compliance capability matrix is used to maintain the compliance attributes of each candidate model. Based on the task feature information and preset enterprise-defined routing rules, a target model is determined from the at least one candidate model. Through a protocol adaptation layer, the coding task to be processed is encapsulated into a calling instruction corresponding to the target model and sent to the target model. Thus, by constructing a dynamic routing mechanism driven by multi-dimensional task features and sensitive data, a comprehensive scheduling of multiple models in terms of capability, load, and compliance attributes is achieved, balancing task execution efficiency and data security compliance. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in 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 some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the hardware environment for an interaction method of a smart device according to an embodiment of this application; Figure 2 This is a flowchart illustrating the coding task routing method provided in this application; Figure 3 This is a schematic diagram of the electronic device provided in this application. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be used interchangeably where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices. All actions involving the acquisition of signal information or data in this application are performed in accordance with the relevant data protection laws and policies of the country where the application is located and with authorization from the owner of the relevant device.
[0023] According to one aspect of the embodiments of this application, an interaction method for smart home devices is provided. This interaction method for smart home devices is widely applicable to digital control scenarios such as smart homes, smart home ecosystems, intelligence house ecosystems, whole-house intelligence, digital homes, networked homes, automated homes, electronic homes, digital homes, and digital homes. It relies on technologies such as the Internet of Things (IoT), cloud computing, artificial intelligence (AI), digital technology, digital twins, and AR / VR to construct an intelligent, automated, personalized, and customized digital ecosystem. Optionally, in this embodiment, the above-mentioned interaction method for smart home devices can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0024] The aforementioned network communication architecture includes, but is not limited to, two types of links: wired transmission and wireless connection. Among them, the wired network can cover wide area networks, metropolitan area networks, and local area networks, while the wireless network supports communication standards such as WIFI, Bluetooth, and 5G. It can adapt to the digital technology transmission needs of the Internet of Things (IoT), the Internet of Things, and the Internet of Things blockchain, ensuring stable interaction of digital information, enabling devices to make autonomous, accurate, precise, and accurate judgments and adjustments, and supporting personalized and customized intelligent capabilities such as voice interaction, remote control, and self-control. Terminal devices 102 include, but are not limited to, PCs, mobile phones, tablets, and all categories of digital home appliances, digital electrical appliances, smart home appliances, and whole-house smart devices. Specifically, they include: smart air conditioners, air conditioning equipment, smart range hoods, smart refrigerators, smart ovens, grilling and cooking equipment, smart stoves, smart washing machines, washing, rinsing, drying and garment processing equipment, smart water heaters, smart washing equipment, smart dishwashers, smart projectors, smart TVs, smart clothes racks, smart curtains, smart audio-visual equipment, smart sockets, smart speakers, smart speakers, smart fresh air systems, smart kitchen and bathroom systems, kitchens, cabinets, kitchen cabinet equipment, smart bathroom equipment, robot vacuum cleaners, robot window cleaners, robot mopping, air purifiers, smart steam ovens, smart microwave ovens, smart water heaters, smart air purifiers, smart water dispensers, smart door locks, smart lighting fixtures, smart light bulbs, smart air detectors, smart remote controls, and smart gateways. They also cover smart terminals for security, lighting, and other digital home furnishings.
[0025] In related technologies, enterprise users or individual users mainly face the following problems when using coding tools: First, existing tool scheduling methods are mostly statically configured, meaning that fixed models or tools are pre-assigned to specific types of tasks. This approach cannot dynamically adjust based on the real-time characteristics of the task, such as its complexity or the differences in the data types involved. When faced with complex tasks, insufficient model capabilities may lead to a decrease in generation quality; while for simple tasks, calling high-capability models may result in wasted resources.
[0026] Secondly, enterprises have strict requirements for data security and compliance. Different models differ in data processing methods, data storage areas, and security certification levels. Existing solutions typically perform uniform sensitive data detection and interception at network boundaries or data exits. This coarse-grained approach cannot select models with corresponding compliance attributes for targeted processing based on the specific types and levels of sensitive data involved in the task, resulting in a disconnect between compliance strategies and task execution.
[0027] To address the aforementioned technical problems in related technologies, this application provides an encoding task routing method applied to an enterprise-level toolchain system. The system architecture adopts a layered design, from top to bottom: user request layer, task access gateway, task classifier, model capability graph engine, intelligent scheduler, protocol adaptation layer, tool execution layer, and result aggregation and feedback layer.
[0028] The coding task routing method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0029] like Figure 2 As shown in the embodiment of this application, an encoding task routing method is provided, which may include the following steps 201 to 205: Step 201: Obtain the encoding task to be processed.
[0030] For example, the user request layer receives code generation or optimization requests submitted by users, and the task access gateway formats the request to obtain the coding task to be processed.
[0031] Step 202: Extract task features from the coding task to be processed to obtain task feature information, and identify sensitive data from the coding task to be processed to obtain sensitive data identification results; the task feature information includes task type and task complexity.
[0032] Specifically, the system performs multi-dimensional analysis of the task. In one implementation, for sensitive data detection of source code type, step 202 above may further include steps 202a1 to 202a3: Step 202a1: Perform a preliminary scan of the encoding task to be processed using regular expressions to obtain a regular expression matching score.
[0033] Step 202a2: When the regular expression matching score is greater than a preset threshold, the encoding task to be processed is deeply parsed using an abstract syntax tree to obtain an abstract syntax tree complexity score.
[0034] Step 202a3: Perform a weighted calculation based on the regular expression matching score and the abstract syntax tree complexity score to determine whether the coding task to be processed contains sensitive data of the source code type, so as to generate the sensitive data identification result.
[0035] For example, the preset threshold can be set to 0.3. When the regular expression score exceeds 0.3, AST parsing is triggered, and the regular expression score (weight 0.4) and AST complexity score (weight 0.6) are combined to determine whether source code is included. This method of first coarse screening and then fine calculation ensures both detection efficiency and recognition accuracy.
[0036] In another implementation, sensitive data identification also encompasses the detection of personal information and trade secrets. Based on this, step 202 above may further include steps 202b1 and 202b2: Step 202b1: Using predefined regular expression pattern matching rules, identify at least one of the personal information and credential information in the coding task to be processed.
[0037] Step 202b2: Use a lightweight text classification model to perform semantic analysis on the coding task to be processed, and identify the trade secrets in the coding task to be processed.
[0038] For example, the personal information includes at least one of: email address, phone number, ID card number, passport number, and bank card number. The credential information includes at least one of: application programming interface key, key, token, and password. The lightweight text classification model is capable of recognizing unstructured trade secret content through semantic understanding.
[0039] Step 203: Based on the sensitive data identification results and the preset model compliance capability matrix, at least one candidate model that meets the compliance requirements is selected from multiple candidate models; the model compliance capability matrix is used to maintain the compliance attributes of each candidate model.
[0040] For example, the model capability graph engine is responsible for constructing and maintaining the compliance attributes of all candidate models and generating the model compliance capability matrix. Based on the sensitive data identification results and the preset model compliance capability matrix, the system selects at least one candidate model that meets the compliance requirements from multiple candidate models.
[0041] Specifically, step 203 may further include steps 203a1 to 203a3: Step 203a1: Obtain the data sensitivity level and the data region of the coding task to be processed contained in the sensitive data identification result.
[0042] Step 203a2: Match the data sensitivity level and the region to which the data belongs with the compliance attributes of each candidate model in the model compliance capability matrix.
[0043] The compliance attributes include at least one of the following: permitted data areas, security certification levels, permitted data categories, and data processing methods.
[0044] Step 203a3: Select the candidate model that meets the matching requirements of the data sensitivity level and the region to which the data belongs as at least one candidate model that meets the compliance requirements.
[0045] For example, the model compliance capability matrix is pre-configured with information such as the data residence location and security certification qualifications of each model. Through the processing in steps 203a1 to 203a3, the system can eliminate models that do not comply with data security regulations, ensuring that the models subsequently called are available at the compliance level.
[0046] Step 204: Based on the task feature information and the preset enterprise-defined routing rules, determine the target model from the at least one candidate model.
[0047] For example, the intelligent scheduler receives at least one candidate model after compliance screening and makes the final scheduling decision based on enterprise-defined routing rules and scoring models.
[0048] Specifically, for the execution process of the routing rule engine, step 204 above may also include the following steps 204a1 to 204a4: Step 204a1: Obtain multiple enterprise-defined routing rules, each of which includes priority, condition judgment conditions, and action execution instructions.
[0049] Step 204a2: Match the task feature information sequentially using the condition judgment conditions according to the priority from high to low.
[0050] Step 204a3: When the task feature information meets the condition judgment condition, execute the corresponding action execution instruction.
[0051] The action execution instructions include at least one of the following: forcibly specifying a data region, excluding a specified model, increasing the priority of a model, forcibly specifying capability requirements, and performing masking processing on the data.
[0052] Step 204a4: After traversing all the enterprise-defined routing rules, determine the target model from at least one updated candidate model.
[0053] For example, the routing rule engine first loads enterprise routing rules from the configuration center and sorts them by priority. The system iterates through the rule list, evaluates rule conditions, and executes actions (such as excluding models) if a match is found, and updates the candidate model list. Rule execution terminates when only one candidate model remains; otherwise, it continues executing subsequent rules.
[0054] Furthermore, when multiple candidate models still exist after rule-based filtering, the system makes the final decision using a scoring model. Step 204 specifically includes the following steps: 204b, 204c, and 204d: Step 204b: When the number of the updated at least one candidate model is greater than 1, obtain the task complexity of the encoding task to be processed.
[0055] Step 204c: Based on the preset five-factor scheduling scoring model, each candidate model is weighted and scored in five dimensions: capability matching degree, load status, response speed, cost-effectiveness and enterprise strategy matching degree. Combined with the task complexity, the comprehensive score of each candidate model is calculated.
[0056] For example, the five-factor scheduling scoring model comprehensively considers five dimensions: capability matching, load status, response speed, cost-effectiveness, and corporate strategy. Specifically, the weight of capability matching is configured as 40%, load status as 25%, response speed as 15%, cost-effectiveness as 10%, and corporate strategy matching as 10%. Through this quantitative scoring, the system can accurately select the optimal model.
[0057] Step 204d: Select the candidate model with the highest comprehensive score as the target model.
[0058] For example, if there are still multiple candidate models after the rule is executed, the above scoring model is used to calculate and generate the final compliant routing decision.
[0059] Specifically, regarding the acquisition of task complexity, step 204a above can be further refined into the following steps 204a1 and 204a2: Step 204a1: Extract the request features, code context features, dependency features, semantic features, and historical data features of the coding task to be processed.
[0060] Step 204a2: Perform a weighted calculation on the request features, the code context features, the dependency features, the semantic features, and the historical data features to obtain the task complexity.
[0061] For example, the task classifier analyzes four dimensions simultaneously: task type, complexity, urgency, and contextual dependency. The dynamic complexity evaluation algorithm combines the above five features to calculate the task complexity in a weighted manner, providing input to the scoring model.
[0062] Step 205: Through the protocol adaptation layer, the encoding task to be processed is encapsulated into a calling instruction corresponding to the target model and sent to the target model.
[0063] Specifically, step 205 above may also include the following steps 205a1 and 205a2: Step 205a1: Invoke the adapter in the protocol adaptation layer that matches the target model.
[0064] Step 205a2: Convert the encoding task to be processed into a data format that conforms to the Model Context Protocol (MCP) standard through the adapter, or convert the encoding task to be processed into a data format that conforms to the target model's private interface protocol through the adapter.
[0065] For example, the MCP protocol adaptation layer converts the routing results into the calling format of the target tool, shielding the protocol differences between different tools and achieving unified scheduling. Subsequently, the tool execution layer is responsible for sending the calling instructions, which have been encapsulated by the protocol adaptation layer, to the target model through the network interface, and establishing a connection to listen for the response from the model side.
[0066] Furthermore, in order to meet the requirements of compliance auditing, the coding task routing method provided in this application embodiment may further include the following step 206: Step 206: Generate compliance audit logs.
[0067] For example, the compliance audit log records the complete compliance decision-making process. Specifically, the compliance audit log records the results of sensitive data identification, the screening process of at least one candidate model that meets compliance requirements, the execution process of the enterprise-defined routing rules, and the final determination result of the target model. This enables enterprises to trace every task invocation, ensuring data security and compliance.
[0068] For example, after the result aggregation and feedback layer receives the response results from the target model in the tool execution layer, it is responsible for parsing and standardizing the response data, feeding it back to the user request layer, and generating compliance audit logs at the same time.
[0069] The coding task routing method provided in this embodiment achieves intelligent and efficient scheduling of the optimal model to process coding tasks while ensuring enterprise data security and compliance through multi-dimensional sensitive data identification, compliance capability matrix filtering, enterprise-defined routing rules, and dynamic scoring scheduling.
[0070] The coding task routing method provided in this application involves: acquiring a coding task to be processed; extracting task features from the coding task to obtain task feature information; and identifying sensitive data from the coding task to obtain sensitive data identification results. The task feature information includes task type and task complexity. Based on the sensitive data identification results and a preset model compliance capability matrix, at least one candidate model that meets compliance requirements is selected from multiple candidate models. The model compliance capability matrix is used to maintain the compliance attributes of each candidate model. Based on the task feature information and preset enterprise-defined routing rules, a target model is determined from the at least one candidate model. Through a protocol adaptation layer, the coding task to be processed is encapsulated into a calling instruction corresponding to the target model and sent to the target model. Thus, by constructing a dynamic routing mechanism driven by multi-dimensional task features and sensitive data, a comprehensive scheduling of multiple models in terms of capability, load, and compliance attributes is achieved, balancing task execution efficiency and data security compliance.
[0071] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include a processor 310, a communications interface 320, a memory 330, and a communication bus 340, wherein the processor 310, communications interface 320, and memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute an encoding task routing method. This method includes: acquiring an encoding task to be processed; extracting task features from the encoding task to obtain task feature information; and identifying sensitive data from the encoding task to obtain sensitive data identification results; the task feature information includes task type and task complexity; based on the sensitive data identification results and a preset model compliance capability matrix, selecting at least one candidate model that meets compliance requirements from multiple candidate models; the model compliance capability matrix is used to maintain the compliance attributes of each candidate model; based on the task feature information and preset enterprise-defined routing rules, determining a target model from the at least one candidate model; and encapsulating the encoding task to be processed into a calling instruction corresponding to the target model through a protocol adaptation layer and sending it to the target model. In this way, by constructing a dynamic routing mechanism driven by multi-dimensional task characteristics and sensitive data, the overall scheduling of multiple models in terms of capabilities, load and compliance attributes is realized, taking into account both task execution efficiency and data security and compliance.
[0072] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0073] On the other hand, this application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can execute the coding task routing method provided by the above methods. The method includes: acquiring a coding task to be processed; extracting task features from the coding task to be processed to obtain task feature information; and identifying sensitive data from the coding task to be processed to obtain sensitive data identification results. The task feature information includes task type and task complexity. Based on the sensitive data identification results and a preset model compliance capability matrix, at least one candidate model that meets compliance requirements is selected from multiple candidate models. The model compliance capability matrix is used to maintain the compliance attributes of each candidate model. Based on the task feature information and preset enterprise-defined routing rules, a target model is determined from the at least one candidate model. Through a protocol adaptation layer, the coding task to be processed is encapsulated into a calling instruction corresponding to the target model and sent to the target model. In this way, by constructing a dynamic routing mechanism driven by multi-dimensional task characteristics and sensitive data, the overall scheduling of multiple models in terms of capabilities, load and compliance attributes is realized, taking into account both task execution efficiency and data security and compliance.
[0074] On another front, this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the aforementioned coding task routing methods. The method includes: acquiring a coding task to be processed; extracting task features from the coding task to obtain task feature information; and identifying sensitive data from the coding task to obtain a sensitive data identification result. The task feature information includes task type and task complexity. Based on the sensitive data identification result and a preset model compliance capability matrix, at least one candidate model that meets compliance requirements is selected from multiple candidate models. The model compliance capability matrix is used to maintain the compliance attributes of each candidate model. Based on the task feature information and preset enterprise-defined routing rules, a target model is determined from the at least one candidate model. Through a protocol adaptation layer, the coding task to be processed is encapsulated into a calling instruction corresponding to the target model and sent to the target model. Thus, by constructing a dynamic routing mechanism driven by multi-dimensional task features and sensitive data, a comprehensive scheduling of multiple models in terms of capability, load, and compliance attributes is achieved, balancing task execution efficiency and data security compliance.
[0075] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0076] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for routing coding tasks, characterized in that, include: Obtain the coding tasks to be processed; Task feature extraction is performed on the coding task to be processed to obtain task feature information, and sensitive data identification is performed on the coding task to be processed to obtain sensitive data identification results; the task feature information includes task type and task complexity; Based on the sensitive data identification results and the preset model compliance capability matrix, at least one candidate model that meets the compliance requirements is selected from multiple candidate models; the model compliance capability matrix is used to maintain the compliance attributes of each candidate model. Based on the task feature information and the preset enterprise-defined routing rules, a target model is determined from the at least one candidate model; The encoding task to be processed is encapsulated into a calling instruction corresponding to the target model through the protocol adaptation layer and sent to the target model.
2. The coding task routing method according to claim 1, characterized in that, The process of identifying sensitive data in the encoding task to be processed, and obtaining the sensitive data identification result, includes: The encoding task to be processed is initially scanned using regular expressions to obtain a regular expression matching score. When the regular expression matching score is greater than a preset threshold, the abstract syntax tree is used to perform deep parsing on the encoding task to be processed, and the abstract syntax tree complexity score is obtained. The weighted calculation is performed based on the regular expression matching score and the abstract syntax tree complexity score to determine whether the coding task to be processed contains sensitive data of the source code type, so as to generate the sensitive data identification result.
3. The coding task routing method according to claim 1, characterized in that, The process of identifying sensitive data in the encoding task to be processed and obtaining the sensitive data identification result further includes: Using predefined regular expression pattern matching rules, identify at least one of personal information and credential information in the encoding task to be processed; A lightweight text classification model is used to perform semantic analysis on the encoding task to be processed, and to identify trade secrets in the encoding task to be processed. The personal information includes at least one of the following: email address, phone number, ID card number, passport number, and bank card number; the credential information includes at least one of the following: application interface key, key, token, and password.
4. The coding task routing method according to claim 1, characterized in that, The step of selecting at least one candidate model that meets the compliance requirements from multiple candidate models based on the sensitive data identification results and a preset model compliance capability matrix includes: Obtain the data sensitivity level and the data region of the coding task to be processed contained in the sensitive data identification result; The data sensitivity level and the region to which the data belongs are matched with the compliance attributes of each candidate model in the model compliance capability matrix; the compliance attributes include at least one of the following: allowed data region, security certification level, allowed data category, and data processing method; Candidate models that meet the requirements of the data sensitivity level and the region to which the data belongs will be selected as at least one candidate model that meets the compliance requirements.
5. The coding task routing method according to claim 1, characterized in that, The step of determining the target model from the at least one candidate model based on the task feature information and preset enterprise-defined routing rules includes: Obtain multiple enterprise-defined routing rules, each of which includes priority, condition judgment conditions, and action execution instructions; The task feature information is matched sequentially using the condition judgment conditions in descending order of priority. When the task feature information meets the condition judgment condition, the corresponding action execution instruction is executed; the action execution instruction includes at least one of the following: forcibly specifying a data region, excluding a specified model, increasing the model priority, forcibly specifying capability requirements, and performing data masking processing; After traversing all the enterprise-defined routing rules, the target model is determined from at least one updated candidate model.
6. The coding task routing method according to claim 5, characterized in that, Determining the target model from at least one updated candidate model includes: When the number of at least one updated candidate model is greater than 1, the task complexity of the encoding task to be processed is obtained. Based on the preset five-factor scheduling scoring model, each candidate model is weighted and scored in five dimensions: capability matching degree, load status, response speed, cost-effectiveness and enterprise strategy matching degree. Combined with the task complexity, the comprehensive score of each candidate model is calculated. The candidate model with the highest overall score is selected as the target model.
7. The coding task routing method according to claim 6, characterized in that, The process of obtaining the task complexity of the encoding task to be processed includes: Extract the request features, code context features, dependency features, semantic features, and historical data features of the coding task to be processed; The task complexity is obtained by weighting the request features, code context features, dependency features, semantic features, and historical data features.
8. The method according to claim 1, characterized in that, The method further includes: Generate compliance audit logs; The compliance audit log records the results of sensitive data identification, the screening process of at least one candidate model that meets compliance requirements, the execution chain of the enterprise-defined routing rules, and the final determination result of the target model.
9. The coding task routing method according to claim 1, characterized in that, The process of encapsulating the encoding task to be processed into a calling instruction corresponding to the target model through the protocol adaptation layer includes: Invoke the adapter in the protocol adaptation layer that matches the target model; The adapter converts the coding task to be processed into a data format that conforms to the Model Context Protocol (MCP) standard, or converts the coding task to be processed into a data format that conforms to the target model's private interface protocol.
10. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the coding task routing method as described in any one of claims 1 to 9.
