Message processing method, system, electronic device, storage medium and program product
Patent Information
- Application Number
- CN202510435597.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2026-10-16
AI Technical Summary
由于即时通信系统难以准确识别某条群聊消息的上下文信息,可能会导致即时通信系统无法准确识别用户意图或无法给出准确回复
[0010] According to the technical solution of this application embodiment, in a group chat service scenario based on instant chat groups, multiple group users may send different messages simultaneously or within a very short period of time, resulting in a highly chaotic message flow in the instant chat group. According to the technical solution of this application embodiment, by configuring user identifiers and time matching identifiers in the historical sessions of the instant chat group, the chaotic historical messages are categorized according to the group user dimension and the time dimension. When any group of users sends a target message, the corresponding context session can be accurately matched from the categorized historical sessions, thereby accurately generating a reply message that matches the user's intent.
Smart Images

Figure CN122933587A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a message processing method, system, electronic device, storage medium, and program product. Background Technology
[0002] In internet instant messaging scenarios, group chats are widely used due to their efficient information sharing and collaboration capabilities. With the popularization of enterprise collaboration, online education, and social communities, the number of group chat users continues to expand, and the volume of group chat messages continues to grow. Group chat scenarios are characterized by multiple users sending concurrent messages and a mixture of contextual information. Specifically, in an instant chat group, multiple users may send messages simultaneously or within a very short period of time, and these messages may involve different contextual information scenarios (e.g., questions, discussion topics, or task requests from different users). Because instant messaging systems have difficulty accurately identifying the contextual information of a group chat message, they may be unable to accurately identify user intent or provide an accurate response. Summary of the Invention
[0003] This application provides a message processing method, a message processing system, an electronic device, a computer-readable storage medium, and a computer program product to alleviate or solve one or more technical problems existing in the prior art.
[0004] In a first aspect, embodiments of this application provide a message processing method, comprising: receiving a target message sent by a target user in an instant chat group, wherein the instant chat group includes multiple group users, and the target user is among the multiple group users; determining a context session of the target message from historical sessions of the multiple group users based on the user identifier of the target user and the sending timestamp of the target message, wherein the historical session is configured with a user identifier and a time matching identifier, the user identifier indicating the group user corresponding to the historical session, and the time matching identifier indicating the time information of at least one historical message in the historical session; the context session of the target message is a historical session in which the user identifier matches the target user and the time information matches the sending timestamp of the target message; and generating a reply message for the target message based on the target message and the context session of the target message.
[0005] Secondly, embodiments of this application provide a message processing method applied to a target user's client. The method includes: sending a target message sent by the target user in an instant chat group to a server, wherein the server is configured to execute the method of the first aspect of this application to generate a reply message for the target message; receiving the reply message returned by the server; and displaying the reply message in the instant chat group.
[0006] Thirdly, embodiments of this application provide a message processing system, including a server and a client, wherein the server is used to execute the method of the first aspect of embodiments of this application and the client is used to execute the method of the second aspect of embodiments of this application.
[0007] Fourthly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor implements any of the methods of embodiments of this application when executing the computer program.
[0008] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method of any one of the embodiments of this application.
[0009] Sixthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements any of the methods described in the embodiments of this application.
[0010] According to the technical solution of this application embodiment, in a group chat service scenario based on instant chat groups, multiple group users may send different messages simultaneously or within a very short period of time, resulting in a highly chaotic message flow in the instant chat group. According to the technical solution of this application embodiment, by configuring user identifiers and time matching identifiers in the historical sessions of the instant chat group, the chaotic historical messages are categorized according to the group user dimension and the time dimension. When any group of users sends a target message, the corresponding context session can be accurately matched from the categorized historical sessions, thereby accurately generating a reply message that matches the user's intent.
[0011] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application, it can be implemented according to the contents of the specification. In order to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description
[0012] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the various drawings denote the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings depict only some embodiments according to this application and should not be construed as limiting the scope of this application.
[0013] Figure 1 This diagram illustrates the architecture of the message processing system provided in an embodiment of this application.
[0014] Figure 2 This is a schematic diagram of the chat interface for an instant messaging group.
[0015] Figure 3 A flowchart illustrating a message processing method according to an embodiment of this application is shown.
[0016] Figure 4 An example diagram is shown illustrating the context matching algorithm used in the message processing method of this application embodiment.
[0017] Figure 5 A flowchart illustrating a message processing method according to an embodiment of this application is shown.
[0018] Figure 6 An example diagram is shown illustrating the message classification algorithm used in the message processing method of this application embodiment.
[0019] Figure 7 The diagram illustrates an application example of the message processing method according to an embodiment of this application.
[0020] Figure 8 A flowchart illustrating a message processing method according to an embodiment of this application is shown.
[0021] Figure 9 A block diagram of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0022] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the concept or scope of this application. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.
[0023] The following terms will be used below.
[0024] Large language models are ultra-large deep learning models pre-trained on massive amounts of text. They can understand and generate natural language by processing large amounts of text data, thereby performing various natural language processing tasks.
[0025] The knowledge base is a database of professional domain knowledge accumulated by the large language model. It is implemented by segmenting and mapping knowledge in the form of natural language such as text and tables, transforming it into low-rank dense vectors and storing them in a vector database so that the large language model can complete tasks such as retrieval or semantic matching.
[0026] A workflow refers to an ordered set of tasks or activities designed to achieve a specific service goal. These tasks or activities are performed according to certain rules and sequences, and can be executed manually or automatically. The core of workflow management lies in improving operations by optimizing processes, increasing efficiency, and reducing errors.
[0027] Retrieval-Augmented Generation (RAG) combines information retrieval and text generation techniques, aiming to enhance the generative capabilities of large language models by retrieving relevant information from external data sources.
[0028] Vector embedding, often simply called "embedding," is a technique in machine learning and natural language processing used to convert discrete objects (such as words, sentences, and images) into numerical vectors. These vectors can represent the original objects in a high-dimensional space and capture the similarities and relationships between objects.
[0029] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application are described below. The following relevant technologies are optional solutions and can be combined with the technical solutions of the embodiments of this application in any way, and all of them fall within the protection scope of the embodiments of this application.
[0030] Against the backdrop of the rapid development of internet instant messaging technology, group chat functionality has evolved from a basic social tool into an important platform supporting multi-party collaboration. Among them, service-oriented group chats, as a vertical solution specifically designed for user services, are gradually becoming instant messaging tools that improve service efficiency. In service-oriented group chats, members include not only users but also customer service representatives. Users, as the service recipients in the service-oriented group chat, can engage in regular communication within the group, while also initiating requests for inquiries, problem assistance, or service feedback. Customer service representatives, as service providers, can respond to user requests within the group or provide service support through notifications or announcements. Customer service can be provided by human representatives or by chatbots integrated with intelligent customer service systems. Chatbots, as an important component of service-oriented group chats, utilize technologies such as natural language understanding and knowledge graph retrieval to independently provide 24 / 7 service, undertaking standardized workflows such as professional Q&A, fault diagnosis, service reminders, and work order classification, effectively freeing up the time and energy of human customer service representatives to handle complex issues.
[0031] In service-oriented group chats, multiple users may simultaneously or within a very short period of time submit different service requests, resulting in a highly chaotic message flow. On one hand, when a user submits a complex request requiring contextual information, the system needs to retrieve the contextual session strongly related to the current request from a massive amount of group messages. This process often relies on traversing and filtering all user messages, leading to excessive consumption of computing resources and increased response latency. On the other hand, when a user sends incomplete information, the system needs to understand the user's intent by combining contextual information. Therefore, if the contextual information is not accurately identified, the chatbot may be unable to respond correctly to the user's request.
[0032] Furthermore, existing chatbot applications in service-oriented group chats have certain limitations. The chatbot's response relies on explicit triggering mechanisms; for example, each time a user asks a question, they need to use a summoning command, such as the explicit "@", to invoke a chatbot's response. This approach neglects a crucial dimension of human-computer interaction: the proactive and natural flow of the chatbot's communication. This passive communication model not only limits the practicality and flexibility of chatbots but may also, to some extent, inhibit user engagement.
[0033] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0034] Figure 1 This diagram illustrates the architecture of a message processing system provided in an embodiment of this application. Figure 1 As shown, the message processing system includes a server and multiple clients, which are connected via network communication.
[0035] The server-side component provides group chat services based on instant chat groups. The group members include chatbots and multiple group users. The chatbots can function as chatbot customer service representatives; they are intelligent customer service systems integrated into the server-side, used to handle group messages, execute service responses, and maintain automated processes for the group chat service. For example, the server-side deployment can take the form of an instance, image, software module, virtual machine, container, cloud server, or intelligent platform, or hardware devices (such as physical servers) or hardware chips with data processing capabilities.
[0036] A client is an application (APP) or software module installed on a terminal device that corresponds to the group chat service. This terminal device includes, but is not limited to, mobile phones, personal computers, tablets, wearable devices, and IoT devices. The client provides a chat interface for the group of users in an instant conversation. This application embodiment does not specifically limit the number of group users or the number of clients; for example, Figure 1 Three clients are shown: Client A, Client B, and Client C.
[0037] The server, by executing the message processing method provided in this application embodiment, can respond to messages sent by group users in an instant chat group. Specifically, the server's chatbot generates a corresponding reply message based on the context of the message. Subsequently, the server sends the generated reply message to the corresponding user's client, and the client displays the reply message in the chatbot's reply box in the chat interface.
[0038] The following is combined Figure 2 This application introduces exemplary scenarios of its embodiments. Figure 2 A schematic diagram of the chat interface of an instant messaging group is shown. Exemplarily, this chat interface is provided by user A's client. The group members include multiple group users (user A and user B) and a server-side chatbot (operation C), where "operation C" is the chatbot's nickname in the instant messaging group. In the chat history of this instant messaging group, there are two troubleshooting scenarios. By executing the message processing method provided in this application embodiment, the server can effectively distinguish the context of messages in the chat history, thereby allowing the chatbot, acting as the operation side, to be responsible for troubleshooting and answering questions.
[0039] User A sends the message "@OperationC's device is down, please check it" in an instant chat group. The server responds to this message, generating the reply message "Wait a moment, I'll check it," which is then displayed on the client's chatbot "OperationC's" reply box. Further, the server creates a historical session A, including: the message "@OperationC's device is down, please check it" sent by user A; and the reply message "Wait a moment, I'll check it" from the chatbot "OperationC." Historical session A has a user identifier indicating that it belongs to user A, and it also has a time identifier indicating the time of the message "@OperationC's device is down, please check it." This time identifier includes a time range identifier indicating the time interval in which the message "@OperationC's device is down, please check it" was sent, and a timestamp identifier indicating the timestamp of the message "@OperationC's device is down, please check it."
[0040] User B sends the message "@OperationsC SLB traffic has decreased, are you making changes?" in an instant chat group based on their client. The server responds to this message, generating the reply message "@UserB Yes, service changes are being made, as expected." The client displays this reply message in the reply box of the chatbot "OperationsC". Further, the server creates a historical session B, including: the message "@OperationsC SLB traffic has decreased, are you making changes?" sent by User B; and the reply message "@UserB Yes, service changes are being made, as expected" from the chatbot "OperationsC". Historical session B has a user identifier, indicating that historical session B corresponds to User B's session. Historical session B also has a timestamp, indicating the time information of the message "@OperationsC SLB traffic has decreased, are you making changes?". This timestamp includes a time interval identifier, indicating the time interval in which the message "@OperationsC SLB traffic has decreased, are you making changes?" was sent, and also includes a timestamp identifier, indicating the timestamp in which the message "@OperationsC SLB traffic has decreased, are you making changes?" was sent.
[0041] Furthermore, user A sends the message "Device B is also" in the instant session group. The server responds to this message, determining from historical sessions A and B that the context session for the message "Device B is also" is historical session A. This is because user A, who sent the message "Device B is also", matches the user identifier of historical session A, and the timestamp of the message "Device B is also" matches the time information indicated by the time matching identifier of historical session A.
[0042] In one example, the time matching identifier for historical session A is a time interval identifier, indicating the sending time interval of historical session A, 12:00-12:30. If the sending timestamp of the message "Device B is also" is 12:29, meaning the sending timestamp of the message "Device B is also" falls within the sending time interval of 12:00-12:30, then the sending timestamp of the message "Device B is also" matches the sending time interval of historical session A. Therefore, the sending timestamp of the message "Device B is also" matches the time information indicated by the time matching identifier of historical session A.
[0043] In another example, the time matching identifier for historical session A is a timestamp identifier, indicating the sending timestamp of the latest message in historical session A. For instance, the message "@Operator C device is down, please check" has a sending timestamp of 12:27, and the message "Device B is also down" has a sending timestamp of 12:31. The sending timestamp of the message "Device B is also down" is not within the sending time interval of 12:00-12:30, but the time interval (4 minutes) between the sending timestamp of "Device B is also down" (12:31) and the sending timestamp of the latest message in historical session A (12:27) is less than a preset threshold (e.g., 5 minutes). Therefore, the sending timestamp of the message "Device B is also down" matches the time information indicated by the time matching identifier of historical session A.
[0044] Furthermore, based on the message "Device B is also..." and its context session (historical session A), the server generates a reply message: "@User AA and B devices have 100% CPU usage, crashing the process." The client displays this reply message in the reply box of the chatbot "Operation C".
[0045] In this exemplary scenario, on the one hand, based on the message processing method executed by the server, for the message "Device B is also" which does not carry a summoning command, the server can accurately identify that the message sent by user A is a message that requires a reply from the chatbot "Operation C", that is, the message is a type pending a reply. On the other hand, based on the message processing method executed by the server, the server can prepare to match the context session of the message as historical session A, thereby accurately identifying user A's intent as wanting to ask the chatbot "Operation C" why device B is down based on the message "Device B is also" and historical session A, and thus accurately generating a reply message that matches the user's intent.
[0046] The technical solution of this application and how it solves the aforementioned technical problems are described in detail below with specific embodiments. The listed specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0047] Figure 3 A flowchart illustrating a message processing method according to an embodiment of this application is provided. This method can be applied to a client, such as being executed by a client installed on a user terminal device; the method can also be applied to a server, such as being executed by... Figure 1 The server-side execution is shown below. Figure 3 As shown, the method may include steps S301, S302 and S303.
[0048] Step S301: Receive the target message sent by the target user in the instant chat group, wherein the instant chat group includes multiple group users, and the target user is among the multiple group users.
[0049] An instant messaging group consists of multiple group users, and any group of users can be a target user. The current message sent by the target user in the instant messaging group is the target message. For example, in a... Figure 2 In the chat interface shown, the instant messaging group includes two group users (user A and user B). User A can be the target user, and the message "device B is also" can be the target message.
[0050] Step S302: Determine the context session of the target message from the historical sessions of multiple group users. The historical session is configured with a user identifier and a time matching identifier. The user identifier is used to indicate the group user corresponding to the historical session, and the time matching identifier is used to indicate the time information of at least one historical message in the historical session. The context session of the target message is a historical session in which the user identifier matches the target user and the time information indicated by the time matching identifier matches the sending timestamp of the target message.
[0051] An instant session group contains multiple historical messages, which can be divided into multiple historical sessions. Each historical session can include one or more historical messages. Specifically, historical messages sent by the same group of users and having the same time information are grouped into the same historical session, and each historical session is configured with its corresponding user identifier and time matching identifier.
[0052] A user identifier is used to indicate the group user corresponding to the historical session. In one example, the historical session may only include historical messages sent by the group user, and the user identifier of the historical session is used to indicate that one or more historical messages in the historical session were sent by the group user. In another example, the group members of the instant chat group also include a chatbot, and the historical session includes historical messages sent by the group user and historical messages replied by the chatbot. The user identifier of the historical session is used to indicate that one or more historical messages in the historical session are interaction information between the group user and the chatbot.
[0053] Matching a user identifier with a target user can be understood as the user group indicated by the user identifier being the same as the target user. For example, the user identifier configured for a historical session is the login identifier of the target user; or the user identifier configured for a historical session is the nickname of the target user, etc.
[0054] Each historical session may contain one or more historical messages. Each historical session can include various time information, such as the sending time range of the first historical message in the historical session (the first historical message sent by the user corresponding to that historical session), the sending time range of any historical message in the historical session, or the sending timestamp of the latest historical message in the historical session (the last historical message sent by the user corresponding to that historical session). Therefore, one type of time information can be selected to configure a time matching identifier for that historical session.
[0055] The time information indicated by the time matching identifier matches the sending timestamp of the target message, which can be understood as the time information indicated by the time matching identifier being consistent with the sending timestamp of the target message. For example, the sending timestamp of the target message falls within the sending time interval indicated by the time matching identifier; or, the time interval between the sending timestamp of the historical message indicated by the time matching identifier and the sending timestamp of the target message meets a preset condition.
[0056] Furthermore, the target user's historical sessions are matched from multiple historical sessions using the target user's user identifier, and the context session of the target message is determined based on the match between the sending timestamp of the target message and the time information indicated by the time matching identifier of the historical session. Specifically, if the user identifier of a historical session matches the group user (i.e., the target user) who sent the target message, and the time information indicated by the time matching identifier of the historical session matches the sending timestamp of the target message, then the historical session is determined as the context session of the target message.
[0057] It should be noted that in the embodiments of this application, "sending time interval" refers to the time interval during which group users send historical messages, and "sending timestamp" refers to the timestamp during which group users send historical messages.
[0058] Step S303: Generate a response message for the target message based on the target message and the context session of the target message.
[0059] For example, the target message and the context of the target message can be preprocessed. The preprocessing methods include, but are not limited to, natural language processing, splicing, word segmentation, semantic recognition, or a combination of multiple processing methods. This application embodiment does not limit this.
[0060] Based on the preprocessing results, the system can generate corresponding response messages. For example, a series of rules or decision trees can be predefined. If the preprocessing results contain certain keywords, the appropriate response template can be selected according to the predefined rules to generate a response message. Alternatively, search engine technology can be used to retrieve the most relevant answer to the target message from historical session data as the response message.
[0061] In one example, the server returns the generated reply message to the client, which then displays the reply message in the chat interface of the instant messaging group, for example... Figure 2 In one example, the client displays the message "@User AA and B devices have 100% CPU usage, crashing the process" in the reply box of the chatbot "Operation C". In another example, the server returns the generated reply message to the client, and the client displays the reply message's operation entry in the instant chat group's chat interface, allowing users to view the reply message through this operation entry.
[0062] In group chat services based on instant messaging groups, multiple group users may send different messages simultaneously or within a very short period of time, resulting in a highly chaotic message flow within the instant messaging group. According to the technical solution of this application, by dividing each historical message in the instant messaging group into multiple historical sessions and configuring user identifiers and time matching identifiers for each historical session, the chaotic historical messages are categorized according to the group user dimension and the time dimension. When any group of users sends a target message, the corresponding context session can be accurately matched from the categorized historical sessions, thereby accurately generating a reply message that matches the user's intent.
[0063] As an application example of this application, a session ID can be set for each historical session. This session ID can consist of a user identifier and a time interval identifier. Since the system may need to maintain historical sessions of multiple instant session groups, in order to facilitate accurate identification of the corresponding instant session groups, a group identifier can also be configured for each historical session to indicate the instant session group corresponding to the historical session. Thus, the session ID of the historical session can consist of a user identifier, a time interval identifier, and a group identifier.
[0064] In one implementation, the time matching identifier is a time interval identifier, which indicates the time information of the sending time interval of at least one historical message in the historical session. In step S302, determining the context session of the target message from the historical sessions of the multiple group users may include: matching the user identifier of the historical session with the target user, and matching the sending time interval of the historical session with the sending timestamp of the target message, to determine the historical session as the context session of the target message.
[0065] The time interval identifier can be a time interval itself, such as "12:00-12:30" indicating a time interval of "12:00-12:30"; or it can be a timestamp within a specific time interval, such as "12:00" indicating a time interval of "12:00-12:30". For example, to ensure consistency in subsequent judgments, multiple preset time intervals can be pre-divided, such as every half hour, and the sending time intervals of historical sessions can all be selected from these preset time intervals.
[0066] If the user identifier of the historical session matches the target user and the sending timestamp of the target message falls within the sending time range of the historical session, then the historical session is identified as the context session of the target message.
[0067] In one example, the target user is "User A", the target message is "Device B is also", and the target message's sending timestamp is "12:29". The user identifier for historical session A is "User A"; the time match identifier is "12:00-12:30", indicating that the sending time range of historical session A is "12:00-12:30". The user identifier for historical session B is "User B"; the time match identifier is "12:00-12:30", indicating that the sending time range of historical session B is "12:00-12:30". Since the target user matches the user identifier "User A" of historical session A, and the target message's sending timestamp "12:29" falls within the sending time range "12:00-12:30", meaning the target message's sending timestamp matches the sending time range of historical session A, the context session for the target message is historical session A.
[0068] Because historical sessions may contain multiple historical messages, they involve multiple points in time. The sending timestamp of the target message represents only one point in time. By using the sending time interval as the time matching identifier, a unified and consistent time matching standard can be established. This method not only covers various matching scenarios but also effectively handles complex session records containing multiple points in time, thereby achieving accurate matching between the target message and the context session, improving the accuracy and reliability of message processing.
[0069] In one implementation, the time matching identifier is a timestamp identifier, used to indicate the sending timestamp of the latest historical message in the historical session; in step S302, determining the context session of the target message from the historical sessions of multiple group users includes: determining the target time interval to which the sending timestamp of the target message belongs from multiple pre-divided preset time intervals; in response to the user identifier of the historical session matching the target user, and the preset time interval of the historical session being the previous time interval of the target time interval, determining the time interval between the sending timestamp of the latest historical message in the historical session and the sending timestamp of the target message; if the time interval is less than a preset threshold, determining the historical session as the context session of the target message.
[0070] For example, to ensure consistency in subsequent judgments, multiple preset time intervals can be pre-divided, such as half an hour per preset time interval. The target time interval corresponding to the target message is selected from these multiple preset time intervals, and the preset time interval into which the sending timestamp of the target message falls is the target time interval. Further, the sending time intervals of historical sessions are selected from these multiple preset time intervals. If it is determined that no preset time interval of a historical session matches the target time interval, then the historical session corresponding to the previous time interval of the target time interval is determined, and the sending timestamp of the latest historical message in that historical session is obtained. Further, if the time interval between the sending timestamp of the latest historical message in that historical session and the sending timestamp of the target message is less than a preset threshold, then that historical session is determined as the context session of the target message.
[0071] For example, a historical session may include one or more historical messages. The latest historical message's sending timestamp is 12:27. Therefore, the timestamp identifier for this historical session indicates the time information of "12:27". The latest historical message can be understood as follows: for each historical message in the historical session, calculate the time interval between the sending timestamp of that historical message and the sending timestamp of the target message; the historical message with the smallest time interval is the latest historical message. If the user identifier of the historical session matches the target user, even if the sending timestamp of the target message does not fall within the sending time interval of the historical session, as long as the time interval between the sending timestamp of the target message and the sending timestamp of the latest historical message is less than a preset threshold, the historical session can still be identified as the context session of the target message.
[0072] The preset threshold can be customized, for example, based on the message sending frequency or number of messages in a group chat scenario. The preset threshold can also be adjusted during the application phase. This application embodiment does not limit this.
[0073] In one example, the target user is "User A", the target message is "Device B is also", and the target message's sending timestamp is "12:31". The user identifier for historical session A is "User A"; the time matching identifier is "12:27", indicating that the latest historical message in historical session A was sent at "12:27". Since the target user matches the user identifier "User A" of historical session A, and the time interval (4 minutes) between the target message's sending timestamp "12:31" and the "12:27" indicated by the time matching identifier is less than a preset threshold (e.g., 5 minutes), that is, the target message's sending timestamp matches the time information indicated by the historical session A's time matching identifier. Therefore, the context session for the target message is historical session A.
[0074] When determining context sessions, relying solely on sending time intervals and user identifiers for matching may lead to matching errors. For example, historical messages sent by a user between 12:00 and 12:30 might be categorized into the same context session. If the user sends two related messages at 12:29 and 12:31 respectively, these two messages will enter different historical sessions. This means that when determining the context session for the message sent at 12:31, the related message sent at 12:29 cannot be identified, resulting in a context session matching error. This matching error is particularly prevalent when the user asks consecutive questions, thus affecting subsequent system processing and response. According to the technical solution of this application embodiment, when matching context sessions, by comparing the time interval between sent messages (the time interval between the target message's sending timestamp and the latest historical message in the historical session) with a preset threshold, the continuity of the user's message sending can be determined, thereby accurately matching the context session.
[0075] In one embodiment, after step S302, the method of this application embodiment may further include: adding the target message to the context session of the target message; and updating the timestamp identifier of the context session of the target message based on the sending timestamp of the target message.
[0076] For example, if the target message's sending timestamp is "12:31", after determining that historical session A is its context session, on the one hand, a reply message is generated using the target message's context session; on the other hand, in parallel, the target message is added to historical session A. The user identifier, time interval identifier, and group identifier (if any) of the historical session remain unchanged; only the timestamp of historical session A is updated to "12:31". In other words, for the current message, the system collects data, including the user identifier (ID) and sending timestamp. This data is used, on the one hand, to determine the historical session (i.e., the target message's context session) to which the current message (i.e., the target message) belongs based on the user identifier and time continuity, facilitating accurate reply message generation; and on the other hand, to update the timestamp of the historical session in a timely manner, thus facilitating subsequent judgment of the continuity of the next message.
[0077] Figure 4 An example diagram is shown illustrating the context matching algorithm used in the message processing method of this application embodiment. The following is in conjunction with... Figure 4 This application introduces a context matching algorithm, which can serve as an example of the application of step S302 and the timestamp identifier update algorithm after step S302 in this application.
[0078] like Figure 4As shown, user X sends message X at 9:58 (user X is the target user, and the message is the target message). The processing flow of message X based on the context matching algorithm of this application embodiment may include: (1) data collection, including the user ID, group ID, and sending timestamp of message X; (2) preset time interval (pre-allocated time interval identifier), that is, according to the sending timestamp of message X, message X is initially divided into one preset time interval (i.e., the target time interval of message X), and it is used as the pre-allocated time interval identifier (time interval ID) for message X. For example, if every half hour is a preset time interval, the sending timestamp of message X is 9:58, and the pre-allocated time interval ID is "9:30"; (3) historical session list, that is, a group of ongoing sessions. The index of the historical session list before message X is the "group chat ID_user ID_time interval ID" of the historical session. Based on the user ID, group ID, target time interval, and index of the historical session list of message X, the message can be processed. X is diverted to historical session X, and the preset time interval of historical session X is the time interval before the target time interval; (4) Obtain the sending timestamp of the latest historical message, that is, the sending timestamp of the latest historical message in historical session X; (5) Determine whether the time interval (that is, the time interval between the sending timestamp of message X and the sending timestamp of the latest historical message) is less than the preset threshold; (5) If the time interval is less than the preset threshold, add message X to historical session X, and at the same time, use historical session X as the context session of message X, and update the sending timestamp of the latest historical message (that is, message X) of historical session X, that is, update the timestamp identifier of historical session X to the sending timestamp of message X "9:58"; (6) If the time interval is greater than the preset threshold, add message X to the new session, and at the same time, configure the new session ID based on the user ID, group ID and time interval ID of message X, and update the sending timestamp of the latest historical message, that is, update the timestamp identifier of the new session to the sending timestamp of message X "9:58".
[0079] For example, in a group chat scenario where the chatbot acts as a customer service representative, each set of historical session IDs maintains a set of dialogue history, with a length of 2n or 2n+1 (where n is a positive integer greater than 1). It can be understood that if the length of a historical session is 2n, it means that the historical session is n sets of question and answer (QA) pairs between the corresponding user (the user corresponding to the user ID of the historical session) and the chatbot. The question and answer pairs include the user's sent message and the chatbot's reply message. If the length of a historical session is 2n+1, it means that the historical session is where the corresponding user sent a message and the user ended the message.
[0080] Figure 5A flowchart illustrating a message processing method according to an embodiment of this application is provided. This method can be applied to a client, such as being executed by a client installed on a user terminal device; the method can also be applied to a server, such as being executed by... Figure 5 The server-side execution is shown below. Figure 5 As shown, the method may include:
[0081] Step S501: Receive the target message sent by the target user in the instant chat group, wherein the instant chat group includes multiple group users, and the target user is among the multiple group users;
[0082] Step S502: Determine the context session of the target message from the historical sessions of multiple group users. The historical session is configured with a user identifier and a time matching identifier. The user identifier is used to indicate the group user corresponding to the historical session, and the time matching identifier is used to indicate the time information of at least one historical message in the historical session. The context session of the target message is a historical session in which the user identifier matches the target user and the time information indicated by the time matching identifier matches the sending timestamp of the target message.
[0083] Step S503: Determine the message type of the target message;
[0084] Step S504: In response to the target message being of the type pending reply, a reply message for the target message is generated based on the target message and the context session of the target message.
[0085] In this context, step S501 can be implemented in the same or similar manner as step S301, step S502 can be implemented in the same or similar manner as step S302, and the step S504, "generating a reply message for the target message based on the target message and the context session of the target message", can be implemented in the same or similar manner as step S303, and will not be described again here.
[0086] The message types include "pending reply" and "no reply." The "pending reply" type indicates that the target message is a problem and requires a response; the "no reply" type indicates that the target message does not require a response. For target messages of the "pending reply" type, a response message is automatically generated based on the aforementioned context matching algorithm, thus eliminating the need for manual reply.
[0087] In one implementation, the instant chat group also includes a chatbot used to generate response messages. The "to be replied to" type indicates that the target message requires a response from the chatbot; the "no reply" type indicates that the target message does not require a response from the chatbot. In step S503, determining the message type of the target message may include: determining the message type of the target message as a "to be replied to" type in response to a trigger flag indicating that the target message carries a call command; or, in response to a trigger flag indicating that the target message does not carry a call command, inputting the target message into a message classification model and determining the message type of the target message based on the output of the message classification model. The message type of the target message also includes a "no reply" type. The message classification model is trained using a first dataset and a second dataset, where the classification result of the first dataset is a "to be replied to" type and the classification result of the second dataset is a "no reply" type.
[0088] The summoning command is used to summon the chatbot. For example, in an instant chat group, the command "@" followed by the chatbot's nickname in the instant chat group is used, and the triggering identifier of the summoning command is "@". Alternatively, in an instant chat group, the chatbot's historical messages in the instant chat group are referenced, and the triggering identifier of the summoning command is the message reference identifier. This application does not specifically limit the form of the summoning command and its triggering identifier.
[0089] If the target message carries a trigger identifier for a summoning command, its message type can be determined to be a "to be replied to" type. If the target message does not carry a trigger identifier for a summoning command, it is input into a message classification model. The message classification model can be obtained by training a deep learning model based on a first dataset and a second dataset. The deep learning model can be a neural network model, and the network structure of the neural network model is not specifically limited in this embodiment. The training method can be supervised or unsupervised. During training, the first dataset serves as a positive example, and its corresponding classification result is "to be replied to" type; the second dataset serves as a negative example, and its corresponding classification result is "no reply" type. Therefore, based on the output of the message classification model, the message type of the target message can be determined.
[0090] The first dataset includes at least one first message, which is a message carrying a trigger identifier for a summoning command. The second dataset includes at least one second message, which is a message without a trigger identifier for a summoning command. The message carrying the trigger identifier for a summoning command can be a historical message or a current message (such as a target message). Therefore, if a target message carries a trigger identifier for a summoning command, it can be added to the first dataset; if a target message does not carry a trigger identifier for a summoning command, it can be added to the second dataset.
[0091] In group chat scenarios where chatbots act as customer service representatives, users typically initiate conversations by using the explicit "@" command to trigger a message response. Therefore, a training dataset can be constructed based on whether or not a trigger command is included. This improves the accuracy of message classification models while reducing the difficulty of constructing training samples. Semantic recognition and classification of message types can then be achieved through vectorization methods combined with deep learning models.
[0092] In one implementation, the first dataset further includes the context session corresponding to the first message, and the second dataset further includes the context session corresponding to the second message. Step S503, inputting the target message into the message classification model and determining the message type of the target message based on the output of the message classification model, may include: inputting the target message and the context session into the message classification model, and determining the message type of the target message based on the output of the message classification model.
[0093] In other words, when training the message classification model, the first dataset includes the first message and its corresponding context session, and the second dataset includes the second message and its corresponding context session. The first message can be used as the target message, and the context session corresponding to the first message can be determined by referring to the context matching algorithm described above; similarly, the second message can be used as the target message, and the context session corresponding to the second message can be determined by referring to the context matching algorithm described above.
[0094] like Figure 5 As shown, when determining the message type of a target message, the target message and its context session can be input together into the message classification model. For example, in Figure 2 In the scenario shown, the target message "Device B is also" and its context session (i.e., historical session A) can be input into the message classification model.
[0095] Since the context session contains message association information and rich semantic features, especially semantic features that may be missing from the current message (first message, second message, or target message), considering the context session during training or during application (when determining the message type of the target message) can improve the accuracy of message classification models in classifying message types.
[0096] In one embodiment, after step S503, the method of this application embodiment may further include: adding the target message and the context session corresponding to the target message to a first dataset in response to a trigger identifier that the target message carries a summoning instruction; or, adding the target message and the context session corresponding to the target message to a second dataset in response to a trigger identifier that the target message does not carry a summoning instruction.
[0097] When the target message carries a trigger identifier for a summoning command, the first dataset can be updated in a timely manner using the target message and its corresponding context session. When the target message does not carry a trigger identifier for a summoning command, the second dataset can be updated in a timely manner using the target message and its corresponding context session. Thus, in the application stage of the message classification model (when determining the message type of the target message), the question of the user initiating an active summoning command is combined with the context to update the training dataset in a timely manner, thereby further improving the accuracy of the message classification model in classifying message types.
[0098] Figure 6 An example diagram is shown illustrating the message classification algorithm used in the message processing method of this application embodiment. The following is in conjunction with... Figure 6 This application introduces a message classification algorithm according to an embodiment of the present application. This message classification algorithm can serve as an application example of step S503 and the dataset update algorithm following step S503 in this embodiment of the present application. Figure 6 As shown, for message X (the target message), if message X carries a trigger identifier for a summoning command, such as the explicit summoning command "@", it is added to the first dataset (positive example) to update the training dataset required for offline training of the message classification model. Simultaneously, message X and its context session output value are sent back to the message generation module to generate a response message for the chatbot. If message X carries a trigger identifier for a summoning command, it is added to the second dataset (negative example). Furthermore, the deployed message classification model determines the message type of message X. If a chatbot response is required, message X and its context session output value are sent back to the message generation module to generate a response message for the chatbot. If a chatbot response is not required, the chatbot ignores message X.
[0099] In the offline training of the message classification model, the first and second datasets are input into the model respectively. The model extracts features from both datasets and further processes these features using a fully connected layer (fc). A softmax normalization layer outputs response probabilities, representing the probability of the message being a response-pending type and the probability of not responding. The model parameters are then adjusted based on the classification results corresponding to these response probabilities. After inputting the target message and its context into the model, a response probability is obtained—the probability that the target message is a response-pending type and the probability that it is not responding. This response probability is then used to determine the message type of the target message.
[0100] In one implementation, in step S303 or step S504, generating a response message for the target message based on the target message and its context session may include: determining the target question that needs to be responded to based on the target message and its context session; querying knowledge information matching the target question in a preset knowledge base; inputting the target question, knowledge information, target message, and its context session into a large language model so that the large language model can output a response message; and obtaining the response message output by the large language model.
[0101] Preprocessing can be performed based on the target message and its context, such as structured processing, templated formatting, natural language processing, or a combination of multiple processing methods; this application does not limit this approach. After preprocessing, the target question that the target user wants to ask can be determined. For example, in Figure 2 In the example shown, based on the target message "Device B is also down" and its context (including: the message sent by user A "@Operation C Device is down, please check it"; the message replied by the chatbot "Operation C" "Wait a moment, I'll check"), it can be determined that the target question user A wants to ask is why device B is down. Further, the target question, knowledge information, target message, and the context of the target message are assembled into a prompt, input into a large language model, and the large language model generates the chatbot's response message.
[0102] The following is combined Figure 7 This paper introduces an application example of the message processing method according to embodiments of this application. In this example, the chat topics (also called question domains) of the same instant chat group are the same or similar, that is, the chat content of the same instant chat group belongs to a certain vertical domain, such as the R domain.
[0103] like Figure 7 As shown, after creating an instant chat group (R domain), for a group chat message in the T time window, such as message X sent by user X (user X can be the target user, and message X can be the target message), the message acquisition module uses the information of the group chat message, including the information <user X, message X>; further, it determines whether message X displays @chatbot, that is, it determines whether message X carries the trigger identifier of the summoning command.
[0104] If the message X carries a trigger identifier for a summoning command, it displays "@conversational robot". Further, it determines whether message X is the first "@conversational robot" within the time window T. If so, a new session is created (subsequent sessions are recorded as history), and the information <User X, Message X> is input into the response message generation module. The response message generation module executes the method of step S303 or step S504 to generate a response message for the target message, including: initializing the knowledge document as an R domain knowledge base, i.e., uploading the R domain knowledge document to the R domain knowledge base of the large language model. The R domain knowledge base will cut the knowledge document into text segments and convert the text segments into semantic vectors through a pre-trained model, storing them in a vector database. This facilitates quick matching of knowledge (text blocks) related to the user's question during vector retrieval. When an R domain-related question is identified, the RAG module first retrieves text from the R domain knowledge base that is semantically similar to the chat message. If there is a piece of knowledge in the R domain knowledge base whose text matches the user information with a degree exceeding a threshold, the searched knowledge is used as a prompt word and combined with the user input, context, and user question, and then input into the large language model, which generates the final answer (the chatbot's reply message Y).
[0105] If no trigger identifier for the summoning command is carried, then message X is not an example of displaying @ chatbot. In this case, the information <User X, Message X> is input to the context matching module. The context matching module implements the context matching algorithm of this embodiment to determine the context session of message X. Further, message X and its context session are input to the message classification module. The message classification module implements the message classification algorithm provided in this embodiment to determine the message type of message X. If the message type is a no-response type, then no chatbot reply is needed, and the chatbot ignores message X. If the message type is a pending reply type, then a chatbot reply is needed. Further, message X and its context session are input to the reply message generation module, where the large language model generates the final response (chatbot reply message Y). The final reply message Y is added to the session of message X in the format <chatbot, @, reply message Y>.
[0106] Traditional group chat bots (conversational bots) typically require users to explicitly use the @ command to trigger a response. In the technical solution of this application embodiment, the conversational bot initiates a dialogue in two situations. The first situation is when the user uses the explicit @ command to summon the bot, after which the bot will automatically track that round of dialogue. The second situation is during the cold start phase; even if the user does not explicitly use the @ command, the conversational bot will proactively initiate a dialogue with the user, providing the user with its knowledge. Specifically, the conversational bot can learn the user's questions, refine its own question domain, and subsequently, without requiring explicit user intervention, the conversational bot can autonomously perceive and intervene in dialogues related to its question domain (knowledge domain), providing timely and accurate feedback and valuable suggestions. Therefore, the conversational robot using the technical solution of this application not only possesses natural language understanding and generation capabilities, but also simulates human communication logic. Through technologies such as continuous dialogue tracking, intent analysis, and knowledge base updates, the communication process becomes closer to real interpersonal interaction. This significantly improves user experience and robot participation while enhancing the quality of group chat interaction, achieving a more natural and efficient group chat interaction mode. New users joining the group do not need to learn how to use the conversational robot again; they only need to communicate normally within the group. The conversational robot will proactively join the conversation at appropriate times, improving the efficiency and experience of users obtaining information. Users also do not need to frequently @ the conversational robot, reducing the user's operational burden, enhancing the interactivity between the conversational robot and the user, and making the group chat environment more active.
[0107] Figure 8 A flowchart illustrating a message processing method according to an embodiment of this application is provided. This method can be applied to a client, for example, executed by a client installed on a user terminal device. Figure 8 As shown, the method may include:
[0108] Step S801: Send the target message sent by the target user in the instant chat group to the server, wherein the server is used to execute the message processing method provided in the embodiments of this application to generate a reply message to the target message;
[0109] Step S802: Receive the reply message returned by the server and display the reply message in the instant chat group.
[0110] For detailed implementation methods and technical information, please refer to the relevant descriptions above.
[0111] It should be noted that the application scenarios or examples provided in the embodiments of this application are for ease of understanding, and the embodiments of this application do not specifically limit the application of the technical solutions. In addition, all information and data involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0112] Corresponding to the application scenarios and methods provided in the embodiments of this application, the embodiments of this application also provide a message processing apparatus, including: a target message receiving unit, configured to receive a target message sent by a target user in an instant session group, wherein the instant session group includes multiple group users, and the multiple group users include the target user; a context session determining unit, configured to determine the context session of the target message from the historical sessions of the multiple group users, wherein the historical session is configured with a user identifier and a time matching identifier, the user identifier is used to indicate the group user corresponding to the historical session, and the time matching identifier is used to indicate the time information of at least one historical message in the historical session; the context session of the target message is a historical session in which the user identifier matches the target user and the time information matches the sending timestamp of the target message; and a reply message generating unit, configured to generate a reply message of the target message based on the target message and the context session of the target message.
[0113] In one implementation, the time matching identifier is a time interval identifier, and the time information is the sending time interval of at least one historical message in the historical session; the context session determination unit is specifically used to: in response to the user identifier of the historical session matching the target user, and the sending time interval of the historical session matching the sending timestamp of the target message, determine the historical session as the context session of the target message.
[0114] In one implementation, the time matching identifier is a timestamp identifier, and the time information is the sending timestamp of the latest historical message in the historical session; the context session determination unit is specifically used to: determine the target time interval to which the sending timestamp of the target message belongs from multiple pre-divided preset time intervals; in response to the user identifier of the historical session matching the target user, and the preset time interval of the historical session being the previous time interval of the target time interval, determine the time interval between the sending timestamp of the latest historical message in the historical session and the sending timestamp of the target message; if the time interval is less than a preset threshold, determine the historical session as the context session of the target message.
[0115] In one embodiment, the apparatus further includes a timestamp identifier update unit, configured to: add the target message to the context session of the target message; and update the timestamp identifier of the context session of the target message based on the sending timestamp of the target message.
[0116] In one embodiment, the instant conversation group further includes a conversational robot that generates the reply message. The device also includes a message type determination unit, configured to: in response to the target message not carrying a trigger identifier for a summoning command, input the target message into a message classification model and determine the message type of the target message based on the output of the message classification model, wherein the summoning command is used to summon the conversational robot, the message classification model is trained using a first dataset and a second dataset, the first dataset includes at least one first message, the first message being a message carrying a trigger identifier for the summoning command, and the second dataset includes at least one second message, the second message being a message not carrying a trigger identifier for the summoning command; in response to the target message being a message type pending reply, trigger the context conversation determination unit to execute the context conversation based on the target message and the target message, and generate a reply message for the target message.
[0117] In one implementation, the first dataset further includes the context session corresponding to the first message, and the second dataset further includes the context session corresponding to the second message. The message type determination unit is specifically used to: input the target message and the context session into a message classification model, and determine the message type of the target message based on the output of the message classification model.
[0118] In one embodiment, the apparatus further includes a dataset update unit, configured to: add the target message and the context session corresponding to the target message to the first dataset in response to the target message carrying a trigger identifier of the summoning instruction; or, add the target message and the context session corresponding to the target message to the second dataset in response to the target message not carrying a trigger identifier of the summoning instruction.
[0119] Corresponding to the application scenarios and methods provided in the embodiments of this application, the embodiments of this application also provide a message processing device applied to a target user's client. The device includes: a target message sending unit, used to send the target message sent by the target user in an instant chat group to a server, wherein the server is used to generate a reply message for the target message; and a reply message display unit, used to receive the reply message returned by the server and display the reply message in the instant chat group.
[0120] The functions of each module in each device in the embodiments of this application can be found in the corresponding description in the above method, and they have corresponding beneficial effects, which will not be repeated here.
[0121] Figure 9 This is a block diagram of an electronic device used to implement embodiments of this application. For example... Figure 9 As shown, the electronic device includes a memory 901 and a processor 902. The memory 901 stores a computer program that can run on the processor 902. When the processor 902 executes the computer program, it implements the method described in the above embodiments. The number of memories 901 and processors 902 can be one or more. In a specific implementation, the electronic device may also include a communication interface 903 for communicating with external devices and performing data interaction and transmission (such as receiving and / or sending data).
[0122] In practical implementation, if the memory 901, processor 902, and communication interface 903 are implemented independently, they can be interconnected via a bus to communicate with each other. This bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0123] Optionally, in a specific implementation, if the memory 901, processor 902, and communication interface 903 are integrated on a single chip, then the memory 901, processor 902, and communication interface 903 can communicate with each other through an internal interface.
[0124] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method provided in this application.
[0125] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in this application.
[0126] This application also provides a chip including a processor for calling and executing instructions stored in a memory, causing a communication device with the chip installed to perform the method provided in this application.
[0127] This application also provides a chip, including: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected through an internal connection path. The processor is used to execute code in the memory. When the code is executed, the processor is used to execute the method provided in the application embodiment.
[0128] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting Advanced Reduced Instruction Set Machines (ARM) architecture.
[0129] Further, optionally, the aforementioned memory may include read-only memory and random access memory. The memory may be volatile memory or non-volatile memory, or may include both. Non-volatile memory may include read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available. Examples include Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0130] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another.
[0131] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0132] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0133] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process. Furthermore, the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functionality involved.
[0134] The logic and / or steps described in the flowchart or otherwise herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).
[0135] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. All or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware, the program being stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiments.
[0136] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. This storage medium can be a read-only memory, a disk, or an optical disk, etc.
[0137] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope described in this application, and these should all 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, comprising: Receive a target message sent by a target user in an instant chat group, wherein the instant chat group includes multiple group users, and the target user is among the multiple group users; The context session of the target message is determined from the historical sessions of the multiple group users. The historical session is configured with a user identifier and a time matching identifier. The user identifier is used to indicate the group user corresponding to the historical session, and the time matching identifier is used to indicate the time information of at least one historical message in the historical session. The context session of the target message is the historical session in which the user identifier matches the target user and the time information matches the sending timestamp of the target message. A response message for the target message is generated based on the target message and the context session of the target message.
2. The method according to claim 1, wherein, The time matching identifier is a time interval identifier, and the time information is the sending time interval of at least one historical message in the historical session. Determining the context session of the target message from the historical sessions of the multiple group users includes: In response to the user identifier of the historical session matching the target user, and the sending time interval of the historical session matching the sending timestamp of the target message, the historical session is determined as the context session of the target message.
3. The method according to claim 1, wherein, The time matching identifier is a timestamp identifier, and the time information is the sending timestamp of the latest historical message in the historical session; Determining the context session of the target message from the historical sessions of the multiple group users includes: From multiple pre-divided preset time intervals, determine the target time interval to which the sending timestamp of the target message belongs; In response to the user identifier of the historical session matching the target user, and the preset time interval of the historical session being the time interval preceding the target time interval, the time interval between the sending timestamp of the latest historical message in the historical session and the sending timestamp of the target message is determined. If the time interval is less than a preset threshold, the historical session is determined as the context session of the target message.
4. The method according to claim 3, further comprising: Add the target message to the context session of the target message; Update the timestamp identifier of the context session of the target message based on the sending timestamp of the target message.
5. The method according to any one of claims 1 to 4, wherein, The instant chat group also includes a chatbot, which generates the response message. Before generating the response message for the target message based on the target message and the context of the target message, the process further includes: In response to the target message not carrying a trigger identifier for a summoning command, the target message is input into a message classification model, and the message type of the target message is determined based on the output of the message classification model. The summoning command is used to summon the chatbot. The message classification model is trained using a first dataset and a second dataset. The first dataset includes at least one first message, which is a message carrying a trigger identifier for the summoning command. The second dataset includes at least one second message, which is a message not carrying a trigger identifier for the summoning command. In response to the target message being of the type pending reply, the context session based on the target message and the target message is executed to generate a reply message for the target message.
6. The method according to claim 5, wherein, The first dataset also includes the context session corresponding to the first message, and the second dataset also includes the context session corresponding to the second message; the step of inputting the target message into a message classification model and determining the message type of the target message based on the output of the message classification model includes: The target message and the context session are input into the message classification model, and the message type of the target message is determined based on the output of the message classification model.
7. The method according to claim 6, further comprising: In response to the trigger identifier of the summoning command carried in the target message, the target message and the context session corresponding to the target message are added to the first dataset; or, In response to the target message not carrying the trigger identifier of the summoning command, the target message and the context session corresponding to the target message are added to the second dataset.
8. A message processing method applied to a target user's client, the method comprising: Send the target message sent by the target user in the instant chat group to the server, wherein the server is configured to perform the method of any one of claims 1 to 7 to generate a reply message for the target message; Receive the reply message returned by the server and display the reply message in the instant chat group.
9. A message processing system comprising a server and a client, the server being configured to perform the method of any one of claims 1 to 7 and the client being configured to perform the method of claim 8.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory, wherein the processor, when executing the computer program, implements the method of any one of claims 1 to 8, and the electronic device further comprising a communication interface for receiving and / or transmitting data.
11. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method of any one of claims 1 to 8.
12. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 8.