Conversation interaction method and device and storage medium
By determining relevant candidate historical dialogues from multiple rounds of historical dialogues and generating corresponding replies, the problem of poor dialogue interaction coherence and correlation caused by the lack of memory of the large language model is solved, and the effect of office software function operation is improved.
Patent Information
- Application Number
- CN202411968698.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-22
AI Technical Summary
Since the large language model has no memory, when the user talks and interacts with the large language model, every time the user enters a demand expression, the large language model responds to the demand expression of the input, resulting in poor consistency and correlation of the dialogue interaction between the user and the large language model, affecting the operation of office software related functions.
By obtaining the current demand statement in the dialogue process, the candidate historical dialogue associated with the current demand statement is determined from multiple rounds of historical dialogues, and a reply statement corresponding to the current demand statement is generated based on the current demand statement and the candidate historical dialogue.
It improves the coherence and relevance of dialogue interaction between users and large language models, and improves the operation experience of office software-related functions.
Smart Images

Figure CN119862963A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a conversation interaction method, device and storage medium. Background Art
[0002] In the digital office environment, users often use various functions in office software to complete daily office work. However, various functions in office software have certain usage thresholds for many users, which brings certain difficulties to users in using various functions in office software.
[0003] For this purpose, a large language model is introduced. Through the form of a dialog box, users can interact with the large language model to operate the relevant functions of the office software. In the process of interacting with the large language model, users can enter the demand expression, and the large language model responds to the demand expression and returns the corresponding reply expression.
[0004] Since the large language model has no memory, during the process of dialogue interaction between the user and the large language model, each time the user inputs a demand expression, the large language model responds to the demand expression input at that time and returns the corresponding reply expression. This results in poor consistency and relevance of the dialogue interaction between the user and the large language model, thereby affecting the operation of related functions of the office software. Summary of the invention
[0005] In order to solve the above-mentioned technical problem that since the large language model has no memory, during the process of dialogue interaction between the user and the large language model, each time the user inputs a demand expression, the large language model responds to the demand expression input at that time and returns the corresponding reply expression, which leads to poor consistency and relevance of the dialogue interaction between the user and the large language model, thereby affecting the operation of related functions of office software, the embodiment of the present application provides a dialogue interaction method, device, electronic device and storage medium. The specific technical solution is as follows:
[0006] In a first aspect of an embodiment of the present application, a conversation interaction method is first provided, the method comprising:
[0007] Get the current demand expression during the conversation;
[0008] Determining, from multiple rounds of historical dialogues included in the dialogue process, candidate historical dialogues associated with the current demand expression;
[0009] A first current reply expression corresponding to the current demand expression is generated according to the current demand expression and the determined candidate historical dialogues.
[0010] In an optional implementation, determining a candidate historical dialogue associated with the current demand expression from the multiple rounds of historical dialogues included in the dialogue process includes:
[0011] Performing intent recognition on the current demand expression to obtain a current operation scenario corresponding to the current demand expression;
[0012] According to the current operation scenario, candidate historical dialogues associated with the current demand expression are determined from multiple rounds of historical dialogues included in the dialogue process.
[0013] In an optional implementation, the performing intent recognition on the current demand expression to obtain a current operation scenario corresponding to the current demand expression includes:
[0014] The current demand expression is input into the pre-trained intention recognition large model to obtain the current operation scenario corresponding to the current demand expression.
[0015] In an optional embodiment, the pre-trained intent recognition large model is obtained in the following manner:
[0016] Obtaining a preset operation scenario set, and obtaining an operation scenario from the preset operation scenario set;
[0017] Generate a requirement statement corresponding to the operation scenario, and construct a first prompt word of the intention recognition model according to the operation scenario and the requirement statement;
[0018] Inputting the first prompt word into the intention recognition large model to obtain a predicted operation scenario;
[0019] Determine the loss between the operation scenario and the predicted operation scenario, and train the intention recognition model according to the loss;
[0020] When the loss converges, the training is stopped to obtain a pre-trained intent recognition large model.
[0021] In an optional implementation, each round of historical dialogue in the dialogue process has a corresponding historical operation scenario;
[0022] According to the current operation scenario, determining a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process includes:
[0023] For each round of historical dialogue in the dialogue process, detecting whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario;
[0024] In a case where the historical operation scenario is the same as the current operation scenario, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
[0025] In an optional implementation, the number of the current operation scenarios is at least one;
[0026] The detecting, for each round of historical dialogue in the dialogue process, whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario includes:
[0027] For any of the current operation scenarios, perform the following processing:
[0028] For each round of historical dialogue in the dialogue process, it is detected whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario.
[0029] In an optional implementation, determining a candidate historical dialogue associated with the current demand expression from the multiple rounds of historical dialogues included in the dialogue process includes:
[0030] For each round of historical dialogue in the dialogue process, determining the semantic relevance between the historical dialogue and the current demand expression; if the semantic relevance exceeds a preset semantic relevance threshold, determining the historical dialogue as a candidate historical dialogue associated with the current demand expression;
[0031] or,
[0032] For each round of historical dialogue in the dialogue process, the historical dialogue is vectorized to obtain a historical dialogue vector; the current demand expression is vectorized to obtain a current dialogue vector, and the similarity between the historical dialogue vector and the current dialogue vector is determined; when the similarity is greater than a preset similarity threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
[0033] In an optional implementation, generating a first current reply expression corresponding to the current demand expression according to the current demand expression and the determined candidate historical dialogues includes:
[0034] Merging the content of the current demand expression with the candidate historical conversations to obtain a content merging result;
[0035] Generate a first current response statement corresponding to the current demand statement according to the content merging result;
[0036] The step of generating a first current reply expression corresponding to the current demand expression according to the content merging result includes:
[0037] Constructing a second prompt word of the pre-trained first dialogue interaction model according to the content merging result;
[0038] The second prompt word is input into the pre-trained first dialogue interaction large model to obtain a first current response expression corresponding to the current demand expression.
[0039] In an optional implementation, the number of the candidate historical conversations is at least one;
[0040] The step of merging the content of the current demand statement with the candidate historical dialogue to obtain a content merging result includes:
[0041] Determine the length of the prompt word of the pre-trained first dialogue interaction large model;
[0042] Screening at least one of the candidate historical dialogues according to the length of the prompt word to obtain a target historical dialogue;
[0043] The current demand statement and the target historical dialogue are content-merged to obtain a content merging result.
[0044] In an optional implementation, screening at least one of the candidate historical dialogues according to the length of the prompt word to obtain a target historical dialogue includes:
[0045] sorting at least one of the candidate historical conversations according to the conversation time to obtain a candidate historical conversation sequence;
[0046] A target historical dialogue is selected from the candidate historical dialogue sequences according to the length of the prompt word.
[0047] In an optional embodiment, the method further comprises:
[0048] When the candidate historical dialogue does not exist, constructing a third prompt word of the pre-trained second dialogue interaction model according to the current demand expression;
[0049] The third prompt word is input into the pre-trained second dialogue interaction model to obtain a second current response expression corresponding to the current demand expression.
[0050] In a second aspect of the embodiment of the present application, a dialog interaction device is further provided, the device comprising:
[0051] The expression acquisition module is used to obtain the current demand expression during the dialogue process;
[0052] A dialogue determination module, configured to determine a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process;
[0053] The expression generation module is used to generate a first current reply expression corresponding to the current demand expression according to the current demand expression and the determined candidate historical dialogues.
[0054] In an optional implementation, the dialogue determination module specifically includes:
[0055] A scenario determination submodule, used to perform intent recognition on the current demand expression to obtain a current operation scenario corresponding to the current demand expression;
[0056] The dialogue determination submodule is used to determine, according to the current operation scenario, a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process.
[0057] In an optional implementation, the scene determination submodule is specifically used to:
[0058] The current demand expression is input into the pre-trained intention recognition large model to obtain the current operation scenario corresponding to the current demand expression.
[0059] In an optional embodiment, the device further includes a large model training module, which is specifically used to:
[0060] Obtaining a preset operation scenario set, and obtaining an operation scenario from the preset operation scenario set;
[0061] Generate a requirement statement corresponding to the operation scenario, and construct a first prompt word of the intention recognition model according to the operation scenario and the requirement statement;
[0062] Inputting the first prompt word into the intention recognition large model to obtain a predicted operation scenario;
[0063] Determine the loss between the operation scenario and the predicted operation scenario, and train the intention recognition model according to the loss;
[0064] When the loss converges, the training is stopped to obtain a pre-trained intent recognition large model.
[0065] In an optional implementation, each round of historical dialogue in the dialogue process has a corresponding historical operation scenario; the dialogue determination submodule specifically includes:
[0066] A scene detection unit, configured to detect, for each round of historical dialogue in the dialogue process, whether the historical operation scene corresponding to the historical dialogue is the same as the current operation scene;
[0067] The dialogue determining unit is used to determine the historical dialogue as a candidate historical dialogue associated with the current demand statement when the historical operation scenario is the same as the current operation scenario.
[0068] In an optional implementation, the number of the current operation scene is at least one; and the scene detection unit is specifically configured to:
[0069] For any of the current operation scenarios, perform the following processing:
[0070] For each round of historical dialogue in the dialogue process, it is detected whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario.
[0071] In an optional implementation, the dialogue determination module is specifically configured to:
[0072] For each round of historical dialogue in the dialogue process, determining the semantic relevance between the historical dialogue and the current demand expression; if the semantic relevance exceeds a preset semantic relevance threshold, determining the historical dialogue as a candidate historical dialogue associated with the current demand expression;
[0073] or,
[0074] For each round of historical dialogue in the dialogue process, the historical dialogue is vectorized to obtain a historical dialogue vector; the current demand expression is vectorized to obtain a current dialogue vector, and the similarity between the historical dialogue vector and the current dialogue vector is determined; when the similarity is greater than a preset similarity threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
[0075] In an optional implementation, the expression generation module specifically includes:
[0076] A content merging submodule, used to merge the current demand expression with the candidate historical dialogue to obtain a content merging result;
[0077] A statement generation submodule, used for generating a first current response statement corresponding to the current demand statement according to the content merging result;
[0078] Wherein, the expression generation submodule is specifically used for:
[0079] Constructing a second prompt word of the pre-trained first dialogue interaction model according to the content merging result;
[0080] The second prompt word is input into the pre-trained first dialogue interaction large model to obtain a first current response expression corresponding to the current demand expression.
[0081] In an optional implementation, the number of the candidate historical conversations is at least one; and the content merging submodule specifically includes:
[0082] A length determination unit, used to determine the length of the prompt word of the pre-trained first dialogue interaction large model;
[0083] A dialogue screening unit, configured to screen at least one of the candidate historical dialogues according to the length of the prompt word to obtain a target historical dialogue;
[0084] The content merging unit is used to merge the current demand expression with the target historical dialogue to obtain a content merging result.
[0085] In an optional implementation, the dialogue screening unit is specifically used to:
[0086] sorting at least one of the candidate historical conversations according to the conversation time to obtain a candidate historical conversation sequence;
[0087] A target historical dialogue is selected from the candidate historical dialogue sequences according to the length of the prompt word.
[0088] In an optional implementation, the expression generation module is further used to:
[0089] When the candidate historical dialogue does not exist, constructing a third prompt word of the pre-trained second dialogue interaction model according to the current demand expression;
[0090] The third prompt word is input into the pre-trained second dialogue interaction model to obtain a second current response expression corresponding to the current demand expression.
[0091] In a third aspect of the embodiments of the present application, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0092] Memory, used to store computer programs;
[0093] The processor is used to implement any of the dialogue interaction methods described in the first aspect when executing the program stored in the memory.
[0094] In a fourth aspect of the embodiments of the present application, a storage medium is further provided, wherein instructions are stored in the storage medium, and when the storage medium is executed on a computer, the computer executes any one of the dialogue interaction methods described in the first aspect above.
[0095] In a fifth aspect of the embodiments of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the above-described dialogue interaction methods.
[0096] The technical solution provided in the embodiment of the present application obtains the current demand expression in the conversation process, determines the candidate historical conversations associated with the current demand expression from the multiple rounds of historical conversations included in the conversation process, and generates the first current reply expression corresponding to the current demand expression based on the current demand expression and the determined candidate historical conversations.
[0097] From the multiple rounds of historical conversations included in the conversation process, determine the candidate historical conversations associated with the current demand expression in the conversation process, and generate the first current reply expression corresponding to the current demand expression based on the current demand expression and the determined candidate historical conversations. In this way, the first current reply expression corresponding to the current demand expression is generated based on the current demand expression and the candidate historical conversations, which can ensure the consistency and relevance of the conversation interaction and avoid affecting the operation of related functions of the office software. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0099] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0100] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0101] Figure 1 A schematic diagram of an implementation flow of a conversation interaction method shown in an embodiment of the present application;
[0102] Figure 2 This is a schematic diagram of an implementation flow of another dialog interaction method shown in an embodiment of the present application;
[0103] Figure 3 This is a schematic diagram of an implementation flow of another dialog interaction method shown in an embodiment of the present application;
[0104] Figure 4 A schematic diagram of an implementation process of a large model fine-tuning method for intent recognition shown in an embodiment of the present application;
[0105] Figure 5 This is a schematic diagram of an implementation flow of another dialog interaction method shown in an embodiment of the present application;
[0106] Figure 6 This is a schematic diagram of an implementation flow of another dialog interaction method shown in an embodiment of the present application;
[0107] Figure 7 A structural diagram of a conversation interaction device shown in an embodiment of the present application;
[0108] Figure 8 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0109] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0110] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0111] In the embodiment of the present application, a dialog box is provided for office software, and the user can interact with the large language model through the dialog box to operate the relevant functions in the office software. For example, a dialog box is provided for slide software, and the user can interact with the large language model through the dialog box to operate the relevant functions in the slide software, such as adjusting the slide background color.
[0112] In the process of dialog interaction between the user and the large language model, the user can input the demand expression through the dialog box, and the large language model responds to the demand expression and returns the corresponding reply expression. Since the large language model has no memory, during the process of dialog interaction between the user and the large language model, each time the user inputs a demand expression, the large language model responds to the demand expression input at that time and returns the corresponding reply expression, which results in poor consistency and relevance of the dialog interaction between the user and the large language model, thereby affecting the operation of related functions of the office software.
[0113] Based on this, the embodiment of the present application determines the candidate historical conversations associated with the current demand expression in the conversation process from the multiple rounds of historical conversations included in the conversation process, and generates the first current reply expression corresponding to the current demand expression based on the current demand expression and the determined candidate historical conversations. In this way, the first current reply expression corresponding to the current demand expression is generated based on the current demand expression and the candidate historical conversations, which can ensure the consistency and relevance of the conversation interaction and avoid affecting the operation of related functions of the office software.
[0114] Based on the above invention concept, Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a conversation interaction method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0115] S101, obtaining the current demand expression during the conversation.
[0116] In the embodiment of the present application, the current demand expression in the dialogue process can be obtained. The dialogue process refers to the dialogue process between the user and the large language model, and the user can input the current demand expression in the form of a dialog box, which is not limited in the embodiment of the present application.
[0117] For example, in the slide software, the user interacts with the large language model in the form of a dialog box. During the dialog process, the user inputs the current demand expression "and adjust the size of the title text" in the form of a dialog box, so that the current demand expression "and adjust the size of the title text" in the dialog process can be obtained. That is, in one embodiment of the present application, the current demand expression in the dialog process is a demand expression based on the presentation document.
[0118] It should be noted that for the current demand expression in the conversation process, it is necessary to detect whether it belongs to the first round of conversation. If it is not the first round of conversation, the subsequent steps can be executed. If it is the first round of conversation, the second current reply expression corresponding to the current demand expression can be generated directly based on the current demand expression. The embodiment of the present application does not limit this.
[0119] S102, determining candidate historical dialogues associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process.
[0120] In an embodiment of the present application, for the dialogue process between the user and the large language model, there are multiple rounds of historical dialogues, which means that before the current round of dialogue, the user has had multiple rounds of dialogues with the large language model, which may involve historical dialogues associated with the current demand expression of the current round of dialogue in the dialogue process.
[0121] Based on this, determining the candidate historical dialogue associated with the current demand expression of the current round of dialogue in the dialogue process from the multiple rounds of historical dialogues included in the dialogue process means that the candidate historical dialogue is associated with the current demand expression of the current round of dialogue in the dialogue process, for example, an association in intent. In one embodiment of the present application, the candidate historical dialogue associated with the current demand expression may be a historical dialogue with the same operation scenario as the current demand expression, and the same operation scenario means the same operation scenario for the slide, for example, the operation scenario is "slide operation", or the operation scenario is "editing background" for the slide. Or the operation scenario is "editing content" for the slide, where the slide operation can be inserting a title slide or a content slide for the slide, etc.; editing the background can be an operation on the background, such as modifying the background color, modifying the background image, etc.; editing the content can be an operation on the content contained in the slide, such as adding an image or adding text to the title slide.
[0122] It should be noted that for each round of historical conversation, it includes historical demand expressions and / or historical response expressions. The historical demand expressions are the historical demand expressions input by the user through the dialog box, and the historical response expressions are the historical response expressions generated by the large language model in response to the historical demand expressions. The same is true for candidate historical conversations, and the embodiments of the present application do not limit this.
[0123] For example, the current demand expression of the current round of dialogue in the dialogue process is "and adjust the size of the title text", and from the multiple rounds of historical dialogues included in the dialogue process, the candidate historical dialogues associated with the current demand expression are determined. The candidate historical dialogues include historical demand expressions and historical response expressions. The historical demand expression is "I want to change the background color of the slide", and the historical response expression is "Which color do you want to change to?".
[0124] S103: Generate a first current reply expression corresponding to the current demand expression according to the current demand expression and the determined candidate historical dialogues.
[0125] In an embodiment of the present application, for the candidate historical conversations determined above, and the current demand expression during the conversation, a first current reply expression corresponding to the current demand expression can be generated based on the current demand expression and the determined candidate historical conversations, and displayed in the form of a dialog box to complete the conversation interaction.
[0126] For example, for the current demand expression and the determined candidate historical dialogues, the first current reply expression corresponding to the current demand expression is generated based on the current demand expression and the determined candidate historical dialogues. For example, the first current reply expression is "OK, please provide specific color and font size settings", and is displayed in the form of a dialog box to complete the dialogue interaction.
[0127] In this way, based on the current demand expression and the candidate historical dialogues, the first current reply expression corresponding to the current demand expression is generated, which can ensure the coherence and relevance of the dialogue interaction and avoid affecting the operation of related functions of the office software.
[0128] In one embodiment of the present application, after generating a first current reply expression corresponding to the current demand expression according to the current demand expression and the determined candidate historical dialogue, the method further includes:
[0129] Based on the first current response expression corresponding to the generated current demand expression, the presentation document is operated.
[0130] like Figure 2 FIG. 1 is a schematic diagram of an implementation flow of another dialog interaction method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0131] S201, obtaining the current demand expression during the dialogue process.
[0132] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.
[0133] S202, determining candidate historical dialogues associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process.
[0134] In the embodiment of the present application, this step is similar to the above-mentioned step S102, and the embodiment of the present application will not be described one by one here.
[0135] S203, merging the current demand expression and the candidate historical dialogues to obtain a content merging result.
[0136] In the embodiment of the present application, the current demand expression and the candidate historical conversations can be merged to obtain a content merging result. The content merging can be understood as splicing the current demand expression with the candidate historical conversations.
[0137] Among them, in the process of merging the content of the current demand expression and the candidate historical conversations, the candidate historical conversations can be spliced in the front and the current demand expression in the back to obtain the content merging result, which is not limited in this embodiment of the present application.
[0138] For example, the current demand is expressed as "and adjust the size of the title text", and the candidate historical dialogues include historical demand expressions and historical response expressions. The historical demand is expressed as "I want to change the background color of the slide", and the historical response is expressed as "What color do you want to change to?" The two are merged to obtain the content merging result as shown below:
[0139] "I want to change the background color of the slide", "Which color do you want to change to?", "And adjust the size of the title text".
[0140] S204: Generate a first current reply expression corresponding to the current demand expression according to the content merging result.
[0141] In an embodiment of the present application, for the content merging results obtained above, a first current reply expression corresponding to the current demand expression can be generated according to the content merging results, and displayed in the form of a dialog box to complete the dialogue interaction.
[0142] For example, if the content merging result is as shown above, then based on the content merging result, generate the first current reply expression corresponding to the current demand expression, for example, the first current reply expression is "OK, please provide specific color and font size settings", and display it in the form of a dialog box to complete the dialogue interaction.
[0143] Through the above description of the technical solution provided in the embodiment of the present application, the current demand expression in the conversation process is obtained, and the candidate historical conversations associated with the current demand expression are determined from the multiple rounds of historical conversations included in the conversation process. The current demand expression and the candidate historical conversations are content-merged to obtain the content merging result, and based on the content merging result, the first current reply expression corresponding to the current demand expression is generated.
[0144] From the multiple rounds of historical conversations included in the conversation process, determine the candidate historical conversations associated with the current demand expression in the conversation process, merge the current demand expression with the candidate historical conversations, and generate the first current reply expression corresponding to the current demand expression based on the content merging result. By merging the current demand expression with the candidate historical conversations and generating the first current reply expression corresponding to the current demand expression, the consistency and relevance of the conversation interaction can be ensured, and the operation of related functions of the office software can be avoided from being affected.
[0145] In the embodiment of the present application, the current demand expression in the conversation process usually corresponds to a certain function of the office software, that is, corresponds to a certain operation scenario, and the same is true for each round of historical conversations in the conversation process. Therefore, in the conversation process, the candidate historical conversations associated with the current demand expression can be determined from the multiple rounds of historical conversations included in the conversation process by marking the operation scenarios.
[0146] Based on this, Figure 3 FIG. 1 is a schematic diagram of an implementation flow of another dialog interaction method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0147] S301, obtaining the current demand expression during the conversation process.
[0148] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.
[0149] S302, performing intent recognition on the current demand expression to obtain a current operation scenario corresponding to the current demand expression.
[0150] In the embodiment of the present application, for the current demand expression, the current demand expression is intentionally identified to obtain the current operation scenario corresponding to the current demand expression. Among them, the current operation scenario is the current operation scenario for the slide. For example, for the current demand expression "I want to change the background color of the slide", the current demand expression is intentionally identified to obtain the current operation scenario "background editing" corresponding to the current demand expression, and then according to the current operation scenario "background editing", the candidate historical dialogues associated with the current "background editing" demand expression for the slide are determined from the multiple rounds of historical dialogues contained in the dialogue process. The historical dialogues with operation scenarios such as inserting title slides or content slides for slides as "slide operations" and the operation scenarios for slides containing content, such as adding pictures and adding texts on title slides, are all "editing content" for slides. Although they are also historical dialogues related to slides, they do not correspond to the current operation scenario corresponding to the current demand expression. It can effectively solve the modification needs of various scenarios involving slides in historical communication, and the first current reply expression generated based on the current demand expression does not correspond to the current operation scenario, which improves the accuracy of the reply expression and effectively improves the user experience. In addition, based on the generated first current response statement corresponding to the current demand statement, the accuracy of operations is improved when operating the presentation document.
[0151] Among them, the current operation scenario corresponding to the current demand expression can be marked with the help of the intention recognition big model. To this end, the current demand expression can be input into the pre-trained intention recognition big model to obtain the current operation scenario corresponding to the current demand expression.
[0152] It should be noted that the pre-trained intent recognition model has certain requirements for the input form. Therefore, according to the current demand expression, a prompt word can be constructed, and the prompt word can be input into the pre-trained intent recognition model to obtain the current operation scenario corresponding to the current demand expression. For the prompt word, in the model application stage, it can include two parts: input and instruction description. For the input, it can include the instructions represented by the above current demand expression, and for the instruction description, it usually indicates the task performed by the pre-trained first large model based on the input.
[0153] For the pre-trained intent recognition model, fine-tuning is required. Figure 4 FIG. 1 is a schematic diagram of an implementation flow of a method for fine-tuning a large model of intent recognition provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0154] S401, obtaining a preset operation scenario set, and obtaining an operation scenario from the preset operation scenario set.
[0155] In the embodiment of the present application, an operation scene set is pre-set, which includes multiple operation scenes, and each operation scene corresponds to a related function in the office software. For example, for the operation scene "background editing", it corresponds to the related function of slide background adjustment in the slide software.
[0156] Based on this, a preset operation scenario set is obtained, wherein the preset operation scenario set includes multiple operation scenarios, and the operation scenarios are obtained from the preset operation scenario set so as to form a learning corpus with the demand statement for learning by the intention recognition large model.
[0157] S402, generating a requirement statement corresponding to the operation scenario, and constructing a first prompt word of the intention recognition model according to the operation scenario and the requirement statement.
[0158] In the embodiment of the present application, for the operation scenario obtained from the preset operation scenario set, the requirement statement corresponding to the operation scenario can be obtained, and the first prompt word of the intention recognition large model is constructed according to the operation scenario and the requirement statement. The intention recognition large model can be any large language model currently on the market.
[0159] It should be noted that, in one embodiment of the present application, the first prompt word may be composed of three parts, namely input, output, and instruction description. The instruction description is usually pre-set and used to indicate what kind of task the schematic diagram recognition model performs based on the input. For input, it may include instructions represented by the demand statement. For output, it refers to the operation scenario, which is not limited in this embodiment of the present application.
[0160] S403: Input the first prompt word into the intention recognition model to obtain a predicted operation scenario.
[0161] S404, determining the loss between the operation scenario and the predicted operation scenario, and training the intent recognition model according to the loss.
[0162] S405, when the loss converges, stop training and obtain a pre-trained intent recognition large model.
[0163] In an embodiment of the present application, for the first prompt word constructed above, the first prompt word can be input into the intention recognition big model to obtain a predicted operation scenario, determine the loss between the operation scenario and the predicted operation scenario, and train the intention recognition big model according to the loss. When the loss converges, for example, the loss is less than a certain threshold, stop the training and obtain the pre-trained intention recognition big model.
[0164] By fine-tuning the intent recognition model in this way, a pre-trained intent recognition model is obtained. Subsequently, the current demand statement can be input into the pre-trained intent recognition model. The pre-trained intent recognition model outputs the current operation scenario corresponding to the current demand statement based on the correspondence between the learned operation scenario and the demand statement.
[0165] S303: According to the current operation scenario, determine a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process.
[0166] In an embodiment of the present application, for a current operation scenario corresponding to a current demand expression, a candidate historical dialogue associated with the current demand expression can be determined from multiple rounds of historical dialogues included in the dialogue process according to the current operation scenario.
[0167] There is a corresponding demand expression for each round of dialogue in the dialogue process, and the corresponding operation scenario can be marked by the above-mentioned operation scenario marking method. In this way, there is a corresponding historical operation scenario for each round of historical dialogue in the dialogue process.
[0168] Therefore, for each round of historical dialogue in the dialogue process, it is detected whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario corresponding to the current demand statement. If the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario corresponding to the current demand statement, the historical dialogue can be determined as a candidate historical dialogue associated with the current demand statement.
[0169] For example, for a certain round of historical dialogue in the dialogue process, assuming that the historical operation scenario corresponding to this round of historical dialogue is "editing background", and the current operation scenario corresponding to the current demand statement is also "editing background", it can be seen that the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario corresponding to the current demand statement, and the historical dialogue can be determined as a candidate historical dialogue associated with the current demand statement.
[0170] In addition, for the current demand expression in the conversation process, the user may have multiple intentions, which means there will be multiple current operation scenarios. Then, for any current operation scenario, the following operations are performed: for each round of historical conversations in the conversation process, detect whether the historical operation scenario corresponding to the historical conversation is the same as the current operation scenario corresponding to the current demand expression. If the historical operation scenario corresponding to the historical conversation is the same as the current operation scenario corresponding to the current demand expression, the historical conversation can be determined as a candidate historical conversation associated with the current demand expression. In this way, for any current operation scenario, a candidate historical conversation associated with the current demand expression can be obtained.
[0171] It should be noted that for any current operation scenario, the corresponding candidate historical conversations associated with the current demand statement can be merged with the current demand statement to obtain a content merging result, or the target historical conversations can be screened from these candidate historical conversations according to subsequent screening strategies and merged with the current demand statement to obtain a content merging result. The embodiments of the present application are not limited to this.
[0172] S304, merging the current demand expression and the candidate historical dialogues to obtain a content merging result.
[0173] In the embodiment of the present application, the current demand expression and the candidate historical conversations can be merged to obtain a content merging result. The content merging can be understood as splicing the current demand expression with the candidate historical conversations.
[0174] In addition, there is at least one candidate historical dialogue, which means there can be multiple candidate historical dialogues. However, the pre-trained first dialogue interaction large model has a limit on the length of the input, so the candidate historical dialogues need to be screened and then the content is merged.
[0175] Based on this, the deployment environment of the pre-trained first conversation interaction model is determined. According to the deployment environment, the length of the prompt word of the pre-trained first conversation interaction model is determined. According to the length of the prompt word, at least one candidate historical conversation is screened to obtain the target historical conversation. The current demand statement and the target historical conversation are content-merged to obtain the content merging result.
[0176] It should be noted that the deployment environment of the pre-trained first dialogue interaction large model determines the size of the pre-trained first dialogue interaction large model, which means that different deployment environments deploy different pre-trained first dialogue interaction large models, and the corresponding requirements for the length of the prompt words are also different. In this way, the length of the prompt words can be determined according to the deployment environment, and the candidate historical dialogues can be screened according to the length of the prompt words.
[0177] For example, for the pre-trained first conversation interaction large model, determine the deployment environment (PC side) of the pre-trained first conversation interaction large model, and determine the length of the prompt word of the pre-trained first conversation interaction large model as 4096 based on the deployment environment. Then, based on the length of the prompt word, screen at least one candidate historical conversation to obtain the target historical conversation, and merge the current demand expression with the target historical conversation to obtain the content merging result.
[0178] For example, for the pre-trained first conversation interaction large model, determine the deployment environment (mobile phone) of the pre-trained first conversation interaction large model, and determine the length of the prompt word of the pre-trained first conversation interaction large model as 1024 based on the deployment environment. Then, based on the length of the prompt word, screen at least one candidate historical conversation to obtain the target historical conversation, and merge the current demand expression with the target historical conversation to obtain the content merging result.
[0179] In the process of screening candidate historical dialogues, considering the coherence and relevance of the dialogue interaction, it is necessary to retain the candidate historical dialogue that is closest to the current demand expression in time. Based on this, at least one candidate historical dialogue is sorted according to the dialogue time to obtain a candidate historical dialogue sequence, and the target historical dialogue is selected from the candidate historical dialogue sequence according to the length of the prompt word.
[0180] It should be noted that at least one candidate historical dialogue can be sorted from front to back according to the dialogue time, which means that the candidate historical dialogue that is closer in time to the current demand expression is ranked higher. In this way, a candidate historical dialogue sequence can be obtained. According to the length of the prompt word, the top N candidate historical dialogues are selected from the candidate historical dialogue sequence as the target historical dialogues, where the general principle of selection is that the length of the target historical dialogue and the current demand expression cannot exceed the length of the prompt word.
[0181] S305: Construct a second prompt word of the pre-trained first dialogue interaction model according to the content merging result.
[0182] In the embodiment of the present application, for the content merging result obtained above, the second prompt word of the pre-trained first dialogue interaction large model can be constructed according to the content merging result. The model architecture of the pre-trained first dialogue interaction large model can be similar to the model architecture of the existing large language model, and the pre-trained first dialogue interaction large model can be obtained through fine-tuning, and the fine-tuning process is similar to the fine-tuning process of the above-mentioned intention recognition large model, which is not limited in the embodiment of the present application.
[0183] It should be noted that in one embodiment of the present application, the second prompt word is usually composed of three parts, namely input, output, and instruction description. The instruction description is usually pre-set and used to indicate what task the pre-trained first dialogue interaction model performs based on the input. The input refers to the merged result of the above content, and the output does not need to fill in the task content to let the pre-trained first dialogue interaction model perform the output. The embodiment of the present application does not limit this. In addition, in the model application stage, the second prompt word can include two parts, namely input and instruction description.
[0184] S306: Input the second prompt word into the pre-trained first dialogue interaction model to obtain a first current response expression corresponding to the current demand expression.
[0185] In an embodiment of the present application, for the second prompt word constructed above, the second prompt word can be input into the pre-trained first dialogue interaction model to obtain the first current reply expression corresponding to the current demand expression, and displayed through a dialog box to complete the dialogue interaction.
[0186] Among them, the current operation scenario corresponding to the current demand expression can be saved. The current round of dialogue is composed of the current demand expression and / or the current reply expression. The current round of dialogue corresponds to the current operation scenario, which is convenient for subsequent content merging.
[0187] In addition, in an embodiment of the present application, for the current demand expression, there may not be any candidate historical dialogues associated with the current demand expression. In this case, in the absence of candidate historical dialogues, a third prompt word of the pre-trained second dialogue interaction model is constructed according to the current demand expression, and the third prompt word is input into the pre-trained second dialogue interaction model to obtain the second current reply expression corresponding to the current demand expression, and is displayed through a dialog box to complete the dialogue interaction.
[0188] Among them, the pre-trained second dialogue interaction large model can be similar to the model architecture of the existing large language model, and the pre-trained second dialogue interaction large model can be obtained through fine-tuning, and the fine-tuning process is similar to the fine-tuning process of the above-mentioned intention recognition large model, which is not limited in the embodiment of the present application. In addition, the pre-trained first dialogue interaction large model and the pre-trained second dialogue interaction large model can be the same or different.
[0189] It should be noted that in one embodiment of the present application, the third prompt word is usually composed of three parts, namely input, output, and instruction description. The instruction description is usually pre-set and is used to indicate what task the pre-trained second dialogue interaction model performs based on the input. The input refers to the above-mentioned current demand expression, and the output does not need to fill in the task content to let the pre-trained second dialogue interaction model output. The embodiment of the present application does not limit this. In addition, in the model application stage, the third prompt word can include two parts, namely input and instruction description.
[0190] In this way, during the conversation process, the candidate historical conversations associated with the current demand statement can be determined from the multiple rounds of historical conversations included in the conversation process through operation scene marking, the current demand statement and the candidate historical conversations can be merged, and the first current reply statement corresponding to the current demand statement can be generated accordingly. This can ensure the consistency and relevance of the conversation interaction and avoid affecting the operation of related functions of the office software.
[0191] In addition, in the embodiment of the present application, several rounds of dialogue in the dialogue process are semantically related. For example, in the first round of dialogue in the dialogue process, the user enters the demand statement "I want to change the background color of the slide" through the dialog box, and in the second round of dialogue in the dialogue process, the user enters the demand statement "and adjust the size of the title text" through the dialog box. The two demand statements are semantically related and can be merged.
[0192] Based on this, Figure 5 FIG. 1 is a schematic diagram of an implementation flow of another dialog interaction method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0193] S501, obtaining the current demand expression during the conversation process.
[0194] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.
[0195] S502, for each round of historical dialogue in the dialogue process, determining the semantic relevance between the historical dialogue and the current demand expression.
[0196] S503: When the semantic relevance exceeds a preset semantic relevance threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current requirement expression.
[0197] In an embodiment of the present application, for each round of historical dialogue in the dialogue process, the semantic relevance between the historical dialogue and the current demand expression is determined. When the semantic relevance exceeds a preset semantic relevance threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
[0198] The current deep model can be used to determine the semantic relevance between the historical conversation and the current demand expression. Specifically, the historical conversation and the current demand expression can be spliced to obtain a splicing result, which is then input into the deep model to obtain the semantic relevance between the historical conversation and the current demand expression.
[0199] For example, for a round of historical dialogue in a conversation process, including historical demand expressions and historical response expressions, the historical demand expression is "I want to change the background color of the slide", the historical response expression is "Which color do you want to change to?", and the current demand expression is "and adjust the size of the title text", the semantic relevance between the historical dialogue and the current demand expression can be determined. When the semantic relevance exceeds a preset semantic relevance threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
[0200] S504, merging the current demand statement and the candidate historical dialogues to obtain a content merging result.
[0201] In the embodiment of the present application, this step is similar to the above-mentioned step S304, and the embodiment of the present application will not be described one by one here.
[0202] S505: Construct a second prompt word of the pre-trained first dialogue interaction model according to the content merging result.
[0203] In the embodiment of the present application, this step is similar to the above-mentioned step S305, and the embodiment of the present application will not be described one by one here.
[0204] S506: Input the second prompt word into the pre-trained first dialogue interaction model to obtain a first current response expression corresponding to the current demand expression.
[0205] In the embodiment of the present application, this step is similar to the above-mentioned step S306, and the embodiment of the present application will not be described one by one here.
[0206] In this way, through semantic relevance, the candidate historical dialogues associated with the current demand expression are determined from the multiple rounds of historical dialogues included in the dialogue process, the current demand expression and the candidate historical dialogues are merged, and the first current reply expression corresponding to the current demand expression is generated accordingly. This can ensure the coherence and relevance of the dialogue interaction and avoid affecting the operation of related functions of the office software.
[0207] In addition, in the embodiment of the present application, for several rounds of dialogue in the dialogue process, if they are similar, the content can be merged. Figure 6 FIG. 1 is a schematic diagram of an implementation flow of another dialog interaction method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0208] S601, obtaining the current demand expression during the conversation process.
[0209] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.
[0210] S602, for each round of historical dialogue in the dialogue process, vectorize the historical dialogue to obtain a historical dialogue vector.
[0211] S603, vectorizing the current demand expression to obtain a current dialogue vector, and determining the similarity between the historical dialogue vector and the current dialogue vector.
[0212] S604: When the similarity is greater than a preset similarity threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
[0213] In an embodiment of the present application, for each round of historical conversation in the conversation process, the historical conversation is vectorized to obtain a historical conversation vector, the current demand expression is vectorized to obtain a current conversation vector, and the similarity between the historical conversation vector and the current conversation vector is determined. When the similarity is greater than a preset similarity threshold, the historical conversation is determined as a candidate historical conversation associated with the current demand expression.
[0214] Among them, for the vectorization processing of historical conversations and the vectorization processing of current demand expressions, the vector models currently available on the market can be used. For the determination of the similarity between the historical conversation vector and the current conversation vector, for example, the cosine distance can be used for calculation, which is not limited in the embodiments of the present application.
[0215] S605, merging the current demand expression and the candidate historical dialogues to obtain a content merging result.
[0216] In the embodiment of the present application, this step is similar to the above-mentioned step S304, and the embodiment of the present application will not be described one by one here.
[0217] S606: Construct a second prompt word of the pre-trained first dialogue interaction model according to the content merging result.
[0218] In the embodiment of the present application, this step is similar to the above-mentioned step S305, and the embodiment of the present application will not be described one by one here.
[0219] S607, input the second prompt word into the pre-trained first dialogue interaction model to obtain a first current response expression corresponding to the current demand expression.
[0220] In the embodiment of the present application, this step is similar to the above-mentioned step S306, and the embodiment of the present application will not be described one by one here.
[0221] In this way, through similarity, the candidate historical dialogues associated with the current demand expression are determined from the multiple rounds of historical dialogues included in the dialogue process, the current demand expression and the candidate historical dialogues are merged, and the first current reply expression corresponding to the current demand expression is generated accordingly. This can ensure the consistency and relevance of the dialogue interaction and avoid affecting the operation of related functions of the office software.
[0222] Corresponding to the above method embodiment, the present application embodiment also provides a dialogue interaction device, such as Figure 7 As shown, the device may include: a statement acquisition module 710, a dialogue determination module 720, and a statement generation module 730.
[0223] The expression acquisition module 710 is used to acquire the current demand expression during the conversation;
[0224] A dialogue determination module 720, configured to determine a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process;
[0225] The expression generation module 730 is used to generate a first current reply expression corresponding to the current demand expression according to the current demand expression and the determined candidate historical dialogues.
[0226] In an optional implementation, the dialogue determination module specifically includes:
[0227] A scenario determination submodule, used to perform intent recognition on the current demand expression to obtain a current operation scenario corresponding to the current demand expression;
[0228] The dialogue determination submodule is used to determine, according to the current operation scenario, a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process.
[0229] In an optional implementation, the scene determination submodule is specifically used to:
[0230] The current demand expression is input into the pre-trained intention recognition large model to obtain the current operation scenario corresponding to the current demand expression.
[0231] In an optional embodiment, the device further includes a large model training module, which is specifically used to:
[0232] Obtaining a preset operation scenario set, and obtaining an operation scenario from the preset operation scenario set;
[0233] Generate a requirement statement corresponding to the operation scenario, and construct a first prompt word of the intention recognition model according to the operation scenario and the requirement statement;
[0234] Inputting the first prompt word into the intention recognition large model to obtain a predicted operation scenario;
[0235] Determine the loss between the operation scenario and the predicted operation scenario, and train the intention recognition model according to the loss;
[0236] When the loss converges, the training is stopped to obtain a pre-trained intent recognition large model.
[0237] In an optional implementation, each round of historical dialogue in the dialogue process has a corresponding historical operation scenario; the dialogue determination submodule specifically includes:
[0238] A scene detection unit, configured to detect, for each round of historical dialogue in the dialogue process, whether the historical operation scene corresponding to the historical dialogue is the same as the current operation scene;
[0239] The dialogue determining unit is used to determine the historical dialogue as a candidate historical dialogue associated with the current demand statement when the historical operation scenario is the same as the current operation scenario.
[0240] In an optional implementation, the number of the current operation scene is at least one; and the scene detection unit is specifically configured to:
[0241] For any of the current operation scenarios, perform the following processing:
[0242] For each round of historical dialogue in the dialogue process, it is detected whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario.
[0243] In an optional implementation, the dialogue determination module is specifically configured to:
[0244] For each round of historical dialogue in the dialogue process, determining the semantic relevance between the historical dialogue and the current demand expression; if the semantic relevance exceeds a preset semantic relevance threshold, determining the historical dialogue as a candidate historical dialogue associated with the current demand expression;
[0245] or,
[0246] For each round of historical dialogue in the dialogue process, the historical dialogue is vectorized to obtain a historical dialogue vector; the current demand expression is vectorized to obtain a current dialogue vector, and the similarity between the historical dialogue vector and the current dialogue vector is determined; when the similarity is greater than a preset similarity threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
[0247] In an optional implementation, the expression generation module specifically includes:
[0248] A content merging submodule, used to merge the current demand expression with the candidate historical dialogue to obtain a content merging result;
[0249] A statement generation submodule, used for generating a first current response statement corresponding to the current demand statement according to the content merging result;
[0250] Wherein, the expression generation submodule is specifically used for:
[0251] Constructing a second prompt word of the pre-trained first dialogue interaction model according to the content merging result;
[0252] The second prompt word is input into the pre-trained first dialogue interaction large model to obtain a first current response expression corresponding to the current demand expression.
[0253] In an optional implementation, the number of the candidate historical conversations is at least one; and the content merging submodule specifically includes:
[0254] A length determination unit, used to determine the length of the prompt word of the pre-trained first dialogue interaction large model;
[0255] A dialogue screening unit, configured to screen at least one of the candidate historical dialogues according to the length of the prompt word to obtain a target historical dialogue;
[0256] The content merging unit is used to merge the current demand expression with the target historical dialogue to obtain a content merging result.
[0257] In an optional implementation, the dialogue screening unit is specifically used to:
[0258] sorting at least one of the candidate historical conversations according to the conversation time to obtain a candidate historical conversation sequence;
[0259] A target historical dialogue is selected from the candidate historical dialogue sequences according to the length of the prompt word.
[0260] In an optional implementation, the expression generation module is further used to:
[0261] When the candidate historical dialogue does not exist, constructing a third prompt word of the pre-trained second dialogue interaction model according to the current demand expression;
[0262] The third prompt word is input into the pre-trained second dialogue interaction model to obtain a second current response expression corresponding to the current demand expression.
[0263] The present application also provides an electronic device, such as Figure 8 As shown, it includes a processor 81, a communication interface 82, a memory 83 and a communication bus 84, wherein the processor 81, the communication interface 82, and the memory 83 communicate with each other through the communication bus 84.
[0264] A memory 83, for storing computer programs;
[0265] The processor 81 is used to execute the program stored in the memory 83 to implement the following steps:
[0266] Acquire a current demand expression in a conversation process; determine candidate historical conversations associated with the current demand expression from multiple rounds of historical conversations included in the conversation process; and generate a first current reply expression corresponding to the current demand expression based on the current demand expression and the determined candidate historical conversations.
[0267] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0268] The communication interface is used for communication between the above electronic device and other devices.
[0269] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0270] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0271] In another embodiment provided in the present application, a storage medium is also provided, in which instructions are stored. When the storage medium is executed on a computer, the computer executes the dialogue interaction method described in any one of the above embodiments.
[0272] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the dialog interaction method described in any one of the above embodiments.
[0273] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a storage medium, or transmitted from one storage medium to another storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0274] 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.
[0275] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0276] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A conversation interaction method, characterized in that: The method comprises: Get the current demand expression during the conversation; Determining, from multiple rounds of historical dialogues included in the dialogue process, candidate historical dialogues associated with the current demand expression; A first current reply expression corresponding to the current demand expression is generated according to the current demand expression and the determined candidate historical dialogues.
2. The method according to claim 1, characterized in that The step of determining a candidate historical dialogue associated with the current demand expression from the multiple rounds of historical dialogues included in the dialogue process includes: Performing intent recognition on the current demand expression to obtain a current operation scenario corresponding to the current demand expression; According to the current operation scenario, candidate historical dialogues associated with the current demand expression are determined from multiple rounds of historical dialogues included in the dialogue process.
3. The method according to claim 2, characterized in that The performing intention recognition on the current demand expression to obtain a current operation scenario corresponding to the current demand expression includes: The current demand expression is input into the pre-trained intention recognition large model to obtain the current operation scenario corresponding to the current demand expression.
4. The method according to claim 3, characterized in that The pre-trained intent recognition large model is obtained specifically in the following way: Obtaining a preset operation scenario set, and obtaining an operation scenario from the preset operation scenario set; Generate a requirement statement corresponding to the operation scenario, and construct a first prompt word of the intention recognition model according to the operation scenario and the requirement statement; Inputting the first prompt word into the intention recognition large model to obtain a predicted operation scenario; Determine the loss between the operation scenario and the predicted operation scenario, and train the intention recognition model according to the loss; When the loss converges, the training is stopped to obtain a pre-trained intent recognition large model.
5. The method according to claim 2, characterized in that: Each round of historical dialogue in the dialogue process has a corresponding historical operation scenario; According to the current operation scenario, determining a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process includes: For each round of historical dialogue in the dialogue process, detecting whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario; In a case where the historical operation scenario is the same as the current operation scenario, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
6. The method according to claim 5, characterized in that: The number of the current operation scenarios is at least one; The detecting, for each round of historical dialogue in the dialogue process, whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario includes: For any of the current operation scenarios, perform the following processing: For each round of historical dialogue in the dialogue process, it is detected whether the historical operation scenario corresponding to the historical dialogue is the same as the current operation scenario.
7. The method according to claim 1, characterized in that The step of determining a candidate historical dialogue associated with the current demand expression from the multiple rounds of historical dialogues included in the dialogue process includes: For each round of historical dialogue in the dialogue process, determining the semantic relevance between the historical dialogue and the current demand expression; if the semantic relevance exceeds a preset semantic relevance threshold, determining the historical dialogue as a candidate historical dialogue associated with the current demand expression; or, For each round of historical dialogue in the dialogue process, the historical dialogue is vectorized to obtain a historical dialogue vector; the current demand expression is vectorized to obtain a current dialogue vector, and the similarity between the historical dialogue vector and the current dialogue vector is determined; when the similarity is greater than a preset similarity threshold, the historical dialogue is determined as a candidate historical dialogue associated with the current demand expression.
8. The method according to claim 1 or 7, characterized in that: Generating a first current reply expression corresponding to the current demand expression according to the current demand expression and the determined candidate historical dialogues includes: Merging the content of the current demand expression with the candidate historical conversations to obtain a content merging result; Generate a first current response statement corresponding to the current demand statement according to the content merging result; The step of generating a first current reply expression corresponding to the current demand expression according to the content merging result includes: Constructing a second prompt word of the pre-trained first dialogue interaction model according to the content merging result; The second prompt word is input into the pre-trained first dialogue interaction large model to obtain a first current response expression corresponding to the current demand expression.
9. The method according to claim 8, characterized in that: The number of the candidate historical dialogues is at least one; The step of merging the content of the current demand statement with the candidate historical dialogue to obtain a content merging result includes: Determine the length of the prompt word of the pre-trained first dialogue interaction large model; Screening at least one of the candidate historical dialogues according to the length of the prompt word to obtain a target historical dialogue; The current demand statement and the target historical dialogue are content-merged to obtain a content merging result.
10. The method according to claim 9, characterized in that The step of screening at least one of the candidate historical dialogues according to the length of the prompt word to obtain a target historical dialogue includes: sorting at least one of the candidate historical conversations according to the conversation time to obtain a candidate historical conversation sequence; A target historical dialogue is selected from the candidate historical dialogue sequences according to the length of the prompt word.
11. The method according to claim 1, characterized in that: The method further comprises: When the candidate historical dialogue does not exist, constructing a third prompt word of the pre-trained second dialogue interaction model according to the current demand expression; The third prompt word is input into the pre-trained second dialogue interaction model to obtain a second current response expression corresponding to the current demand expression.
12. A conversational interaction device, characterized in that: The device comprises: The expression acquisition module is used to obtain the current demand expression during the dialogue process; A dialogue determination module, configured to determine a candidate historical dialogue associated with the current demand expression from multiple rounds of historical dialogues included in the dialogue process; The expression generation module is used to generate a first current reply expression corresponding to the current demand expression according to the current demand expression and the determined candidate historical dialogues.
13. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.