A message processing method, program product, electronic device and storage medium for large model calling service

By using the message processing method of the large model call service in the AI ​​dialogue system, and using the target thread and thread identification matching mechanism, the problem of insufficient flexibility in the AI ​​dialogue system when processing continuous questions from users is solved, and more efficient and accurate user messages are achieved. processing, improving user experience.

CN118427334BActive Publication Date: 2024-10-22LINGXI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410889446.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-22
Estimated Expiration
2044-07-04

AI Technical Summary

Technical Problem

Existing AI dialogue systems lack flexibility when handling continuous questions from users, causing users to manually stop or resend questions to obtain correct responses, affecting user experience.

Method used

By introducing the message processing method of large model call service into the AI ​​dialogue system, using the target thread and thread identification matching mechanism to ensure that the reply content is generated based on the latest user messages, and storing and splicing user messages in the storage area for idle thread processing. Reduce message processing burden and improve response accuracy.

Benefits of technology

It realizes the ability of the AI ​​dialogue system to handle continuous questions from users, improves dialogue flexibility and response accuracy, avoids the situation where users ask multiple questions and the AI ​​responds multiple times, saves computing power and improves message processing throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118427334B_ABST
    Figure CN118427334B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a message processing method, program product, electronic device and storage medium for a large model calling service, the method comprising: in response to the first user message currently input in the conversation, calling the target thread and updating the pre-stored target identifier based on the thread identifier of the target thread; wherein the target identifier is used to indicate the most recently called thread in the conversation; in the process of processing the target message through the target thread, in response to triggering a preset detection condition, reading the target identifier; wherein the target message includes the first user message; if the target identifier does not match the thread identifier, stop processing the target message; if the target identifier matches the thread identifier, continue processing the target message. Since the processing of the target message that does not include the latest user message is stopped, it can avoid the situation where the user asks multiple questions and the AI ​​replies multiple times, thereby enabling the artificial intelligence to have the ability to handle continuous user questions and improving the flexibility of the conversation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a message processing method, program product, electronic device and storage medium for a large model calling service. Background Art

[0002] With the development of artificial intelligence (AI) technology, AI dialogue is being widely used in various scenarios, such as AI robots replacing human agents for sales and return visits, etc. In the AI ​​dialogue process, the AI ​​robot responds to each question asked by the user. The dialogue is usually conducted in the form of one question and one answer, which lacks flexibility and is not conducive to improving the user experience in AI dialogue. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a message processing method, program product, electronic device and storage medium for a large model calling service, so as to achieve the technical effect of improving the flexibility of AI dialogue.

[0004] A first aspect of an embodiment of the present application provides a message processing method for a large model calling service, the method comprising:

[0005] In response to a first user message currently input in the conversation, a target thread is called and a pre-stored target identifier is updated based on the thread identifier of the target thread; wherein the target identifier is used to indicate the most recently called thread in the conversation;

[0006] In the process of processing the target message through the target thread, in response to triggering a preset detection condition, reading the target identifier; wherein the target message includes the first user message;

[0007] If the target identifier does not match the thread identifier, stop processing the target message;

[0008] If the target identifier matches the thread identifier, continue processing the target message.

[0009] In the above implementation process, it can be ensured that the reply content output by the dialogue is generated based on at least the latest user message. At the same time, since the target message that does not include the latest user message is stopped from being processed, it can avoid the situation where the user asks multiple questions and the AI ​​replies multiple times, thereby enabling the artificial intelligence to handle continuous user questions and improving the flexibility of the dialogue.

[0010] Further, in response to a first user message currently input in the conversation, the method further includes:

[0011] Storing the first user message in a preset storage area;

[0012] After calling the target thread, the method further includes:

[0013] The target message is acquired from the storage area, and the target message is processed by the target thread.

[0014] In the above implementation process, the first user message is first stored in a preset storage area, and then the target message including at least the first user message is obtained from the storage area after the target thread is called, so that the target message can be processed after there is an idle thread, thereby reducing the message processing burden.

