Multi-role agent interaction method and device, electronic equipment and readable storage medium
Patent Information
- Application Number
- CN202610758772.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-28
- Publication Date
- 2026-08-18
AI Technical Summary
[0004]然而,这种方式需要消耗大量计算资源,当参与的角色智能体数量较多时,会产生大量无效的推理计算,从而影响交互响应的及时性,并增加系统侧的计算资源开销
[0016] This application provides a multi-role intelligent agent interaction method, comprising: acquiring interaction information input by a user in a conversation window, and determining multiple role intelligent agents participating in the current conversation, wherein each role intelligent agent is associated with an NFC device; controlling each role intelligent agent to start a response generation task execution process, and determining at least one target role intelligent agent from among the role intelligent agents based on the interaction information and the user's conversation history context information in the conversation window; after determining the target role intelligent agent, controlling the other role intelligent agents among the role intelligent agents to exit the response generation task execution process; acquiring the first response content generated by the target role intelligent agent in response to the interaction information, and outputting the first response content in the conversation window.
Smart Images

Figure CN122602124A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of near-field communication technology, and in particular to a multi-role intelligent agent interaction method, device, electronic device, and readable storage medium. Background Technology
[0002] With the development of near field communication (NFC) technology, it has been widely used in various interactive products. In interactive scenarios such as games, social entertainment, and virtual companionship, users typically need to interact and converse with multiple intelligent agents with independent settings and personality traits simultaneously. Each intelligent agent can be carried and activated by an independent NFC device.
[0003] Currently, for user interactions with multi-role intelligent agents, the system typically receives the interaction information entered by the user in the conversation window, calls all the intelligent agents currently participating in the conversation to generate complete response content, and then the system or the user selects one or more of them for display.
[0004] However, this approach requires a large amount of computing resources. When there are many participating agents, it generates a lot of invalid reasoning calculations, which affects the timeliness of interactive responses and increases the computing resource overhead on the system side. Summary of the Invention
[0005] The main objective of this application is to provide a multi-role intelligent agent interaction method, device, electronic device, and readable storage medium, which aims to improve the timeliness of interaction response while ensuring the accuracy of interaction and reducing the computational resource overhead on the system side.
[0006] This application provides a multi-role intelligent agent interaction method, the method comprising: The system acquires interactive information input by the user in the conversation window and identifies multiple role agents participating in the current conversation, wherein each role agent is associated with an NFC device. Control each of the aforementioned role-intelligent agents to initiate the response generation task execution process, and determine at least one target role-intelligent agent from among the aforementioned role-intelligent agents based on the interaction information and the user's session history context information in the session window; After determining the target role agent, control the other role agents among the role agents except the target role agent to exit the response generation task execution process; Obtain the first response content generated by the target role agent in response to the interaction information, and output the first response content in the conversation window.
[0007] In one embodiment, the step of determining at least one target role agent from among the role agents based on the interaction information and the user's session history context information in the session window includes: Based on the interaction information, at least one first candidate role agent is determined from each of the role agents; The last active role agent in the session history context information is identified as the second candidate role agent. At least one target role agent is determined from the first candidate role agent and the second candidate role agent.
[0008] In one embodiment, the step of determining at least one first candidate role agent from among the role agents based on the interaction information includes: The large language model is invoked to perform semantic analysis on the interaction information; If the analysis reveals that the interaction information contains a user-specified identifier that indicates a specific role agent, then the specific role agent is selected as the first candidate role agent. If the analysis output of the interaction information contains information expressing the intention to switch roles, then at least one of the role agents other than the role agent currently active in the session window will be selected as the first candidate role agent. If the analysis determines that the interaction information is a group message directed at all role agents, then each of the aforementioned role agents will be considered as the first candidate role agent.
[0009] In one embodiment, the step of outputting the first reply content in the session window includes: Obtain the content output rhythm parameters associated with the target role agent, and divide the first reply content into multiple text paragraphs according to line breaks; Based on the output rhythm parameters and the number of characters in each text segment, the output delay time of each text segment is calculated. According to the output delay time of each text segment, each text segment is sequentially streamed in the session window.
[0010] In one embodiment, the step of controlling each of the said role agents to initiate the response generation task execution process includes: Retrieve historical session data of the user in the session window within the historical period; Based on the historical session data, determine the probability that each of the aforementioned role agents is selected as the target role agent; Control each role-based intelligent agent whose selection probability is greater than a preset probability threshold to start the response generation task execution process.
[0011] In one embodiment, the step of determining the selection probability of each of the aforementioned role agents being identified as the target role agent based on the historical session data includes: Extract multiple historical interaction information and the corresponding historical target role intelligent agent from the historical session data; The interaction information is semantically similar to each of the historical interaction information, and each of the historical interaction information whose semantic similarity with the interaction information is greater than a preset similarity threshold is regarded as similar interaction information. The frequency of each of the aforementioned role-based intelligent agents in the historical target role-based intelligent agents corresponding to each of the aforementioned similar interaction information is statistically analyzed. The ratio between the frequency of occurrence of each of the aforementioned role agents and the total number of interactions in the historical session data is used as the selection probability of each of the aforementioned role agents.
[0012] In one embodiment, after the step of outputting the first reply content in the session window, the method further includes: Call at least one of the other role agents besides the target role agent to generate a second response to the first response; The second reply content is output in the conversation window.
[0013] Furthermore, to achieve the above objectives, this application also provides a multi-role intelligent agent interaction device, the device comprising: The data acquisition module is used to acquire the interactive information entered by the user in the conversation window and to identify multiple role agents participating in the current conversation, wherein each role agent is associated with an NFC device. The agent determination module is used to control each of the said role agents to start the response generation task execution process, and to determine at least one target role agent from each of the said role agents based on the interaction information and the user's session history context information in the session window. The control module is used to control other role intelligent agents besides the target role intelligent agent to exit the response generation task execution process after the target role intelligent agent is determined. The response content output module is used to obtain the first response content generated by the target role agent in response to the interaction information, and output the first response content in the conversation window.
[0014] In addition, to achieve the above objectives, this application also provides an electronic device, the electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the multi-role intelligent agent interaction method as described above.
[0015] In addition, to achieve the above objectives, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the multi-role intelligent agent interaction method as described above.
[0016] This application provides a multi-role intelligent agent interaction method, comprising: acquiring interaction information input by a user in a conversation window, and determining multiple role intelligent agents participating in the current conversation, wherein each role intelligent agent is associated with an NFC device; controlling each role intelligent agent to start a response generation task execution process, and determining at least one target role intelligent agent from among the role intelligent agents based on the interaction information and the user's conversation history context information in the conversation window; after determining the target role intelligent agent, controlling the other role intelligent agents among the role intelligent agents to exit the response generation task execution process; acquiring the first response content generated by the target role intelligent agent in response to the interaction information, and outputting the first response content in the conversation window.
[0017] Therefore, the technical solution provided in this application, after acquiring the interaction information input by the user in the conversation window and identifying multiple role agents participating in the current conversation, controls each role agent to start the response generation task execution process, and synchronously determines the target role agent based on the interaction information and conversation history context information. This allows response generation and role decision-making to be executed in parallel, avoiding the serial waiting of decision-making followed by generation, thereby improving the timeliness of the interaction response. Furthermore, after determining the target role agent, by controlling other role agents to exit the response generation task execution process, invalid inference calculations of non-target role agents are terminated in a timely manner, thereby reducing the computational resource overhead on the system side. At the same time, since the determination of the target role agent is based on the interaction information and conversation history context information, it is a responder selected from among the role agents that matches the current dialogue context, rather than relying on preset rules or random selection, thus ensuring the accuracy of the final output response content.
[0018] In summary, the technical solution provided in this application can improve the timeliness of interactive response while ensuring the accuracy of interaction, and reduce the computational resource overhead on the system side. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating the multi-role intelligent agent interaction method provided in the first embodiment of this application; Figure 2 A flowchart illustrating the multi-role intelligent agent interaction method provided in the second embodiment of this application; Figure 3 A flowchart illustrating the multi-role intelligent agent interaction method provided in the third embodiment of this application; Figure 4 A schematic diagram of the module structure of the multi-role intelligent agent interaction device provided in the embodiments of this application; Figure 5 This is a schematic diagram of the hardware operating environment involved in the embodiments of this application.
[0022] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0023] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0024] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0025] With the development of near field communication (NFC) technology, it has been widely used in various interactive products. In interactive scenarios such as games, social entertainment, and virtual companionship, users typically need to interact and converse with multiple intelligent agents with independent settings and personality traits simultaneously. Each intelligent agent can be carried and activated by an independent NFC device.
[0026] Currently, for user interactions with multi-role intelligent agents, the system typically receives the interaction information entered by the user in the conversation window, calls all the intelligent agents currently participating in the conversation to generate complete response content, and then the system or the user selects one or more of them for display.
[0027] However, this approach requires a large amount of computing resources. When there are many participating agents, it generates a lot of invalid reasoning calculations, which affects the timeliness of interactive responses and increases the computing resource overhead on the system side.
[0028] Based on this, this application provides a multi-role intelligent agent interaction method, including: acquiring interaction information input by a user in a conversation window, and determining multiple role intelligent agents participating in the current conversation, wherein each role intelligent agent is associated with an NFC device; controlling each role intelligent agent to start a response generation task execution process, and determining at least one target role intelligent agent from among the role intelligent agents based on the interaction information and the user's conversation history context information in the conversation window; after determining the target role intelligent agent, controlling the other role intelligent agents among the role intelligent agents except the target role intelligent agent to exit the response generation task execution process; acquiring the first response content generated by the target role intelligent agent in response to the interaction information, and outputting the first response content in the conversation window.
[0029] Therefore, the technical solution provided in this application, after acquiring the interaction information input by the user in the conversation window and identifying multiple role agents participating in the current conversation, controls each role agent to start the response generation task execution process, and synchronously determines the target role agent based on the interaction information and conversation history context information. This allows response generation and role decision-making to be executed in parallel, avoiding the serial waiting of decision-making followed by generation, thereby improving the timeliness of the interaction response. Furthermore, after determining the target role agent, by controlling other role agents to exit the response generation task execution process, invalid inference calculations of non-target role agents are terminated in a timely manner, thereby reducing the computational resource overhead on the system side. At the same time, since the determination of the target role agent is based on the interaction information and conversation history context information, it is a responder selected from among the role agents that matches the current dialogue context, rather than relying on preset rules or random selection, thus ensuring the accuracy of the final output response content.
[0030] In summary, the technical solution provided in this application can improve the timeliness of interactive response while ensuring the accuracy of interaction, and reduce the computational resource overhead on the system side.
[0031] The executing entity of the multi-role intelligent agent interaction method of this application can be an electronic device with data processing, network communication and program running functions. For example, it can be a control system, control circuit, etc. that can realize the above functions. This embodiment does not specifically limit it.
[0032] The following description uses an electronic device as the execution subject to illustrate the various embodiments.
[0033] This application proposes a multi-role intelligent agent interaction method according to a first embodiment. Please refer to [link / reference]. Figure 1 The multi-role intelligent agent interaction method may include steps S10~S40: Step S10: Obtain the interaction information entered by the user in the conversation window, and determine the multiple role agents participating in the current conversation, wherein each role agent is associated with an NFC device. It should be noted that interactive information refers to text, voice, or image information entered by the user in the input area of the conversation window for dialogue interaction with the intelligent role. This embodiment does not specifically limit this. The conversation window refers to the visual interface through which the user interacts with the intelligent role, such as a chat window or dialog box. An intelligent role is a virtual dialogue entity with independent personality traits, speaking style, and knowledge background. Each intelligent role can call a large language model to generate response content based on the user's interactive information. An NFC device refers to a physical or virtual carrier using near-field communication technology. Each intelligent role is associated with an NFC device, and the user can activate the corresponding intelligent role to participate in the conversation by touching or scanning the NFC device.
[0034] When determining multiple role agents participating in the current session, in one feasible implementation, an activation signal generated by the user touching or scanning at least one NFC device can be acquired; based on the activation signal, the role agent associated with the touched or scanned NFC device is determined as the role agent participating in the current session. In another feasible implementation, multiple role identifiers selected by the user in the role selection interface of the session window can be acquired; the role agents corresponding to each role identifier are determined as the respective role agents participating in the current session. This embodiment does not impose specific limitations on this.
[0035] Step S20: Control each role agent to start the response generation task execution process, and determine at least one target role agent from each role agent based on the interaction information and the user's session history context information in the session window. It should be noted that the response generation task execution process refers to the computational task process of calling the large language model to generate response content for the role agent in response to the interaction information. The conversation history context information refers to the interaction records formed by the user and various role agents during the historical time period of the current conversation window. This can include the user's historical input interaction information and the historical output response content of each role agent. The target role agent refers to the role agent determined from the various role agents participating in the current conversation, which is used to respond to the current interaction information.
[0036] In this embodiment, "controlling each role's intelligent agent to start the response generation task execution process" and "determining at least one target role's intelligent agent from among the role's intelligent agents based on the interaction information and the user's session history context information in the session window" are two actions executed in parallel. That is, the system simultaneously executes the process of determining the target role's intelligent agent while starting the response generation task.
[0037] In one feasible implementation, step S20 may include steps S21 to S23: Step S21: Based on the interaction information, determine at least one first candidate role agent from among the role agents; It should be noted that the first candidate agent refers to the agent that is initially selected based on the user's current input interaction information and is likely suitable to respond.
[0038] When determining at least one first candidate role agent from among the role agents based on the interaction information, a large language model can be invoked to perform semantic analysis on the interaction information. If the analysis reveals that the interaction information contains a user-specified identifier that instructs a specific role agent, then that specific role agent is selected as the first candidate role agent. If the analysis reveals that the output interaction information contains information expressing the intention to switch roles, then at least one role agent other than the role agent currently active in the conversation window is selected as the first candidate role agent. If the analysis reveals that the interaction information is a group message directed to all role agents, then all role agents are selected as the first candidate role agents.
[0039] User-specified identifiers refer to markers in the interaction information that explicitly point to a specific role agent, such as mention symbols in the format "@roleA" or text content that directly calls out the role's name. Expressions of role-switching intent refer to semantic content in the interaction information indicating that the user wishes to change the current dialogue partner, such as expressions like "let someone else speak" or "let someone else answer." Group messages refer to semantic content in the interaction information that is directed to all or most of the role agents participating in the conversation, such as expressions containing titles like "you," "everyone," or "all."
[0040] For example, if a user enters "@roleA, what do you think of this issue?", the system will identify "@roleA" as a user-specified identifier for role A through semantic analysis, and then determine role A as the first candidate role agent.
[0041] If the user enters "Let someone else answer", and the currently active role is role B, the system can identify some or all of the other role agents participating in the current conversation, such as role A and role C, as the first candidate role agent.
[0042] If the user enters "What do you think?", the system identifies "you" through semantic analysis as referring to all the role agents participating in the current session, and then determines all candidate role agents as the first candidate role agent.
[0043] Understandably, by utilizing large language models to perform refined semantic analysis of user interaction information, the type of intent contained in the user's current speech can be accurately identified. Based on this analysis, the system can accurately select the first candidate agent that matches the user's intent from among the various agents participating in the current conversation. This provides a reliable decision-making basis for subsequently determining the target agent by combining conversation history context information, thereby effectively improving the rationality of role selection and the smoothness of the user interaction experience.
[0044] Step S22: Determine the last active role agent in the session history context information as the second candidate role agent; It should be noted that the last active agent in the historical context information refers to the agent that output a reply in the most recent conversational interaction before the current input of the interaction information.
[0045] When determining the last active role agent in the session history context as the second candidate role agent, in one feasible implementation set, the speaker identifier corresponding to each interaction can be extracted from the session history context information; the speaker identifiers are sorted according to time order, and the role agent corresponding to the speaker identifier closest to the current time is determined as the last active role agent. Alternatively, a state variable can be maintained in the interaction record of the session window to record the role agent identifier of the most recent output reply content. Thus, the role agent pointed to by this state variable can be directly read as the second candidate role agent. This embodiment does not specifically limit the implementation method of step S22.
[0046] Step S23: Determine at least one target role agent from the first candidate role agent and the second candidate role agent.
[0047] When determining at least one target role agent from the first candidate role agent and the second candidate role agent, in one feasible implementation, if the first candidate role agent is determined based on a user-specified identifier and / or based on the expression information of role switching intention, then the first candidate role agent is selected as the target role agent; otherwise, the second candidate role agent is selected as the target role agent. In another feasible implementation, a large language model can be invoked to comprehensively evaluate the first and second candidate role agents, selecting the role agent with the highest matching degree with the current dialogue context as the target role agent based on the semantic content of the interaction information and the coherence of the conversation history context. This embodiment does not specifically limit the implementation method of step S23.
[0048] In this implementation, a first candidate agent is initially selected based on the user's current input interaction information. This first candidate agent reflects the user's immediate intent expressed in the current interaction. Simultaneously, a second candidate agent is determined based on the conversation history context. This second candidate agent represents the active role in the previous round of dialogue, reflecting the continuity of the conversation. Based on this, the target agent is determined by comprehensively considering the first and second candidate agents. This ensures that the final selected responder can respond to the user's explicit intent expressed in the interaction (such as specifying or switching roles) while also maintaining the continuity of the conversation even when the user does not express an explicit intent. This approach ensures the accuracy of role selection while improving the interactive experience of multi-turn dialogues.
[0049] This embodiment does not specifically limit the implementation of step S20. For example, in other feasible implementations, a large language model can be invoked to analyze the interaction information and the session history context information to identify whether the interaction information contains a user-specified identifier that indicates a specific role agent; if it does, the specific role agent is identified as the target role agent; if it does not, the last active role agent in the session history context information is identified as the target role agent.
[0050] Step S30: After determining the target role agent, control the other role agents besides the target role agent to exit the response generation task execution process. It should be noted that exiting the response generation task execution process terminates the corresponding response generation task and releases the computing resources occupied by the task.
[0051] Step S40: Obtain the first response content generated by the target role agent in response to the interaction information, and output the first response content in the conversation window.
[0052] It should be noted that the first response content refers to the reply text generated by the target agent in response to the user's input interaction information by calling the large language model. To improve the coherence of the interaction, the target agent can rely on the conversation history context information when generating the first response content.
[0053] In one feasible implementation, the step of outputting the first reply content in the session window may include steps S41-S43: Step S41: Obtain the content output rhythm parameters associated with the target agent, and divide the first reply content into multiple text paragraphs according to the newline character; It should be noted that the content output rhythm parameter refers to a preset value associated with the personality traits or behavioral settings of the target agent, used to control the speed at which it outputs response content, such as the number of characters per second or the character output speed. Different agents can be configured with different content output rhythm parameters to reflect their personalized expression styles.
[0054] When obtaining the content output rhythm parameters associated with the target character agent, in one feasible implementation, a pre-stored base output speed can be read from the target character agent's character configuration file as the content output rhythm parameter. This base output speed can be set to different levels according to the character's personality (e.g., a faster output speed for an impatient type and a slower output speed for a calm type). In another feasible implementation, the base output speed can be dynamically adjusted according to the target character agent's emotional state in the current conversation context to obtain a real-time output speed, which can then be used as the content output rhythm parameter to simulate the changes in expression rhythm under different emotions. This embodiment does not specifically limit the implementation of step S41.
[0055] Step S42: Calculate the output delay time of each text segment based on the content output rhythm parameter and the number of characters in each text segment; It should be noted that the output delay time refers to the time interval that the system needs to wait before outputting the current text paragraph, and its value determines the speed at which the paragraph is displayed.
[0056] When calculating the output delay time of each text segment based on the content output rhythm parameter and the number of characters in each text segment, in one feasible implementation, the number of characters in each text segment can be multiplied by the content output rhythm parameter to obtain the base delay time of that segment; on this basis, a random fluctuation value within a preset range (e.g., 0.9~1.1) is added to obtain the final output delay time. For example, the specific calculation process can be expressed as: Output delay time = min(max(number of characters × content output rhythm parameter × random fluctuation value, 1.0), 5.0). In another feasible implementation, the output delay time of a text segment can be calculated only when the number of characters in the text segment is greater than a set threshold; for text segments with a number of characters less than or equal to the threshold, a fixed minimum delay time can be set or the text can be output directly to avoid excessively fragmented delays affecting the user's reading experience. This embodiment does not specifically limit the implementation of step S42.
[0057] Step S43: Output each text segment sequentially in the session window according to the output delay time of each text segment.
[0058] It should be noted that sequential streaming output refers to the process of pushing each text paragraph to the session window for display one by one, according to the original order of the text paragraphs in the first reply, with a corresponding output delay time between each two text paragraphs.
[0059] In this implementation, firstly, based on the personalized content output rhythm parameters associated with the target agent, and combined with the paragraph structure formed by line breaks in the first reply content, a differentiated output delay time is calculated for each text paragraph. Then, the paragraphs are displayed sequentially in the conversation window according to this delay time. This process allows the replies of different agents to exhibit an output rhythm that matches their respective personality traits (for example, an impatient agent's paragraphs are tightly connected and output is rapid, while a composed agent has slightly longer pauses between paragraphs and outputs at a more leisurely pace). This enhances the realism and recognizability of the agents at a detailed level, creating a more natural and vivid multi-agent interactive experience for users.
[0060] This embodiment does not specifically limit the implementation of step S40. For example, in other feasible implementations, the first reply content can also be directly output and displayed in the chat window in complete text form at once.
[0061] Furthermore, in one feasible implementation, before outputting the first reply content in the conversation window, the first reply content can be filtered for validity to remove invalid reply content that does not meet the preset output conditions, thereby avoiding displaying meaningless or incorrect reply information to the user. Specifically, it can detect whether the first reply content is empty, whether it is a preset invalid marker (such as "none", "nothing", or other placeholders), or whether it contains prohibited sensitive words; if the first reply content passes the validity filter, the step of outputting the first reply content in the conversation window continues; if the first reply content fails the validity filter, the output of the first reply content is abandoned, and a preset default reply or prompt information can be selectively output. Thus, this implementation can effectively avoid invalid content interfering with the user's interactive experience due to abnormal large language model generation, incorrect role agent configuration, or network transmission problems, thereby improving the reliability of multi-role agent interaction.
[0062] As can be seen from the above, the technical solution provided in this embodiment, after acquiring the interaction information input by the user in the conversation window and identifying multiple role agents participating in the current conversation, controls each role agent to start the response generation task execution process, and synchronously determines the target role agent based on the interaction information and conversation history context information. This allows response generation and role decision-making to be executed in parallel, avoiding the serial waiting of decision-making followed by generation, thereby improving the timeliness of the interaction response. Furthermore, after determining the target role agent, controlling other role agents to exit the response generation task execution process ensures that invalid inference calculations of non-target role agents are terminated in a timely manner, thereby reducing the computational resource overhead on the system side. At the same time, since the determination of the target role agent is based on the interaction information and conversation history context information, it is a responder selected from among the role agents that matches the current dialogue context, rather than relying on preset rules or random selection, thus ensuring the accuracy of the final output response content.
[0063] Therefore, the technical solution provided in this embodiment can improve the timeliness of interactive response while ensuring the accuracy of interaction, and reduce the computing resource overhead on the system side.
[0064] Based on the first embodiment described above, a second embodiment of the multi-role intelligent agent interaction method of this application is proposed. For the second embodiment, please refer to... Figure 2 Step S20 may include steps S201 to S203: Step S201: Obtain the user's historical session data in the session window within the historical period; It should be noted that the historical period refers to a preset time range that traces back from the current interaction moment, such as the past seven days, the past thirty days, or the time interval covered by the most recent one hundred interaction records. Historical session data refers to the complete record of the user's dialogue interactions with various role agents in the session window within this historical period. It can include the user's historical input interaction information and the role identifier of the target role agent corresponding to each interaction.
[0065] When obtaining the number of historical sessions a user has in the session window within a historical period, one feasible implementation is to read all dialogue records of the current user within the specified historical period from the session log storage system and organize them in chronological order. Another feasible implementation is to obtain only the historical dialogue records associated with each role agent currently participating in the session, rather than obtaining the entire interaction history between the user and all role agents, to reduce the amount of data processing. This embodiment does not specifically limit the implementation method of step S201.
[0066] Step S202: Based on historical session data, determine the probability that each role agent is selected as the target role agent; It should be noted that the selection probability refers to the quantitative indicator of the likelihood that each candidate role agent will be identified as the target role agent in the current interaction scenario, based on statistical or predictive results of historical session data.
[0067] In one feasible implementation, step S202 may include steps S221 to S224: Step S221: Extract multiple historical interaction information and the corresponding historical target role intelligent agent from the historical session data; It should be noted that historical interaction information refers to the message content entered by the user in the conversation window each time within a historical period. The historical target role agent refers to the role agent that was ultimately identified by the system as the target role agent in that historical interaction and responded to the historical interaction information.
[0068] Step S222: Perform semantic similarity matching between the interaction information and each historical interaction information, and take each historical interaction information whose semantic similarity with the interaction information is greater than a preset similarity threshold as similar interaction information; It should be noted that semantic similarity refers to a quantitative indicator calculated through a preset semantic model to measure the degree of similarity between two texts in terms of semantic content. The preset similarity threshold is a pre-set criterion used to judge whether the two texts are highly similar in terms of semantic content. It can be a default value or can be flexibly set by the user according to the actual situation. This embodiment does not impose specific limitations on it.
[0069] Step S223: Count the frequency of each role agent in the historical target role agent corresponding to each similar interaction information; Step S224: The ratio between the frequency of occurrence of each role agent and the total number of interactions in the historical session data is used as the selection probability of each role agent.
[0070] This implementation method, when calculating the selection probability of each role agent, does not simply count historical selection frequencies. Instead, it first uses semantic similarity to filter out a set of similar interaction information from historical session data that is semantically similar to the current interaction information. Then, it calculates the selection probability based on the frequency of each role agent being selected as the historical target role agent within this set of similar interaction information. This approach allows the calculation of selection probability to focus on historical experience related to the semantics of the current interaction scenario, rather than indiscriminately relying on all historical data. This improves the targeting and accuracy of selection probability prediction, and provides a more reliable decision-making basis for subsequently initiating response generation tasks only for high-probability role agents. It also helps to further optimize the efficiency of computing resource utilization while ensuring the accuracy of role selection.
[0071] Step S203: Control each role agent whose selection probability is greater than a preset probability threshold to start the response generation task execution process.
[0072] It should be noted that the preset probability threshold is a pre-set probability threshold value used to determine whether the role intelligence agent needs to start the response generation task execution process. It can be a default value or it can be flexibly set by the user according to the actual situation. This embodiment does not make specific limitations on it.
[0073] This embodiment limits the execution of response generation tasks for each agent to a specific role. Instead of indiscriminately initiating full inference calculations for all candidate agents, it first predicts the probability of each agent being selected as the target agent based on historical session data. Then, it only initiates the response generation task for agents with a selection probability higher than a preset probability threshold. This mechanism effectively reduces invalid inference calculations caused by agents with low selection probabilities while maintaining timely interactive responses. This further reduces system-side computational resource overhead while ensuring the accuracy of target agent determination, achieving a dynamic balance between resource consumption and response speed.
[0074] Based on the first and / or second embodiments described above, a third embodiment of the multi-role intelligent agent interaction method of this application is proposed. In the third embodiment, please refer to... Figure 3 After step S40, the multi-role intelligent agent interaction method may further include steps S50-S60: Step S50: Call at least one other role agent among the role agents, excluding the target role agent, to generate a second response to the first response content; It should be noted that the second response content refers to the commentary, supplementary, or feedback text generated by other intelligent agents after obtaining the first response content output by the target intelligent agent, based on the semantic information of that first response content. The second response content differs from the first response content's direct response to user interaction information; it is a secondary processing or interactive feedback of the first response content.
[0075] When invoking at least one other intelligent agent (excluding the target intelligent agent) to generate a second response to the first response, in one feasible implementation, the other intelligent agents (excluding the target intelligent agent) can be asynchronously triggered. The first response is used as context input, and a large language model is invoked to generate a short comment on the first response. The comments generated by each intelligent agent are then filtered for validity, and comments that are neither empty nor marked as invalid are used as the second response. In another feasible implementation, only some intelligent agents with a preset interactive relationship with the target intelligent agent (e.g., a friend relationship, rival relationship, or specific plot connection in the character settings) can be triggered to generate the second response to the first response. This embodiment does not specifically limit the implementation of step S50.
[0076] Step S60: Output the second reply in the chat window.
[0077] When outputting the second reply content in the conversation window, the second reply content generated by each role's intelligent agent can be displayed as independent message bubbles, appended to the conversation window sequentially according to the order in which the reply content was generated, and the corresponding role's intelligent agent identifier can be marked before each second reply content. Alternatively, the second reply content generated by each role's intelligent agent can be aggregated and associated with the first reply content's message bubble through reference or nested display, to reflect the commenting and being commented relationship between the second reply content and the first reply content. This embodiment does not specifically limit the implementation method of step S60.
[0078] In this embodiment, after the target agent completes its response to the user's interaction, it asynchronously triggers at least one other agent to generate and output a second response. This mechanism simulates the interactive behavior of other members commenting or supplementing on a member's speech in a real group chat scenario, enabling spontaneous, multi-layered interactions between agents around the dialogue content. This not only enriches the dialogue hierarchy within the conversation window but also enhances the realism and immersion of the user in multi-agent group chat interactions. Furthermore, because the generation of the second response is asynchronous, it does not block the output of the first response or subsequent user interactions. Therefore, while increasing the richness of interaction, it does not significantly impact the timeliness of the interaction response.
[0079] This application also provides a multi-role intelligent agent interaction device. Please refer to... Figure 4 Multi-role intelligent agent interaction devices may include: The data acquisition module 10 is used to acquire the interaction information entered by the user in the conversation window and to identify multiple role smart agents participating in the current conversation, wherein each role smart agent is associated with an NFC device. The agent determination module 20 is used to control each role agent to start the response generation task execution process, and to determine at least one target role agent from each role agent based on the interaction information and the user's session history context information in the session window. Control module 30 is used to control other role intelligent agents besides the target role intelligent agent to exit the response generation task execution process after the target role intelligent agent is determined; The response content output module 40 is used to obtain the first response content generated by the target role intelligent agent in response to the interaction information, and output the first response content in the conversation window.
[0080] In one embodiment, the agent determination module 20 is further configured to: Based on the interaction information, at least one first candidate role agent is determined from each role agent; The last active role agent in the session history context information is identified as the second candidate role agent. At least one target role agent is determined from the first candidate role agent and the second candidate role agent.
[0081] In one embodiment, the agent determination module 20 is further configured to: Call upon a large language model to perform semantic analysis on the interactive information; If the analysis of the interaction information reveals a user-specified identifier that indicates a specific role agent, then the specific role agent will be selected as the first candidate role agent. If the analysis output interaction information contains information expressing the intention to switch roles, then at least one role agent other than the role agent currently active in the conversation window will be selected as the first candidate role agent. If the analysis reveals that the interaction information is a group message directed at all role-based intelligent agents, then each role-based intelligent agent will be considered as the first candidate role-based intelligent agent.
[0082] In one embodiment, the response content output module 40 is further configured to: Obtain the content output rhythm parameters associated with the target agent, and divide the first reply into multiple text paragraphs according to the newline character; The output delay time of each text segment is calculated based on the content output rhythm parameter and the number of characters in each text segment; The text segments are output sequentially in the session window according to their output delay time.
[0083] In one embodiment, the agent determination module 20 is further configured to: Retrieve historical session data of the user in the session window within the historical period; Based on historical session data, determine the probability that each role agent is selected as the target role agent; Control the execution process of the response generation task for each intelligent agent whose selection probability is greater than a preset probability threshold.
[0084] In one embodiment, the agent determination module 20 is further configured to: Extract multiple historical interaction information and the corresponding historical target role intelligent agent from historical session data; The interaction information is semantically similar to each historical interaction information, and each historical interaction information whose semantic similarity with the interaction information is greater than a preset similarity threshold is regarded as similar interaction information. Statistically analyze the frequency of each role-based intelligent agent in the historical target role-based intelligent agents corresponding to each similar interaction information; The ratio of the frequency of each role's intelligent agent to the total number of interactions in the historical session data is used as the selection probability of each role's intelligent agent.
[0085] In one embodiment, the response content output module 40 is further configured to: Call at least one other role agent among the role agents, excluding the target role agent, to generate a second response to the first response; The second reply will be displayed in the chat window.
[0086] The multi-role intelligent agent interaction device provided in this application embodiment can improve the timeliness of interaction response while ensuring the accuracy of interaction, and reduce the computational resource overhead on the system side. Compared with the prior art, the beneficial effects of the multi-role intelligent agent interaction device provided in this application embodiment are the same as the beneficial effects of the multi-role intelligent agent interaction method provided in the above embodiments, and other technical features in this multi-role intelligent agent interaction device are the same as the features disclosed in the methods of the above embodiments, and will not be repeated here.
[0087] This application also provides an electronic device, which may include: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute the multi-role intelligent agent interaction method described above.
[0088] The following is for reference. Figure 5 It shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of this application. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0089] like Figure 5 As shown, the electronic device may include a processing unit 101 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory 102 or a program loaded from storage device 103 into random access memory 104. Random access memory 104 also stores various programs and data required for the operation of the electronic device. The processing unit 101, read-only memory 102, and random access memory 104 are interconnected via bus 105. Input / output interface 106 is also connected to bus 105. Typically, the following systems can be connected to input / output interface 106: input devices 107 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 108 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 103 including, for example, magnetic tape, hard disks, etc.; and communication devices 109. Communication device 109 allows the electronic device to communicate wirelessly or wiredly with other devices to exchange data. Although the diagrams show electronic devices with various systems, it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems may be implemented alternatively.
[0090] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 103, or installed from read-only memory 102. When the computer program is executed by processing device 101, it performs the functions defined in the methods of the embodiments of this application.
[0091] The electronic device provided in this application adopts the multi-role intelligent agent interaction method in the above embodiments, which can improve the timeliness of interaction response while ensuring the accuracy of interaction and reducing the computing resource overhead on the system side. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as the beneficial effects of the multi-role intelligent agent interaction method provided in the above embodiments, and other technical features in the electronic device are the same as the features disclosed in the methods of the above embodiments, and will not be repeated here.
[0092] It should be understood that various parts of the embodiments of this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0093] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the above claims.
[0094] This application also provides a computer-readable storage medium storing a computer program that can run on a processor. The computer program is used to execute the multi-role intelligent agent interaction method described in the above embodiments.
[0095] The computer-readable storage medium provided in this application embodiment may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0096] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.
[0097] The aforementioned computer-readable storage medium carries one or more programs that, when executed by an electronic device, cause the electronic device to: acquire interactive information input by the user in a session window and identify multiple role agents participating in the current session, wherein each role agent is associated with an NFC device; control each role agent to initiate a response generation task execution process and, based on the interactive information and the user's session history context information in the session window, identify at least one target role agent from among the role agents; after identifying the target role agent, control the other role agents besides the target role agent to exit the response generation task execution process; acquire the first response content generated by the target role agent in response to the interactive information, and output the first response content in the session window.
[0098] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0099] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0100] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0101] The computer-readable storage medium provided in this application embodiment stores computer-readable program instructions for executing the above-described multi-role intelligent agent interaction method. This improves the timeliness of interaction response while ensuring interaction accuracy and reduces system-side computational resource overhead. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application embodiment are the same as those of the multi-role intelligent agent interaction method provided in the above embodiments, and will not be repeated here.
[0102] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the multi-role intelligent agent interaction method described above.
[0103] The computer program product provided in this application can improve the timeliness of interaction response while ensuring the accuracy of interaction, and reduce the computing resource overhead on the system side. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the multi-role intelligent agent interaction method provided in the above embodiments, and will not be repeated here.
[0104] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A multi-role intelligent agent interaction method, characterized in that, The method includes: The system acquires interactive information input by the user in the conversation window and identifies multiple role agents participating in the current conversation, wherein each role agent is associated with an NFC device. Control each of the aforementioned role-intelligent agents to initiate the response generation task execution process, and determine at least one target role-intelligent agent from among the aforementioned role-intelligent agents based on the interaction information and the user's session history context information in the session window; After determining the target role agent, control the other role agents among the role agents except the target role agent to exit the response generation task execution process; Obtain the first response content generated by the target role agent in response to the interaction information, and output the first response content in the conversation window.
2. The method as described in claim 1, characterized in that, The step of determining at least one target role agent from among the role agents based on the interaction information and the user's session history context information in the session window includes: Based on the interaction information, at least one first candidate role agent is determined from each of the role agents; The last active role agent in the session history context information is identified as the second candidate role agent. At least one target role agent is determined from the first candidate role agent and the second candidate role agent.
3. The method as described in claim 2, characterized in that, The step of determining at least one first candidate role agent from among the role agents based on the interaction information includes: The large language model is invoked to perform semantic analysis on the interaction information; If the analysis reveals that the interaction information contains a user-specified identifier that indicates a specific role agent, then the specific role agent is selected as the first candidate role agent. If the analysis output of the interaction information contains information expressing the intention to switch roles, then at least one of the role agents other than the role agent currently active in the session window will be selected as the first candidate role agent. If the analysis determines that the interaction information is a group message directed at all role agents, then each of the aforementioned role agents will be considered as the first candidate role agent.
4. The method as described in claim 1, characterized in that, The step of outputting the first reply content in the conversation window includes: Obtain the content output rhythm parameters associated with the target role agent, and divide the first reply content into multiple text paragraphs according to line breaks; Based on the output rhythm parameters and the number of characters in each text segment, the output delay time of each text segment is calculated. According to the output delay time of each text segment, each text segment is sequentially streamed in the session window.
5. The method as described in claim 1, characterized in that, The step of controlling each of the aforementioned role-based intelligent agents to initiate the response generation task execution process includes: Retrieve historical session data of the user in the session window within the historical period; Based on the historical session data, determine the probability that each of the aforementioned role agents is selected as the target role agent; Control each role-based intelligent agent whose selection probability is greater than a preset probability threshold to start the response generation task execution process.
6. The method as described in claim 5, characterized in that, The step of determining the selection probability of each of the aforementioned role agents being identified as the target role agent based on the historical session data includes: Extract multiple historical interaction information and the corresponding historical target role intelligent agent from the historical session data; The interaction information is semantically similar to each of the historical interaction information, and each of the historical interaction information whose semantic similarity with the interaction information is greater than a preset similarity threshold is regarded as similar interaction information. The frequency of each of the aforementioned role-based intelligent agents in the historical target role-based intelligent agents corresponding to each of the aforementioned similar interaction information is statistically analyzed. The ratio between the frequency of occurrence of each of the aforementioned role agents and the total number of interactions in the historical session data is used as the selection probability of each of the aforementioned role agents.
7. The method according to any one of claims 1 to 6, characterized in that, After the step of outputting the first reply content in the conversation window, the method further includes: Call at least one of the other role agents besides the target role agent to generate a second response to the first response; The second reply content is output in the conversation window.
8. A multi-role intelligent agent interaction device, characterized in that, The device includes: The data acquisition module is used to acquire the interactive information entered by the user in the conversation window and to identify multiple role agents participating in the current conversation, wherein each role agent is associated with an NFC device. The agent determination module is used to control each of the said role agents to start the response generation task execution process, and to determine at least one target role agent from each of the said role agents based on the interaction information and the user's session history context information in the session window. The control module is used to control other role intelligent agents besides the target role intelligent agent to exit the response generation task execution process after the target role intelligent agent is determined. The response content output module is used to obtain the first response content generated by the target role agent in response to the interaction information, and output the first response content in the conversation window.
9. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the multi-role intelligent agent interaction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the multi-role intelligent agent interaction method as described in any one of claims 1 to 7.