Command processing methods, storage media, electronic devices, and computer program products
By introducing a dual-path routing mechanism of cloud recognition and local access into the intelligent agent system, the execution path is selected according to the type of control command, which solves the problems of response latency and resource waste in the intelligent agent system and achieves more efficient command processing and user experience.
Patent Information
- Application Number
- CN202611271604.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-20
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, intelligent agent systems suffer from high response latency, resource waste, and high costs when processing user control commands. This is especially true on resource-constrained devices, where simple commands often have high response latency, impacting user experience.
The device receives user control commands and uploads them to the cloud. The cloud performs keyword recognition and whitelist matching. Based on the matching results, simple commands are executed directly on the device or complex commands are executed through the target intelligent agent, avoiding unnecessary LLM calls. A dual-path diversion mechanism of cloud recognition and local processing is adopted.
It reduces the response latency of control commands, improves the real-time performance of command execution, reduces resource waste and operating costs, and enhances the user experience.
Smart Images

Figure CN123123344A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and more specifically, to a command processing method, a storage medium, an electronic device, and a computer program product. Background Technology
[0002] With the continuous development of artificial intelligence (AI) technology, the application of various AI agents is becoming more and more widespread.
[0003] In related technologies, when processing user control commands, intelligent agent systems use a processing chain based on Large Language Model (LLM) inference, regardless of the complexity of the user commands. This control command processing method results in high command response latency and low real-time execution, which affects the user experience. Summary of the Invention
[0004] This application provides a command processing method, storage medium, electronic device, and computer program product to at least solve the problems of high command response latency and low real-time command execution in related technologies, which affect the user experience.
[0005] According to one embodiment of this application, a command processing method is provided, executed by a device, including:
[0006] Receive control commands and upload the control commands to the cloud;
[0007] Receive the message message corresponding to the control command returned by the cloud;
[0008] In response to the inclusion of target execution information in the message message, the control command is executed by calling the local application programming interface (API) of the device according to the target execution information, and the execution process of the control command does not go through the target intelligent agent;
[0009] In response to the message message not including the target execution information, the control command is executed by the target agent.
[0010] According to one embodiment of this application, a command processing method is provided, executed by the cloud, including:
[0011] Receive control commands sent by the device;
[0012] In response to the control command successfully matching in the target whitelist in the cloud, the target execution information corresponding to the control command is determined, and a message including the target execution information is sent to the device. The target execution information is used to instruct the device to call the local application programming interface (API) to execute the control command, and the execution process of the control command does not go through the target agent.
[0013] In response to the failure of the control command to match the target whitelist, a message message excluding the target execution information is sent to the device to instruct the device to execute the control command through the target agent.
[0014] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the steps in any of the above-described command processing method embodiments when it is run.
[0015] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above-described command processing method embodiments.
[0016] According to yet another embodiment of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps in any of the above-described command processing method embodiments.
[0017] In this embodiment, the device receives a user's control command and uploads it to the cloud. The device also receives a message corresponding to the control command returned from the cloud. If the message includes target execution information, the device can directly execute the control command by calling its local application programming interface (API), bypassing the target agent. If the message does not include target execution information, the device can execute the control command by calling the target agent. Thus, this application can select whether to call the target agent based on the actual situation of the control command. When the message includes target execution information, it directly calls the local API to execute the control command without processing by the target agent. This reduces the response latency of the control command, improves the real-time performance of the control command execution, and enhances the user experience. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of an intelligent agent system for a command processing method according to an embodiment of this application;
[0019] Figure 2This is a flowchart illustrating the steps of a command processing method according to an embodiment of this application;
[0020] Figure 3 This is a flowchart illustrating the steps of a command processing method according to an embodiment of this application;
[0021] Figure 4 This is a schematic diagram of the specific system architecture of an intelligent agent system according to an embodiment of this application;
[0022] Figure 5 This is a schematic diagram of the execution flow of a command processing method for a device-side LDU according to an embodiment of this application;
[0023] Figure 6 This is a schematic diagram of the execution flow of a cloud-based KDU command processing method according to an embodiment of this application;
[0024] Figure 7 This is a schematic diagram of a smart home control scenario in an embodiment of this application;
[0025] Figure 8 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0026] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples. 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.
[0027] AI agents have been widely applied in users' work and daily lives. In related technologies, agent systems, regardless of the complexity of user control commands, employ a unified "LLM inference-skill invocation-execution" processing chain. This relatively simplistic approach to command execution results in high response latency (up to 10 seconds or more) for simple commands (such as "turn on the living room light"), leading to poor real-time performance and severely impacting the user experience. Furthermore, on resource-constrained gateway devices, insufficient memory on the gateway side prevents the deployment of local keyword recognition models, exacerbating the real-time performance issue and resulting in even higher response latency.
[0028] For example, intelligent agent systems in related technologies typically employ the following unified serial processing architecture to process control commands:
[0029] User command -> Instant Messaging (IM) platform receives -> forwards to Agent -> LLM intent understanding -> skill / tool invocation -> device control execution -> result return.
[0030] The control command execution process described above in related technologies requires all control commands, regardless of complexity, to be implemented through a complete process; the understanding of the control command intent relies entirely on LLM inference; the core logic runs on a cloud server; and there is a lack of differentiated scheduling, i.e., a lack of a command type-based routing mechanism. The control command execution process described above in related technologies has the following shortcomings:
[0031] 1) High response latency. For example, for a control command, LLM inference takes 5-8 seconds. With skill invocation and network transmission, the total time for a simple command may reach 10-15 seconds, resulting in long waiting times for users and a poor user experience.
[0032] 2) Resource waste. For example, simple commands such as turning lights on and off require the same LLM computing power as complex tasks (such as trip planning), resulting in wasted computing power.
[0033] 3) High cost. The cost of LLM calls increases linearly with the number of users. When there are many users using the agent, all control commands need to call LLM for inference, resulting in high operational costs during large-scale deployment.
[0034] Therefore, there is an urgent need in related technologies for a solution that can reduce the response latency of control commands and improve the real-time performance of command execution without compromising the accuracy of understanding.
[0035] To address or partially address the aforementioned problems, embodiments of this application provide a command processing method, storage medium, electronic device, and computer program product. The device receives a user's control command and uploads it to the cloud. The device also receives a message corresponding to the control command returned from the cloud. When the message includes target execution information, the device can directly execute the control command by calling its local application programming interface (API), bypassing the target agent. When the message does not include target execution information, the device can execute the control command by calling the target agent. Thus, this application can select whether to call the target agent based on the actual situation of the control command. When the message includes target execution information, it directly calls the local API to execute the control command without processing by the target agent, reducing response latency, improving real-time execution, and enhancing the user experience.
[0036] The command processing method in this application embodiment can be applied to fields such as artificial intelligence and the Internet of Things (IoT). Specifically, it can involve user command processing in intelligent agent systems and can be applied to application scenarios such as equipment operation and maintenance, smart home control, and IoT device management. Specifically, it can be applied to voice / text control applications in real-world scenarios where real-time response requirements are high. For example, Figure 1 This is a schematic diagram of an intelligent agent system for a command processing method according to an embodiment of this application. Figure 1 As shown, the intelligent agent system includes a device 101 and a cloud 102. The device 101, also known as a user terminal or mobile terminal, can be used for command monitoring, command format processing, and local command execution. The cloud 102, also known as a server or cloud platform, can be used for intent recognition of control commands, matching decisions, intelligent agent services, and closed-loop learning. Due to the limited computing resources of the device 101, the target intelligent agent, including LLM targets, can be deployed in the cloud 102.
[0037] This application provides a command processing method that can run in the aforementioned intelligent agent system and other application scenarios. Figure 2 This is a flowchart illustrating the steps of a command processing method according to an embodiment of this application. The command processing method is executed by a device, which may specifically include a mobile phone, computer, or wearable device, etc. This embodiment of the application does not limit the specific device type. Figure 2 As shown, the command processing method includes the following steps:
[0038] Step S201: Receive control commands and upload the control commands to the cloud.
[0039] Step S202: Receive the message message corresponding to the control command returned by the cloud.
[0040] In this embodiment, the control command can refer to a user command received by the device, which includes, but is not limited to, user voice commands, text messages, user-end (i.e., device-end) operation commands, and user behavior perception conversion commands. For example, the control command could be "turn off the lights" or "turn on the router." The message message can be a cloud-return message indicating the execution method of the control command.
[0041] The device can receive control commands, encapsulate them according to a target format (e.g., JSON), and upload the encapsulated commands to the cloud. The cloud receives the control commands from the device and extracts the target keywords using keyword recognition or similar methods. These target keywords are then compared and matched against a target whitelist in the cloud. This whitelist contains multiple predefined entries, representing commands that the device can directly execute via a local application programming interface (API). Based on the matching results between the control commands and the target whitelist, the cloud can send corresponding message messages to the device, instructing it on the specific execution method for processing the control commands.
[0042] Step S203: In response to the target execution information included in the message message, the control command is executed by calling the local application programming interface (API) of the device according to the target execution information. The execution process of the control command does not go through the target intelligent agent.
[0043] Step S204: In response to the message message not including the target execution information, the control command is executed by the target agent.
[0044] In this embodiment, the target execution information may be information used to instruct the device to directly execute commands, and the specific information types included in the target execution information can be flexibly set based on actual needs. In some exemplary embodiments, the target execution information may include at least one of the following:
[0045] Message identifier, hit entry identifier, target keyword, target keyword confidence level, execution mode identifier, device information, action parameter dictionary, preset time threshold, and degradation strategy identifier.
[0046] In this embodiment of the application, the target execution information in the message can serve as a special identifier for the direct execution of control commands by the execution device. This special identifier can adopt a specific data structure. For example, the target execution information may include at least one of the following:
[0047] (1) Message identifier, used to indicate the specific type of message message, serving as the unique identifier of the message message, such as “FAST_CMD_WL001” etc.
[0048] (2) Hit entry identifier, used to indicate the whitelist entry that the control command matches in the target whitelist.
[0049] (3) Target keywords can refer to the keywords corresponding to control commands, including intentional actions, target objects, parameter information and location information, etc.
[0050] (4) Target keyword confidence score, which is used to indicate the credibility of the target keywords extracted from the control commands in the cloud, i.e. the probability that the target keywords are correct.
[0051] (5) Execution mode identifier, which can be used to indicate how the device executes the control command. The execution mode identifier can include local direct execution (local_direct), cloud execution or normal path execution (cloud_execute), and hybrid execution. Local direct execution means that the device does not need to call the target agent and directly executes the control command through the local API. Cloud execution means that the device needs to call the target agent to execute the control command. Hybrid execution means that the device and the cloud work together to execute the command. For example, the control command can be "recommend the air conditioner temperature according to the actual weather". The cloud can calculate the recommended air conditioner temperature parameters based on the local weather conditions, and the local device can adjust the air conditioner temperature based on the air conditioner temperature parameters returned by the cloud. In this embodiment, the execution mode identifier in the target execution information can be local_direct, which is used to indicate that the device executes the control command locally to reduce the command processing latency.
[0052] (6) Equipment information, including equipment-related information that needs to execute control commands, such as equipment type, equipment location (living room or bedroom, etc.) and equipment identification (ID), to ensure the accuracy of the execution of control commands.
[0053] (7) Action parameter dictionary, which can refer to the specific execution action corresponding to the control command, such as turning on the light, brightness parameters, etc., can ensure the integrity and reliability of the action execution.
[0054] (8) The preset time threshold can refer to the timeout setting on the device side, that is, the maximum waiting time on the device side. For example, if the device side does not receive a message from the cloud within the preset time threshold after reporting the control command to the cloud, the device side can call the target execution body to execute the control command to ensure that the control command can be executed reliably.
[0055] (9) Degradation policy identifier can refer to the processing policy identifier in abnormal situations such as local execution failure or timeout. For example, when the cloud is offline or the device fails to parse the message message, the device can process the control command or output prompt information based on the pre-configured policy indicated by the degradation policy identifier. This can ensure the robustness and reliability of the intelligent agent system.
[0056] It should be noted that the target execution information in the message may include at least one of the aforementioned information fields. For example, if the device detects the presence of at least one of the above information fields in the message, the device can directly execute the control command locally. This target execution information may also include other information fields, and can be flexibly set based on actual needs; this application embodiment does not limit this.
[0057] In this embodiment, if the cloud determines that the control command uploaded by the device matches the target whitelist (e.g., the target keyword of the control command has a matching entry in the target whitelist), the cloud can add target execution information to the message packet and return the message packet containing the target execution information to the device. Upon receiving the message packet containing the target execution information, the device can directly execute the control command by calling its local API. In this case, the execution process of the control command does not go through the target intelligent agent, which reduces the response latency of the control command, improves the real-time performance of the control command execution, reduces user waiting time, and enhances the user experience.
[0058] Alternatively, if the cloud determines that the control command does not match the target whitelist, for example, if the target keyword of the control command does not have a matching whitelist entry, the cloud can send a message message to the device that does not include target execution information. The device can then call the target agent to execute the control command, enabling the user to accurately process complex control commands.
[0059] In some exemplary embodiments, after uploading the control commands to the cloud, the method further includes:
[0060] In response to the failure to receive the message packet returned by the cloud within a preset time threshold, the control command is executed through the target intelligent agent; or,
[0061] In response to receiving the message returned by the cloud within the preset time threshold, and the message parsing fails, the control command is executed by the target intelligent agent.
[0062] In this embodiment, the device can employ degradation and fault tolerance mechanisms under abnormal circumstances, such as timeout degradation and parsing failure degradation. In some examples, after uploading the control command to the cloud, if the device does not receive a message from the cloud within a preset time threshold (e.g., 500 milliseconds, 1 second, etc.), the device can switch to the normal path and call the target intelligent agent to execute the control command.
[0063] In other examples, after the device uploads the control command to the cloud, if it receives a message from the cloud within a preset time threshold, but the device fails to parse the message, for example, due to an incorrect message format, the device can switch to the normal path and call the target agent to execute the control command.
[0064] In some exemplary embodiments, the method further includes:
[0065] In response to an anomaly in the cloud and a successful match in the local cache whitelist, the control command is executed by calling the local API based on the matched whitelist entry; the local cache whitelist is periodically synchronized from the cloud to the device; or,
[0066] In response to an anomaly in the cloud and the failure of the control command to match the local cache whitelist, a preset prompt message is output.
[0067] In this embodiment, real-world scenarios also involve situations where cloud services are unavailable, such as communication anomalies between the device and the cloud, or cloud services being unavailable. The device can periodically cache the target whitelist from the cloud locally, creating a local cache whitelist. It should be noted that, limited by local storage resources, the device's local cache whitelist can be a subset of the target whitelist from the cloud. For example, the device can cache only the N whitelist entries with the highest historical hit counts from the target whitelist, where N is a positive integer, such as 5 or 10. In some specific examples, the device can cache the top 10 whitelist entries from the target whitelist, sorted by historical hit count from highest to lowest, as its local cache whitelist.
[0068] If an anomaly occurs in the cloud, the device can determine that the cloud service is temporarily unavailable. The device can compare the control command with the most recently synchronized local cache whitelist from the cloud. If the control command matches in the local cache whitelist, the device will execute the control command by calling the local API based on the matched whitelist entry. If the control command fails to match in the local cache whitelist, the device cannot execute the control command at this time and can output a preset prompt message to the user. This preset prompt message can be in the form of text, image, audio, or video to inform the user that the control command execution has failed. In this way, in this embodiment of the application, the device can implement a degradation or rollback strategy in case of message message timeout, message message parsing failure, or cloud anomaly, which can improve the reliability of control command execution and ensure the normal execution of control commands.
[0069] This application provides a command method that can be run in the aforementioned intelligent agent system and other application scenarios. Figure 3This is a flowchart illustrating the steps of a command processing method according to an embodiment of this application, as follows: Figure 3 As shown, the command processing method includes the following steps:
[0070] Step S301: Receive control commands sent by the device.
[0071] Step S302: In response to the successful matching of the control command in the target whitelist in the cloud, the target execution information corresponding to the control command is determined, and a message message including the target execution information is sent to the device. The target execution information is used to instruct the device to call the local application programming interface (API) to execute the control command. The execution process of the control command does not go through the target intelligent agent.
[0072] Step S303: In response to the failure of the control command to match the target whitelist, a message message that does not include the target execution information is sent to the device to instruct the device to execute the control command through the target agent.
[0073] In this embodiment, corresponding to the device, the cloud can receive control commands uploaded by the device and compare them with the target whitelist in the cloud. If the control command matches the target whitelist successfully, the cloud can generate target execution information corresponding to the control command and return a message message including the target execution information to the device, instructing the device to directly execute the control command by calling the local API. In this case, the execution process of the control command does not need to go through the target intelligent agent, which can reduce the response latency of the control command, shorten the user's waiting time, and improve the user experience.
[0074] Alternatively, if the control command fails to match the target whitelist, the cloud can send a message to the device that does not include target execution information. For example, this message could be an empty object or the same as the control command. Upon receiving this message without target execution information, the device can then execute the control command through the target agent.
[0075] In some exemplary embodiments, after receiving a control command reported by the device in the cloud, the command processing method further includes:
[0076] Extract the target keywords of the control command; the target keywords include at least one of the following: intentional action, target object, parameter information, and location information.
[0077] The target keyword is matched with the whitelist entries in the target whitelist in the cloud to obtain the matching result.
[0078] In this embodiment of the application, the target keyword can refer to the key word corresponding to the control command, which may include at least one of the intentional action, target object, parameter information, and location information, as shown in the following example:
[0079] Intended actions: open, close, adjust, query, set, etc.
[0080] Target objects: living room lights, bedroom air conditioners, curtains, audio equipment, etc.
[0081] Parameter information: brightness 50%, temperature 26 degrees, color red, etc.
[0082] Location information: living room, bedroom, kitchen, bathroom, etc.
[0083] After receiving a control command from the device, the cloud can perform keyword recognition processing on the control command to obtain the target keyword corresponding to the control command. This keyword recognition processing may include text preprocessing, extracting intent actions, identifying target objects, and extracting parameter information. This embodiment does not limit the specific method of keyword recognition processing. After determining the target keyword of the control command, the cloud can match the target keyword with entries in the cloud's target whitelist. These whitelist entries may include structured fields such as matching mode, intent classification, device type, execution action, and parameter extraction rules. Of course, the specific fields of the whitelist entries can be flexibly set based on actual needs, and this embodiment does not limit this. The cloud can return a message to the device based on the matching result between the target keyword and the whitelist entries. Thus, in this embodiment, by extracting target keywords from the control command and matching them with entries in the target whitelist, the cloud can accurately and quickly filter control commands that can be executed locally on the device, improving the execution efficiency of the control commands and shortening the response latency.
[0084] In some exemplary embodiments, the method further includes:
[0085] Obtain command feedback information; the command feedback information includes at least one of control command execution information and whitelist entry feedback information.
[0086] Update the target whitelist in the cloud based on the feedback information from the command.
[0087] In this embodiment, the cloud can dynamically update and iteratively optimize the target whitelist based on the actual filtering of control commands and the command feedback information during execution. This command feedback information can refer to the feedback information corresponding to the control command, specifically including control command execution information (e.g., the execution result of the control command) and whitelist entry feedback information (the hit status of whitelist entries). In some examples, the command feedback information continuously recorded by the cloud may include the following information or metrics:
[0088] 1) The original text, recognition result, execution path, and response time of each control command.
[0089] 2) The frequency of each whitelist entry being hit, the distribution of hit times, and user feedback, etc.
[0090] 3) The text pattern, intent classification, and execution duration of the control commands that were not matched. The text pattern can refer to the set of commands with common semantic structure, keyword combinations, or sentence features identified by analyzing and mining the original text of a large number of control commands after the target whitelist match failed in the cloud.
[0091] Based on the recorded command feedback information, the cloud can periodically (e.g., daily / weekly) update the target whitelist. Specifically, the following update operations can be performed:
[0092] 1) Add frequently missed simple command patterns (i.e. text patterns of control commands) to the target whitelist.
[0093] 2) Delete or lower the priority of whitelist entries that have not been hit for a long time in the target whitelist. Long-term non-hit can refer to non-hit within a preset period (such as one day or one week).
[0094] 3) Adjust priorities based on the hit time distribution of whitelist entries to ensure that control commands used during high-frequency periods can be matched quickly and preferentially. In some examples, the cloud can statistically analyze the hit frequency of each whitelist entry in different time periods to generate a time-frequency distribution model. Based on this time-frequency distribution model, the cloud can adjust the dynamic priority weight of whitelist entries in different time periods to ensure that whitelist entries with higher hit frequencies are given higher priority within a specific time period. This allows the device to prioritize the retrieval of whitelist entries during matching, thereby improving retrieval and matching efficiency.
[0095] It should be noted that the cloud can also continuously record or maintain other types of command feedback information, or perform other types of iterative update operations. The specific settings can be flexibly configured based on actual needs, and this application embodiment does not limit this.
[0096] In this embodiment, the cloud can dynamically update and continuously optimize the target whitelist based on command feedback information, enabling a data-driven self-learning closed loop. This ensures that the target whitelist aligns with users' actual behavior and meets their specific needs, allowing it to adapt to changes in user habits (such as new devices or seasonal operations). Furthermore, dynamic updates to the target whitelist reduce manual maintenance costs.
[0097] The command processing method in this embodiment employs a dual-path routing approach, combining cloud-based identification and local routing, adding an interception and routing mechanism before the user's control command reaches the target agent. Specifically, the device can send the control command to the cloud. The cloud quickly determines the command type (whether the device can execute it locally) through keyword recognition and target whitelist matching, and returns the corresponding message to the device. The device determines the execution path of the control command based on the received message, which can include the following two methods:
[0098] (1) Fast path: The control command hits a whitelist entry in the target whitelist, that is, the control command is a simple command. The device receives a message message containing target execution information returned by the cloud, and executes the control command by calling the local API based on the target execution information. There is no need to call the target intelligent agent, which can reduce response latency.
[0099] (2) Normal path: The control command does not match any whitelist entry in the target whitelist, meaning the control command is a complex command. The device can receive message packets from the cloud indicating non-target execution information and invoke the target agent to execute the control command.
[0100] The command processing method in this application embodiment can reduce response latency and improve the real-time performance of control command execution; it can reduce unnecessary LLM calls, save token costs, and reduce resource overhead; in addition, it can improve user experience, for example, it can provide better user experience with higher real-time performance on resource-constrained devices such as gateways.
[0101] Based on the above embodiments, Figure 4 This is a schematic diagram illustrating the specific system architecture of an intelligent agent system according to an embodiment of this application. This intelligent agent system can be applied to scenarios such as smart home control, equipment maintenance, and industrial / industrial IoT device control. Specifically, the intelligent agent system may include the following:
[0102] Cloud-based: Keyword Recognition Module (KRM) and Whitelist Matching Module (WMM) can be deployed in the cloud. Specifically, a microservice architecture can be adopted, supporting elastic scaling.
[0103] On the device side: Local Dispatch Unit (LDU) can be deployed on the device side, and it can run on lightweight gateway devices such as Customer Premises Equipment (CPE) and Mobile WiFi (Mifi).
[0104] Communication protocols: The device and the cloud can communicate using protocols such as HyperText Transfer Protocol Secure (HTTPS) and WebSocket, with network latency less than 200 milliseconds (ms).
[0105] Instant Messaging Platform Integration: The device-side LDU can establish a message receiving channel with an instant messaging (IM) platform, such as through integration with chatbots (Robots, Bots).
[0106] like Figure 4 As shown, the intelligent agent system mainly includes a local processing unit (LDU) on the device side and a keyword processing unit (KPU) in the cloud. The KPU can include a keyword recognition module (KRM) and a whitelist matching module (WMM). The following provides a detailed explanation of the LDU and KPU:
[0107] 1. Local Distribution Unit (LDU)
[0108] LDUs are deployed on the device side, specifically including CPEs, routers, gateways, edge boxes, or personal computers (PCs). This LDU can be used to implement functions such as command interception, cloud-side communication, message (or special identifier) parsing, path selection decision-making, local execution, and whitelist caching. For example, Table 1 shows a schematic diagram of the module settings for one type of LDU, as follows:
[0109] Table 1
[0110]
[0111] 2. Cloud-based Keyword Recognition and Processing Unit (KPU)
[0112] The KPU mainly consists of a Keyword Recognition Module (KRM) and a Whitelist Matching Module (WMM). The KRM can be deployed in the cloud, such as on a cloud-based container (Kubernetes) cluster. KRM's processing time can be less than 200 milliseconds. Specifically, it can be implemented using lightweight models such as a field / regularity engine, a fast text classification library (FastText), or a lightweight BERT. The output target keyword data is in a standard format such as JSON and can include at least one of the following: intent action, target object, parameter information, and location information.
[0113] The whitelist matching module WMM can be deployed in the cloud, either in the same process as KRM or as a separate microservice. Data storage can utilize databases like Redis for hot data and persistent storage via databases like MySQL. The matching process between target keywords and the target whitelist can employ a regular expression engine (RE2), supporting multi-level priority data retrieval and matching. Output can be a message message including target execution information or a message message excluding target execution information (e.g., the control command itself).
[0114] It should be noted that, Figure 4 The specific architecture of the intelligent agent system in this paper is merely an example. In real-world scenarios, the cloud and device can also execute the above command processing methods based on other modules or other methods. This application does not limit this.
[0115] For example, Figure 5 This is a schematic diagram illustrating the execution flow of a command processing method for a device-side LDU according to an embodiment of this application. Figure 4 , Figure 5 As shown, the specific execution flow of this command processing method may include the following steps:
[0116] Step S501: Listen for and receive control commands from the IM platform.
[0117] Step S502: Upload the control commands to the cloud.
[0118] Step S503: Determine whether the message returned by the cloud has timed out. If the device's waiting time exceeds a preset time threshold, proceed to step S505. If the device's waiting time does not exceed (is less than or equal to) the preset time threshold, proceed to step S504.
[0119] Step S504: Receive and cache the message returned from the cloud. Determine whether the execution path of the control command is a fast path or a normal path based on whether the message includes target execution information. If it is a fast path, proceed to step S506; if it is a normal path, proceed to step S505.
[0120] Step S505: Send the control command to the target agent. The target agent calls the LLM to process the control command and execute the control command in the normal path.
[0121] Step S506: Based on the target execution information, the client calls the local API to execute control commands and perform a fast path processing procedure. This procedure does not require calling the target agent, which can reduce response latency and shorten user waiting time.
[0122] For example, Figure 6 This is a schematic diagram illustrating the execution flow of a cloud-based KDU command processing method according to an embodiment of this application. Figure 4 , Figure 6 As shown, the specific execution flow of this command processing method may include the following steps:
[0123] Step S601: Receive the control command sent by the device, perform keyword recognition processing on the control command, and extract the target keywords of the control command.
[0124] Step S602: Match the control commands with the target whitelist. That is, match the target keywords extracted by KRM with the whitelist entries in the predefined target whitelist.
[0125] Step S603: Confirm whether the control command matches the target whitelist. If the match is successful, proceed to S604; otherwise, proceed to S605.
[0126] Step S604: If a match is found, target execution information is generated based on the target keyword and the matching result, and a message containing the target execution information is returned to the device.
[0127] Step S605: If the target is not found, return a message message to the device that does not include the target execution information, such as returning the original control command as is.
[0128] In the command processing method in the embodiments of the present application, the LDU on the device side is configured to intercept a user's control command, encapsulate the control command into a target format, and upload the formatted control command to the cloud. The LDU selects to execute the control command through a fast path or a normal path according to a message packet returned by the cloud. After receiving the control command, the KPU in the cloud may extract target keywords through a rule engine (regular expression / keyword dictionary) or a lightweight machine learning model, compare and match the target keywords with whitelist entries in a target whitelist, and deliver a message packet to the device side based on the matching result. The whitelist entries in the target whitelist may adopt a combined form of regular expressions and structured parameters, which supports fuzzy matching and parameter extraction, and enables more flexible pattern matching. For example, "turn on + light" can match "turn on the living room light", "turn on the bedroom light" and the like, with high recognition accuracy. In this way, according to the command processing method in the embodiments of the present application, the cloud performs recognition and matching on the control command, and the device side executes the control command through the fast path or the normal path based on whether the message packet returned by the cloud includes target execution information, which can reduce the response latency of the control command, improve the real-time performance of control command execution, and enhance the user experience.
[0129] The command processing method in the embodiments of the present application can be applied to a variety of practical scenarios. Exemplary descriptions are given below for the CPE local operation and maintenance scenario and the smart home control scenario.
[0130] (1) CPE local operation and maintenance scenario
[0131] In this scenario, users can query basic device information and set related parameters through the IM platform, for example, query the network registration status, Wi-Fi information, etc., or modify the Wi-Fi password, turn Wi-Fi on or off, set parental control, and the like. Exemplarily, Table 2 is a schematic table of command processing in the CPE local operation and maintenance scenario according to an embodiment of the present application, which is specifically as follows:
[0132] Table 2
[0133]
[0134] (2) Smart home control scenario
[0135] In this scenario, home control based on the agent system can understand and respond according to the user's natural language instruction or device input state, simplifying the use process. Users can complete linkage settings through simple control commands. Exemplarily, Figure 7 is a schematic diagram of a smart home control scenario in an embodiment of the present application. As shown in Figure 7As shown, users can control various smart home devices through IM applications, smart voice applications, or smart audio devices (such as speakers) via corresponding message channels, cloud platforms, etc., by using the smart agent system to process commands.
[0136] For example, Table 3 is a command processing diagram of a smart home control scenario according to an embodiment of this application, as follows:
[0137] Table 3
[0138]
[0139] The following are two specific examples from embodiments of this application:
[0140] Specific example 1: Smart home lighting control
[0141] The specific scenario in Example 1 involves a user sending a control command to "turn on the living room lights" via IM software. The specific processing flow is as follows:
[0142] (1) The device-side LDU intercepts control commands and uploads them to the cloud.
[0143] (2) Extract target keywords from cloud-based KRM, for example, the target keyword is "{action: "open", location:"living room", device: "light"}.
[0144] (3) The cloud-based WMM matches the whitelist entry WL001 ("Open") in the target whitelist. lamp").
[0145] (4) The cloud returns a message containing target execution information, such as the target execution information identified as “FAST_CMD_WL001”.
[0146] (5) The device-side LDU parses the message packet, calls the local smart home API, and executes control commands, such as the command “home.light.turn_on("living room")”.
[0147] (6) Once the execution is complete, return the execution result to the user.
[0148] Specific Example 2: Complex Task Processing
[0149] The specific scenario in Example 1 involves a user sending a control command via IM software: "Help me plan a trip to location A next week, with a budget of 20,000 yuan." The specific processing flow of this control command is as follows:
[0150] (1) The device-side LDU intercepts control commands and uploads them to the cloud.
[0151] (2) The cloud-based KRM extracts the target keywords, but the cloud-based WMM does not match any whitelist entries in the target whitelist.
[0152] (3) The cloud returns a message message to the device-side LDU that does not include target execution information.
[0153] (4) The device-side LDU forwards the control command to the target intelligent agent, which calls the LLM to perform intent understanding and reasoning, and invokes the travel planning skill.
[0154] (5) The device returns a detailed travel plan to the user.
[0155] It should be noted that the specific examples and actual scenarios mentioned above are merely examples, and the command processing methods in the embodiments of this application can also be applied to other actual scenarios. The embodiments of this application do not limit this.
[0156] It should be understood that in the various embodiments of this application, the sequence number of each process and step does not imply the order of execution. The execution order of each process and step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0157] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, 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 is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0158] This embodiment also provides a command processing device for implementing the above embodiments and implementation methods; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated. The command processing device includes:
[0159] The first receiving module is used to receive control commands and upload the control commands to the cloud;
[0160] The second receiving module is used to receive the message message corresponding to the control command returned by the cloud.
[0161] The first execution module is used to respond to the target execution information included in the message message, and to call the local application programming interface (API) of the device to execute the control command according to the target execution information. The execution process of the control command does not go through the target intelligent agent.
[0162] The second execution module is used to execute the control command through the target agent in response to the message message not including the target execution information.
[0163] This application embodiment also provides another command processing apparatus, including:
[0164] The receiving module is used to receive control commands sent by the device.
[0165] The first sending module is configured to, in response to the successful matching of the control command in the target whitelist in the cloud, determine the target execution information corresponding to the control command, and send a message message including the target execution information to the device; the target execution information is used to instruct the device to call the local application programming interface (API) to execute the control command, and the execution process of the control command does not go through the target intelligent agent;
[0166] The second sending module is configured to send a message message that does not include the target execution information to the device in response to the failure of the control command to match the target whitelist, so as to instruct the device to execute the control command through the target agent.
[0167] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0168] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described command processing method embodiments when it is run.
[0169] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), computer hard disk, magnetic disk, or optical disk.
[0170] Figure 8 This is a structural block diagram of an electronic device according to an embodiment of this application, such as... Figure 8As shown, embodiments of this application also provide an electronic device 80, including a memory 801 and a processor 802. The memory 801 stores a computer program, and the processor 802 is configured to run the computer program to execute the steps in any of the above-described command processing method embodiments.
[0171] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0172] Embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps in any of the above-described command processing method embodiments.
[0173] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0174] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0175] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A command processing method, characterized in that, Executed by the device, including: Receive control commands and upload the control commands to the cloud; Receive the message message corresponding to the control command returned by the cloud; In response to the inclusion of target execution information in the message message, the control command is executed by calling the local application programming interface (API) of the device according to the target execution information, and the execution process of the control command does not go through the target intelligent agent; In response to the message message not including the target execution information, the control command is executed by the target agent.
2. The method according to claim 1, characterized in that, After uploading the control commands to the cloud, the method further includes: In response to the failure to receive the message packet returned by the cloud within a preset time threshold, the control command is executed through the target intelligent agent; or, In response to receiving the message returned by the cloud within the preset time threshold, and the message parsing fails, the control command is executed by the target intelligent agent.
3. The method according to claim 1, characterized in that, The target execution information includes at least one of the following: Message identifier, hit entry identifier, target keyword, target keyword confidence level, execution mode identifier, device information, action parameter dictionary, preset time threshold, and degradation strategy identifier.
4. The method according to claim 1, characterized in that, The method further includes: In response to an anomaly in the cloud and a successful match in the local cache whitelist, the local API is invoked to execute the control command based on the matched whitelist entry; the local cache whitelist is periodically synchronized from the cloud to the device; or, In response to an anomaly in the cloud and the failure of the control command to match the local cache whitelist, a preset prompt message is output.
5. A command processing method, characterized in that, Executed in the cloud, including: Receive control commands sent by the device; In response to the control command successfully matching in the target whitelist in the cloud, the target execution information corresponding to the control command is determined, and a message including the target execution information is sent to the device. The target execution information is used to instruct the device to call the local application programming interface (API) to execute the control command, and the execution process of the control command does not go through the target agent. In response to the failure of the control command to match the target whitelist, a message message excluding the target execution information is sent to the device to instruct the device to execute the control command through the target agent.
6. The method according to claim 5, characterized in that, The method further includes: Extract the target keywords of the control command; the target keywords include at least one of the following: intentional action, target object, parameter information, and location information. The target keyword is matched with the whitelist entries in the target whitelist in the cloud to obtain the matching result.
7. The method according to claim 5, characterized in that, The method further includes: Obtain command feedback information; the command feedback information includes at least one of control command execution information and whitelist entry feedback information. Update the target whitelist in the cloud based on the feedback information from the command.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the command processing method described in any one of claims 1 to 4 or any one of claims 5 to 7.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the command processing method described in any one of claims 1 to 4 or any one of claims 5 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the command processing method described in any one of claims 1 to 4 or any one of claims 5 to 7.