[0015] Further, the storage area includes second user messages that are historically input in the conversation and for which no reply message is generated, and the acquiring the target message from the storage area includes:

[0016] Reading the first user message and the second user message from the storage area;

[0017] The first user message and the second user message are concatenated in an input order to obtain the target message.

[0018] In the above implementation process, understanding the first user message and the second user message as a whole is conducive to AI accurately understanding the user's conversation intention, thereby improving the accuracy of the reply message.

[0019] Furthermore, the method further comprises:

[0020] The third user message for which a reply message has been generated in the storage area is deleted.

[0021] In the above implementation process, it can be avoided that the target thread obtains the third user message for which a reply message has been generated from the storage area for processing, resulting in repeated generation of a reply message for the same user message.

[0022] Furthermore, the method further comprises:

[0023] Receiving a conversation message; the conversation message includes a sender field and conversation content;

[0024] The first user message is extracted from the conversation message according to the sender field.

[0025] In the above implementation process, the first user message is intelligently identified from the dialogue message through the sender field in the dialogue message, so that the dialogue between the user and AI can be applied to various channels, broadening the scope of application.

[0026] Further, processing the target message through the target thread includes:

[0027] Processing the target message through the target thread based on a dialogue system; wherein the dialogue system includes one or more agent modules based on a large language model;

[0028] The triggering preset detection condition includes: running the current Agent module through the target thread.

[0029] In the above implementation process, the large language model is used to realize user dialogue. Thanks to the powerful data processing and understanding capabilities of the large language model, it can better respond to user messages. At the same time, setting the detection condition to run the current Agent module can determine whether to continue data processing, and can effectively stop the processing of non-latest user data to save computing power.

[0030] Further, after stopping processing the target message, the method further includes:

[0031] The target thread is recycled to the thread pool.

[0032] In the above implementation process, unnecessary message processing is stopped in time, and the threads after the processing are recycled to the thread pool, so that more idle threads can be called to process user messages, which avoids unnecessary waste of computing power and improves the throughput of user message processing.

[0033] Further, after continuing to process the target message, the method further includes:

[0034] generating a reply message based on the target message;

[0035] The reply message is output in the dialog.

[0036] In the above implementation process, it is ensured that the reply content output by the dialogue is generated based on at least the latest user message. This can avoid the situation where the user asks multiple questions and the AI ​​replies multiple times, thereby enabling the artificial intelligence to handle continuous user questions and improving the flexibility of the dialogue.

[0037] A second aspect of an embodiment of the present application provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, any method described in the first aspect is implemented.

[0038] According to a third aspect of the present application, an electronic device is provided, the electronic device comprising:

[0039] processor;

[0040] a memory for storing processor-executable instructions;

[0041] Wherein, when the processor calls the executable instruction, it implements the operation of any method described in the first aspect.

[0042] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of any method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A flowchart of a message processing method for a large model calling service provided in an embodiment of the present application;

[0045] Figure 2 A flowchart of another message processing method for a large model calling service provided in an embodiment of the present application;

[0046] Figure 3 A flowchart of another message processing method for a large model calling service provided in an embodiment of the present application;

[0047] Figure 4 A structural block diagram of a message processing device for a large model calling service provided in an embodiment of the present application;

[0048] Figure 5 A hardware structure diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0050] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0051] In related technologies, the dialogue between AI and users is usually conducted in the form of one question and one answer, that is, if the user asks N times, the AI ​​will answer N times. However, in daily conversations, users may ask questions continuously.

[0052] As an example of continuous questioning, if the user accidentally touches the sending component when entering a question, the AI ​​will only receive the first half of the question. At this point, the AI ​​will begin to generate a corresponding reply for the first half of the question. If the user wants to send the second half of the question, it is usually necessary to manually stop the AI ​​from generating a reply and then resend the complete question. Alternatively, if the user does not resend the complete question, but only sends the second half of the question, the AI ​​may not be able to recognize that the second half of the question is a complete question with the first half of the question entered previously, and will only generate a reply for the second half of the question.

