A stateless robot dialogue method, device and medium
By introducing a stateless robot dialogue method in the voice robot dialogue system, using session token decoupling services and conversations, the effect of reducing coupling, improving scalability and concurrent access is achieved, and the problems of large resource occupancy and expansion difficulties in the prior art are solved.
Patent Information
- Application Number
- CN202211284734.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-17
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2042-10-17
AI Technical Summary
The existing voice robot dialogue system has large amounts of shared data stored on the server, resulting in large memory overhead, serious resource usage, and poor scalability of services, which cannot flexibly expand. The coupling of services and sessions leads to difficulty in scaling.
The stateless robot dialogue method is adopted to generate a session token through the gateway and associate it with the server to realize the decoupling of the service and the session, allowing each call to fall on any service robot. The service robot loads relevant information based on the session token, and implements the stateless session mechanism.
It reduces the coupling of services, facilitates maintenance and modification of service robots, and adopts a distributed architecture to increase concurrent visits. Each service robot provides undifferentiated services, avoiding service pressure and expansion difficulties.
Smart Images

Figure CN115665326B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a stateless robot dialogue method, device and medium. Background Art
[0002] With the rapid development of AI robots, robot dialogue services are widely used in various fields. At present, the demand in the banking and financial industry is growing rapidly, and the business scenarios are complex and diverse, which has extremely high requirements for the system's throughput, reliability, and maintenance costs. At present, most robot dialogue systems on the market adopt a single service architecture and a cluster architecture. The request from the client to the server is stateful, that is, the server generally saves the relevant information of the client request, and each request can use the previous request information by default. This leads to the need to maintain a call session, and all interactions of the call can only fall on one server, causing huge pressure on the service and unable to be flexibly expanded. How to achieve the decoupling between service and session is a problem that needs to be solved at present.
[0003] At present, voice robots still have the following shortcomings:
[0004] (1) During voice interaction, the coupling degree is high, and session maintenance is required. In addition, the server saves a large amount of shared data, which results in high memory overhead and occupies a large amount of resources.
[0005] (2) As demand continues to increase, business logic becomes very bloated and concentrated in a single service node, resulting in poor service scalability;
[0006] (3) Traditional voice robots have outdated architectures and use single-server and cluster approaches. When a service fails, the server switching process takes a long time, which has a huge impact on business development. Summary of the invention
[0007] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a stateless robot dialogue method and device that realizes decoupling between service and session, thereby breaking the dependence of session on service.
[0008] The purpose of the present invention can be achieved by the following technical solutions:
[0009] One aspect of the present invention provides a stateless robot dialogue method, which is applied to a gateway and includes the following steps: establishing a first link with a client and receiving call request data, generating a session token and sending it to the client; establishing a second link with a server, the server including multiple service robots, matching the service robots using a preset strategy, sending the call request data and the session token associated with user data to the service robots; forwarding response data from the service robots to the client; receiving expression data including the session token from the client, re-matching the service robots using a preset strategy, sending the expression data and the session token to the service robots, obtaining new response data from the service robots and forwarding it to the client, determining whether the current response data contains session end information, if not, re-executing this step, if yes, executing the next step; disconnecting the first link and the second link to end the call.
[0010] As a preferred technical solution, the process of matching the service robots includes the following steps: obtaining the load status information of the service robot cluster on the server side; and selecting a service robot with a smaller load as the matched service robot according to a preset strategy.
[0011] As a preferred technical solution, the preset strategy is a load balancing strategy.
[0012] As a preferred technical solution, the user data is preset in a database within the server.
[0013] As a preferred technical solution, the response data matches the current node of the business process chain, the business process chain is preset in the server, and matches the call request data.
[0014] As a preferred technical solution, the expression data includes text content expressed by the user.
[0015] As a preferred technical solution, the session token has a time limit and is marked as invalid after exceeding a preset threshold.
[0016] As a preferred technical solution, the threshold is 30 minutes.
[0017] Another aspect of the present invention provides an electronic device, comprising: one or more processors and a memory, wherein the memory stores one or more programs, and the one or more programs include instructions for executing the above-mentioned stateless robot dialogue method.
[0018] Another aspect of the present invention provides a computer-readable storage medium comprising one or more programs for execution by one or more processors of an electronic device, wherein the one or more programs include instructions for executing the above-mentioned stateless-based robot dialogue method.
[0019] Compared with the prior art, the present invention has the following advantages:
[0020] (1) When a session is created for the first time, the gateway allocates a session token and associates it with the user data on the server side. In subsequent sessions, each call can be placed on any service robot. The service robot loads relevant information based on the session token. In the conversation environment, the robot does not need to be bound to the session object, forming a stateless session mechanism.
[0021] (2) The coupling of services is greatly reduced, making it easier to maintain and modify service robots;
[0022] (3) With the distributed architecture, the gateway dynamically obtains the load information of the service robot cluster and matches the service robots through the load balancing strategy, which greatly increases the concurrent access volume;
[0023] (4) Each service robot can provide the same service, so there is no need to classify service robots into different types according to business types. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flow chart of a stateless robot dialogue method in an embodiment;
[0025] Figure 2 A schematic diagram of a server in an embodiment;
[0026] Figure 3 It is a flowchart of realizing stateless robot dialogue in an embodiment. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] Example 1
[0029] like Figure 1 The above is a flow chart of the stateless robot dialogue method of this embodiment, which includes the following steps:
[0030] Step S1, receiving call request information, and matching a service robot according to the current load status of the service robot cluster;
[0031] Step S2, generating and sending a session token;
[0032] Step S3, obtaining customer information from a preset database, and matching a preset business process chain according to the customer information;
[0033] Step S4, the service robot obtains the information of the next node associated with the starting node according to the starting node information of the business process chain, associates it with the session token, assembles and sends the matching service data;
[0034] Step S5, re-matching the service robot according to the current load state of the service robot cluster, the service robot receives the expression information including the session token, and determines the current node of the business process chain according to the session token;
[0035] Steps S6-S7, parsing the information of the current node, if the current node is the end node, go to step S10, otherwise go to step S5;
[0036] Step S8, obtaining information of the next node associated with the current node and associating it with the session token;
[0037] Step S9, assembling and sending matching speech data according to the expression information;
[0038] Step S10, sending a call end message to end the call.
[0039] The session token is time-limited and will become invalid after 30 minutes.
[0040] This embodiment adopts a distributed architecture of microservices, divides the entire voice robot system into different functional modules, configures it through process scenario management, maintains the process list, process node list, and node relationship list, establishes the correlation relationship between the trends of various process scenarios, and synchronizes the data to the middleware; configures the robot conversation text through speech management, and stores the data in the database; adopts a session management strategy, obtains the customer's basic data, extensible data, and process scenario data based on the list information, and associates the above data with the session ID and stores it in the middleware according to the HSAH type; utilizes the robot process service mechanism, obtains the shared data of the session through the middleware and parses the process, and synchronizes the new session data generated during the interaction to the middleware again, thereby extracting the context information that the robot conversation depends on, and uniformly managing the session data, so that the voice robot system can be stateless, improve system resource utilization, and configure efficiently.
[0041] like Figure 2The server mainly includes three modules, namely: (i) Session management service, including basic data management, extensible data management, and process scenario data management. (ii) Robot process service, including process scenario analysis and session data update. (iii) Configuration service, including process scenario management and speech management.
[0042] Session management service: After the call enters the robot process service, the session is created. The session data is associated with the session ID, and the session is uniformly stored in the distributed cache according to the Hash type, and its expiration time is set to 30 minutes. The session data is divided into customer data and process scenario data. Among them, customer data includes basic data and extensible data. The key of basic data is defined as callid|custBasicData, and the corresponding content includes customer name, gender, number, and process ID; the key of extensible data is defined as callid|custVariableData, and extensible data can add attributes according to business needs and attribute values can be dynamically updated by calling the interface; the key of process scenario data is defined as callid|flowData, and the corresponding content includes process list, process node list, and node relationship list. After the session data is initialized, it enters the waiting stage. As context data during the call, the session data is generated when the call starts and will also disappear when the call ends. When the process is executed or the user hangs up, the server actively initiates the session destruction mechanism to clear the customer basic data, extensible data, and process scenario data associated with the current call according to the session ID to ensure that the memory is released in time.
[0043] Robotic process service: mainly provides a set of undifferentiated services. During the interaction process, the server does not store session-related data, and a call can fall on any process node. When session data is needed, the distributed cache data is obtained according to the session id. After entering the process entry, the process scenario data in the cache is obtained according to callid|flowData, the corresponding process template is parsed, the start node is obtained and executed, and the associated next node NEXT_CODE to be executed is stored in the cached extensible data. According to the intention instruction corresponding to the start node, the configuration service is called to obtain the conversation content, and the TTS device is called through the voice platform to broadcast to the customer. Furthermore, after the first request, the session id of the current call will be returned. In each subsequent round of interaction, the server will be requested again with the current session id. The session data related to the customer can be dynamically updated during runtime. Inside the server, when the robot process service parses the instruction that needs to call the interface, it interacts through the call between services. After obtaining the data, the data is updated to the distributed cache according to the session id. The process scenario data in the session is used for node jumps. The server obtains the NEXT_CODE node stored last in the process based on the session id, matches the node to be executed next time based on the process list, and updates the value of the node as NEXT_CODE to the cache. When executing the current node, call the configuration service to obtain the content of the robot conversation. When there are variables in the conversation text, obtain the latest customer data in the distributed cache through the session id to fill in the variables in the conversation text, and return the replaced complete words to the voice platform for broadcast. And so on, the subsequent loop executes this step.
[0044] Configuration service: This service consists of two parts. The first is process scenario management, which is used to define the relationship between process nodes, including process list, process node list, and node relationship list. During configuration, the data will be synchronized to the distributed cache and wait for the robot process service to call it. The second is speech management, which provides an interface for http requests. The robot process service requests this interface during parsing to obtain the text content of the robot's current conversation.
[0045] The components cooperate with each other to realize stateless robot dialogue. The specific steps of the dialogue are as follows: Figure 3 The explanation of each step is as follows:
[0046] 1. The voice platform initiates a call. After the customer answers, a call connection is established, a session ID for the current call is generated, and the Geteway gateway is called by sending an HTTP request.
[0047] 2. After receiving the request, the gateway requests a robot process service through the load balancing strategy.
[0048] 3. The robot process service calls the database to obtain the basic data of the current customer, requests the configuration service according to the process ID number in the basic data, and obtains the current process scenario data.
[0049] 4. The robot process service calls the session management service to pre-process the acquired data and store the customer basic data, scalable data, and process scenario data in the distributed cache.
[0050] 5. The robot process service calls the session management service, filters out the session data of the current call according to the session ID, and obtains the process scenario data therein.
[0051] 6. Parse the process scenario data, first find the START node, obtain the detailed information of the START node, and put the corresponding next jump node information into the extensible data through the session management service.
[0052] 7. The robot process service assembles the vxml file of the current node and returns the data with the session ID to the Geteway gateway.
[0053] 8. Geteway gateway returns the vxml file to the voice platform, parses it through the media server, calls the TTS device for voice broadcast, and after the broadcast is completed, turns on the ASR voice recognition function to collect the content expressed by the user.
[0054] 9. After collecting user expressions in subsequent interactions, the voice platform carries the session ID of the last interaction and the text content of the user's expression when requesting the Geteway gateway.
[0055] 10. Geteway gateway requests any robot process service based on load balancing. The service node does not need to be consistent with the service node of the last interaction.
[0056] 11. The robot process service parses the current node, calls the NLP semantic understanding device according to the content expressed by the user, obtains the intention instruction CODE, and puts the next node data associated with the current node into the middleware through the session management service.
[0057] 12. The robot process service calls the speech management interface in the configuration management service and obtains the speech text of the current node based on the current node and intent instruction CODE.
[0058] 13. The robot process service assembles the vxml file of the current node and returns the data to the Geteway gateway.
[0059] 14. The subsequent nodes execute step 8 above in a loop.
[0060] 15. During the robot process service parsing process, if the current node is the end node or the user hangs up abnormally, the session management service is called to clear the current session data according to the session ID and notify the voice platform that the process has ended.
[0061] 16. After receiving the hang-up command, the voice platform executes the hangup event and ends the call.
[0062] Example 2
[0063] This embodiment provides an electronic device, including: one or more processors and a memory, wherein one or more programs are stored in the memory, wherein the one or more programs include instructions for executing the stateless robot dialogue method based on Example 1.
[0064] Example 3
[0065] This embodiment provides a computer-readable storage medium, including one or more programs for execution by one or more processors of an electronic device, wherein the one or more programs include instructions for executing the stateless robot dialogue method based on Example 1.
[0066] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A stateless robot dialogue method, applied to a gateway, characterized in that: The steps include: Establishing a first link with a client and receiving call request data, generating a session token and sending it to the client; Establishing a second link with a server, the server comprising a plurality of service robots, matching the service robots using a preset strategy, and sending the call request data and the session token for associating with the user data to the service robots; forwarding the response data from the service robot to the client; Receive expression data including the session token from the client, re-match the service robot using a preset strategy, send the expression data and the session token to the service robot, the service robot receives the expression information including the session token, determines the current node of the business process chain according to the session token, obtains new response data from the service robot and forwards it to the client, determines whether there is session end information in the current response data, if not, re-executes this step, if yes, executes the next step; Disconnect the first link and the second link, and end the call. The process of matching the service robot includes the following steps: Obtaining load status information of the service robot cluster on the server side; According to the preset strategy, a service robot with a smaller load is selected as the matched service robot. The preset strategy is a load balancing strategy. The response data matches the current node of the business process chain, the business process chain is preset in the service end and matches the call request data.
2. A stateless robot dialogue method according to claim 1, characterized in that: The user data is preset in the database in the server.
3. The stateless robot dialogue method according to claim 1, characterized in that: The expression data includes the text content expressed by the user.
4. A stateless robot dialogue method according to claim 1, characterized in that: The session token has a time limit and is marked as invalid after exceeding a preset threshold.
5. A stateless robot dialogue method according to claim 4, characterized in that: The threshold is 30 minutes.
6. An electronic device, characterized in that: include: One or more processors and a memory, wherein the memory stores one or more programs, and the one or more programs include instructions for executing the stateless robot dialogue method according to any one of claims 1-5.
7. A computer-readable storage medium, characterized in that: It comprises one or more programs for execution by one or more processors of an electronic device, wherein the one or more programs comprise instructions for executing the stateless robot dialogue method as described in any one of claims 1-5.
Citation Information
Patent Citations
Chatting robot system and automatic chatting method
CN101076060A
Man-machine conversation control method and device of robot, computer equipment and medium
CN113626568A
Multi-robot dialogue management method, device, equipment and medium
CN113868404A