A message processing method, apparatus, device, medium and program product
By using a local caching component to store answer message identifiers in the intelligent question-answering system, the problems of high network I/O overhead and poor stability caused by frequent access to the Redis database are solved. This enables low-overhead, real-time stop-response functionality, improving the stability and response flexibility of streaming question answering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2024-11-27
- Publication Date
- 2026-05-29
AI Technical Summary
In the process of intelligent question answering, frequent access to the Redis database to determine when to stop answering leads to problems such as high network I/O overhead, poor stability, and insufficient scalability.
A local caching component is used to store the answer message identifier, reducing network I/O overhead and enabling low-overhead, real-time streaming message stop-response functionality.
It improves the stability and scalability of streaming question-and-answer scenarios, reduces network latency, and enhances response flexibility and user experience.
Smart Images

Figure CN122111702A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more particularly to the field of intelligent documents, specifically to a message processing method, a message processing device, a computer equipment, a computer-readable storage medium, and a computer program product. Background Technology
[0002] Intelligent question answering refers to the process of answering user questions with accurate and concise natural language; it is a promising and highly regarded area in the field of Natural Language Processing (NLP).
[0003] Currently, the common solution for implementing a "stop answering" function in intelligent question answering is to use a Redis database for storing data on which to stop answering. This results in a data retrieval from the Redis database every time a decision is made to stop answering. However, the frequency of Redis database access is very high during intelligent question answering, which not only leads to a significant amount of time being wasted on network I / O (Input / Output) overhead, but also puts a heavy request load on the Redis database, causing instability and impacting the stability and scalability of the intelligent question answering process. Summary of the Invention
[0004] This application provides a message processing method, apparatus, device, medium, and program product that can achieve low-overhead, real-time streaming message stop reply function in streaming question-and-answer scenarios through a local judgment method without network I / O overhead.
[0005] On one hand, embodiments of this application provide a message processing method, which is executed by a computer device, and the method includes:
[0006] Retrieve question messages in streaming question-answering scenarios;
[0007] In response to a question message, generate an answer message corresponding to the question message and an answer message identifier that refers to the answer message;
[0008] If a stop reply request is received for the answer message, the answer message identifier is stored in the local cache component of the computer device;
[0009] Based on the answer message identifier in the local cache component, obtain the generation progress information of the answer message;
[0010] Based on the progress information of the answer message generation, the question message is processed to provide a response.
[0011] On the other hand, embodiments of this application provide a message processing apparatus, which is mounted on a computer device and executed thereon. The apparatus includes:
[0012] The acquisition unit is used to acquire question messages in streaming question-answering scenarios.
[0013] The processing unit is used to generate an answer message corresponding to the question message and an answer message identifier referring to the answer message in response to the question message;
[0014] The processing unit is also configured to, if a stop reply request is received for the answer message, store the answer message identifier in a local cache component of the computer device;
[0015] The processing unit is also used to obtain the generation progress information of the answer message based on the answer message identifier in the local cache component;
[0016] The processing unit is also used to process question messages and provide answers based on the progress information of the answer message generation.
[0017] In one implementation, the processing unit, when receiving a stop-response request for an answer message and storing the answer message identifier in a local cache component of the computer device, specifically performs the following:
[0018] Receive a stop reply request in response to the answer message. The stop reply request is used to request the cessation of generating the answer message.
[0019] In response to a stop-response request, obtain the time when the stop-response request was received;
[0020] The answer message identifier and the receiving time are stored as data pairs in the local cache component.
[0021] In one implementation, the generation progress information of the answer message includes any of the following: generation not started, generation in progress, and generation completed; wherein,
[0022] The generation of a message representing the answer has not yet begun;
[0023] The generation process indicates that some sub-messages in the answer message have been generated; the answer message is composed of multiple sub-messages arranged in the order in which they were generated.
[0024] The completion of generation indicates that all sub-messages in the answer message have been generated.
[0025] In one implementation, the generation progress information of the answer message is "generation not started"; the processing unit, used to process the question message for answering questions based on the generation progress information of the answer message, specifically performs the following:
[0026] Stop generating the answer message;
[0027] Remove the target data pair, which includes the answer message identifier and the reception time, from the local cache component; and...
[0028] Output the first notification message, which indicates that the generation of the answer message has been stopped.
[0029] In one implementation, the generation progress information of the answer message is "generating". The processing unit, used to process the question message and provide a question answer based on the generation progress information, specifically performs the following:
[0030] Abort the generation of the answer message and delete the target data pair, which includes the answer message identifier and the reception time, from the local cache component; and,
[0031] Retrieve the target sub-message to be displayed and the message display strategy; the target sub-message is a sub-message that has been generated but not yet displayed in the local cache component before the answer message identifier is detected; the message display strategy is used to indicate the display rules for the target sub-message;
[0032] The target sub-message is processed according to the display rules indicated by the message display strategy.
[0033] In one implementation, the generation progress information of the answer message indicates that generation is complete; the processing unit, used to process the question message for answering questions based on the generation progress information of the answer message, specifically performs the following:
[0034] Output a second notification message, which indicates that the current streaming question and answer session has ended.
[0035] In one implementation, the local caching component is configured with a data cleanup task. This task cleans up data pairs within the local caching component. These data pairs include, in a streaming question-and-answer scenario, the answer message identifier and reception time corresponding to an answer message whose generation was requested to be stopped. The reception time refers to the time when a stop-response request for the answer message is received. The data pairs in the local caching component are configured with a cache duration. The processing unit is further configured to:
[0036] Perform data scanning on the local cache component to obtain multiple first data pairs;
[0037] The received time included in each of the multiple first data pairs is compared with the current time to obtain the cached duration of each first data pair;
[0038] Delete the first data pair from multiple first data pairs whose cache duration has exceeded the cache duration period.
[0039] In one implementation, the local cache component stores data pairs, which include, in a streaming question-and-answer scenario, the answer message identifier corresponding to the answer message whose generation was requested to be stopped and the receiving time, where the receiving time refers to the time when the stop-response request for the answer message was received; the local cache component is configured with a memory threshold; the processing unit is further used for:
[0040] Calculate the amount of memory used by each data pair in the local cache component;
[0041] If the total memory occupied by each data pair reaches the memory threshold, the second data pair is removed from the local cache component according to the eviction policy until the total memory occupied by the remaining data pairs in the local cache component is less than the memory threshold. The eviction policy is a strategy to select the second data pair from the local cache component based on the amount of memory occupied by the data pair.
[0042] In one implementation, the computer device is the target service node in a distributed question-answering system. The distributed question-answering system includes N service nodes, among which the target service node is included, where N is an integer greater than 1. The target service node is configured with a first communication strategy. When the distributed question-answering system starts, the processing unit is further configured to:
[0043] Receive the second communication strategy;
[0044] If the first communication strategy and the second communication strategy are different, then obtain the node information of each of the N-1 reference service nodes; the reference service node is any service node other than the target service node among the N service nodes.
[0045] The second communication strategy is verified based on the node information of N service nodes;
[0046] If the verification is successful, a second communication strategy is deployed, and node information for each reference service node is stored.
[0047] In one implementation, the processing unit is further used for:
[0048] If the first communication strategy and the second communication strategy are the same, then the node information of the historical service nodes stored in the target service node is detected; the historical service nodes are the service nodes in the original cluster service to which the target service node belongs; and,
[0049] If the target service node stores the node information of each of the M historical service nodes, then the node information of the M historical service nodes is compared with the node information of the N-1 reference service nodes; M is an integer greater than zero.
[0050] When a target reference service node exists among the N-1 reference service nodes but is not included in the M historical service nodes, the node information of the target reference service node is stored in the target service node.
[0051] In one implementation, the second communication strategy is an election communication strategy; the processing unit, when deploying the second communication strategy, specifically performs the following functions:
[0052] Initialize the logs of the target service node; and,
[0053] In a distributed question-and-answer system, a voting election is conducted, and the leader service node elected by the vote is recorded; and,
[0054] Start the backup node. The backup node is used to back up the data stored in the target service node.
[0055] In one implementation, the processing unit is further used for:
[0056] If a stop reply request is received for the answer message, check whether the target service node is the leader service node;
[0057] If the target service node is not the leader service node, a stop reply request will be sent to the leader service node, causing the leader service node to respond to the stop reply request for the answer message, cache the answer message identifier and the receipt time of the stop reply request in the leader service node's local cache component, and the leader service node will write the stop reply request to the log to obtain log information; the leader service node will forward the log information to the reference service nodes and the target service node in the distributed question and answer system, excluding the leader service node.
[0058] Receive log information sent by the leader service node;
[0059] In response to log information, the answer message identifier and reception time are cached as data pairs in the local cache component of the target service node.
[0060] In one implementation, the second communication strategy is a broadcast communication strategy; the processing unit is further configured to:
[0061] If a stop-response request is received in response to an answer message, the answer message identifier and the time the stop-response request was received are cached as a data pair in the local cache component of the target service node; and,
[0062] Traverse the N-1 reference service nodes in the distributed question-answering system, forward the stop-response request to each reference service node, and enable each reference service node to cache the answer message identifier and reception time in the form of data pairs in its local caching component.
[0063] On the other hand, embodiments of this application provide a computer device, the device comprising:
[0064] A processor is used to load and execute computer programs;
[0065] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described message processing method.
[0066] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program adapted to be loaded by a processor and executed by the above-described message processing method.
[0067] On the other hand, embodiments of this application provide a computer program product, which includes computer instructions that, when executed by a processor, implement the message processing method described above.
[0068] In this embodiment, after obtaining the question message input by the user in a streaming question-and-answer scenario, the computer device responds to the question message by generating an answer message corresponding to the question message and an answer message identifier that identifies the answer message. The answer message identifier uniquely identifies the answer message, and the answer message can be understood as a message used to answer the question message. If the user wants to stop the smart assistant from continuing to respond to the answer message, the user can perform a stop-response operation on the answer message. At this time, the computer device receives a stop-response request generated by the smart assistant based on the stop-response operation and, in response to the stop-response, caches the answer message identifier of the answer message in the computer device's local cache component. Thus, during the generation of the answer message, the computer device can directly detect the existence of the answer message identifier of the requested-stop-response answer message from its local cache component. Compared to requiring the computer device to detect the answer message identifier from other devices independent of the computer device (such as a dedicated database storing the answer message identifier, such as a Redis database) via a network I / O interface, directly detecting the answer message identifier from the local cache component greatly reduces network I / O overhead and is not limited by the device performance of other devices, thereby improving the stability of the streaming question-and-answer scenario to a certain extent. Furthermore, when the computer device detects the presence of an answer message identifier in its local cache component, indicating that the user wants to stop responding to the answer message, the computer device stops responding to the answer message while simultaneously acquiring the answer message generation progress information. Thus, the computer device processes the question message based on the answer message generation progress information, such as pushing the partially generated answer message. Compared to simply not replying to the question message when it detects that it has stopped generating the answer message, this method allows for continued responses based on the answer message generation progress information, achieving real-time cessation of responses while increasing the flexibility of responses to question messages and enhancing the user experience of participating in intelligent question answering. Attached Figure Description
[0069] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0070] Figure 1 This is a schematic diagram of the architecture of a streaming question-answering system provided in an exemplary embodiment of this application;
[0071] Figure 2 This is a flowchart illustrating a message processing method provided in an exemplary embodiment of this application;
[0072] Figure 3aThis is a schematic diagram of an object input problem message provided in an exemplary embodiment of this application;
[0073] Figure 3b This is a schematic diagram of another object input problem message provided in an exemplary embodiment of this application;
[0074] Figure 3c This is a schematic diagram of yet another object input problem message provided in an exemplary embodiment of this application;
[0075] Figure 4 This is a schematic diagram of a dialogue provided in an exemplary embodiment of this application;
[0076] Figure 5 This is a schematic diagram illustrating a server streaming data from an answer generation model, provided in an exemplary embodiment of this application.
[0077] Figure 6 This is a schematic diagram illustrating an exemplary embodiment of this application of performing a stop-response operation in a question-and-answer interface;
[0078] Figure 7a This is a schematic diagram illustrating a method for stopping responses in a question-and-answer interface, provided by an exemplary embodiment of this application.
[0079] Figure 7b This is an exemplary embodiment of the present application providing another diagram of stopping the response in a question-and-answer interface;
[0080] Figure 7c This is another schematic diagram illustrating the cessation of answering in a question-and-answer interface, provided by an exemplary embodiment of this application;
[0081] Figure 8 This is a schematic diagram of the architecture of an existing distributed system.
[0082] Figure 9 This is a schematic diagram of an exemplary embodiment of the present application providing a Polaris automatic selection communication strategy;
[0083] Figure 10 This is a schematic diagram illustrating an exemplary embodiment of the present application of a deployment election communication strategy;
[0084] Figure 11 This is a schematic diagram illustrating data synchronization based on an election communication strategy, provided in an exemplary embodiment of this application.
[0085] Figure 12 This is a schematic diagram illustrating a data synchronization based on a broadcast communication strategy, provided in an exemplary embodiment of this application.
[0086] Figure 13This is a schematic diagram of the structure of a message processing apparatus provided in an exemplary embodiment of this application;
[0087] Figure 14 This is a schematic diagram of the structure of a computer device provided in an exemplary embodiment of this application. Detailed Implementation
[0088] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0089] This application provides a message processing solution, specifically a solution for implementing a stop-response function in an intelligent question-answering scenario. Intelligent question answering (QA), also known as open-ended question answering, interactive dialogue, or intelligent dialogue, belongs to the field of human-computer interaction and is an advanced form of information retrieval system. With the rapid development and application of artificial intelligence (AI), intelligent question answering technology has become a highly anticipated and promising area in the field of NLP.
[0090] In intelligent question-and-answer scenarios, a smart assistant, a corresponding backend server (or simply server), and a user interacting with the smart assistant are typically involved. The smart assistant can be understood as intelligent software deployed on a terminal, capable of interacting with the user through voice, text, and images, providing rich functions such as information retrieval, life services, and learning guidance. The smart assistant can be deployed as an application on the terminal; an application is a computer program designed to perform one or more specific tasks. Classified by its operating method, applications can include, but are not limited to: clients that require downloading and installing a package, which is then deployed on the terminal to implement intelligent question-and-answer; small programs that do not require downloading and install a package but run as subroutines on the client; and web (World Wide Web) applications opened and run through a browser on the terminal; etc. This application embodiment does not limit the operating method of the smart assistant on the terminal.
[0091] The process of realizing human-computer dialogue in an intelligent question-answering scenario can include: the user inputs a question message into an intelligent assistant. After receiving the question message, the intelligent assistant sends it to the server. The server processes the question indicated by the question message and obtains an answer message corresponding to the question message. This answer message is a message that can answer the question indicated by the question message. The question processing performed on the question message can sequentially include operations such as question understanding → knowledge detection → answer generation. The server returns the answer message to the intelligent assistant, enabling the intelligent assistant to output the answer message in accurate and concise natural language to resolve the user's question. It is worth noting that, in order to optimize the user's intelligent question-answering experience, a streaming response method is usually used to output the answer message in an intelligent question-answering scenario; that is, streaming output is used to respond to the question message. Therefore, this application embodiment also refers to the intelligent question-answering scenario as a streaming question-answering scenario or a streaming dialogue scenario, etc. Here, streaming response means that when the server processes the question message, it does not return the answer message all at once after generating the answer message for the question message, but rather returns a portion of the generated answer message in real time during the process of generating the answer message. In other words, streaming response can be understood as follows: while the server feeds back the generated sub-messages belonging to the answer message to the smart assistant, it continues to generate other sub-messages belonging to the answer message. This streaming response can reduce the delay in answer message output, improve user experience, and is well adapted to smart question-and-answer scenarios with real-time updates or large amounts of data.
[0092] Furthermore, in streaming question-and-answer scenarios, users may have a need to "stop replying." "Stop replying" refers to the process where, after a user actively triggers a stop replying action, the server actively stops generating answers. Currently, the solution for implementing the "stop replying" function in streaming question-and-answer scenarios is to introduce a server-independent database for storing data related to stopping replying. For example, Redis can be used to store stop replying signals or requests in streaming question-and-answer scenarios. Redis is an open-source, in-memory, high-performance key-value store commonly used as a database, cache, and message broker. In this way, during the process of generating answer messages for question messages, the server retrieves data from the Redis database every time it determines whether to stop responding (e.g., to stop the response request). Since the frequency of data retrieval from the Redis database is very high in streaming response scenarios, the entire streaming response process involves frequent calls to the Redis database. This not only wastes a significant amount of time on network I / O overhead (i.e., the overhead incurred by the server retrieving data from the Redis database through input and output interfaces), but also, since the entire streaming response process relies on the Redis database, if the Redis database crashes or malfunctions due to excessive request pressure, it will affect the stability of the intelligent question-answering system (i.e., the system architecture corresponding to the streaming response scenario) and introduce uncertainties regarding the subsequent functional scalability of the intelligent question-answering system.
[0093] To improve the stability and scalability of intelligent question-answering systems, the message processing scheme provided in this application utilizes local caching to implement the stop-response function in streaming response scenarios. Specifically, a memory region is allocated or set up in the server's local memory space as a local caching component (or local memory component) to cache data related to the stop-response function, ensuring low local memory usage and high performance. Compared to relying on a Redis database to implement the stop-response function, reading data from the server's local memory eliminates network I / O overhead, thus achieving low-overhead and real-time streaming message stopping.
[0094] Specifically, the message processing scheme provided in this application embodiment can be roughly described as follows: A computer device acquires the question-and-answer message input by the user in a streaming question-and-answer scenario. Before generating an answer message to answer the question message, the computer device first responds to the question message by generating an answer message corresponding to the question message and an answer message identifier representing the answer message, and stores the answer message identifier, such as in the computer device's memory. Then, the computer device generates the answer message by performing operations such as question understanding, knowledge retrieval, and answer generation on the question-and-answer message. If the computer device receives a stop-response request, which is generated by the terminal when the user performs a stop-response operation on the answer message in the smart assistant, the stop-response request is used to request the computer device to stop generating the answer message. When the computer device receives the stop-response request, it caches the answer message identifier pre-generated for the answer message in the computer device's local cache component, such as reading the answer message identifier from the computer device's memory and caching it in the computer device's local cache component. Thus, during the generation of the answer message, if the computer device detects an answer message identifier in the local cache component during any access, it determines that the user wants to stop generating the answer message. At this point, the computer device obtains the answer message generation progress information based on the answer message identifier in the local cache component and flexibly processes the question message accordingly. Conversely, if the computer device does not receive a stop-response request, the answer message identifier pre-generated for the answer message remains stored in the computer device's memory, and the answer message generation process continues. When answer message generation is complete, and the computer device generates a new answer message for a new question message, it scans the answer message identifier of the new answer message in the local cache component, but no longer scans the answer message identifier of the already completed answer message generation.
[0095] Practice has shown that the message processing scheme provided in this application has significant advantages in implementing the stop-response function in a streaming question-and-answer scenario. The advantages of this application's embodiment are illustrated below by comparing it with existing mainstream streaming question-and-answer schemes for implementing the stop-response function.
[0096] Current mainstream solutions for stopping response functionality in streaming question-answering scenarios include introducing a Redis database independent of the computer device to store stop response requests; during the generation of answer messages, the computer device accesses the Redis database via network I / O interface to remotely determine whether to stop generating answer messages. This remote determination method has the following disadvantages: ① Poor scalability: Migration or scaling up / down of the intelligent question-answering system involves Redis database compatibility; network incompatibility issues can easily arise in cross-datacenter and cross-regional scenarios, making functional expansion in streaming question-answering scenarios more difficult. ② High network overhead and latency: Each read and write operation from the Redis database by the computer device incurs network overhead. In streaming question-answering scenarios, Redis database access is frequent, with each access or call incurring network I / O overhead, potentially slowing down the response speed to question messages; and the latency problem can be exacerbated by network fluctuations or cross-regional issues. ③ Performance Bottleneck: The high frequency of data reads and writes to the Redis database by computer devices makes Redis a performance bottleneck in streaming question-and-answer scenarios. As the business volume increases, the pressure on the Redis database will become more severe, easily becoming a weak link in the entire streaming question-and-answer system. ④ Poor Stability: Streaming question-and-answer scenarios rely on Redis databases to implement the stop-response function. This means that if the Redis database fails or the network fluctuates, the stop-response function will become unavailable, and may even paralyze the intelligent question-and-answer system. ⑤ Memory Waste: High-frequency access to the Redis database by computer devices generates a large number of cached stop-response keys, and these keys have very short lifespans. Even if Redis databases use lazy deletion or periodic small-scale cleanup strategies, they do not fundamentally solve the problem of a large number of invalid keys in Redis database memory, resulting in serious memory waste.
[0097] However, on the one hand, this application embodiment directly allocates a memory area in the local memory of the computer device as a local cache component. This local cache component is used to cache the answer message identifiers corresponding to the answer messages for which the user requests to stop replying in a streaming question-and-answer scenario. The user may initiate a stop reply request for the question message at any time after sending it in the smart assistant. The number of answer message identifiers stored in the local cache component is a non-zero integer. If the user does not initiate a stop reply request in a round of streaming question-and-answer scenario, the number of answer message identifiers in the local cache component is zero. This solution has at least the following advantages: ① High scalability and high availability: The stop reply function in the streaming question-and-answer scenario no longer relies on the Redis database, making system migration and scaling of the smart question-and-answer system easier. ② Low latency with no network I / O overhead: It eliminates the need to call the Redis database via network I / O, achieving a stop reply function with no network I / O overhead in the streaming question-and-answer scenario, improving the streaming response rate. ③ High performance and high stability: The performance of the computer device is no longer limited by the performance bottleneck of the Redis database, improving the device performance and enhancing the stability of the streaming question-and-answer scenario. ④ High memory utilization: By allocating a local cache component in the local memory of the computer device to cache data, high utilization of the computer device's local memory is achieved. On the other hand, the computer device can process question messages based on the progress information of answer message generation. Compared to simply not replying to question messages when a message indicating a halt to answering is detected, the ability to continue processing question messages based on the progress information of answer message generation improves the flexibility of responding to question messages and enhances the user experience of participating in intelligent question answering.
[0098] The intelligent question-and-answer system provided in this application embodiment serves as an automatic question-and-answer solution for human-computer interaction. It can understand, parse, and answer questions posed by users. This makes the message processing solution provided in this application embodiment applicable to various interactive dialogue scenarios that require the use of an intelligent question-and-answer system for inquiry. Interactive dialogue scenarios may include, but are not limited to: ① Customer support: The intelligent question-and-answer system can serve as a customer support tool to answer users' common questions, reducing the workload of customer service personnel and improving customer satisfaction. ② Enterprise internal knowledge base: Enterprises can utilize the intelligent question-and-answer system to build internal knowledge bases, helping employees quickly find the information they need and improving work efficiency. ③ Virtual assistant: The intelligent question-and-answer system can serve as a virtual assistant for individuals or enterprises, providing functions such as daily task management, scheduling, and reminder services. ④ Online education: The intelligent question-and-answer system can be applied to the field of online education, providing students with personalized learning resources and real-time Q&A services. ⑤ E-commerce: The intelligent question-and-answer system can help users answer questions and provide shopping suggestions during the shopping process, improving the shopping experience. ⑥ Financial services: The intelligent question-and-answer system can provide real-time consultation services to customers of financial institutions such as banks and insurance companies, answering questions about accounts, transactions, and products. ⑦ Medical Consultation: The intelligent question-and-answer system can provide patients with basic medical consultation services, answering questions about diseases, treatments, medications, etc. ⑧ Tourism Consultation: The intelligent question-and-answer system can provide tourists with real-time tourism information, answering questions about attractions, hotels, transportation, etc. ⑨ News and Information Retrieval: The intelligent question-and-answer system can help users quickly find the news and information they need, improving the efficiency of information retrieval.
[0099] It should be understood that the above description is merely an exemplary product performance and interactive dialogue scenario provided by the embodiments of this application, and does not limit the product performance and interactive dialogue scenario of the message processing solution provided by the embodiments of this application. The intelligent question-answering system provided by the embodiments of this application can provide efficient, accurate and convenient question-answering services in various interactive dialogue scenarios, demonstrating high value and practicality in various interactive dialogue scenarios, and helping to improve user experience and satisfaction.
[0100] The message processing scheme provided in this application can be applied to centralized or distributed intelligent question-answering systems. A centralized intelligent question-answering system, also known as a centralized question-answering system, refers to a system controlled by a central processing unit (CPU) (which can be deployed on one or more computer devices). All tasks in a streaming question-answering scenario are uniformly processed and executed by this CPU, without the need for network connections or node configuration. Conversely, a distributed intelligent question-answering system, also known as a distributed question-answering system, refers to a system formed by multiple distributed computer devices interconnected through a network. In a distributed system, information exchange, processing, and control functions are distributed across the various computer devices, and there is no master-slave relationship between the computer devices. Each computer device in a distributed system can be called a service node.
[0101] For ease of explanation, the following will be combined with Figure 1 Provide a schematic diagram of the system architecture of an intelligent question-answering system; such as Figure 1 As shown, the intelligent question-and-answer system includes an object 101, a terminal 102, and a server 103. This application embodiment does not limit the number or naming of the object 101, terminal 102, and server 103. The terminal 102 can refer to a terminal device with interactive dialogue capabilities. The terminal 102 can include, but is not limited to, smartphones (such as smartphones running the Android system or smartphones running the Internetworking Operating System (IOS), tablets, portable personal computers, mobile internet devices (MIDs), in-vehicle devices, head-mounted devices, intelligent chatbots, and aircraft. This application embodiment does not limit the type of terminal device, as stated herein. Furthermore, an intelligent assistant runs on the terminal 102, allowing the object 101 to engage in single-turn or multi-turn interactive dialogue with the intelligent assistant through the terminal 102 to obtain information.
[0102] Server 103 is the server corresponding to terminal 102, used to interact with terminal 102 to provide computing and application service support, specifically providing application services and technical support for the intelligent assistant running on terminal 102. Server 103 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. For example, if server 103 is a standalone physical server, in this case... Figure 1 The intelligent question-answering system shown is the centralized intelligent question-answering system mentioned above. For example, server 103 is a server cluster consisting of multiple physical servers. In this case, Figure 1 The intelligent question-answering system shown is the aforementioned distributed intelligent question-answering system. The terminal 102 and the server 103 can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0103] It is worth noting that the specific implementation process of the stop-response function of a computer device in a centralized intelligent question-answering system in a streaming question-answering scenario (such as detecting the existence of an answer message identifier in the local cache component, responding to the question message according to the answer message generation progress information, and clearing the memory of the local cache component, etc.) is the same as the specific implementation process of the stop-response function of a single service node in a centralized intelligent question-answering system in a streaming question-answering scenario. The difference lies in the fact that in a distributed intelligent question-answering system, since the stop-response signal (or stop-response request, indicating the cessation of answer message generation) and the answer generation signal (or answer generation request, indicating the generation of an answer message for the question message) are two independent actions, these two independent signals may be sent to different service nodes in the distributed intelligent question-answering system through different interfaces. In order to enable the same service node in the distributed intelligent question-answering system to be aware of both the stop-response signal and the answer generation signal, this application embodiment also provides a communication scheme (or communication strategy) to ensure signal synchronization between multiple service nodes in the distributed question-answering system. For ease of explanation, the following section will take server 103 as an independent physical server, i.e., the intelligent question-answering system as a centralized system, as an example. The specific implementation process of enabling a single computer device to simultaneously receive stop-response signals and answer generation signals, thereby realizing the stop-response function in a streaming question-answering scenario, will be introduced. The specific content of the communication scheme deployment in the distributed intelligent question-answering system will then be introduced, which will be explained here.
[0104] The message processing scheme provided in this application embodiment can be derived from... Figure 1 The system shown executes the message processing scheme either from terminal 102 or server 103, or it can be executed jointly by terminal 102 and server 103; that is, the computer device used to execute the message processing scheme can be either terminal 102 or server 103, or it can include both terminal 102 and server 103. The following example illustrates the message processing scheme executed jointly by terminal 102 and server 103. Figure 1 The intelligent question-answering system shown introduces the message processing scheme flow, including:
[0105] The computer device (such as server 103) is equipped with a local cache component, which is a fixed-size cache component allocated in the server's local memory. This local cache component stores data related to the stop-response function in the streaming question-and-answer scenario, such as the answer message identifier corresponding to the answer message for which the user requests to stop responding, and the receiving time of the stop-response request indicating the cessation of responding to that answer message. Based on this, during the streaming question-and-answer process conducted by object 101 through the intelligent assistant in terminal 102, the intelligent assistant can obtain the question message input by the user in the streaming question-and-answer scenario, generate an answer generation request based on the question message, and forward the answer generation request to server 103. After receiving the answer generation request, server 103, before sending the question message to the answer generation model, first processes the question message in response to the question message in the answer generation request using business logic, such as generating an answer message identifier based on the question message identifier in response to the question message. Server 103 also periodically (e.g., every 5 seconds) checks the local cache component for the existence of an answer message identifier. The answer message identifier is stored in the local cache component by the computer device when it receives a stop reply request for the answer message from the terminal. If the computer device does not receive a stop reply request for the answer message, then the computer device will not store the answer message identifier in the local cache component.
[0106] Therefore, if the computer device detects an answer message identifier in the local cache component, it indicates that object 101 wants to stop responding to the answer message before the answer generation model has started generating the answer message. At this time, server 103 deletes the answer message identifier from the local cache component and processes the question message to answer the question message according to the answer message generation progress information. Conversely, if it does not exist, it indicates that object 101 has not performed a stop-response operation for the answer message corresponding to the question message. At this time, server 103 sends the question message to the answer generation model for operations such as question understanding → knowledge retrieval → answer generation.
[0107] Server 103 streams sub-messages generated by the answer generation model for the question message (the answer message is composed of multiple sub-messages arranged in the order of their generation). Streaming (or streaming) sub-message retrieval means that as the answer generation model gradually generates the answer message, server 103 periodically reads sub-messages from the answer generation model, such as every 2 seconds. Before pushing the sub-messages read from the answer generation model to terminal 102, server 103 first checks its local cache for the existence of an answer message identifier. If it exists, it indicates that object 101 wants to stop responding to the answer message during the answer generation model's process. In this case, server 103 deletes the answer message identifier from its local cache and processes the question message according to the answer message generation progress information. Conversely, if it does not exist, it indicates that object 101 has not performed a stop-response operation for the answer message corresponding to the question message. In this case, the answer generation model continues to generate the answer message and pushes the sub-messages to be displayed to terminal 102 for display. Throughout the entire process of generating an answer message for a question message using the response generation model, server 103 periodically accesses the local cache component until an answer message identifier is detected or the answer message generation is complete.
[0108] Therefore, on the one hand, during the process of generating the answer message, server 103 directly checks whether an answer message identifier exists in its local cache component; this reduces network I / O overhead and is not limited by the device performance of other devices, thus improving the stability of streaming question-and-answer scenarios to a certain extent. On the other hand, after server 103 reads the answer message identifier from the local cache component, it calls the local cache component to delete the answer message identifier before responding (i.e., before pushing the sub-message to be displayed to terminal 102). This real-time deletion method saves space in the local cache component and improves memory utilization. Furthermore, after detecting the existence of the answer message identifier in the local cache component, server 103 obtains the answer message generation progress information and continues to process the question message's response based on this progress information, improving the flexibility of responding to question messages and enhancing the user's experience in participating in intelligent question-and-answer.
[0109] It should be noted that the above Figure 1This is merely a schematic diagram of an exemplary scenario architecture provided for embodiments of this application; the architecture may be adapted in practical applications. For example, in the case of a distributed system, the intelligent question-answering system may have multiple servers 103, and communication schemes may be deployed between these servers 103 to achieve signal synchronization. The deployment of communication schemes between servers 103 in a distributed question-answering system will be described in subsequent embodiments of this application.
[0110] It should also be noted that the data collection and processing in this application embodiment should strictly comply with the requirements of relevant laws and regulations. Obtaining personal information requires the knowledge or consent of the individual (or a legal basis for information acquisition), and subsequent data use and processing should be carried out within the scope of laws, regulations, and the authorization of the personal information subject. For example, when this application embodiment is applied to specific products or technologies, such as obtaining the user's input question message, permission or consent from the user is required, and the collection, use, and processing of related data (such as stopping the generation of answer messages for question messages, etc.) must comply with the relevant laws, regulations, and standards of the relevant regions.
[0111] Based on the message processing scheme described above, this application proposes a more detailed message processing method. The message processing method proposed in this application will be described in detail below with reference to the accompanying drawings.
[0112] Please see Figure 2 , Figure 2 A flowchart illustrating a message processing method provided in an exemplary embodiment of this application is shown. Figure 2 The message processing method shown can be executed by a computer device, which can be one of the aforementioned... Figure 1 The server 103 shown. The message processing method may include, but is not limited to, steps S201-S205:
[0113] S201: Retrieve question messages in a streaming question-answering scenario.
[0114] S202: In response to the question message, generate an answer message corresponding to the question message and an answer message identifier that refers to the answer message.
[0115] In steps S201-S202, in a streaming question-and-answer scenario, the object and the intelligent assistant can engage in one or more rounds of interactive dialogue (or streaming question-and-answer). A round of streaming question-and-answer includes multiple interactive dialogues or streaming question-and-answer sessions between the object and the intelligent assistant. A single streaming question-and-answer session includes a question message input by the object and an answer message output by the intelligent assistant in response to that question message. Multiple streaming question-and-answer sessions exist in the form of streaming dialogues. After one streaming question-and-answer session is completed, the next streaming question-and-answer session begins. During any interactive dialogue, the intelligent assistant can receive the question message input by the object through the terminal held by the object; that is, the question message can be a message generated during any interactive dialogue between the object and the intelligent assistant. The methods or means by which the intelligent assistant obtains the question message in the streaming question-and-answer scenario can include, but are not limited to: receiving the question message input by the object in the message input box of the question-and-answer interface; receiving the question message through a microphone deployed in the terminal; or triggering the candidate question option in the question-and-answer interface to obtain the question message; etc. The following describes several exemplary methods for obtaining question messages; wherein:
[0116] (1) The intelligent assistant obtains question messages in a streaming question-and-answer scenario by receiving the question message entered by the user in the message input box of the question-and-answer interface; that is, the message entered by the user in the intelligent assistant's question-and-answer interface is directly used as the question message. This method of directly entering question messages conforms to the user's daily question-and-answer habits and does not require the user to learn new operations. For example Figure 3a As shown, the terminal's display screen shows a question-and-answer interface 301 provided by the intelligent assistant; this interface 301 includes a message input box 3011 and a message display box 3012. When a user has a question, they can edit the question in the message input box 3011, such as "Will it rain today?"; after editing the question, the user can trigger the send option in the message input box 3011 to publish the question as a question message 302 to the message display box 3012, so that the user can intuitively know the question they have asked.
[0117] (2) The intelligent assistant obtains question messages in streaming question-and-answer scenarios by receiving them through a microphone deployed in the terminal. In other words, it supports verbal description of the question; the terminal only needs to collect this description via the microphone to obtain the question message. This method simplifies the process of inputting question messages in streaming question-and-answer scenarios, especially for individuals with visual or finger disabilities, greatly facilitating their interaction with the intelligent assistant. Figure 3bAs shown, while the question-and-answer interface 301 provided by the intelligent assistant is displayed on the terminal's screen, the terminal's microphone is turned on. At this time, the user can directly verbally describe the question. After the terminal's microphone collects the question, it can convert the question in voice signal form into a text message 302 and display the converted question message 302 on the question-and-answer interface 301.
[0118] (3) The intelligent assistant obtains question messages in streaming question-and-answer scenarios by triggering candidate question options in the question-and-answer interface; that is, it supports multiple candidate question options provided by the intelligent assistant, so that the user only needs to select a candidate question from multiple options as the question they want to ask, which simplifies the question message input process and improves the user experience. For example Figure 3c As shown, a question-and-answer interface 301 provided by the intelligent assistant is displayed on the terminal's screen. This interface 301 displays one or more candidate question options provided by the intelligent assistant, such as candidate question option 303, candidate question option 304, and candidate question option 305, with each candidate question option corresponding to a specific candidate question. Users can directly trigger an operation on the target question option in the question-and-answer interface 301 according to their query needs. The terminal responds to the user's trigger operation on the target question option, determining the question message based on the question corresponding to the target question option. For example, the question message may be the text content displayed by the target question option.
[0119] Therefore, the intelligent assistant provided in this application provides users with a variety of interactive dialogue methods, making it easier for users to interact and have dialogues according to their own dialogue habits, thereby improving the user's human-computer interaction experience and promoting the use of the intelligent assistant.
[0120] Furthermore, after the intelligent assistant obtains the question message that the object wants to ask in the streaming question-and-answer scenario, it generates an answer generation request (or answer generation signal, or response reply signal) based on the question message. This answer generation request carries the question message and requests the server to generate a corresponding answer message for the question message. This answer message answers the question message, specifically the question indicated in the question message. Then, the intelligent assistant sends the answer generation request to the server, causing the server to respond to the answer generation request, specifically to the question message in the answer generation request, by generating an answer message corresponding to the question message and an answer message identifier identifying the answer message. The answer message identifier is a unique identifier for the answer message, such as a number.
[0121] Specifically, the server records one or more question messages that the object has entered in this round of interaction, as well as the answer messages generated for each question message. These question messages include the question message currently being answered. The server generates corresponding message identifiers for question messages and answer messages in the order they were generated in this round of interaction. Specifically, the answer message identifier ID (Identification) of the answer message is the question message identifier ID of the corresponding question message + 1. For example... Figure 4 As shown, in this round of interactive dialogue, the server generates a question message identifier ID = 0 for the first question message 401 input by the object, and the server generates an answer message identifier ID = 1 for the first answer message 402 corresponding to the first question message 401; similarly, the server generates a question message identifier ID = 2 for the second question message 403 input by the object, and the server generates a question message identifier ID = 3 for the second answer message 404 corresponding to the second question message 403, and so on.
[0122] Furthermore, after the server generates an answer message identifier for the answer message to be generated, the server can perform the answer message generation operation based on the question message. In this embodiment, an answer generation model is supported to generate answer messages for question messages. This requires the server to send the question message to the answer generation model and stream data from it; for example, the server reads data from the answer generation model every 2 seconds, and this data is a sub-message generated by the answer generation model that belongs to the answer message. The answer generation model can be deployed on a computer device or on other devices independent of the computer device. The following is in conjunction with the appendix... Figure 5 This section provides a brief overview of the process by which the server streams data from the answer generation model; for example... Figure 5As shown, assuming the question message is "Will it rain today?", when the answer generation model generates the answer message, it generates sub-message 1 as "According to the weather forecast" in the first 2 seconds, sub-message 2 as "[Forecast]" in the second 2 seconds, sub-message 3 as "High probability today" in the third 2 seconds, and sub-message 4 as "No rain" in the fourth 2 seconds. For the server, each time it accesses the answer generation model, it can read a portion of the generated sub-messages. For example, two seconds after sending the question message to the answer generation model, the server reads sub-message 1 from the answer generation model; two seconds after reading sub-message 1, it reads sub-message 2; two seconds after reading sub-message 2, it reads sub-message 3; and two seconds after reading sub-message 3, it reads sub-message 4, until no more data is read from the answer generation model, indicating that the generation of the answer message is complete.
[0123] It should be noted that the answer message identifier, which refers to the answer message, can also be generated by the terminal. The terminal can cache the question message identifier of the question message and the answer message identifier of the answer message generated in this round of interaction. In this way, the terminal uses the same answer message identifier generation logic as the server to generate the answer message identifier for the answer message on the terminal side. For the server, the answer message identifier is directly carried in the stop reply request sent by the terminal; this reduces the computational load on the server and can achieve load balancing to a certain extent.
[0124] S203: If a stop reply request is received for the answer message, the answer message identifier is stored in the local cache component of the computer device.
[0125] In practical applications, after an object enters a question message into a smart assistant, the object may want to cancel the smart assistant's response to the question message at any time; this application embodiment supports the object to quickly stop responding to the answer message by performing a stop response operation on the answer message.
[0126] Specifically, when the terminal detects that an object performs a stop-response operation on the answer message, indicating that the object wants to stop responding to the question message, the terminal generates a stop-response request corresponding to the answer message of the question message (i.e., the stop-response request is generated when the terminal detects that the object has performed a stop-response operation on the answer message). This stop-response request is used to request the server to stop generating the answer message. Stopping the generation of the answer message means pausing the process of generating the answer message. The terminal sends the stop-response request to the server. After receiving the stop-response request for the answer message, the server responds by storing the answer message identifier in the local cache component of the computer device. Specifically, considering that there may be multiple answer message identifiers cached in the local cache component, this application embodiment supports obtaining the reception time of the server receiving the stop-response request. This reception time is the time when the server receives the stop-response request sent by the terminal, and the answer message identifier of the answer message and the reception time are stored together in the local cache component of the computer device in the form of a data pair. The data pair is a key-value pair, such as the key being the answer message identifier and the value being the reception time. As described above, this embodiment of the application allocates a local cache component in the memory of the computer device to exclusively store the answer message identifier of the answer message whose generation is requested to be stopped. Compared with transmitting the answer message identifier of the answer message whose generation is requested to be stopped to a Redis database independent of the computer device via network I / O for storage, the computer device can read and store the answer message identifier of the answer message whose generation is requested to be stopped without incurring network overhead, which greatly saves data reading overhead.
[0127] This application does not limit the specific operation method of the object performing the stop reply operation on the answer message. For example... Figure 6 The accompanying figure (a) shows a question-and-answer interface for the intelligent assistant, including a stop-response option 601; the stop-response operation performed by the object in response to the answer message includes a triggering operation performed by the object on the stop-response option 601. Figure 6 As shown in Figure (b), the stop-response operation performed by the object in response to the answer message includes gesture operations (such as double-click, single-click, or long-press) performed by the object at any display location on the question-and-answer interface.
[0128] As described above, the stop-response operation performed by the object in response to the answer message can occur at any time after the server receives the question message. Therefore, to ensure the server can promptly stop generating the answer message after the terminal detects the object's stop-response operation, this application embodiment supports the server checking the existence of the answer message identifier in the local cache component according to a detection strategy after generating the answer message identifier, and executing subsequent processes based on the detection result. The detection strategy specifies the access time of the server to the local cache component. For example, the detection strategy is a first detection strategy, which instructs the server to access the local cache component periodically, such as accessing the local cache component every second starting from when the server generates the answer message identifier for the answer message. Another example is a second detection strategy, which instructs the server to access the local cache component before pushing the question message to the answer generation model, and before each response (i.e., before the server reads a sub-message from the answer generation model and pushes it to the terminal). The second detection strategy will be used as an example in subsequent embodiments, and is explained here for clarity.
[0129] Specifically, if the server does not detect an answer message identifier in the local cache component, it indicates that the object did not perform a stop-response operation for the answer message before the server accessed the local cache component this time. In this case, the server can perform subsequent operations according to the normal question-and-answer processing flow. For example, if the server accesses the local cache component before pushing the question message to the answer generation model, the server will perform the operation of sending the question message to the answer generation model if it does not detect an answer message identifier. As another example, if the server accesses the local cache component after obtaining a sub-message from the answer generation model, the server will perform the operation of pushing the accessed sub-message to the terminal if it does not detect an answer message identifier.
[0130] Conversely, if the server detects an answer message identifier in the local cache component, indicating that the object performed a stop-response operation on the answer message before the server accessed the local cache component this time, the server needs to obtain the generation progress information of the answer message and perform question response processing on the question message according to the generation progress information; see the specific implementation process shown in steps S204-S205 for details.
[0131] S204: Obtain the answer message generation progress information based on the answer message identifier in the local cache component.
[0132] S205: Based on the progress information of the answer message generation, process the question message to provide a question answer.
[0133] In steps S204-S205, the answer message generation progress information is used to indicate the generation progress of the answer generation model for the answer message during this server access to the local cache component. According to the streaming generation process of the answer generation model for the answer message, the generation progress information indicates any of the following: generation not started, generation in progress, and generation finished. Specifically: ① Generation not started indicates that the answer message has not yet started generating; when the server has not obtained any sub-messages belonging to the answer message from the answer generation model, the server determines that the answer message has not yet started generating. Two possible situations where the answer message has not started generating include: the server has not yet sent the question message to the answer generation model, or the answer generation model has received the question message but has not yet started generating the answer message. ② Generation in progress indicates that the answer message has started generating, but has not yet finished generating; in short, some sub-messages in the answer message have been generated, or the server has obtained target sub-messages belonging to the answer message that have not yet been displayed from the answer generation model. ③ Generation finished indicates that all sub-messages in the answer message have been generated; when the server cannot obtain the answer message from the answer generation model, the server determines that the answer message generation has finished. When the generation progress of the answer message is in any of the above situations, the user may perform a stop reply operation on the answer message, that is, the user requests to stop replying to the answer message; the terminal responds to the stop reply operation by generating a stop reply request and sending the stop reply request to the server; the server can determine from the stop reply request that the answer message is the answer message for which the user requests to stop replying, and stores the answer message identifier of the answer message in the local cache component.
[0134] Furthermore, the computer device scans the local cache component according to the aforementioned detection strategy to detect whether an answer message identifier exists in the local cache component. If the computer device detects the existence of an answer message identifier in the local cache component, indicating that the user has triggered a stop to reply to the answer message, the computer device obtains the answer message generation progress information based on the answer message identifier in the local cache component. Specifically, the computer device determines the answer message generation progress information based on the answer message identifier in the local cache component and whether the sub-message of the answer message can be obtained from the device with the answer generation model deployed.
[0135] In a specific implementation, if the computer device detects that the question message has not been sent to the answer generation model, or if the computer device detects that the question message has been sent to the answer generation model and has not obtained a sub-message of the answer message from the answer generation model (specifically, the device where the answer generation model is deployed) based on the answer message identifier in the historical time, the computer device determines that the generation progress information of the answer message is "not started yet". If the computer device obtains a sub-message of the answer message from the answer generation model based on the answer message identifier in the historical time and also obtains a sub-message of the answer message from the answer generation model based on the answer message identifier at the current time, the computer device determines that the generation progress information of the answer message is "in progress". If the computer device obtains a sub-message of the answer message from the answer generation model based on the answer message identifier in the historical time and does not obtain a sub-message of the answer message from the answer generation model based on the answer message identifier at the current time, the computer device determines that the generation progress information of the answer message is "completed".
[0136] The following introduces the process of the server's question reply processing for the question message after detecting the answer message identifier from the local cache component when the answer message is in different generation progress; specifically:
[0137] (1) The generation progress information of the answer message is "not started yet".
[0138] The generation progress information of the answer message being "not started yet" indicates that the answer generation model has not yet generated the first character in the answer message. For example, if the answer message is a string "It will not rain today", when the generation progress information of the answer message is "not started yet", it means that the first character "It" in the string "It will not rain today" has not been generated. In this case, the server performs question reply processing on the question message according to the "not started yet" indicated by the generation progress information. The process of the question reply processing may include: ① The server aborts the generation of the answer message, specifically, pauses the preparation generation process of the answer message. For example, if the server has not sent the question message to the answer generation model, the server will no longer send the question message to the answer generation model to abort the start of generating the answer message; another example is that if the server has sent the question message to the answer generation model, the server notifies the answer generation model to abort the start of generating the answer message. ② The server deletes the target data pair from the local cache component. The target data pair refers to the data pair including the answer message identifier and the reception time; by setting the server to delete the answer message identifier from the local cache component in real time after reading the answer message identifier from the local cache component and stopping the reply successfully, the memory overhead of the local cache component can be released in a timely manner. ③ Output a first notification message to the terminal; the first notification message is used to indicate that the start of generating the answer message has been aborted.
[0139] Therefore, it is evident that by responding to a stop-response request before the answer message generation begins, the server can promptly halt the generation of the answer message, enabling flexible control over its creation. Furthermore, the server can delete target data pairs from the local cache component in real time, releasing memory and preventing overload of the local cache component. Additionally, it supports outputting a first notification message to the terminal, allowing the user to intuitively perceive the intelligent assistant's feedback on the stop-response operation, thus enhancing the user's human-computer interaction experience.
[0140] The following describes the process from the user's perspective: when the generation progress information for the answer message has not yet started, the smart assistant stops replying to the first notification message. For example... Figure 7a As shown, when the answer message generation progress information indicates that generation has not started, icon 701 is displayed in the question-and-answer interface provided by the smart assistant to indicate that the object is currently preparing to generate the answer message. If the object performs a stop reply operation on the answer message before the answer message generation has started, icon 701 is replaced with a first notification message 702; this first notification message 702 is used to indicate that the object has stopped generating the answer message.
[0141] Furthermore, this application embodiment also supports resuming the generation of answer messages after an object performs a stop reply operation on the answer message, improving the flexibility of answer message generation and meeting the object's need for dynamic control of answer message generation. See also... Figure 7a The continuation generation option 7021 can be displayed adjacent to the first notification message 702. When the object performs a trigger operation on the continuation generation option 7021, it indicates that the object wants to cancel the abort of the answer message generation operation. At this time, the terminal generates a continuation response request and sends the continuation response request to the server so that the server responds to the continuation response request and continues to generate and output the answer message.
[0142] (2) The progress information for generating the answer message is "generating".
[0143] The "generating" status of the answer message's generation progress indicates that the answer generation model has generated a portion of the characters in the answer message. This portion of characters is the aforementioned sub-message belonging to the answer message; in other words, the server can obtain the target sub-message to be displayed from the answer generation model. For example, if the answer message is the string "It won't rain today," and the generation progress information is "generating," it means that a portion of the string "It won't rain today," such as "today," has been generated. In this case, the server performs question answering processing on the question message based on the "generating" status indicated by the generation progress information. The question answering process may include: ① The server pausing the generation of answer messages that have started but are not yet fully generated. For example, the server notifies the answer generation model to stop continuing to generate the answer message. ② The server also needs to delete the data pair containing the answer message identifier (i.e., the aforementioned target data pair) from the local cache component to achieve real-time release of the memory overhead of the local cache component. ③ For cases where the server has already obtained the target sub-message from the response generation model before accessing the local cache component—a sub-message that was generated but not yet displayed before the server detected the answer message identifier in the local cache component—the server can obtain a pre-set message display strategy. This strategy indicates the display rules for the target sub-message. The server then processes the target sub-message according to the display rules indicated by the strategy. For example, if the strategy specifies that the target sub-message to be displayed should not be output, the server does not need to send it to the terminal for display. Alternatively, if the strategy specifies that the target sub-message to be displayed should continue to be output, the server will still send it to the terminal for display.
[0144] Therefore, in this embodiment of the application, when the answer message is being generated, the server can respond to a stop reply request and promptly stop generating the answer message, saving computing resources while achieving flexible control over the generation of the answer message. Furthermore, the server can delete target data pairs from the local cache component in real time, releasing memory and avoiding overload of the local cache component. In addition, it supports displaying or not displaying target sub-messages based on message display strategies. These strategies can be varied according to different business needs of the terminal, improving the flexibility of target sub-message display.
[0145] The following describes the process from the user's perspective: when the answer message generation progress information is "generating," the smart assistant stops replying to the answer message. For example... Figure 7bAs shown, when the answer message generation progress information is "generating," the question-and-answer interface provided by the smart assistant can display the displayed sub-message 703, which the server has pushed to the terminal before the server accesses the local cache component and finds the answer message identifier. If the object performs a stop-response operation for the answer message after the answer generation model continues to generate the target sub-message 704, then, if the display rule indicated by the message display strategy is to continue outputting the target sub-message to be displayed, the server will push the target sub-message 704 to the terminal, and the terminal will then display the target sub-message 704 after the displayed sub-message 703. To facilitate the object's awareness that answer message generation has stopped, a first notification message 702 is supported to be displayed in the adjacent area of the displayed sub-message 703 and the target sub-message 704. Similarly, if the display rule indicated by the message display strategy is not to continue outputting the target sub-message to be displayed, the server does not need to push the target sub-message 704 to the terminal; the terminal only needs to display the first notification message 702 in the adjacent area of the displayed sub-message 703 to inform the object that answer message generation has stopped.
[0146] (3) The progress information of the answer message generation is that the generation is complete.
[0147] The generation progress information of the answer message indicates that generation is complete, meaning that the answer generation model has generated all the characters in the answer message; that is, the data obtained by the server from the answer generation model is empty. For example, if the answer message is the string "It won't rain today," and the generation progress information indicates that generation is complete, it means that all the characters in the string "It won't rain today" have been generated. In this case, the server performs question answering processing on the question message based on the generation completion indication of the generation progress information. The question answering process may include: since the answer message has been completely generated when the server scans the answer message from the local cache component, the server cannot respond to the stop answering request to stop generating the answer message; however, in order for the user to be aware that the answer message has been completely generated, this application embodiment supports the server pushing a second notification message to the terminal. This second notification message is used to indicate that the current streaming question and answer (or interactive dialogue) has ended, specifically indicating that the generation and display of the answer message in the current streaming question and answer has ended. In this way, even when the answer message has finished generating, the object can also understand the situation that the generation of the answer message has ended when the stop answering operation is performed through the second notification message, improving the human-computer interaction experience.
[0148] The following describes the process from the user's perspective: when the generation of the answer message is complete, the intelligent assistant stops replying with the answer message. For example... Figure 7cAs shown, when the generation progress information of the answer message indicates that generation is complete, the answer message 705 is fully displayed in the question-and-answer interface provided by the smart assistant. If the object performs a stop reply operation on the answer message, a second notification message 706 is displayed in the adjacent area of the answer message 705. The second notification message 706 is used to inform the object that the current streaming conversation has ended, that is, the generation and display of the answer message in this streaming conversation have been completed.
[0149] Therefore, this embodiment of the application supports dynamically responding to question messages based on the progress information of answer message generation after the server detects the answer message identifier from the local cache component. Compared with not responding to question messages when it is detected that the generation of answer messages has stopped, this improves the flexibility of responding to question messages and enhances the user's experience in participating in intelligent question answering.
[0150] It's worth noting that when the answer message generation progress information indicates "generation complete," it means the server has finished generating the answer for the question message. At this point, the server stops the "stop reply" function for the answer message; that is, the server no longer checks the answer message identifier in the local cache component. Instead, it checks for new question messages and, upon detecting a new question message, initiates the "stop reply" function for the answer message corresponding to that new question message. This involves the server checking and deleting the answer message identifier for the new question message in the local cache component. This ensures that the "stop reply" function is available for every interaction in multiple conversations between the user and the smart assistant. It's easy to see that when the answer message generation progress information indicates "generation complete," the server does not delete data pairs containing answer messages from the local cache component. This results in the local cache component storing some data pairs corresponding to completed answer messages. If these data pairs are not cleaned up in a timely manner, it will waste memory in the local cache component.
[0151] To address the issue of memory waste, the local caching component provided in this application offers three parallel data cleanup strategies: real-time deletion, scheduled cleanup, and fixed memory eviction. These strategies effectively ensure low memory usage and high performance of the local caching component. Specifically:
[0152] (1) Real-time deletion refers to the process whereby the server deletes the answer message identifier from the local cache component after detecting the answer message identifier in the local cache component and successfully stopping the response, thereby achieving real-time deletion of invalid answer message identifiers in the local cache component. For the specific implementation process of real-time deletion, please refer to the relevant descriptions of the three types of generation progress information mentioned above, which will not be repeated here.
[0153] (2) Scheduled cleanup refers to the periodic cleanup of invalid data in the local cache component by using the data cleanup tasks described above, from the perspective of data storage time.
[0154] To prevent the ineffective cleanup of a large amount of expired and invalid data (such as data pairs containing answer message identifiers corresponding to answer messages that have already been generated) in the local cache component, this application embodiment configures a timed data cleanup task (specifically an asynchronous task, i.e., a task that can be executed in parallel with other tasks) for the local cache component. This data cleanup task can be used to clean up data pairs in the local cache component (such as, in the aforementioned data pairs, including answer message identifiers and reception times corresponding to answer messages that have been requested to stop generating in a streaming question-and-answer scenario, where the reception time refers to the time when a stop-response request for the answer message indicated by the answer message identifier is received). Specifically, after the data cleanup task is started on a timed basis, a scan and eviction process can be triggered for the local cache component. Each scan will obtain multiple data pairs in the local cache component, and then invalid data will be evicted based on the write time of the data pairs.
[0155] Specifically, when initializing the local cache component in the computer device, a cache duration is set for the data pairs in the local cache component. This cache duration refers to the maximum time a data pair can be cached in the local cache component, such as 8 hours. Additionally, a scheduled data cleanup task is started for the local cache component, such as setting it to start every 7 days. When the data cleanup task is started, the computer device scans the local cache component, identifying multiple first data pairs. Specifically, a filtering strategy can be used to scan multiple first data pairs from the local cache component. For example, if the filtering strategy indicates scanning the 100 data pairs with the longest reception times, then the data pairs in the local cache component are sorted according to their reception times from earliest to latest using this filtering strategy, and the first 100 data pairs in the sequence are read as the first data pairs. Then, the receiving time of each of the multiple first data pairs is compared with the current time (i.e., the time when the data cleanup task was started) to obtain the cached duration of each first data pair; the cached duration of any first data pair is the write duration of that data pair to the local cache component. Next, the cached duration of each first data pair is compared with a preset cache duration period to obtain the comparison result for each first data pair. The comparison result of any first data pair indicates the relationship between the cached duration and the cache duration period. Based on the comparison result of each first data pair, the computer device deletes the first data pair from the multiple first data pairs whose comparison result indicates a cached duration exceeding the cache duration period. By periodically cleaning up invalid data in the local cache component, storage space of the local cache component can be saved, the security of the local cache component can be enhanced, and thus the stable operation of the stop-response function in streaming question-and-answer scenarios can be improved.
[0156] For example, suppose the first data pairs read from the local cache component include: first data pair 1, first data pair 2, first data pair 3, and first data pair 4, and the cached duration of first data pair 1 is 10 hours, that of first data pair 2 is 2 hours, that of first data pair 3 is 24 hours, and that of first data pair 4 is 4 hours. If the preset cache duration is 8 hours, then if the cached duration of first data pair 1 and first data pair 3 exceeds the cache duration threshold, then first data pair 1 and first data pair 3 will be deleted from the local cache component. This achieves the goal of periodically cleaning up invalid data in the local cache component, thus keeping the local cache component's memory usage low.
[0157] (3) Fixed memory eviction refers to cleaning up invalid data in the local cache component from the perspective of memory capacity (or memory quantity) using the aforementioned eviction algorithm.
[0158] The local cache component configured in this application within a computer device can specifically be a fixed-size component based on an eviction algorithm. In this way, the local cache component can address memory waste and Out of Memory (OOM) problems arising from large amounts of data being written and not promptly cleared, based on the eviction algorithm. The OOM problem refers to the inability of a computer device to continue execution due to insufficient memory.
[0159] Specifically, when initializing the local cache component in a computer device, a memory threshold is configured for the local cache component. This threshold indicates the maximum amount of memory (or memory value) that can be used in the local cache component. When the amount of memory occupied by the local cache component exceeds this maximum amount, it may cause a malfunction (such as causing the computer device to freeze). Therefore, when the computer device receives a stop response request, it determines that the amount of memory occupied in the local cache component may change. The computer device can then initiate a fixed memory eviction process for the local cache component to clean up invalid data. Specifically, when the computer device receives a stop response request, it calculates the amount of memory occupied by each data pair in the local cache component. The computer device determines the relationship between the sum of the memory occupied by each data pair and the memory threshold. If the sum of the memory occupied by each data pair reaches the memory threshold, the second data pair is deleted from the local cache component according to the eviction policy, until the sum of the memory occupied by the remaining data pairs in the local cache component is less than the memory threshold. This eviction policy, or eviction algorithm, is a strategy for selecting the second data pair from the local cache component based on the amount of memory occupied by each data pair. By using the fixed memory eviction method described above, it can be ensured that the local cache component has enough free memory after each fixed memory eviction, thereby preventing the local cache component from malfunctioning due to excessive memory usage and improving the normal operation of the stop reply function in streaming question-and-answer scenarios.
[0160] Depending on the specific streaming question-answering scenario, the eviction algorithm may include, but is not limited to: LRU (Least Recently Used) algorithm, LFU (Least Frequently Used) algorithm, and FIFO (First In, First Out) algorithm, as well as the open-source Group Cache algorithm (a distributed caching library written in Go that provides a simple, efficient, and easily scalable caching solution that supports sharing cached data across multiple servers).
[0161] For example, suppose the total memory of the local cache component is 100KB (kilobytes), and the maximum memory limit (memory threshold) set for this local cache component is 80KB. When the computer receives a stop response request, it calculates that the total memory occupied by all data pairs in the local cache component is 90KB, which is greater than the memory threshold. Therefore, it uses an eviction algorithm to delete the second data pair in the local cache component, ensuring that the total memory occupied by the remaining data pairs in the local cache component after deletion is less than the memory threshold. The second data pair selected for deletion from the local cache component is determined according to the eviction algorithm; the selected second data pair varies depending on the eviction algorithm. For example, if the eviction algorithm deletes the data pair with the longest write time, then the data pair with the longest write time in the local cache component is selected as the second data pair to be deleted.
[0162] In summary, on the one hand, the computer device directly detects the existence of the answer message identifier from its local cache component. Compared to requiring the computer device to detect the answer message identifier from other devices (such as a dedicated database storing the answer message identifier) via an I / O interface, this reduces network I / O overhead and is not limited by the performance of other devices, thus improving the stability of streaming question-and-answer scenarios to some extent. On the other hand, the computer device can respond to question messages based on three types of answer message generation progress information, such as pushing partially generated answer messages, improving the flexibility of responding to question messages while ensuring that the answer generation model can stop responding in real time during the answer message generation process, enhancing the user experience of participating in intelligent question-and-answer. Furthermore, the embodiments of this application set three parallel data cleanup strategies for the local cache component, effectively ensuring low occupancy of the local cache component in the computer device, thereby maintaining the high performance of the computer device.
[0163] As mentioned above, the intelligent question-answering system involved in this application embodiment can be a distributed question-answering system; the distributed question-answering system includes N service nodes, among which there is a target service node, which is any one of the N service nodes, and the target service node is the computer device that executes the aforementioned message processing method. After the distributed question-answering system starts, two interfaces will be started in the target service node of the distributed question-answering system, namely a first interface and a second interface. Wherein:
[0164] ① The first interface is used to respond to a stop-response request sent by the terminal. In other words, the first interface is responsible for receiving the stop-response request sent by the terminal as input. This stop-response request may carry a question message and an answer message identifier (or only the question message). After the computer device receives the stop-response request through the first interface, it will execute the operation of writing the answer message identifier to the local cache component, thereby recording which user wants to stop the response to which question message. The logic for synchronizing and storing the answer message identifier in the distributed question-and-answer system will differ depending on the communication scheme deployed by the target service node, which will be explained in detail later.
[0165] ② The second interface is used to respond to requests for daily dialogue sent by the terminal, namely answer generation requests. In other words, the second interface takes the answer generation request generated when the object inputs a question message during the interactive dialogue between the object and the smart assistant as input. This answer generation request carries the question message (and may also carry a question message identifier). The second interface is also responsible for pushing the sub-messages belonging to the answer message received by the target service node to the terminal. As mentioned above, this embodiment uses streaming response to push sub-messages. According to the aforementioned second detection strategy, when the target service node obtains the target sub-message to be pushed from the answer generation model, it will attempt to detect whether an answer message identifier exists in the local cache component. If an answer message identifier is detected, subsequent output stops, and the current interactive dialogue ends. If no answer message identifier is detected, the target sub-message to be displayed continues to be output until the response is complete.
[0166] Based on the above descriptions of the first and second interfaces, it is clear that stopping the response and generating the answer are two independent actions in a distributed question-and-answer system. During a single streaming question-and-answer session, the service nodes receiving the stop-response request and the answer-generating request may be different, resulting in the same service node in the distributed question-and-answer system not simultaneously detecting both requests. For example... Figure 8 The distributed system shown includes service node 801, service node 802, and service node 803, etc. During a dialogue interaction between the object and the intelligent assistant, the terminal may send an answer generation request to server node 801 and a stop reply request to server node 802. Since service node 801 and service node 802 are different, the service nodes in the distributed question-and-answer system cannot notify and perceive the two types of requests, which is not conducive to realizing the stop reply function in the streaming question-and-answer scenario.
[0167] To ensure that each service node in a distributed question-answering system can simultaneously perceive two independent actions, thereby improving data synchronization and consistency among service nodes, this application provides a communication strategy deployment scheme for a distributed question-answering system. The communication strategy includes an election communication strategy and a broadcast communication strategy. The election communication strategy may include, but is not limited to, the Raft algorithm and the PAXOS algorithm. The Raft algorithm is a distributed consensus algorithm used to achieve fault tolerance and data consistency in a distributed system. It manages log replication by electing a leader node, ensuring data consistency across all service nodes. The PAXOS algorithm primarily achieves data synchronization among service nodes in the distributed question-answering system through a proposal mechanism.
[0168] In the case where the distributed question-answering system is a cluster (or cluster service) within the self-developed Polaris system, to ensure compatibility between various clusters, this application embodiment supports automatic switching between communication strategies using Polaris, improving the flexibility of communication strategy deployment in the distributed question-answering system. Polaris is a self-developed, internally collaborative service discovery and governance platform that integrates multiple name services and load balancing systems. Specifically, when the distributed question-answering system starts up—specifically, when each service node in the distributed question-answering system starts up—Polaris automatically selects a communication strategy. Furthermore, whenever a service node in the distributed question-answering system changes and a new service node is started, Polaris pulls all service nodes from the new distributed question-answering system and determines whether to automatically switch communication strategies based on the number of nodes.
[0169] The process by which Polaris automatically selects its communication strategy can be found in [reference needed]. Figure 9 ;like Figure 9 As shown, a cluster service (or name service, i.e., the aforementioned distributed question-answering system) is created in Polaris and started. Specifically, N service nodes in Polaris are started according to the required number of nodes, and the node information (such as node identifier, IP port, etc.) of each service node is registered with the cluster service. Then, Polaris obtains the N service nodes under the cluster service and selects a second communication strategy based on the number of service nodes N. In this embodiment, it is assumed that the communication strategy is an election communication strategy—the Raft algorithm—and a broadcast communication strategy. Since the Raft algorithm requires that the number of nodes in the cluster service cannot be less than 3, otherwise problems such as the inability to elect nodes will occur, if the number of service nodes N in the cluster service is greater than 2, Polaris selects the Raft algorithm as the communication strategy; otherwise, it uses the broadcast communication strategy. In this way, Polaris distributes the selected second communication strategy to each service node in the cluster service.
[0170] For a target service node in the cluster service, it may have a first communication policy deployed before the distributed question-and-answer system starts (e.g., when the distributed question-and-answer system starts for the first time, or when a service node in the distributed question-and-answer system changes and is restarted). This first communication policy is the communication policy deployed when the target service node belonged to a historical cluster service (i.e., a cluster service before the distributed question-and-answer system). Thus, when the distributed question-and-answer system starts, the target service node will receive a new communication policy—a second communication policy—issued by Polaris. Then, the target service node checks whether the first and second communication policies are consistent.
[0171] in:
[0172] ① If the first and second communication strategies are the same, the target service node does not need to deploy the second communication strategy, because the second communication strategy is the first communication strategy, and the target service node has already deployed the first communication strategy. The target service node only needs to store the node information of the new reference service node locally. Specifically, the target service node first checks the node information of the historical service nodes stored locally. These historical service nodes are service nodes in the original cluster service to which the target service node belongs. For example, if the target service node was in the historical cluster service, it stores the node information of the service nodes belonging to the historical cluster service. If the target service node detects the existence of M historical service node node information locally, the target service node compares the node information of the M historical service nodes with the node information of N-1 reference service nodes in the distributed question-answering system; M is an integer greater than zero. When the comparison finds a target reference service node among the N-1 reference service nodes that is not included in the M historical service nodes, the computer device directly stores the node information of the target reference service node in the target service node. Therefore, when the first and second communication strategies are the same, the target service node only needs to add the node information of the newly added service node in the distributed system. Compared with redeploying the second communication strategy, this reduces the communication strategy deployment overhead caused by starting the distributed question-and-answer system and improves the efficiency of communication strategy deployment to a certain extent.
[0173] For example, if the target service node stores historical service nodes A, B, and C, and N-1 reference service nodes A, B, D, and E, then service nodes D and E are determined to be target reference service nodes among the four reference service nodes in the distributed question-answering system that are not included in the three historical service nodes (i.e., service nodes A, B, and C). In this case, the node information of service nodes D and E will be stored in the target service node.
[0174] ② If the first and second communication strategies differ, the target service node needs to redeploy the new communication strategy. In this case, the target service node obtains the node information of each of the N-1 reference service nodes in the distributed question-answering system. Each reference service node is any one of the N service nodes except the target service node. The target service node verifies the received second communication strategy based on the node information of the N service nodes. For example, the target service node recounts the number of obtained service nodes and checks if this number meets the requirement of the second communication strategy. If it does, the second communication strategy is successfully verified, and the target service node can deploy the second communication strategy and store the node information of each of the N-1 reference service nodes. If it does not meet the requirement, the second communication strategy verification fails, and the target service node can ignore the received second communication strategy. For the target service node, verifying the second communication strategy before deploying a new one, and only redeploying the second communication strategy after successful verification, avoids deploying malicious communication strategies, thereby improving the security of the target service node.
[0175] The deployment method of the second communication strategy in the target service node varies depending on the specific strategy. The following describes the deployment process of the second communication strategy in the target service node using an election communication strategy (such as the Raft algorithm) as an example. Specifically, the target service node is initialized as a follower node, and its logs are initialized. A voting election is conducted in the distributed question-and-answer system according to the election mechanism, and the leader service node determined by the vote is recorded. Specifically, since there is no leader service node in the distributed question-and-answer system, each service node that has not applied to become the leader service node will vote for the candidate service nodes that have applied to become the leader service node. Specifically, each service node sends a voting request to a candidate service node, instructing the receiving candidate service node to vote once; and the number of votes received by each candidate service node is counted, with the candidate service node receiving the most votes being elected as the leader service node. The leader node is primarily responsible for transaction processing in the distributed question-and-answer system, sending data to follower nodes for synchronization. Follower nodes primarily receive data from the leader node and synchronize it locally. In addition, each service node in the distributed question-and-answer system also runs an backup node; for example... Figure 10As shown, both the follower and leader nodes in a distributed question-answering system will start their respective backup nodes. The backup nodes are used to back up the data stored on the target service node, ensuring a timely switchover to the backup node in case of a target service node failure. This effectively ensures the node functionality of the target service node and maintains the system stability of the distributed question-answering system.
[0176] Furthermore, when the second communication strategy deployed on the target service node is an election communication strategy, the process of data synchronization between multiple nodes in a distributed question-answering system can be found in [reference needed]. Figure 11 .like Figure 11 As shown, if the target service node receives a stop-response request for the answer message from the terminal, it can first determine or detect whether it is the leader service node in the distributed question-and-answer system. If the target service node is not the leader service node, it sends the stop-response request to the leader service node. The leader service node, in response to the stop-response request, caches the answer message identifier and the reception time of the stop-response request in its local cache component. The leader service node also writes the stop-response request to its log, obtains the log information, and forwards the log information to the reference service nodes and the target service node in the distributed question-and-answer system, excluding the leader service node. For the target service node, upon receiving the log information from the leader service node, it responds by caching the answer message identifier and the reception time of the stop-response request as a data pair in its local cache component. Furthermore, the target service node needs to reply to the leader service node to ensure that the leader service node is aware of the target service node's reception status of the stop-response request. Conversely, if the target service node is the leader service node, then in response to the stop reply request for the answer message, the target service node caches the answer message identifier and the receipt time of the stop reply request in its local cache component. Furthermore, the target service node writes the stop reply request to its log, and after obtaining the log information, forwards the log information to the reference service nodes in the distributed question-and-answer system other than the target service node. The reference service nodes also need to reply to the target service node to ensure that the target service node is aware of the reference service node's reception status of the stop reply request.
[0177] When the second communication strategy deployed on the target service node is a broadcast communication strategy, the process of achieving data synchronization between multiple nodes in a distributed question-answering system can be found in [reference needed]. Figure 12 .like Figure 12As shown, under the broadcast communication strategy, the service nodes in the distributed question-and-answer system do not have a subordinate relationship. For the target service node, if it receives a stop-response request for an answer message, it directly caches the target message identifier and the reception time of the stop-response request as a data pair in its local cache component. Then, the target service node pulls the node information of N-1 reference service nodes in the distributed question-and-answer system from its local cache; if it cannot pull it from its local cache, it pulls the node information of N-1 reference service nodes in the distributed question-and-answer system excluding the target service node from the North Star. Furthermore, the target service node iterates through the N-1 reference service nodes in the distributed question-and-answer system to forward the stop-response request to each reference service node. In this way, each reference service node that receives the stop-response request forwarded by the target service node caches the target message identifier and the reception time of the stop-response request as a data pair in its local cache component.
[0178] In summary, regardless of whether the communication strategy deployed in the distributed question-answering system is an election communication strategy or a broadcast communication strategy, it can overcome the defect that the service nodes cannot simultaneously perceive the two types of requests, which is caused by the fact that the stop reply request and the reply generation request are received by different service nodes in the distributed question-answering system. This effectively ensures data synchronization between the service nodes in the distributed question-answering system.
[0179] In this application embodiment, on the one hand, a deployment scheme for a highly available, high-performance, and highly scalable distributed question-answering system is provided. Multiple communication strategies are offered to ensure communication efficiency and consistency between service nodes in the distributed question-answering system, and Polaris is used to achieve automatic switching between schemes to ensure compatibility between various clusters. On the other hand, practical experience has shown that the distributed question-answering system based on local caching provided in this application embodiment significantly improves performance compared to existing Redis-based distributed question-answering systems when handling 1000 stop-response requests; a performance comparison table can be found in Table 1 below.
[0180] Table 1
[0181]
[0182] As shown in Table 1, with the same total amount of data for stopping response requests, this solution is significantly better than existing technologies in terms of total response time, number of network I / O requests, and efficiency in cleaning up data pairs in the local cache component.
[0183] The methods of the embodiments of this application have been described in detail above. To facilitate better implementation of the above-described solutions of the embodiments of this application, the apparatus of the embodiments of this application is provided below. In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0184] Figure 13 This application shows a schematic diagram of the structure of a message processing apparatus according to an exemplary embodiment; the message processing apparatus can be used to perform... Figure 2 and Figure 8 Some or all of the steps in the method embodiments shown. Please refer to [link / reference]. Figure 13 The device is mounted on a computer device and includes the following units:
[0185] Acquisition unit 1301 is used to acquire question messages in streaming question-answering scenarios;
[0186] Processing unit 1302 is used to generate an answer message corresponding to the question message and an answer message identifier referring to the answer message;
[0187] The processing unit 1302 is further configured to, if a stop reply request is received for the answer message, store the answer message identifier in a local cache component of the computer device;
[0188] The processing unit 1302 is also used to obtain the generation progress information of the answer message based on the answer message identifier in the local cache component;
[0189] The processing unit 1302 is also used to perform question answering processing on the question message based on the generation progress information of the answer message.
[0190] In one implementation, the processing unit 1302, when receiving a stop-response request for an answer message and storing the answer message identifier in a local cache component of the computer device, specifically performs the following:
[0191] Receive a stop reply request in response to the answer message. The stop reply request is used to request the cessation of generating the answer message.
[0192] In response to a stop-response request, obtain the time when the stop-response request was received;
[0193] The answer message identifier and the receiving time are stored as data pairs in the local cache component.
[0194] In one implementation, the generation progress information of the answer message includes any of the following: generation not started, generation in progress, and generation completed; wherein,
[0195] The generation of a message representing the answer has not yet begun;
[0196] The generation process indicates that some sub-messages in the answer message have been generated; the answer message is composed of multiple sub-messages arranged in the order in which they were generated.
[0197] The completion of generation indicates that all sub-messages in the answer message have been generated.
[0198] In one implementation, the generation progress information of the answer message is "generation has not started"; the processing unit 1302, when processing the question message to answer the question based on the generation progress information of the answer message, specifically performs the following:
[0199] Stop generating the answer message;
[0200] Remove the target data pair, which includes the answer message identifier and the reception time, from the local cache component; and...
[0201] Output the first notification message, which indicates that the generation of the answer message has been stopped.
[0202] In one implementation, the generation progress information of the answer message is "generating"; the processing unit 1302, when processing the question message to answer the question based on the generation progress information of the answer message, specifically performs the following:
[0203] Abort the generation of the answer message and delete the target data pair, which includes the answer message identifier and the reception time, from the local cache component; and,
[0204] Retrieve the target sub-message to be displayed and the message display strategy; the target sub-message is a sub-message that has been generated but not yet displayed in the local cache component before the answer message identifier is detected; the message display strategy is used to indicate the display rules for the target sub-message;
[0205] The target sub-message is processed according to the display rules indicated by the message display strategy.
[0206] In one implementation, the generation progress information of the answer message indicates that generation is complete; the processing unit 1302, when processing the question message to answer the question based on the generation progress information of the answer message, specifically performs the following:
[0207] Output a second notification message, which indicates that the current streaming question and answer session has ended.
[0208] In one implementation, the local cache component is configured with a data cleanup task. This task cleans up data pairs within the local cache component. The data pairs include, in a streaming question-and-answer scenario, the answer message identifier and reception time corresponding to an answer message whose generation was requested to be stopped. The reception time refers to the time when a stop-response request for the answer message is received. The data pairs in the local cache component are set with a cache duration. The processing unit 1302 is further configured to:
[0209] Perform data scanning on the local cache component to obtain multiple first data pairs;
[0210] The received time included in each of the multiple first data pairs is compared with the current time to obtain the cached duration of each first data pair;
[0211] Delete the first data pair from multiple first data pairs whose cache duration has exceeded the cache duration period.
[0212] In one implementation, the local cache component stores data pairs, which include, in a streaming question-and-answer scenario, an answer message identifier corresponding to an answer message whose generation has been requested to be stopped and a receiving time, wherein the receiving time refers to the time when a stop-response request for the answer message is received; the local cache component is configured with a memory threshold; the processing unit 1302 is further configured to:
[0213] Calculate the amount of memory used by each data pair in the local cache component;
[0214] If the total memory occupied by each data pair reaches the memory threshold, the second data pair is removed from the local cache component according to the eviction policy until the total memory occupied by the remaining data pairs in the local cache component is less than the memory threshold. The eviction policy is a strategy to select the second data pair from the local cache component based on the amount of memory occupied by the data pair.
[0215] In one implementation, the computer device is the target service node in a distributed question-answering system. The distributed question-answering system includes N service nodes, among which the target service node is one of the N service nodes, where N is an integer greater than 1. The target service node is configured with a first communication strategy. When the distributed question-answering system starts, the processing unit 1302 is further configured to:
[0216] Receive the second communication strategy;
[0217] If the first communication strategy and the second communication strategy are different, then obtain the node information of each of the N-1 reference service nodes; the reference service node is any service node other than the target service node among the N service nodes.
[0218] The second communication strategy is verified based on the node information of N service nodes;
[0219] If the verification is successful, a second communication strategy is deployed, and node information for each reference service node is stored.
[0220] In one implementation, the processing unit 1302 is further configured to:
[0221] If the first communication strategy and the second communication strategy are the same, then the node information of the historical service nodes stored in the target service node is detected; the historical service nodes are the service nodes in the original cluster service to which the target service node belongs; and,
[0222] If the target service node stores the node information of each of the M historical service nodes, then the node information of the M historical service nodes is compared with the node information of the N-1 reference service nodes; M is an integer greater than zero.
[0223] When a target reference service node exists among the N-1 reference service nodes but is not included in the M historical service nodes, the node information of the target reference service node is stored in the target service node.
[0224] In one implementation, the second communication strategy is an election communication strategy; the processing unit 1302, when deploying the second communication strategy, is specifically used for:
[0225] Initialize the logs of the target service node; and,
[0226] In a distributed question-and-answer system, a voting election is conducted, and the leader service node elected by the vote is recorded; and,
[0227] Start the backup node. The backup node is used to back up the data stored in the target service node.
[0228] In one implementation, the processing unit 1302 is further configured to:
[0229] If a stop reply request is received for the answer message, check whether the target service node is the leader service node;
[0230] If the target service node is not the leader service node, a stop reply request will be sent to the leader service node, causing the leader service node to respond to the stop reply request for the answer message, cache the answer message identifier and the receipt time of the stop reply request in the leader service node's local cache component, and the leader service node will write the stop reply request to the log to obtain log information; the leader service node will forward the log information to the reference service nodes and the target service node in the distributed question and answer system, excluding the leader service node.
[0231] Receive log information sent by the leader service node;
[0232] In response to log information, the answer message identifier and reception time are cached as data pairs in the local cache component of the target service node.
[0233] In one implementation, the second communication strategy is a broadcast communication strategy; the processing unit 1302 is further configured to:
[0234] If a stop-response request is received in response to an answer message, the answer message identifier and the time the stop-response request was received are cached as a data pair in the local cache component of the target service node; and,
[0235] Traverse the N-1 reference service nodes in the distributed question-answering system, forward the stop-response request to each reference service node, and enable each reference service node to cache the answer message identifier and reception time in the form of data pairs in its local caching component.
[0236] According to one embodiment of this application, Figure 13 The message processing apparatus shown can be constructed by combining the various units into one or more other units, or one or more of the units can be further divided into multiple functionally smaller units. This can achieve the same operation without affecting the technical effect of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the message processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by multiple units working together. According to another embodiment of this application, the message processing apparatus can be executed by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM). Figure 2 and Figure 8 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 13 The message processing apparatus shown herein, and the message processing method for implementing the embodiments of this application, are described. A computer program may be recorded on, for example, a computer-readable recording medium, loaded onto the aforementioned computing device via the computer-readable recording medium, and run therein.
[0237] Based on the same inventive concept, the message processing device provided in the embodiments of this application solves the problem in a similar principle and with similar beneficial effects as the message processing method in the embodiments of this application. For details, please refer to the principle and beneficial effects of the method implementation. For the sake of brevity, these will not be repeated here.
[0238] Figure 14 A schematic diagram of the structure of a computer device provided in an exemplary embodiment of this application is shown. Please refer to... Figure 14 The computer device includes a processor 1401, a communication interface 1402, and a computer-readable storage medium 1403. The processor 1401, communication interface 1402, and computer-readable storage medium 1403 can be connected via a bus or other means. The communication interface 1402 is used to receive and send data. The computer-readable storage medium 1403 can be stored in the computer device's memory and is used to store computer programs. The processor 1401 is used to execute the computer programs stored in the computer-readable storage medium 1403. The processor 1401 (or CPU (Central Processing Unit)) is the computing and control core of the computer device, suitable for implementing one or more computer programs, specifically suitable for loading and executing one or more computer programs to achieve corresponding method flows or corresponding functions.
[0239] This application embodiment also provides a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the processing system of the computer device. Furthermore, one or more computer programs suitable for loading and execution by the processor 1401 are also stored in this storage space. It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer-readable storage medium located remotely from the aforementioned processor.
[0240] In one embodiment, a computer-readable storage medium stores one or more computer programs; the processor 1401 loads and executes one or more computer programs stored in the computer-readable storage medium to implement the corresponding steps in the above-described message processing method embodiments; specifically, the one or more computer programs in the computer-readable storage medium are loaded and executed by the processor 1401 to perform the steps of the embodiments of this application:
[0241] Retrieve question messages in streaming question-answering scenarios;
[0242] In response to a question message, generate an answer message corresponding to the question message and an answer message identifier that refers to the answer message;
[0243] If a stop reply request is received for the answer message, the answer message identifier is stored in the local cache component of the computer device;
[0244] Based on the answer message identifier in the local cache component, obtain the generation progress information of the answer message;
[0245] Based on the progress information of the answer message generation, the question message is processed to provide a response.
[0246] In one implementation, when one or more computer programs in a computer-readable storage medium are loaded by processor 1401 and executed, if a stop reply request for an answer message is received, the answer message identifier is stored in a local cache component of the computer device, specifically the following steps are performed:
[0247] Receive a stop reply request in response to the answer message. The stop reply request is used to request the cessation of generating the answer message.
[0248] In response to a stop-response request, obtain the time when the stop-response request was received;
[0249] The answer message identifier and the receiving time are stored as data pairs in the local cache component.
[0250] In one implementation, the generation progress information of the answer message includes any of the following: generation not started, generation in progress, and generation completed; wherein,
[0251] The generation of a message representing the answer has not yet begun;
[0252] The generation process indicates that some sub-messages in the answer message have been generated; the answer message is composed of multiple sub-messages arranged in the order in which they were generated.
[0253] The completion of generation indicates that all sub-messages in the answer message have been generated.
[0254] In one implementation, the generation progress information of the answer message is "generation not started"; when one or more computer programs in the computer-readable storage medium are loaded and executed by the processor 1401 to process the question message according to the generation progress information of the answer message, the following steps are specifically performed:
[0255] Stop generating the answer message;
[0256] Remove the target data pair, which includes the answer message identifier and the reception time, from the local cache component; and...
[0257] Output the first notification message, which indicates that the generation of the answer message has been stopped.
[0258] In one implementation, the generation progress information of the answer message is "generating"; when one or more computer programs in the computer-readable storage medium are loaded and executed by the processor 1401 to process the question message according to the generation progress information of the answer message, the following steps are specifically performed:
[0259] Abort the generation of the answer message and delete the target data pair, which includes the answer message identifier and the reception time, from the local cache component; and,
[0260] Retrieve the target sub-message to be displayed and the message display strategy; the target sub-message is a sub-message that has been generated but not yet displayed in the local cache component before the answer message identifier is detected; the message display strategy is used to indicate the display rules for the target sub-message;
[0261] The target sub-message is processed according to the display rules indicated by the message display strategy.
[0262] In one implementation, the generation progress information of the answer message indicates that generation is complete; when one or more computer programs in the computer-readable storage medium are loaded and executed by the processor 1401 to process the question message according to the generation progress information of the answer message, the following steps are specifically performed:
[0263] Output a second notification message, which indicates that the current streaming question and answer session has ended.
[0264] In one implementation, the local cache component is configured with a data cleanup task to clean up data pairs in the local cache component. These data pairs include, in a streaming question-and-answer scenario, an answer message identifier and a reception time corresponding to an answer message whose generation was requested to be stopped. The reception time refers to the time when a stop-response request for the answer message was received. The data pairs in the local cache component are set with a cache duration. One or more computer programs in a computer-readable storage medium are loaded by the processor 1401 and the following steps are also performed:
[0265] Perform data scanning on the local cache component to obtain multiple first data pairs;
[0266] The received time included in each of the multiple first data pairs is compared with the current time to obtain the cached duration of each first data pair;
[0267] Delete the first data pair from multiple first data pairs whose cache duration has exceeded the cache duration period.
[0268] In one implementation, the local cache component stores data pairs, which include, in a streaming question-and-answer scenario, an answer message identifier corresponding to an answer message whose generation has been requested to be stopped and a reception time, wherein the reception time refers to the time when a stop-response request for the answer message is received; the local cache component is configured with a memory threshold; one or more computer programs in a computer-readable storage medium are loaded by the processor 1401 and the following steps are also performed:
[0269] Calculate the amount of memory used by each data pair in the local cache component;
[0270] If the total memory occupied by each data pair reaches the memory threshold, the second data pair is removed from the local cache component according to the eviction policy until the total memory occupied by the remaining data pairs in the local cache component is less than the memory threshold. The eviction policy is a strategy to select the second data pair from the local cache component based on the amount of memory occupied by the data pair.
[0271] In one implementation, the computer device is the target service node in a distributed question-answering system. The distributed question-answering system includes N service nodes, among which the target service node is included, where N is an integer greater than 1. The target service node is equipped with a first communication strategy. When the distributed question-answering system starts, one or more computer programs in a computer-readable storage medium are loaded by the processor 1401 and the following steps are executed:
[0272] Receive the second communication strategy;
[0273] If the first communication strategy and the second communication strategy are different, then obtain the node information of each of the N-1 reference service nodes; the reference service node is any service node other than the target service node among the N service nodes.
[0274] The second communication strategy is verified based on the node information of N service nodes;
[0275] If the verification is successful, a second communication strategy is deployed, and node information for each reference service node is stored.
[0276] In one implementation, one or more computer programs in a computer-readable storage medium are loaded by processor 1401 and the following steps are also performed:
[0277] If the first communication strategy and the second communication strategy are the same, then the node information of the historical service nodes stored in the target service node is detected; the historical service nodes are the service nodes in the original cluster service to which the target service node belongs; and,
[0278] If the target service node stores the node information of each of the M historical service nodes, then the node information of the M historical service nodes is compared with the node information of the N-1 reference service nodes; M is an integer greater than zero.
[0279] When a target reference service node exists among the N-1 reference service nodes but is not included in the M historical service nodes, the node information of the target reference service node is stored in the target service node.
[0280] In one implementation, the second communication strategy is an election communication strategy; when one or more computer programs in a computer-readable storage medium are loaded and executed by the processor 1401 to deploy the second communication strategy, the following steps are specifically performed:
[0281] Initialize the logs of the target service node; and,
[0282] In a distributed question-and-answer system, a voting election is conducted, and the leader service node elected by the vote is recorded; and,
[0283] Start the backup node. The backup node is used to back up the data stored in the target service node.
[0284] In one implementation, one or more computer programs in a computer-readable storage medium are loaded by processor 1401 and the following steps are also performed:
[0285] If a stop reply request is received for the answer message, check whether the target service node is the leader service node;
[0286] If the target service node is not the leader service node, a stop reply request will be sent to the leader service node, causing the leader service node to respond to the stop reply request for the answer message, cache the answer message identifier and the receipt time of the stop reply request in the leader service node's local cache component, and the leader service node will write the stop reply request to the log to obtain log information; the leader service node will forward the log information to the reference service nodes and the target service node in the distributed question and answer system, excluding the leader service node.
[0287] Receive log information sent by the leader service node;
[0288] In response to log information, the answer message identifier and reception time are cached as data pairs in the local cache component of the target service node.
[0289] In one implementation, the second communication strategy is a broadcast communication strategy; one or more computer programs in a computer-readable storage medium are loaded by processor 1401 and the following steps are also executed:
[0290] If a stop-response request is received in response to an answer message, the answer message identifier and the time the stop-response request was received are cached as a data pair in the local cache component of the target service node; and,
[0291] Traverse the N-1 reference service nodes in the distributed question-answering system, forward the stop-response request to each reference service node, and enable each reference service node to cache the answer message identifier and reception time in the form of data pairs in its local caching component.
[0292] Based on the same inventive concept, the principle and beneficial effects of the computer device provided in the embodiments of this application in solving the problem are similar to the principle and beneficial effects of the message processing method in the embodiments of this application in solving the problem. Please refer to the principle and beneficial effects of the implementation of the method. For the sake of brevity, they will not be repeated here.
[0293] This application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described message processing method.
[0294] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0295] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. A computer program product includes one or more computer programs. When a computer program is loaded and executed on a computer device, the computer program performs the processes or functions described above in the embodiments of this application. The computer device can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program can be stored in or transmitted through a computer-readable storage medium. The computer program can be transmitted from one website, computer device, server, or data center to another website, computer device, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium accessible to the computer device or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0296] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A message processing method, characterized in that, The method is performed by a computer device, and the method includes: Obtain the question messages in the streaming question-answering scenario; In response to the question message, an answer message corresponding to the question message and an answer message identifier referring to the answer message are generated; If a stop reply request is received for the answer message, the answer message identifier is stored in the local cache component of the computer device; Based on the answer message identifier in the local cache component, obtain the generation progress information of the answer message; Based on the progress information of the answer message generation, the question message is processed to provide a question answer.
2. The method as described in claim 1, characterized in that, If a stop-responding request is received for the answer message, storing the answer message identifier in the local cache component of the computer device includes: Receive a stop reply request in response to the answer message, the stop reply request being used to request the termination of generating the answer message; In response to the stop reply request, obtain the time when the stop reply request was received; The answer message identifier and the receiving time are stored as data pairs in the local cache component.
3. The method as described in claim 1 or 2, characterized in that, The generation progress information of the answer message includes any of the following: generation not started, generation in progress, and generation completed; wherein, The phrase "generation has not started" is used to indicate that the answer message has not started generating. The generation process is used to indicate that some sub-messages in the answer message have been generated; the answer message is composed of multiple sub-messages arranged sequentially according to the generation order of the sub-messages; The term "generation complete" indicates that all sub-messages in the answer message have been generated.
4. The method as described in claim 3, characterized in that, The generation progress information of the answer message indicates that generation has not started; the step of processing the question message with a question answer based on the generation progress information of the answer message includes: Abort the generation of the answer message; Delete the target data pair, which includes the answer message identifier and the reception time, from the local cache component; and... Output a first notification message, which indicates that the generation of the answer message has been stopped.
5. The method as described in claim 3, characterized in that, The generation progress information of the answer message is "generating". The step of processing the question message with a question answer based on the generation progress information of the answer message includes: The generation of the answer message is aborted, and the target data pair, including the answer message identifier and the reception time, is deleted from the local cache component; and... Obtain the target sub-message to be displayed and the message display strategy; the target sub-message is a sub-message that has been generated but not displayed before the answer message identifier is detected in the local cache component; the message display strategy is used to indicate the display rules for the target sub-message; The target sub-message is processed according to the display rules indicated by the message display strategy.
6. The method as described in claim 3, characterized in that, The generation progress information of the answer message indicates that the generation is complete; the step of processing the question message to answer the question based on the generation progress information of the answer message includes: Output a second notification message, which indicates that the current streaming question and answer session has ended.
7. The method as described in claim 1 or 2, characterized in that, The local cache component is configured with a data cleanup task, which is used to clean up data pairs in the local cache component. The data pairs include the answer message identifier and the receiving time corresponding to the answer message that was requested to be stopped in the streaming question-and-answer scenario. The receiving time refers to the time when the stop reply request for the answer message is received. The data pairs in the local caching component are configured with a cache duration; the method further includes: The local cache component is subjected to data scanning processing to obtain multiple first data pairs; The receiving time included in each of the multiple first data pairs is compared with the current time to obtain the cached duration of each first data pair; From the plurality of first data pairs, delete the first data pairs whose cache duration exceeds the cache duration period.
8. The method as described in claim 1 or 2, characterized in that, The local cache component stores data pairs, which include the answer message identifier and the receiving time corresponding to the answer message whose generation was requested to be stopped in the streaming question-and-answer scenario. The receiving time refers to the time when the stop-response request for the answer message is received. The local cache component is configured with a memory threshold; the method further includes: Calculate the amount of memory occupied by each data pair in the local cache component; If the sum of the memory occupied by each of the data pairs reaches the memory threshold, the second data pair is deleted from the local cache component according to the eviction policy until the sum of the memory occupied by the remaining data pairs in the local cache component is less than the memory threshold; the eviction policy is a policy of selecting the second data pair from the local cache component according to the memory occupied by the data pair.
9. The method as described in claim 1, characterized in that, The computer device is the target service node in the distributed question-answering system, which includes N service nodes, including the target service node, where N is an integer greater than 1. The target service node is equipped with a first communication strategy. When the distributed question-answering system starts, the method further includes: Receive the second communication strategy; If the first communication strategy and the second communication strategy are different, then obtain the node information of each of the N-1 reference service nodes; the reference service node is any one of the N service nodes except the target service node. The second communication strategy is verified based on the node information of the N service nodes; If the verification is successful, the second communication strategy is deployed, and the node information of each of the reference service nodes is stored.
10. The method as described in claim 9, characterized in that, The method further includes: If the first communication strategy and the second communication strategy are the same, then the node information of the historical service nodes stored in the target service node is detected, wherein the historical service nodes are service nodes in the original cluster service to which the target service node belongs; and, If the target service node stores node information for each of the M historical service nodes, then the node information for the M historical service nodes is compared with the node information for the N-1 reference service nodes; M is an integer greater than zero. When there is a target reference service node among the N-1 reference service nodes that is not included in the M historical service nodes, the node information of the target reference service node is stored in the target service node.
11. The method as described in claim 9, characterized in that, The second communication strategy is an election communication strategy; deploying the second communication strategy includes: Initialize the logs of the target service node; and, In the distributed question-and-answer system, a voting election is conducted, and the leader service node elected by the voting election is recorded; and, Start the backup node, which is used to back up the data stored in the target service node.
12. The method as described in claim 11, characterized in that, The method further includes: If a stop reply request is received for the answer message, then it is checked whether the target service node is the leader service node; If the target service node is not the leader service node, the stop reply request is sent to the leader service node, causing the leader service node to respond to the stop reply request for the answer message by caching the answer message identifier and the reception time of the stop reply request in its local cache component, and writing the stop reply request to the log to obtain log information; the leader service node forwards the log information to the reference service node and the target service node in the distributed question-and-answer system, excluding the leader service node. Receive the log information sent by the leadership service node; In response to the log information, the answer message identifier and the receiving time are cached as a data pair in the local cache component of the target service node.
13. The method as described in claim 9, characterized in that, The second communication strategy is a broadcast communication strategy; the method further includes: If a stop-response request is received in response to the answer message, the answer message identifier and the receipt time of the stop-response request are cached as a data pair in the local cache component of the target service node; and, The system iterates through N-1 reference service nodes in the distributed question-answering system and forwards the stop-response request to each reference service node, so that each reference service node caches the answer message identifier and the reception time in the form of a data pair in its local caching component.
14. A message processing device, characterized in that, The message processing device is mounted on a computer device, and the device includes: The acquisition unit is used to acquire question messages in the streaming question-answering scenario; The processing unit is configured to, in response to the question message, generate an answer message corresponding to the question message and an answer message identifier referring to the answer message; The processing unit is further configured to, if it receives a stop reply request for the answer message, store the answer message identifier in the local cache component of the computer device; The processing unit is further configured to obtain the generation progress information of the answer message based on the answer message identifier in the local cache component; The processing unit is further configured to perform question answering processing on the question message based on the generation progress information of the answer message.
15. A computer device, characterized in that, include: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program that, when executed by the processor, implements the message processing method as described in any one of claims 1-13.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed as described in any one of claims 1-13.
17. A computer program product, characterized in that, The computer program product includes computer instructions that, when executed by a processor, implement the message processing method as described in any one of claims 1-13.