[0053] For example, if a user wants to ask "What are the recommended attractions in Beijing on weekends?" but mistakenly sends "Beijing weekends", AI will generate an introduction to Beijing. If the user only sends the second half of the question "What are the recommended attractions" to AI, AI will generate an introduction to the attractions in the user's location. At this time, the user needs to re-enter the complete question to get the correct answer.

[0054] As an example of continuous questioning, out of habit, users may ask the next question to the AI ​​immediately after asking a question. Similarly, before asking a follow-up question, the user needs to manually stop the AI ​​from generating a response. After asking a follow-up question, the AI ​​will give two responses to the previous and next questions.

[0055] For example, after a user sends the question "What are the recommended attractions in Beijing?", before the AI ​​generates a reply, he asks another question "What are the recommended restaurants?" At this time, the AI ​​will answer these two questions separately, for a total of two replies.

[0056] It can be seen that in the relevant technologies, AI fails to intelligently respond to the situation where users ask questions continuously, and will mechanically generate corresponding replies for each question, and the dialogue flexibility is insufficient. It is understandable that with the rapid development of artificial intelligence, one of the development trends is to enable artificial intelligence to simulate real people to talk to users. In real dialogue scenarios, dialogues between users are able to handle continuous questions. Therefore, how to enable artificial intelligence to have the ability to handle continuous questions from users to improve dialogue flexibility is a technical problem that needs to be solved urgently in this field.

[0057] To this end, the present application provides a message processing method for a large model calling service, specifically including the following: Figure 1 Steps 110 to 140 are shown.

[0058] Step 110: In response to the first user message currently input in the conversation, call the target thread and update the pre-stored target identifier based on the thread identifier of the target thread.

[0059] The target identifier is used to indicate the most recently called thread in the conversation.

[0060] The dialogue refers to a dialogue between a user and an AI. The AI ​​can have a dialogue with multiple users at the same time. The dialogue described in this embodiment refers to a dialogue between the AI ​​and any user. The dialogue can be conducted in one or more forms of text, voice, and video. The AI ​​generates a response based on at least a trained neural network module to achieve a dialogue with the user.

[0061] The first user message may be a text message, for example, a first user question.

[0062] Exemplarily, if the conversation is a text conversation, the first user message may be a text message entered by the user in the dialog box. If the conversation is a voice conversation, the first user message may be a text message obtained by recognizing a voice message sent by the user as text. If the conversation is a video conversation, the first user message may be a text message obtained by recognizing the user's voice in the video stream as text. The process of recognizing voice as text may refer to the speech-to-text technology in the related art, which will not be elaborated in this application.

[0063] When a first user message is currently input into the conversation, the target thread may be called first. The target thread is used to generate a corresponding reply message based at least on the first user message. Exemplarily, the number of first user messages may match the number of target threads, for example, the number is the same. That is, each first user message corresponds to a target thread. In this way, whenever a new first user message is input into the conversation, a target thread will be called accordingly. The target thread may be an idle thread. For example, it may be a thread in a thread pool that has not executed a task.

[0064] Each thread has a corresponding thread identifier, which can be used to uniquely identify the thread. Exemplarily, the thread identifier may include but is not limited to a thread number, a thread name, and the like.

[0065] In addition, this embodiment also presets a target identifier to indicate the most recently called thread in the conversation. As mentioned above, since AI can have conversations with multiple users at the same time, each conversation can correspond to a target identifier, and each target identifier can represent the most recently called thread in the corresponding conversation.

[0066] After calling the target thread, the target identifier can be updated based on the thread identifier of the target thread. Exemplarily, since the target thread corresponding to the currently input first user message is the latest called thread in the conversation, the target identifier can be updated to the thread identifier of the target thread.

[0067] Step 120: In the process of processing the target message through the target thread, in response to triggering a preset detection condition, read the target identifier.

[0068] The target message includes the first user message.

[0069] The called target thread is used to process the target message, which at least includes the first user message. The purpose of processing the target message is to generate a reply message corresponding to the target message. In this way, at least the first user message is processed by the target thread to generate a corresponding message reply.

