Machine question and answer dialogue method and device
By using a sliding window to update memory documents and asynchronously generate user portraits in a machine question-answering system, the problem of low answer accuracy in the existing technology is solved, and more accurate and efficient user interaction is achieved.
Patent Information
- Application Number
- CN202511212126.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-27
- Publication Date
- 2025-09-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In existing technologies, machine question-answering systems can only recommend answers based on a few recent rounds of conversations, resulting in low answer accuracy and an inability to deeply understand users' long-term preferences and historical behaviors.
A sliding window mechanism is used to update memory documents, including user portraits and historical conversation information. The preset model is used to analyze question information to generate answers, and user portraits and stored answers are generated asynchronously to avoid repeated calls to large models.
It improves the accuracy of answers, optimizes system operation efficiency, enhances user experience and system performance, and can better understand user intent and provide personalized responses.
Smart Images

Figure CN120705284A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a machine question-answering dialogue method and device. Background Art
[0002] In today's rapidly developing digital era, AI-based dialogue systems are rapidly developing and becoming increasingly integrated into people's daily lives and work environments, becoming indispensable tools for people to obtain information, solve problems, and communicate. With the rapid advancement of AI technology, language models have mushroomed. Their powerful language processing capabilities and knowledge base provide a solid and robust foundation for intelligent dialogue systems. The core goal of AI-based dialogue systems is to accurately understand natural language input from users and generate accurate, appropriate, and logical responses based on it. From the perspective of user needs, with the development of society and technological advancements, user needs and the questions they ask are becoming increasingly diverse and complex. Users are no longer satisfied with simple, superficial responses; instead, they expect dialogue systems to deeply understand the meaning and intent behind their questions. For example, in areas of professional knowledge, users may ask questions that involve deep expertise, such as medical diagnosis or financial investment strategies, requiring dialogue systems to accurately answer them like professionals. Especially in multi-turn dialogue scenarios, the storage and utilization of historical user interaction information has become a critical factor affecting the quality of the conversation. Currently, many traditional dialogue systems have significant shortcomings in user memory storage. When processing multiple rounds of conversations, some systems can only mechanically remember the most recent few interactions. This simple storage method is far from meeting the needs of deeply understanding user intent. This is because these systems cannot conduct comprehensive and in-depth analysis and summary of users' preferences and historical behaviors over a long period of time. For example, in an e-commerce scenario, if a conversation system can only remember the user's most recent consultation content, it will not be able to comprehensively consider the user's long-term purchasing preferences, browsing habits, and other information. As a result, when recommending products to users, it can only provide relatively one-sided and inaccurate recommendations. This limitation makes it difficult for the system to provide highly targeted responses based on the user's complete profile characteristics during the conversation, which greatly limits the quality and depth of the conversation. Summary of the Invention
[0003] The embodiments of the present application provide a machine question-answering dialogue method and device to at least solve the technical problem in the related art that answers can only be recommended based on a few recent rounds of dialogue, resulting in low accuracy of the answers obtained.
[0004] According to one aspect of an embodiment of the present application, a machine question-answering dialogue method is provided, including: receiving a user request of a target user, and obtaining question information in a target round of conversation corresponding to the user request from the user request; obtaining a memory document of the target user, and using a preset model to analyze the question information and the memory document to generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving a sliding window, and the memory document contains at least one of the following: a user portrait and historical dialogue information; and outputting an answer.
[0005] Optionally, a preset model is used to analyze the question information and the memory document to generate an answer corresponding to the question information, including: when there is no memory document for the target user, using the preset model to analyze the question information to generate an answer corresponding to the question information; when there is a memory document for the target user, obtaining a user portrait of the target user from the memory document; using the preset model to analyze the question information and the user portrait of the target user to generate an answer corresponding to the question information.
[0006] Optionally, the method also includes: when a memory document exists for the target user, updating the historical conversation information according to the question information and the answer corresponding to the question information to obtain updated historical conversation information, and generating an updated user portrait based on the updated historical conversation information, wherein the process of generating the answer corresponding to the question information is asynchronous with the process of updating the user portrait and the historical conversation information.
[0007] Optionally, the historical conversation information is updated according to the question information and the answer corresponding to the question information to obtain updated historical conversation information, including: obtaining the length of the historical conversation information; when the length of the historical conversation information is greater than the length of a preset time window, deleting the conversation information ranked first from the historical conversation information to obtain deleted historical conversation information; adding the question information and the answer corresponding to the question information to the deleted historical conversation information according to the time sequence of conversation generation to obtain updated historical conversation information, wherein the length of the updated historical conversation information is not greater than the length of the preset time window.
[0008] Optionally, the method also includes: in the case that a memory document does not exist for the target user, constructing a memory document for the target user, and generating a user portrait of the target user based on the question information and the answer corresponding to the question information; storing the generated user portrait of the target user, the question information, and the answer corresponding to the question information in the memory document of the target user, wherein the process of generating the answer corresponding to the question information is asynchronous with the process of generating the user portrait of the target user and storing the user portrait of the target user, the question information, and the answer corresponding to the question information.
[0009] Optionally, the question information and the answer corresponding to the question information are added to the deleted historical conversation information according to the time sequence of the conversation generation to obtain the updated historical conversation information, including: when the length of the historical conversation information is greater than the length of the preset time window, moving the preset time window forward, deleting the first conversation information, and obtaining the deleted historical conversation information; adding the question information and the answer corresponding to the question information to the end of the deleted historical conversation information to obtain the updated historical conversation information.
[0010] Optionally, a preset model is used to analyze the question information and the user portrait of the target user to generate an answer corresponding to the question information, including: generating a query vector based on the question information and the user portrait of the target user; retrieving knowledge fragments from the local knowledge base based on the query vector, whose correlation with the question information and the user portrait of the target user is higher than a preset correlation threshold; and analyzing the knowledge fragments using a preset model to generate an answer corresponding to the question information.
[0011] Optionally, a user profile of the target user is generated based on the question information and the answer corresponding to the question information, including: extracting features of the question information and the answer corresponding to the question information to obtain a feature vector, wherein the feature vector is used to represent the subject of the question information, the intention of the target user and the emotional state of the target user; and constructing a user profile based on the feature vector.
[0012] According to another aspect of the embodiment of the present application, a machine question-answering dialogue device is also provided, including: a receiving module for receiving a user request of a target user, and obtaining question information in a target round of conversation corresponding to the user request from the user request; a generating module for obtaining a memory document of the target user, and using a preset model to analyze the question information and the memory document, and generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving a sliding window, and the memory document contains at least one of the following: a user portrait and historical dialogue information; an output module for outputting the answer.
[0013] According to another aspect of an embodiment of the present application, a computer device is also provided, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-mentioned machine question-answering dialogue method.
[0014] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the above-mentioned machine question-answering dialogue method when executed by a processor.
[0015] In an embodiment of the present application, a user request of a target user is received, and question information in a target round conversation corresponding to the user request is obtained from the user request; a memory document of the target user is obtained, and the question information and the memory document are analyzed using a preset model to generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving a sliding window, and the memory document contains at least one of the following: a user portrait and historical conversation information; an answer is output, and the memory document is updated by moving the sliding window, thereby achieving the purpose of jointly generating an answer corresponding to the question information based on the updated memory document and the question information, thereby achieving the technical effect of improving the accuracy of generated answers, and further solving the technical problem in the related art that answers can only be recommended based on a few adjacent rounds of conversations, resulting in a low accuracy rate of the obtained answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0017] Figure 1 This is a hardware structure block diagram of a computer terminal for implementing a machine question-answering dialogue method according to an embodiment of the present application;
[0018] Figure 2 This is a flow chart of a machine question-answering dialogue method according to an embodiment of the present application;
[0019] Figure 3 is a flowchart of another machine question-answering dialogue method according to an embodiment of the present application;
[0020] Figure 4 is a flow chart of a memory document updating method according to an embodiment of the present application;
[0021] Figure 5 is a flowchart of another memory document updating method according to an embodiment of the present application;
[0022] Figure 6 This is a structural diagram of a machine question-answering dialogue device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] The information collected in the embodiments of the present application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, and provide corresponding operation entrances for users to choose to authorize or reject the automated decision results; if the user chooses to reject, the expert decision-making process will be entered.
[0026] In order to solve the problems existing in the related art, the embodiment of the present application provides a machine question-answering dialogue method, which can be run on Figure 1 In the computer terminal shown, the computer terminal is explained below.
[0027] The machine question-answering dialogue method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG1 shows a hardware structure block diagram of a computer terminal for implementing a machine question-answering dialogue method. Figure 1 As shown, the computer terminal 10 may include one or more processors (illustrated as 102a, 102b, ..., 102n in the figure) (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions via a wired and / or wireless network connection. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0028] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be fully or partially integrated into any of the other components of the computer terminal 10. As discussed in the embodiments of the present application, the data processing circuitry functions as a processor control (e.g., the selection of a variable resistor terminal path connected to an interface).
[0029] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the machine question-answering dialogue method in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned machine question-answering dialogue method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0030] The transmission module 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission module 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission module 106 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0031] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .
[0032] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. Figure 1This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.
[0033] In the above-mentioned operating environment, an embodiment of the present application provides an embodiment of a machine question-answering dialogue method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] Figure 2 This is a flow chart of a machine question-answering dialogue method according to an embodiment of the present application. Figure 2 As shown, the method includes the following steps:
[0035] Step S202: receiving a user request from a target user, and obtaining question information in a target round of conversation corresponding to the user request from the user request;
[0036] Step S204: Obtain the target user's memory document and analyze the question information and the memory document using a preset model to generate an answer corresponding to the question information. The information in the memory document is updated by moving the sliding window. The memory document contains at least one of the following: a user profile and historical conversation information.
[0037] In step S204, when the user number initialization field is received from the front-end feedback, the system will automatically create an independent memory document. This document will record the user's preferences, behavior patterns and historical conversations. It can be understood that the user's preferences and behavior patterns can be obtained through the user portrait. For example: the memory document records the user's historical conversation information and user portrait, where the historical conversation information and user portrait can be updated as the conversation progresses.
[0038] It should be noted that updating the memory document by moving the sliding window mainly updates the historical conversation information in the memory document by moving the sliding window. For example, by moving the sliding window, the earliest conversation information in the historical conversation information is deleted and the latest conversation information is added.
[0039] Step S206: output the answer.
[0040] Through the above steps S202 to S206, a user request of a target user is received, and question information in the target round of conversation corresponding to the user request is obtained from the user request; a memory document of the target user is obtained, and the question information and the memory document are analyzed using a preset model to generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving a sliding window, and the memory document contains at least one of the following: a user profile and historical conversation information; an answer is output, and the memory document is updated by moving a sliding window, thereby achieving the purpose of jointly generating an answer corresponding to the question information based on the updated memory document and the question information, thereby achieving the technical effect of improving the accuracy of generated answers, and further solving the technical problem in related technologies that answers can only be recommended based on a few recent rounds of conversations, resulting in a low accuracy rate of the obtained answers. The following is a detailed description.
[0041] In some embodiments of the present application, a preset model is used to analyze question information and memory documents to generate an answer corresponding to the question information. This can be divided into two situations. For example, when the target user does not have a memory document, the preset model is used to analyze the question information to generate an answer corresponding to the question information; when the target user has a memory document, the user portrait of the target user is obtained from the memory document; the preset model is used to analyze the question information and the user portrait of the target user to generate an answer corresponding to the question information, such as Figure 3 As shown in the figure, upon receiving a user request, the system obtains and decomposes the user request. This crucial step involves obtaining and decomposing the user request. User requests are received using a pre-designed input format, which provides the fundamental infrastructure for the entire system to accurately understand and process user requests. The input format comprehensively covers the initialization phase, user ID information, question-and-answer mode identifier, and user question content. The initialization phase is primarily responsible for establishing a unique database for each user, ensuring that subsequent information processing can be performed in a stable and appropriate environment. The user ID, as a unique identifier for different users, plays a crucial role. It enables the system to accurately distinguish each user's information when processing multiple user requests, thus enabling personalized services. The question-and-answer mode specifies the user's desired interaction method, such as a simple knowledge Q&A mode or a scenario-specific Q&A mode (e.g., generating a travel plan). This helps the system optimize its response strategy based on different modes. Regarding the user question, upon receiving the user question, the decomposed content is input into the system's knowledge retrieval module, which breaks down the complex question information into clearly defined elements. This allows the knowledge retrieval module to quickly locate relevant information within the vast knowledge system and generate accurate answers. like Figure 4As shown, after receiving a user request, the system determines whether the target user's memory document exists in the system based on the target user's number in the user request. If the target user's memory document exists, the system searches the question information and the memory document, generates an answer to the question information based on the search results, and stores the question information and the answer corresponding to the question information in the memory document. If the target user's memory document does not exist, the system generates an answer corresponding to the question information based on the question information. The specific retrieval process is as follows: the question information and the user profile of the target user are analyzed using a preset model to generate an answer corresponding to the question information. Specifically, a query vector is generated based on the question information and the user profile of the target user; based on the query vector, knowledge fragments whose correlation with the question information and the user profile of the target user is higher than a preset correlation threshold are retrieved from the local knowledge base; the knowledge fragments are analyzed using a preset model to generate an answer corresponding to the question information.
[0042] During the retrieval process, first, you can start the entire retrieval enhancement process by calling the query tool. Quickly locate relevant knowledge fragments in a huge knowledge system, such as a local knowledge base. These knowledge fragments are crucial for subsequent operations and are the basic elements for building a complete knowledge puzzle. After obtaining these knowledge fragments, we will use them to carry out a series of complex and orderly operations on the constructed local knowledge base, namely, knowledge filtering and reorganization. Filtering is to remove information from the local knowledge base that is not strongly relevant to the current user's question or does not meet specific standards. The reorganization process is a creative integration step that will recombine the filtered fragments with the original valid information in the local knowledge base according to a new logical structure, thereby forming a more targeted knowledge system. This filtered and reorganized knowledge base can better meet user needs and provide users with more accurate and valuable answers.
[0043] In addition, when the target user has a memory document, the historical conversation information is updated according to the question information and the answer corresponding to the question information to obtain updated historical conversation information, and an updated user portrait is generated based on the updated historical conversation information. The process of generating the answer corresponding to the question information is asynchronous with the process of updating the user portrait and the historical conversation information.
[0044] like Figure 5As shown, the memory module acquires a user profile (generated based on previous questions, previous memories, and previous answers) and uses the previous user profile and historical conversation information as the memory document from the previous round as input. Specifically, an updated memory document is generated based on the questions from the previous round, the memory document from the previous round, and the answers from the previous round of retrieval augmentation. Retrieval augmentation is achieved through RAG (Retrieval Augmented Generation), for example, by quickly locating relevant knowledge fragments in the local knowledge base and using them to generate accurate and valuable answers (the answers from the retrieval augmentation). Then, upon receiving the current question, the corresponding answer is generated based on the current question information and the updated memory document.
[0045] The specific steps for updating historical conversation information based on the question information and the corresponding answer to obtain the updated historical conversation information are as follows: obtaining the length of the historical conversation information; if the length of the historical conversation information is greater than the length of a preset time window, deleting the conversation information ranked first from the historical conversation information to obtain the deleted historical conversation information; adding the question information and the corresponding answer to the question information to the deleted historical conversation information in the order in which the conversation occurred to obtain the updated historical conversation information, wherein the length of the updated historical conversation information is no greater than the length of the preset time window. If a memory document does not exist for the target user, a memory document for the target user is constructed, and a user profile of the target user is generated based on the question information and the corresponding answer to the question information; the generated user profile of the target user, the question information, and the corresponding answer to the question information are stored in the target user's memory document, wherein the process of generating the answer to the question information is asynchronous with the process of generating the user profile of the target user and storing the user profile, the question information, and the corresponding answer to the question information.
[0046] It's easy to understand that the sliding window is like a dynamic information container, flexibly moving within the information flow of multiple conversation rounds. When a new conversation round occurs, the sliding window incorporates the information from that round. This window has a certain capacity limit; it doesn't store all conversation records indefinitely. Instead, it retains only the information from the few rounds of conversation that are most relevant to the current user's state and needs, based on pre-set rules and parameters. For example, the sliding window size can be set to the three most recent conversation rounds. As new conversation rounds occur, the oldest conversation round information gradually moves out of the window, while the latest conversation information is continuously added.
[0047] This sliding window storage method effectively avoids excessive information accumulation and redundancy, while ensuring that the system remains focused on the most valuable user conversation information at the moment. This allows the system to promptly capture changes in user information across multiple rounds of conversation. Whether it's fine-tuning user needs, the emergence of new concerns, or shifts in emotional state, all can be accurately recorded and analyzed. This provides solid data support and assurance for the system to subsequently adjust response strategies, optimize recommended content, and enhance the user experience based on updated user information, enabling the system to interact with users more intelligently and accurately.
[0048] The machine question-answering dialogue method provided in the embodiment of the present application generates user portraits and stores answers asynchronously. In related technologies, it often takes a certain amount of time for artificial intelligence models to generate answers. If a synchronous method is used, the answer generation function of the large model must be executed twice, which will double the time required. To address this problem, whether it is streaming output or non-streaming output, the core of the machine question-answering dialogue method provided in the embodiment of the present application is that the model only needs to be run once each time. During this process, the large model generates answers on the one hand and generates user portraits in the background on the other hand. This method achieves the completion of the two important tasks of answer generation and user portrait construction without increasing the running time of the large model, which can effectively improve retrieval efficiency and is a very valuable retrieval enhancement method. It fully considers the problem of large model operation efficiency, optimizes the operation process of the entire system through a reasonable asynchronous operation mechanism, avoids the time waste caused by repeated calls to the large model, and thus improves the user experience and the overall performance of the system.
[0049] When outputting answers, streaming output is generally used. Streaming output itself is implemented by asynchronous functions. Therefore, when using streaming output, the memory document can be written directly at the end of the function to complete the storage of the memory document. When using non-streaming output, the output will not begin until the memory document storage is completed. Therefore, the storage memory and the output of the answer need to be executed asynchronously.
[0050] Among them, the question information and the answer corresponding to the question information are added to the deleted historical conversation information according to the time sequence of the conversation generation, and the specific steps for obtaining the updated historical conversation information are as follows: when the length of the historical conversation information is greater than the length of the preset time window, move the preset time window forward, delete the first conversation information, and obtain the deleted historical conversation information; add the question information and the answer corresponding to the question information to the end of the deleted historical conversation information to obtain the updated historical conversation information.
[0051] To better illustrate the update process of the memory document, the following further elaborates on the update process of the memory document: Input requirements: Obtain the questions raised by the user and the answers of the large model to these questions; Ensure: The latest conversation history and updated user profile are stored in the file corresponding to each user ID.
[0052] Step 1: Initialize the conversation history list: At the start of the algorithm, initialize a conversation history list for each user to record the interaction records between the user and the system. This list is empty in the initial state and awaits the first round of conversations from the user to be filled.
[0053] Step 2: Update the conversation history with a sliding window: When a new question from the user and the corresponding answer from the large model are received: If the current length of the list has reached the preset maximum length, then remove the earliest conversation record in the list (i.e., the first element of the list) to keep the list length fixed. Then, add the latest conversation (including the question and answer) to the end of the list to ensure that the list always contains the latest and relevant conversation information.
[0054] Step 3: Open the user memory file: For each user, there is a dedicated memory document file to store the user profile and conversation history of that user. When updating each conversation record, the corresponding user file will be opened first to prepare for writing new information.
[0055] Step 4: Asynchronously generate the user profile and update the conversation history. In this stage, the algorithm uses an asynchronous approach to simultaneously handle two key tasks: 1. Generate the user profile: Based on the current question, the answer from the large model, and the existing user profile (stored in memory variables), the artificial intelligence model will generate a new version of the user profile, which includes the analysis results of the current question and answer, as well as potentially updated user preferences and behavior patterns. Write the user profile: The new user profile will be written into the user's memory document file as the latest version of the user profile. 2. Update the conversation history: Traverse the conversation history list and write each pair of question and answer into the user's memory document file. It should be noted that when writing each question, the prefix string "上" will gradually accumulate according to the distance of the question from the current conversation. The purpose of this is to visually represent the order of questions in the file for convenient subsequent parsing.
[0056] Step 5: Implementation of asynchronous processing: The entire processing process, including generating the user profile and updating the conversation history, is achieved by calling asynchronous functions. This asynchronous processing method ensures the smoothness of the main process, avoids delays caused by long-term memory writing and calculations, and enables the large model to quickly respond to the next user request, improving the overall performance of the system.
[0057] Optionally, a user profile of the target user is generated based on the question information and the answer corresponding to the question information, including: extracting features of the question information and the answer corresponding to the question information to obtain a feature vector, wherein the feature vector is used to represent the subject of the question information, the intention of the target user and the emotional state of the target user; and constructing a user profile based on the feature vector.
[0058] Figure 6 A machine question-answering dialogue device is shown, the device comprising:
[0059] The receiving module 60 is configured to receive a user request from a target user and obtain question information in a target round of conversation corresponding to the user request from the user request;
[0060] A generation module 62 is configured to obtain a memory document of the target user, analyze the question information and the memory document using a preset model, and generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving the sliding window, and the memory document includes at least one of the following: a user profile and historical conversation information;
[0061] The output module 64 is used to output the answer.
[0062] The above-mentioned machine question-answering dialogue device receives a user request from a target user, and obtains question information in a target round of conversation corresponding to the user request from the user request; obtains the memory document of the target user, and uses a preset model to analyze the question information and the memory document to generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving the sliding window, and the memory document contains at least one of the following: user portrait and historical conversation information; outputs the answer, and updates the memory document by moving the sliding window, thereby achieving the purpose of jointly generating the answer corresponding to the question information based on the updated memory document and the question information, thereby achieving the technical effect of improving the accuracy of the generated answer, and further solving the technical problem in the related technology that the answer recommendation can only be based on the adjacent rounds of conversation, resulting in a low accuracy rate of the obtained answer.
[0063] The generation module 62 includes: a generation submodule, which is used to use a preset model to analyze the question information and the memory document to generate an answer corresponding to the question information, including: when the target user does not have a memory document, using the preset model to analyze the question information and generate an answer corresponding to the question information; when the target user has a memory document, obtaining the user portrait of the target user from the memory document; using the preset model to analyze the question information and the user portrait of the target user to generate an answer corresponding to the question information.
[0064] The generation submodule includes: an update submodule, which is used to update the historical conversation information according to the question information and the answer corresponding to the question information when the target user has a memory document, obtain updated historical conversation information, and generate an updated user portrait based on the updated historical conversation information, wherein the process of generating the answer corresponding to the question information is asynchronous with the process of updating the user portrait and historical conversation information.
[0065] The update submodule includes: an update unit, which is used to update the historical dialogue information according to the question information and the answer corresponding to the question information to obtain the updated historical dialogue information, including: obtaining the length of the historical dialogue information; when the length of the historical dialogue information is greater than the length of the preset time window, deleting the dialogue information ranked first from the historical dialogue information to obtain the deleted historical dialogue information; adding the question information and the answer corresponding to the question information to the deleted historical dialogue information according to the time sequence of the dialogue generation to obtain the updated historical dialogue information, wherein the length of the updated historical dialogue information is not greater than the length of the preset time window.
[0066] The generation module 62 also includes: a construction submodule, which is used to construct a memory document of the target user when no memory document exists for the target user, and generate a user portrait of the target user based on the question information and the answer corresponding to the question information; the generated user portrait of the target user, the question information and the answer corresponding to the question information are stored in the memory document of the target user, wherein the process of generating the answer corresponding to the question information is asynchronous with the process of generating the user portrait of the target user and storing the user portrait of the target user, the question information and the answer corresponding to the question information.
[0067] The updating unit also includes: an updating subunit, which is used to add the question information and the answer corresponding to the question information to the deleted historical conversation information according to the time sequence of the conversation generation to obtain the updated historical conversation information, including: when the length of the historical conversation information is greater than the length of the preset time window, moving the preset time window forward, deleting the first conversation information, and obtaining the deleted historical conversation information; adding the question information and the answer corresponding to the question information to the end of the deleted historical conversation information to obtain the updated historical conversation information.
[0068] The generation submodule includes: a retrieval unit, which is used to use a preset model to analyze the question information and the user portrait of the target user to generate an answer corresponding to the question information, including: generating a query vector based on the question information and the user portrait of the target user; retrieving knowledge fragments from the local knowledge base based on the query vector, whose correlation with the question information and the user portrait of the target user is higher than a preset correlation threshold; using the preset model to analyze the knowledge fragments to generate an answer corresponding to the question information.
[0069] The generation submodule also includes: a portrait unit, which is used to generate a user portrait of the target user based on the question information and the answer corresponding to the question information, including: extracting features of the question information and the answer corresponding to the question information to obtain a feature vector, wherein the feature vector is used to represent the subject of the question information, the intention of the target user and the emotional state of the target user; and constructing a user portrait based on the feature vector.
[0070] It should be noted that Figure 6 The machine question-answering dialogue device shown is used to perform Figure 2 The machine question-answering dialogue method shown in the figure, therefore, the above-mentioned relevant explanations except for the machine question-answering dialogue method also apply to the machine question-answering dialogue device, and will not be repeated here.
[0071] An embodiment of the present application also provides a computer device, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-mentioned machine question-answering dialogue method.
[0072] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the machine question-answering dialogue method in the present application.
[0073] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0074] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0075] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0076] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected to achieve the purpose of the present embodiment according to actual needs.
[0077] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0078] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, and other media that can store program code.
[0079] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A machine question-answering dialogue method, characterized in that: include: Receive a user request from a target user, and obtain question information in a target round reply corresponding to the user request from the user request; Obtaining a memory document of the target user, and analyzing the question information and the memory document using a preset model to generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving a sliding window, and the memory document includes at least one of the following: a user profile and historical conversation information; Output the answer.
2. The method according to claim 1, characterized in that Analyzing the question information and the memory document using a preset model to generate an answer corresponding to the question information includes: In the case that the target user does not have a memory document, the preset model is used to analyze the question information to generate an answer corresponding to the question information; If a memory document exists for the target user, obtaining a user profile of the target user from the memory document; The preset model is used to analyze the question information and the user portrait of the target user to generate an answer corresponding to the question information.
3. The method according to claim 2, characterized in that The method further comprises: In the case where a memory document exists for the target user, the historical conversation information is updated according to the question information and the answer corresponding to the question information to obtain updated historical conversation information, and an updated user portrait is generated according to the updated historical conversation information, wherein the process of generating the answer corresponding to the question information is asynchronous with the process of updating the user portrait and the historical conversation information.
4. The method according to claim 3, characterized in that The historical conversation information is updated according to the question information and the answer corresponding to the question information to obtain updated historical conversation information, including: Obtaining the length of the historical conversation information; When the length of the historical conversation information is greater than the preset time window length, deleting the conversation information ranked first from the historical conversation information to obtain the deleted historical conversation information; The question information and the answer corresponding to the question information are added to the deleted historical conversation information according to the conversation generation sequence to obtain the updated historical conversation information, wherein the length of the updated historical conversation information is not greater than the preset time window length.
5. The method according to claim 1, wherein The method further comprises: If no memory document exists for the target user, construct a memory document for the target user, and generate a user profile of the target user based on the question information and the answer corresponding to the question information; The generated user portrait of the target user, the question information and the answer corresponding to the question information are stored in the memory document of the target user, wherein the process of generating the answer corresponding to the question information is asynchronous with the process of generating the user portrait of the target user and storing the user portrait of the target user, the question information and the answer corresponding to the question information.
6. The method according to claim 4, characterized in that Adding the question information and the answer corresponding to the question information to the deleted historical conversation information according to the conversation generation time sequence to obtain the updated historical conversation information, including: If the length of the historical conversation information is greater than the length of the preset time window, the preset time window is moved forward, the first conversation information is deleted, and the deleted historical conversation information is obtained; The question information and the answer corresponding to the question information are added to the end of the deleted historical conversation information to obtain the updated historical conversation information.
7. The method according to claim 2, characterized in that The preset model is used to analyze the question information and the user profile of the target user to generate an answer corresponding to the question information, including: generating a query vector based on the question information and the user profile of the target user; Retrieving, from a local knowledge base according to the query vector, knowledge fragments whose correlation with the question information and the user profile of the target user is higher than a preset correlation threshold; The preset model is used to analyze the knowledge fragment to generate an answer corresponding to the question information.
8. The method according to claim 5, characterized in that Generating a user profile of the target user according to the question information and the answer corresponding to the question information includes: Extracting features from the question information and the answer corresponding to the question information to obtain a feature vector, wherein the feature vector is used to represent the subject of the question information, the intention of the target user, and the emotional state of the target user; The user portrait is constructed based on the feature vector.
9. A machine question-answering dialogue device, characterized in that: include: A receiving module, configured to receive a user request from a target user and obtain question information in a target round reply corresponding to the user request from the user request; a generation module, configured to obtain a memory document of the target user, analyze the question information and the memory document using a preset model, and generate an answer corresponding to the question information, wherein the information in the memory document is updated by moving a sliding window, and the memory document includes at least one of the following: a user profile and historical conversation information; An output module is used to output the answer.
10. A computer device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; The processor is connected to the memory and is used to execute the machine question-answering dialogue method described in any one of claims 1 to 8.
11. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the machine question-answering dialogue method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Conversation generation method and device based on artificial intelligence, equipment and storage medium
CN114756667A
Question and answer method and device based on large language model and electronic equipment
CN118377878A
Intelligent question and answer method and device, electronic equipment and storage medium
CN119646127A
Question and answer method and device based on large language model
CN119990300A
Multi-round dialogue question and answer method and system, electronic equipment and storage medium
CN120407717A
Cited By
Intelligent question answering method and device for preschool education and storage medium
CN120929578A
Preschool education intelligent question-answering method and device, and storage medium
CN120929578B
Data processing method and device, storage medium and electronic equipment
CN121412359A
Data processing method and device, storage medium and electronic equipment
CN121412359B
Question and answer information determination method and device, computer equipment and storage medium
CN121902997A