[0070] This embodiment is also provided with a detection condition. During the processing of the target message, when the detection condition is triggered, the target identifier is read, and the target identifier is matched with the thread identifier of the target thread. The following step 130 or step 140 is selected to be executed according to the matching result.

[0071] Step 130: If the target identifier does not match the thread identifier, stop processing the target message.

[0072] If the target ID does not match the target thread's thread ID, for example, the target ID is inconsistent with the target thread's thread ID, it means that during the target thread's processing of the target message, a new user message was input into the conversation and a new thread was called. Therefore, the target ID is updated to the thread ID of the most recently called thread. At this point, the target message stops being processed.

[0073] Step 140: If the target identifier matches the thread identifier, continue processing the target message.

[0074] If the target identifier matches the thread identifier of the target thread, for example, the target identifier is the same as the thread identifier of the target thread, it means that during the process of processing the target message, there is no new user message input in the dialogue, and no new thread is called. At this time, the target identifier is still the thread identifier of the target thread, and the target message continues to be processed.

[0075] In this embodiment, there is no sequential execution order between the above steps 110-140, and each step can be executed simultaneously. It is understandable that multiple threads can run in parallel. When multiple first user messages are input in the dialogue successively, the target thread will be called successively to process the target message including at least the first user message, so multiple target threads will run simultaneously. For each running target thread, when the preset detection condition is triggered, it will be determined whether to continue to process the corresponding target message according to the target identifier and its own thread identifier. For the target thread that does not match the target identifier, it means that the target message processed by the target thread no longer includes the latest user message, so the processing is stopped. On the contrary, for the target thread that matches the target identifier, it means that the target message processed by the target thread includes the latest user message, so the processing is continued. In this way, it can be ensured that the reply content output by the dialogue is generated based on at least the latest user message. At the same time, since the processing of the target message that does not include the latest user message is stopped, it can avoid the situation where the user asks multiple questions and the AI ​​replies multiple times, so that the artificial intelligence has the ability to handle continuous user questions and improves the flexibility of the dialogue.

[0076] In some embodiments, in response to the first user message currently input in the conversation, in addition to calling the target thread and updating the target identifier as described in step 110, the step of storing the first user message in a preset storage area is also included.

[0077] That is, when the first user message is currently input into the conversation, on the one hand, the target thread is called, and the target identifier is updated based on the thread identifier of the target thread; on the other hand, the first user message is stored in a preset storage area. The calling of the target thread and the storing of the first user message are not executed in order, and can be performed simultaneously.

[0078] The storage area may be a storage area pre-divided for storing user messages, and may include but is not limited to a cache, such as a redis cache.

[0079] Optionally, the target identifier can also be stored in the storage area. In this way, the preset storage area is used to store user messages and target identifiers. Specifically, the first sub-area in the storage area can be used to store user messages; and the second sub-area in the storage area can be used to store target identifiers. In this way, in response to the first user message currently input in the conversation, the first user message and the thread identifier of the target thread can be stored in the storage area.

[0080] On this basis, after calling the target thread in step 110, the method may further include the steps of: acquiring the target message from the storage area, and processing the target message through the target thread.

[0081] Since the first user message is stored in the storage area, and the target message includes at least the first user message, after the target thread is called, the target message can be obtained from the storage area and then processed by the target thread.

[0082] In this embodiment, the first user message is first stored in a preset storage area, and then the target message including at least the first user message is obtained from the storage area after the target thread is called, so that the target message can be processed after there is an idle thread, thereby reducing the message processing burden.

[0083] In addition, in some embodiments, the storage area may store a second user message in addition to the first user message currently input in the conversation. The second user message refers to a user message that was input in the conversation in the past and did not generate a reply message. The target message includes the first user message and the second user message.

[0084] For example, for multiple user messages input successively in a conversation, the previous user message has been processed by the corresponding target thread, but no reply message has been generated. During the processing, a subsequent user message is received and a new target thread is called. At this time, the previous user message is the second user message described in this embodiment, and the subsequent user message is the first user message described in this embodiment.

[0085] That is, the first user message and the second user message actually refer to user messages at different time points, rather than specifically referring to a certain user message. For example, for user message A, when it is the current input message of the conversation at the first time node, user message A is the first user message. At the second time node, if the AI ​​has not yet generated a reply message corresponding to user message A, and the conversation has a new user message B input, then at the second time node, user message A is the second user message, and user message B is the new first user message.

[0086] Based on this, obtaining the target message from the storage area in the above embodiment may specifically include: reading the first user message and the second user message from the storage area; and concatenating the first user message and the second user message in the input order to obtain the target message.

[0087] As an example, the user message may carry a timestamp, which is used to indicate the input time of the user message. Thus, after reading the first user message and the second user message, the input order of the first user message and the second user message may be determined based on the timestamps they carry.

[0088] As an example, the user messages may be stored in the storage area in the order in which they are input. For example, the storage position of the user message input first is closer to the front than the storage position of the user message input later. In this way, the order in which the first user message and the second user message are input may be determined according to the storage positions of the user messages in the storage area.

[0089] Then, the first user message and the second user message may be spliced ​​according to the input order. For example, the second user message may be spliced ​​after the first user message, thereby obtaining the target message.

[0090] It is understandable that when the second user message is processed through the corresponding target thread, when the first user message is newly input into the conversation, the target thread corresponding to the second user message will stop processing the second user message after the detection condition is triggered, thus avoiding the situation where the user asks multiple questions and the AI ​​replies multiple times. At the same time, the first user message and the second user message are spliced ​​into a target message, and the target message is processed through the most recently called target thread (i.e., the target thread corresponding to the first user message). Then, during the processing, the first user message and the second user message will be understood as a whole, which is conducive to AI accurately understanding the user's conversation intentions, thereby improving the accuracy of the reply message. It can be seen that this embodiment improves the flexibility of the conversation, gives AI the ability to process continuous questions, and also improves the accuracy of the reply message.

[0091] In addition, based on any of the above embodiments, the method may further include the steps of:

[0092] The third user message for which a reply message has been generated in the storage area is deleted.

[0093] The third user message refers to the user message that has generated a reply message. Similarly, the first user message, the second user message, and the third user message actually refer to user messages at different time points, rather than specifically referring to a certain user message. Continuing with the above example, if at the third time node, AI has generated a corresponding reply message based on user message A and user message B, then at the third time node, user message A and user message B are the third user messages.

[0094] In this embodiment, deleting the third user message for which a reply message has been generated can prevent the target thread from acquiring the third user message for which a reply message has been generated from the storage area for processing, resulting in repeated generation of a reply message for the same user message.

[0095] In addition, based on any of the above embodiments, before executing step 110, the following steps may be performed: Figure 2 Steps 210 to 220 are shown.

[0096] Step 210: receiving a conversation message; the conversation message includes a sender field and conversation content;

[0097] Step 220: Extract the first user message from the conversation message according to the sender field.

[0098] The conversation between the user and AI can be conducted through a variety of channels. The channels include but are not limited to APP (Application), browser, mini-program, etc. In some cases, AI may not directly receive the first user message, but a conversation message carrying the first user message. For example, take the browser as an example. The user enters the first user message in the browser's web page. At this time, the browser returns a conversation message carrying the first user message to the backend server. In this case, it is necessary to extract the first user message from the conversation message first.

[0099] Specifically, the conversation message includes a sender field and a conversation content. The sender field is used to represent a conversation participant, and the conversation participant may include multiple, for example, including but not limited to a user, AI, etc. The conversation content includes the content input by the conversation participant. If the conversation participant is a user, then the corresponding conversation content is the first user message; if the conversation participant is an AI, then the corresponding conversation content is a reply message.

[0100] Therefore, the first user message can be extracted from the conversation message according to the sender field. Specifically, it is determined that the conversation content corresponding to the sender field being the user is the first user message.

[0101] For example, a conversation message can be represented as: {"sender": "user", "msg": "What is the capital of China?"}. The sender field is sender, and the conversation content is msg. According to the value "user" of the sender field, it can be known that the corresponding conversation content "What is the capital of China?" is the first user message.

[0102] It can be seen that this embodiment intelligently identifies the first user message from the dialogue message through the sender field in the dialogue message, so that the dialogue between the user and AI can be applied to various channels, broadening the scope of application.

[0103] Based on any of the above embodiments, the AI ​​may include a dialogue system. The dialogue system receives a first user message and outputs a corresponding reply message.

[0104] Among them, the dialogue system includes one or more Agent modules based on a large language model. Each Agent module can be used to perform different tasks. At present, there is no unified and clear definition of Agent in the industry. For example, in the MetaGPT framework, Agent can be understood as a combination of a large language model, observation, thinking, action and memory. The large language model is one of the "brains" of the Agent; observation is the Agent's perception mechanism, which enables it to perceive the environment; thinking involves the Agent analyzing observations, drawing on memory, and considering possible actions; action is the Agent's visible response to its thinking and observations; memory is the Agent's storage of past experience. For another example, in other frameworks, Agent can be understood as a combination of a large language model, tool use, planning, action and memory.

[0105] Thus, the process of processing the target message through the target thread in the above embodiment may specifically include the steps of: processing the target message through the target thread based on the dialogue system.

[0106] Exemplarily, after obtaining the target message, the target thread sequentially runs one or more Agent modules in the dialog system to execute the corresponding tasks of each Agent module, and finally obtains a reply message corresponding to the target message.

[0107] Based on this, the triggering preset detection condition in the above embodiment may include: running the current Agent module through the target thread.

[0108] That is, each Agent module is preset with a corresponding detection node. During the operation of the target thread, whenever the target thread is ready to run the Agent module, the detection node is first triggered to read the target identifier for matching.

[0109] It can be seen that if the dialogue system includes an Agent module, that is, the target message will output a reply message after being processed by the Agent module, then before the target message is input into the Agent module, it is determined whether the target identifier matches the thread identifier of the target thread to determine whether to input the target message into the Agent module.

[0110] If the dialogue system includes multiple Agent modules, that is, the target message is processed by multiple Agent modules in sequence before the reply message is output. Then before the target thread runs each Agent module, it is necessary to determine whether the target identifier matches the thread identifier of the target thread to determine whether to continue processing the data. It can be seen that the number of times the detection condition is triggered is consistent with the number of Agent modules in the dialogue system.

[0111] It can be seen that this embodiment uses a large language model to realize user dialogue. Thanks to the powerful data processing and understanding capabilities of the large language model, it can better respond to user messages. At the same time, setting the detection condition to run the current Agent module can determine whether to continue data processing, and can effectively stop the processing of non-latest user data to save computing power.

[0112] In addition, in addition to setting a detection node before each Agent module, in some embodiments, the triggering preset detection condition may also include: reaching a preset detection cycle.

[0113] That is, in the process of the target thread processing the target message, whenever the preset detection period is reached, the target identifier will be read for matching. The period length of the detection period can be set according to actual needs, and this embodiment does not limit it.

[0114] In addition, in some embodiments, after executing step 130 to stop processing the target message, the method may further include the steps of:

[0115] The target thread is recycled to the thread pool.

[0116] In the case where the target identifier does not match the thread identifier, after stopping the target thread from processing the target message, the target thread can be recycled to the thread pool and wait for the next call as an idle thread.

[0117] It is understandable that the processing of user messages has a certain throughput, that is, AI can only process a certain number of user messages at the same time. This embodiment stops unnecessary message processing in a timely manner and recycles the threads that have stopped processing to the thread pool, so that more idle threads can be called to process user messages, avoiding unnecessary waste of computing power while also improving the throughput of user message processing.

[0118] In addition, in some embodiments, after executing step 140 to continue processing the target message, the method may further include: Figure 3 Steps 310 to 320 shown:

[0119] Step 310: Generate a reply message based on the target message;

[0120] Step 320: Output the reply message in the conversation.

[0121] For example, if after each time the detection condition is triggered, the target message is determined to continue to be processed through the matching judgment of the target identifier and the thread identifier, then a reply message based on the target message will eventually be generated. At this time, the reply message can be output in the conversation.

[0122] It can be seen that as long as the target identifier does not match the thread identifier after a trigger detection condition exists, a reply message corresponding to the target message will not be generated. Then, for the target thread, steps 310 to 320 will not be executed.

[0123] It can be seen that this embodiment ensures that the reply content output by the dialogue is generated based on at least the latest user message. It can avoid the situation where the user asks multiple questions and the AI ​​replies multiple times, thereby enabling the artificial intelligence to handle continuous user questions and improving the flexibility of the dialogue.

[0124] In order to better understand the technical solution of the present application, the following examples are given for illustration.

[0125] Example 1: The user wants to ask "What are the recommended attractions in Beijing on weekends?", but mistakenly sends "Beijing weekend". At this time, "Beijing weekend" is the first user message currently input in the conversation. In response to the first user message, the target thread 1 is called from the thread pool, and the thread ID (Identity document, identity number) of the target thread 1, such as 001, and the first user message "Beijing weekend" are stored in the redis cache. At this time, the redis cache stores the first user message "Beijing weekend" and the target identifier 001.

[0126] Subsequently, the target thread 1 reads the first user message "Beijing Weekend" from the redis cache, and generates a reply message corresponding to "Beijing Weekend" by running multiple Agent modules in the dialogue system. Each Agent module is preset with a detection node. Whenever the target thread 1 runs the Agent module, the preset detection node is triggered, and the target identifier is read from the redis cache to match with the thread ID 001 to determine whether to continue to generate a reply message of "Beijing Weekend".

[0127] At a certain point in time before the "Beijing Weekend" reply message is generated, the user continues to input "What are the recommended attractions" in the conversation. At this time, "What are the recommended attractions" is the first user message currently input in the conversation, and the historical input "Beijing Weekend" is the second user message in the storage area that has not generated a reply message. In response to the first user message "What are the recommended attractions", a new target thread 2 is similarly called from the thread pool, and the thread ID of the target thread 2, for example 002, and the first user message "What are the recommended attractions" are stored in the redis cache. At this time, the redis cache stores the second user message "Beijing Weekend", the first user message "What are the recommended attractions", and the target identifier 002.

[0128] Subsequently, target thread 2 reads the first user message and the second user message from the redis cache, and concatenates the first user message and the second user message into "What are the recommended attractions in Beijing on weekends" according to the input order to obtain the target message. Target thread 2 generates a reply message corresponding to "What are the recommended attractions in Beijing on weekends" by running multiple Agent modules. At the same time, when target thread 1 triggers the detection node after this time point, since the read target identifier 002 does not match thread ID 001, it stops generating the reply message corresponding to "Beijing weekend". Finally, the dialogue system generates a reply message corresponding to "What are the recommended attractions in Beijing on weekends" and outputs it to the user.

[0129] It can be seen that the message processing method of a large model call service provided in this application gives AI the ability to handle continuous questions from users and supports situations where users ask questions continuously, thereby better simulating conversations between real people and users and improving conversation flexibility.

[0130] Based on any of the above embodiments, the present application also provides a message processing device for a large model calling service. Figure 4 As shown, the message processing device 400 includes:

[0131] The calling module 410 is used to call the target thread in response to the first user message currently input in the conversation and update the pre-stored target identifier based on the thread identifier of the target thread; wherein the target identifier is used to indicate the most recently called thread in the conversation;

[0132] A reading module 420, configured to read the target identifier in response to triggering a preset detection condition during the process of processing the target message through the target thread; wherein the target message includes the first user message;

[0133] The judgment module 430 is configured to stop processing the target message if the target identifier does not match the thread identifier; and continue processing the target message if the target identifier matches the thread identifier.

[0134] In some embodiments, the message processing device 400 further includes:

[0135] A storage module, used for storing the first user message in a preset storage area;

[0136] A processing module is used to obtain the target message from the storage area after calling the target thread, and process the target message through the target thread.

[0137] In some embodiments, the storage area includes second user messages that were historically input in the conversation and for which no reply message was generated, and the processing module is specifically configured to:

[0138] Reading the first user message and the second user message from the storage area;

[0139] The first user message and the second user message are concatenated in an input order to obtain the target message.

[0140] In some embodiments, the message processing device 400 further includes:

[0141] The deleting module is used to delete the third user message for which a reply message has been generated in the storage area.

[0142] In some embodiments, the message processing device 400 further includes:

[0143] A receiving module, used for receiving a conversation message; the conversation message includes a sender field and conversation content;

[0144] An extraction module is used to extract the first user message from the conversation message according to the sender field.

[0145] In some embodiments, the processing module is specifically used to:

[0146] Processing the target message through the target thread based on a dialogue system; wherein the dialogue system includes one or more agent modules based on a large language model;

[0147] The triggering preset detection condition includes: running the current Agent module through the target thread.

[0148] In some embodiments, the message processing device 400 further includes:

[0149] The recycling module is used to recycle the target thread to the thread pool after stopping processing the target message.

[0150] In some embodiments, the message processing device 400 further includes:

[0151] A generating module, used for generating a reply message based on the target message;

[0152] An output module is used to output the reply message in the conversation.

[0153] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0154] Based on the message processing method for a large model calling service described in any of the above embodiments, the present application also provides a computer program product, which includes one or more computer programs or instructions. The computer program or instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. When the computer program is executed by a processor, the message processing method for a large model calling service described in any of the above embodiments is implemented.

[0155] Based on the message processing method of a large model calling service described in any of the above embodiments, the present application also provides the following Figure 5 A schematic diagram of the structure of an electronic device is shown in FIG. Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement a message processing method for a large model calling service as described in any of the above embodiments.

[0156] The present application also provides a computer storage medium, which stores a computer program. When the computer program is executed by a processor, it can be used to execute a message processing method for a large model calling service described in any of the above embodiments.

[0157] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0158] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0159] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks.

[0160] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0161] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0162] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A message processing method for a large model calling service, characterized in that: The method comprises steps 110 to 140: Step 110: In response to a first user message currently input in the conversation, the first user message is stored in a preset storage area, a target thread is called, and a pre-stored target identifier is updated based on the thread identifier of the target thread; wherein the target identifier is used to indicate the most recently called thread in the conversation; the conversation is between a user and an AI; the AI ​​includes a conversation system, and the conversation system includes one or more agent modules based on a large language model; the storage area includes a second user message that was historically input in the conversation and for which no reply message was generated; the first user message includes a first user question; Step 120: reading the first user message and the second user message from the storage area, and splicing the first user message and the second user message in the input order to obtain a target message; in the process of processing the target message through the target thread, in response to triggering a preset detection condition, reading the target identifier; wherein the triggering preset detection condition includes running the current Agent module through the target thread; Step 130: If the target identifier is inconsistent with the thread identifier, stop processing the target message; Step 140: If the target identifier is consistent with the thread identifier, continue to process the target message, generate a reply message based on the target message, and output the reply message in the dialog; There is no sequential execution order between step 110 to step 140, and each step can be executed simultaneously. When multiple first user messages are input into the conversation successively, multiple target threads are called successively and respectively, and the multiple target threads run simultaneously.

2. The method according to claim 1, characterized in that The method further comprises: The third user message for which a reply message has been generated in the storage area is deleted.

3. The method according to claim 1, characterized in that The method further comprises: Receiving a conversation message; the conversation message includes a sender field and conversation content; The first user message is extracted from the conversation message according to the sender field.

4. The method according to claim 1, characterized in that: After stopping processing the target message, the method further includes: The target thread is recycled to the thread pool.

5. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

6. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; Wherein, when the processor calls the executable instructions, it implements the operation of any method described in claims 1-4.

7. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the computer instructions are executed by a processor, the steps of any method described in claims 1-4 are implemented.