Custom role switching method and device for AI voice module

By receiving role switching instructions and binding session data in the AI ​​voice module, filtering and updating context information, the problem of information loss during role switching is solved, achieving seamless inheritance and intelligent tracking in multi-role scenarios, and improving user experience and the intelligence of system response.

CN121190073AActive Publication Date: 2025-12-23ZHEJIANG LUOPING INFORMATION TECH CO LTD

Patent Information

Application Number
CN202511333387.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-18
Publication Date
2025-12-23
Estimated Expiration
2045-09-18

AI Technical Summary

Technical Problem

Existing AI voice modules have difficulty accurately distinguishing the historical dialogues associated with different roles when switching roles, resulting in the loss or overwriting of the original context information when the user switches back to the original role, leading to confusion in intent tracking.

Method used

By receiving user input of role switching commands, the system binds the current session's native data with the previous role to form a session data group and records the dialogue state; it extracts and filters historical context information to generate a context transition data group, and combines role identity, permission level, and topic tags to update the session state to achieve accurate inheritance and tracking between multiple roles.

Benefits of technology

It achieves information isolation and dynamic association in multi-role scenarios, ensuring that each role seamlessly inherits its own context during switching, improving the continuity of the conversation and intelligent tracking capabilities, and significantly enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121190073A_ABST
    Figure CN121190073A_ABST
Patent Text Reader

Abstract

The invention provides a user-defined role switching method and device for an AI voice module, and relates to the technical field of data processing, and the method comprises the steps: receiving a role switching instruction inputted by a user, carrying out the identification binding of the original data of a current session with a first role before switching, and recording the current dialogue state of the first role; according to a role switching instruction input by a user, determining a switching target as a second role, and extracting and archiving historical context information in the first role session data set; screening the context transfer data set in combination with the identity information, the permission level and the theme tag of the second role, and extracting historical context content suitable for the second role; updating the current session state with the second role; when the user switches back to the first role again, calling the stored current dialogue state and the dialogue data set of the first role; the autonomy and accuracy of the user-defined role switching method are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a custom role switching method and device for an AI voice module. BACKGROUND

[0002] In the prior art, an AI voice module usually allows a user to select a specific role through a preset role library to switch voice styles and response contents. The user can switch to different roles through voice instructions or interface menus, and the system loads the voice parameters and dialogue models of the role accordingly to meet diversified interaction needs. This method has been widely used in smart home, vehicle-mounted terminals, online customer service and other scenarios, improving the interaction flexibility of the system.

[0003] In the smart customer service scenario, the prior art usually clears or resets the current dialogue context after the user initiates role switching to prevent information interference between different roles. However, in actual applications, if the user first asks a "pre-sales consultant" role to answer product questions and then switches to a "technical support" role to handle troubleshooting in the consultation process, the system often has difficulty in accurately distinguishing the historical dialogue associated with different roles. If the user switches back to the original role to continue asking questions, the original context information may have been lost or overwritten by new content from other roles, causing confusion in intent tracking. SUMMARY

[0004] The purpose of the present application is to provide a custom role switching method and device for an AI voice module to solve the problems mentioned in the background.

[0005] To solve the above technical problems, the technical solution of the present application is as follows: In a first aspect, a custom role switching method for an AI voice module is provided, which includes: Receiving a role switching instruction input by a user, binding the native data of the current session with the first role before switching, forming a first role session data group, and recording the current dialogue state of the first role; According to the role switching instruction input by the user, determining that the switching target is a second role, extracting and archiving the historical context information in the first role session data group to generate a context transfer data group associated with the second role, and the role switching instruction includes the switching target and the current dialogue task; According to the dialogue task, combining the identity information, permission level and theme label of the second role to filter the context transfer data group, extract the historical context content suitable for the second role, and form a context call data set exclusive to the second role; According to the context call data set, updating the current session state with the second role; When the user switches back to the first role again, the saved first role current dialogue state and the first role conversation data group are called to restore the historical context of the first role, so as to achieve accurate inheritance and tracking of the conversation state among multiple roles.

[0006] Preferably, according to the role switching instruction input by the user, it is determined that the switching target is the second role, the historical context information in the first role conversation data group is extracted and archived, and a context transfer data group associated with the second role is generated, including: According to the first role conversation data group, the dialogue content is processed in time sequence and speaking turn to obtain fragmented data, and each data fragment is assigned a unique timestamp and speaking serial number; According to the fragmented data, the user identity information, the permission level and the theme label are extracted and bound for each fragment to form a context fragment with multi-dimensional metadata; According to the context fragment, a unique identifier and index are established through the timestamp, the speaking serial number, the identity information, the theme label and the permission level, and a context transfer data group associated with the second role is generated.

[0007] Preferably, according to the dialogue task, the context transfer data group is screened in combination with the identity information, the permission level and the theme label of the second role, the historical context content suitable for the second role is extracted, and a context calling data set exclusive to the second role is formed, including: According to the context transfer data group, the context fragments matching the permission and related to the theme are screened out based on the identity information, the permission level and the theme label of the second role to form a first fragment screening set; According to each context fragment in the first fragment screening set, the comprehensive semantic matching degree thereof with the current dialogue task is calculated through keyword extraction, intent recognition and semantic correlation, the context fragments satisfying a preset comprehensive semantic matching degree threshold are screened out, and a second fragment screening set is generated; The context fragments in the second fragment screening set are processed for deduplication, merging and conflict resolution to generate a third fragment screening set; For each context fragment in the third fragment screening set, a sensitive information review process is automatically triggered, the context fragments requiring cross-role confirmation or special permission are reviewed and decided, the context fragments passing the review are screened out, and a qualified fragment data set is generated; According to the time sequence, the qualified fragment data set is sorted to form a context calling data set exclusive to the second role.

[0008] Preferably, according to the fragmented data, the user identity information, the permission level and the theme label are extracted and bound for each fragment to form a context fragment with multi-dimensional metadata, including: According to the fragmented data, the source information of each fragment is obtained, the user identity information is identified through the account identifier or the voiceprint recognition method, and is bound as independent metadata with the data fragment to obtain first fragment data; According to the first fragment data, the fragment content and the context environment are analyzed, the preset role permission model and the content sensitivity determination rule are combined, the permission level is automatically allocated for each fragment, and the permission level is bound as independent metadata with the data fragment to generate second fragment data; According to the second fragment data, the keyword extraction and the theme induction are performed on the fragment content, the automatically identified theme label is bound as independent metadata with the identity information and the permission level to the data fragment to generate the context fragment with multi-dimensional metadata.

[0009] Preferably, according to the context transfer data set, the context fragments with permission matching and theme correlation are screened out based on the identity information, the permission level and the theme label of the second role to form a first fragment screening set, including: According to the context transfer data set, the permission level of each context fragment is read and compared with the permission level of the second role, and the context fragments with the permission level equal to or lower than the permission level of the second role are screened out to generate a first candidate set; According to the first candidate set, the theme label of each context fragment is extracted and compared with the theme label of the second role, and only when the theme label content is completely consistent with the theme label of the second role or is determined to belong to the same category in the preset label mapping table, the fragment is retained, and the remaining fragments are removed to form the first fragment screening set.

[0010] Preferably, according to each context fragment in the first fragment screening set, the comprehensive semantic matching degree thereof with the current dialogue task is calculated through keyword extraction, intent recognition and semantic correlation, the context fragments satisfying the preset comprehensive semantic matching degree threshold are screened out to generate a second fragment screening set, including: The keyword extraction is performed on each context fragment, the keyword field of the current dialogue task is compared, the keyword coverage and the core word matching degree are calculated, and the preset weight is added to obtain a keyword correlation score; The semantic feature vector representation is performed on the text content of each context fragment and the current dialogue task, and the similarity score is calculated through the semantic feature vectors of the two as a semantic correlation score; For each context fragment, the content expression of the fragment and the intent matching score of the fragment with the current dialogue task are comprehensively analyzed according to the theme label, the keyword correlation score and the semantic correlation score, and the intent matching score of the fragment with the current dialogue task is determined according to the analysis result; Figure One ​The keyword relevance score, the intent matching score and the semantic relevance score of each context segment are fused according to preset weights to calculate a comprehensive semantic matching degree score of the context segment with the current dialogue task; According to the comprehensive semantic matching degrees of all segments, context segments equal to or higher than a preset comprehensive semantic matching degree threshold are screened to form a second segment screening set.

[0011] Preferably, the context segments in the second segment screening set are subjected to deduplication, merging and conflict resolution processing to generate a third segment screening set, including: According to the second segment screening set, a similarity score of any two context segments is calculated, and when the similarity score is greater than a preset first similarity threshold, only the context segment with the highest comprehensive semantic matching degree score is retained, and the redundant context segment is removed to form a deduplicated segment set; According to the deduplicated segment set, the content structure and metadata of the context segments are analyzed, and for context segments under the same topic label but with different content, when the similarity score of the two is greater than a preset second similarity threshold, they are merged into a context segment with unified expression to generate a merged segment set; According to the merged segment set, conflict detection is performed on context segments with a similarity score greater than a preset third similarity threshold but with different metadata in sequence according to time sequence, authority level and topic label comparison; When it is detected that multiple context segments under the same topic label have inconsistent content or authority levels, the context segment with the higher authority level is retained, and if the authority levels are the same, the segment with the latest time sequence is retained, and the remaining segments are discarded to generate the third segment screening set.

[0012] Preferably, for each context segment in the third segment screening set, a sensitive information review process is automatically triggered, and context segments requiring cross-role confirmation or special authority are reviewed and decided, and context segments that pass the review are screened to generate a qualified segment dataset, including: According to each context segment in the third segment screening set, whether the authority level and content attribute meet the preset sensitive information features, cross-role calling rules or special authority transfer conditions is determined to automatically identify the context segments that need to be reviewed; For the context segments that need to be reviewed, the automatic review rules, role authority mapping table and sensitive information identification rules are used for review, and the qualified ones enter the subsequent process, and the unqualified segments are automatically isolated and stored or removed from the subsequent context processing; For the context fragments that cannot be accurately determined by automatic rules, push to the manual auxiliary review link, and review by the designated role or system administrator. After the review is passed, a review pass mark is given, and all qualified context fragments are generated as qualified fragment data sets.

[0013] Preferably, keyword extraction is performed on each context fragment, which is compared with the keyword field of the current dialogue task, the keyword coverage and core word matching degree are calculated, and the preset weight is added to obtain the keyword relevance score, including: Keyword extraction is performed on the text content of each context fragment to obtain the keyword set of the fragment; The keyword set of the fragment is compared with the keyword field of the current dialogue task one by one, the number of keywords contained in the intersection is counted, and the keyword coverage of the fragment is calculated by ratio with the total number of keywords of the current dialogue task; During the comparison process, the intersection number of the keyword set of the fragment and the core keyword set of the current dialogue task is counted, and the intersection number is divided by the total number of the core keyword set of the current dialogue task to obtain the core word matching degree score of the fragment; According to the preset weight ratio, the keyword coverage and the core word matching degree are weighted and added to obtain the keyword relevance score between the context fragment and the current dialogue task.

[0014] In a second aspect, a custom role switching device for an AI voice module, the device comprising: An instruction receiving module for receiving a user input role switching instruction, identifying and binding the native data of the current session with the first role before switching to form a first role session data group, and recording the current dialogue state of the first role; A target determination and archiving module for determining the switching target as the second role according to the user input role switching instruction, extracting and archiving the historical context information in the first role session data group to generate a context transfer data group associated with the second role, the role switching instruction including the switching target and the current dialogue task; A context screening module for screening the context transfer data group according to the dialogue task, combining the identity information, permission level and theme label of the second role, extracting the historical context content suitable for the second role, and forming a context calling data set exclusive to the second role; A session state updating module for updating the current session state with the second role according to the context calling data set; The conversation recovery module is configured to call the saved first role current conversation state and the first role conversation data group to recover the historical context of the first role when the user switches back to the first role again, so as to achieve accurate inheritance and tracking of the conversation state among multiple roles.

[0015] The above scheme of the present application at least includes the following beneficial effects: By binding the role switching instruction input by the user with the current conversation native data, the conversation data group and the conversation state record can be independently established for each role when the role is switched, and the loss of historical information caused by directly resetting the context can be avoided. Compared with the prior art which only realizes role switching by emptying or resetting the context, the present application can accurately manage and archive the historical context for different roles, and realize information isolation and dynamic association in a multi-role scene. When the user switches the role multiple times in the same conversation, the system can automatically extract and filter out the historical content highly related to the current target role and the conversation task, generate a dedicated context calling data set, so that each role can seamlessly inherit its own context during the switching process and is not disturbed by the conversation content of other roles, thereby improving the coherence and intelligent tracking capability of the conversation. For example, in an intelligent customer service application, when the user switches from a 'pre-sales consultant' to a 'technical support' and then switches back to the original role, the user can continue to ask about the previous left-over questions, and all the historical information related to the role can be accurately recovered and called, thereby greatly improving the user experience and the intelligence of the system response in a complex multi-role conversation scene. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 is a flowchart of a self-defined role switching method for an AI voice module provided by an embodiment of the present application. DETAILED DESCRIPTION

[0017] Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings; however, they are not limited thereto and can be embodied in various forms. It is to be understood that the embodiments disclosed herein are merely exemplary and that a person skilled in the art can embody the present disclosure in various forms without departing from the scope of the present disclosure.

[0018] As shown in Figure 1 An embodiment of the present application proposes a self-defined role switching method for an AI voice module, which comprises the following steps: Receiving a role switching instruction input by a user, binding the native data of the current conversation with the first role before switching, forming a first role conversation data group, and recording the current conversation state of the first role; According to the role switching instruction input by the user, it is determined that the switching target is the second role, the historical context information in the first role conversation data group is extracted and archived, and a context transfer data group associated with the second role is generated, and the role switching instruction includes the switching target and the current dialogue task; According to the dialogue task, the context transfer data group is screened in combination with the identity information, permission level and theme label of the second role, historical context content suitable for the second role is extracted, and a context calling data set exclusive to the second role is formed; According to the context calling data set, the current conversation state with the second role is updated; When the user switches back to the first role again, the saved current dialogue state of the first role and the first role conversation data group are called, and the historical context of the first role is restored, so that the accurate inheritance and tracking of the conversation state between multiple roles is achieved.

[0019] In the embodiment of the application, by receiving the role switching instruction input by the user, the native data of the current conversation is bound to the first role before switching, which can effectively ensure that the conversation data before and after each role switching will not be confused, and is beneficial to the independent management of the conversation state of multiple roles. When the switching target is determined to be the second role according to the role switching instruction, and the historical context information in the first role conversation data group is extracted and archived, the historical dialogue information of multiple roles can be separated and archived in the same conversation process, and the data tracing and tracking capability during subsequent role switching is improved. The context transfer data group is screened in combination with the identity information, permission level and theme label of the second role, which can accurately screen the most relevant historical context content for different roles and different dialogue tasks, prevent irrelevant information from being incorrectly inherited, and thus form a context calling data set exclusive to the second role. By updating the current conversation state with the second role based on the context calling data set, it can be ensured that the context experience of the user after switching to the second role is consistent with the real continuous dialogue, and context breakage caused by switching is avoided. For example, in a customer service application scenario, the user switches from a normal consultation role to a complaint handling role, can seamlessly inherit and call all context content related to the complaint before, and greatly improves the flexibility and continuity of the multi-role intelligent dialogue system.

[0020] Among them, the role switching instruction input by the user is received, the native data of the current conversation is bound to the first role before switching, a first role conversation data group is formed, and the current dialogue state of the first role is recorded, specifically including: Firstly, when the AI voice module receives the user's input role switching instruction, the user's switching intention can be parsed through voice recognition, graphical interface clicking or command input, etc. After the system obtains the instruction, it first collects all the original dialogue data generated in the current session before switching, as the data content to be identified. Then, the system assigns each original data with identification information related to the first role before switching, such as adding role number, role name or identity field in the data structure, and unifies these data contents into the first role's session data group. Then, the system records the current dialogue state of the first role, including the round of dialogue, context content, current intention tracking state, etc. These state information can be stored in the database or cache system and associated with the unique identity of the first role. This processing process ensures that all historical information formed by the original role in the dialogue process can be independently archived and traced each time the switching is performed, avoiding data confusion or loss due to switching operation. For example, in the intelligent customer service scenario, before the user switches from the "pre-sales consultant" to the "technical support", the system will bind all the question and answer content between the user and the pre-sales consultant, as well as the progress of the last communication, into the exclusive session data group and current state of the first role, so as to restore at any time.

[0021] Among them, according to the context calling data set, the current session state with the second role is updated, specifically including: After the system determines that the role switching target is the second role, it first extracts all historical context fragments closely related to the second role identity, permission level and current dialogue task from the context calling data set generated by the foregoing screening. Then, the system organizes these context fragments according to time sequence, theme label and task relevance, etc. to build a context environment that can be continuously called by the second role. Then, the system merges and updates the content in the context calling data set with the current session state structure of the second role, including but not limited to: restoring the dialogue node of the second role when it left the session last time, reloading the historical dialogue fragments related to the task target, and synchronizing the task progress, unfinished matters and other information of the second role. The update process uses data overlay or incremental merging to ensure that there is no omission and conflict between the new and old state data. Finally, the system stores the updated second role session state into a special storage area, so that the second role can naturally continue the previous context logic when continuing to interact with the user, and obtain a coherent dialogue experience. For example, in the smart home voice assistant scenario, after the user switches from the "life helper" to the "device manager" role, the system automatically loads all related operations and task contexts of the device manager before, so that the new role can accurately continue the previous device management task without repeated questioning, significantly improving the intelligence and continuity of multi-role voice interaction.

[0022] Among them, the AI voice module is a system component for voice interaction based on artificial intelligence (AI) technology, especially natural language processing (NLP), speech recognition and synthesis, semantic understanding, etc. The AI voice module usually integrates multiple technologies such as speech recognition, speech synthesis, dialogue management, intent recognition, etc., which can interact with users through voice, understand and process user instructions or questions, and give corresponding voice feedback.

[0023] In the prior art, the AI voice module mainly consists of the following core parts: Speech recognition module: This module is responsible for converting user speech into text. Through deep learning algorithms such as convolutional neural networks (CNN) or recurrent neural networks (RNN), it extracts features from speech signals and matches existing language models to achieve efficient and accurate speech-to-text conversion.

[0024] Speech synthesis module: The speech synthesis module interacts with users by converting text into speech. Existing speech synthesis technologies (such as deep neural networks) can generate natural and fluent speech output, simulating human speech expression.

[0025] Natural language processing module: This module is used for semantic analysis of user input text (or text converted from speech). Through steps such as word segmentation, entity recognition, syntax parsing, and semantic understanding, the AI voice module can extract user intent and respond appropriately. Common techniques include word embedding (such as Word2Vec, BERT) and machine learning classifiers (such as support vector machines, decision trees).

[0026] Dialogue management system: The dialogue management system is responsible for managing multi-turn dialogues based on context information and current dialogue state. It determines the next voice output or task execution based on current dialogue content, user needs, and historical dialogue records, and ensures the consistency and fluency of the dialogue.

[0027] Role management and task management module: In some systems, the AI voice module also integrates role switching functions, allowing interaction through different roles. For example, in an intelligent customer service application, the system can switch to different roles such as "pre-sales consultant" or "technical support" based on user needs. This module switches different role parameters and dialogue models to better match user expectations.

[0028] In a preferred embodiment of the present application, according to the role switching instruction input by the user, the switching target is determined to be the second role, the historical context information in the first role session data set is extracted and archived, and the context transfer data set associated with the second role is generated, including: According to the first role conversation data set, the dialogue content is fragmented in time sequence and speaking turn to obtain fragmented data, and each data fragment is assigned a unique timestamp and speaking serial number; According to the fragmented data, user identity information, permission level and theme label are extracted and bound for each fragment to form a context fragment with multi-dimensional metadata; According to the context fragment, a unique identifier and index are established through the timestamp, speaking serial number, identity information, theme label and permission level of the context fragment, and a context transfer data set for the second role association is generated.

[0029] In the embodiment of the application, by fragmenting the dialogue content of the first role conversation data set in time sequence and speaking turn, and assigning a unique timestamp and speaking serial number to each data fragment, fine management of multi-turn dialogue content can be realized, facilitating subsequent retrieval and tracing. Further extraction and binding of user identity information, permission level and theme label for each fragment can lay a solid foundation for subsequent context screening and permission management, ensuring strict separation of conversation data under different permissions and themes. For example, when the same user participates in multi-role interaction in the same conversation under different identities, the system can automatically identify and distinguish the dialogue data generated under different identities. By establishing a unique identifier and index through the timestamp, speaking serial number, identity information, theme label and permission level, not only the retrieval efficiency of the context fragment is improved, but also effective protection is provided for subsequent cross-role data reference and security review. Through the above processing, the AI voice module can effectively improve the organization efficiency and security isolation capability of conversation data in the multi-role concurrent management scenario. For example, in a customer service system, data between different customer service roles will not be disordered, sensitive information can be managed according to permission, and information security and compliance operation can be ensured.

[0030] In a preferred embodiment of the application, according to the dialogue task, the context transfer data set is screened in combination with the identity information, permission level and theme label of the second role, and the historical context content suitable for the second role is extracted to form a context calling data set exclusive to the second role, including: According to the context transfer data set, the context fragments matching the permission and related to the theme are screened out based on the identity information, permission level and theme label of the second role to form a first fragment screening set; According to each context fragment in the first fragment screening set, the comprehensive semantic matching degree of the context fragment with the current dialogue task is calculated through keyword extraction, intent recognition and semantic relevance, and the context fragments meeting the preset comprehensive semantic matching degree threshold are screened to generate a second fragment screening set; The context fragments in the second fragment screening set are processed for deduplication, merging and conflict resolution to generate a third fragment screening set; For each context segment in the third segment screening set, an automatic sensitive information review process is triggered, context segments requiring cross-role confirmation or special permissions are reviewed and decided, qualified context segments are screened, and a qualified segment data set is generated; According to the time sequence, the qualified segment data set is sorted to form a context calling data set special for the second role.

[0031] In the embodiment of the application, by screening the context transfer data set based on the identity information, permission level and theme tag of the second role, the context segments that match the permissions and are related to the theme can be quickly screened for the current dialogue task, greatly improving the accuracy of historical context screening. Based on keyword extraction, intent recognition and semantic correlation comprehensive calculation, the system can quantitatively determine the semantic matching degree between each context segment and the current dialogue task, and screen out the most relevant content through threshold, effectively avoiding the misuse of context irrelevant to the current dialogue task. For example, in the multi-role conference assistant scene, when different participants switch to different roles, the system can intelligently extract and push the most relevant conference content according to the current topic, permissions and historical identity, support decision-making and collaboration. The screened context segments are de-duplicated, merged and conflict resolved, ensuring that the data set content is unique, consistent and complete, and finally forming a sorted exclusive context calling data set, so that the second role can obtain the most closely related historical information for the current task, realizing seamless context connection in multi-role.

[0032] In a preferred embodiment of the application, according to the fragmented data, the user identity information, permission level and theme tag are extracted and bound for each segment to form a context segment with multi-dimensional metadata, including: According to the fragmented data, the source information of each segment is obtained, the user identity information is identified through account identification or voiceprint recognition method, and is bound as independent metadata with the data segment to obtain first segment data; According to the first segment data, the segment content and context environment are analyzed, the preset role permission model and content sensitivity determination rule are combined, the permission level is automatically allocated for each segment, and the permission level is bound as independent metadata with the data segment to generate second segment data; According to the second segment data, keyword extraction and theme induction are performed on the segment content, the automatically identified theme tag is bound as independent metadata with the identity information and permission level to the data segment to generate a context segment with multi-dimensional metadata.

[0033] In the embodiments of the present application, by extracting and binding user identity information, permission level and topic label for each piece of fragmented data, comprehensive multi-dimensional metadata description can be established for each context fragment. The user identity information is accurately identified through account identification or voiceprint recognition method, effectively avoiding the risk of identity confusion in multi-user or multi-role scenarios. The permission level is independently bound with the data fragment, which is helpful for subsequent information isolation and review in different permission scenarios, and ensures the data security compliance of the system. The topic label is automatically extracted and summarized, so that each piece of conversation content has a clear semantic classification, which is convenient for subsequent context retrieval and screening related to the task. For example, in an enterprise knowledge management system, the system can accurately distinguish and archive the data of the same user in different business lines, laying a foundation for subsequent intelligent retrieval and multi-dimensional analysis, thereby effectively supporting the multi-role and multi-scenario application requirements of large-scale AI voice modules.

[0034] Among them, according to the fragmented data, the source information of each fragment is obtained, and the user identity information is identified through account identification or voiceprint recognition method, specifically including: After the system processes the dialogue content by fragmentation, for each fragmented data, the metadata information of the fragment is first extracted, including the conversation initiator, the speaking time, the device ID, etc. If the user logs in the system through an account, the account is directly taken as the account identification field of the fragment. If multiple users share a terminal or there is a voice multi-round interaction scenario, the voiceprint recognition method can be used to compare the extracted voice fragment features with the pre-stored user voiceprint templates in the database, to realize automatic identification of user identity. After identity recognition, the system binds the identified user identity information as independent metadata with the fragment, ensuring that each fragment can be uniquely traced back to a specific user. For example, in an intelligent meeting scenario, the speaking fragments of different participants can be distinguished and accurately labeled by voiceprint technology, providing data basis for subsequent permission determination and content tracking.

[0035] Among them, according to the first fragment data, the fragment content and context environment are analyzed, and the permission level of each fragment is automatically assigned in combination with the preset role permission model and content sensitivity determination rule, specifically including: After obtaining the first fragment data bound with user identity information, the system performs semantic analysis on the fragment content to identify elements such as business domain, task type, and privacy level involved therein. Subsequently, the system consults a preset role permission model, which generally defines the accessible data range and sensitivity level division according to user roles (such as ordinary user, administrator, expert, etc.). In combination with content sensitivity determination rules, such as the presence of sensitive words, proprietary information, trade secrets, etc. in the fragment, the permission requirements of the fragment are enhanced. The system combines the analyzed role category, content type, and sensitivity level, etc. factors, and assigns a corresponding permission level to each fragment according to the pre-set permission grading standard. For example, ordinary question and answer content can be set as open permission, while information involving user privacy or high security requirements is assigned a higher permission, only authorized for specific roles to access, realizing hierarchical security management.

[0036] Among them, according to the second fragment data, the key words of the fragment content are extracted and the theme is summarized, specifically including: After the system obtains the second fragment data bound with identity information and permission level, the natural language processing technology is used to perform word segmentation and key word extraction on the fragment text content. Key word extraction can combine word frequency statistics, TF-IDF algorithm, or entity recognition model to automatically select high-frequency words or domain entities that accurately reflect the main theme of the fragment. After extraction, the system aggregates and summarizes multiple highly relevant key words into theme tags according to the semantic relevance of the key words. For example, if a fragment contains keywords such as "after-sales service", "fault", "warranty", etc., it can be summarized as a "after-sales support" theme tag. Finally, the system identifies the key words and the theme tags summarized as metadata and attaches them to the fragment, realizing multi-dimensional semantic classification of the dialogue content, facilitating subsequent theme retrieval, screening, and context inheritance.

[0037] In a preferred embodiment of the present application, according to the context transfer data set, based on the identity information, permission level and theme tag of the second role, the context fragments with matching permissions and related themes are screened out to form a first fragment screening set, including: According to the context transfer data set, read the permission level of each context fragment, and compare it with the permission level of the second role, screen out the context fragments with permission level equal to or lower than the permission level of the second role, generate a first candidate set; According to the first candidate set, extract the theme tag of each context fragment, compare it with the theme tag of the second role, and only when the theme tag content is completely consistent with the theme tag of the second role or is determined to belong to the same category in the preset label mapping table, the fragment is retained, and the remaining fragments are removed, forming the first fragment screening set.

[0038] In the embodiment of the present application, by reading the permission level of each context segment in the context transition data set and comparing it with the permission level of the second role, the segment content meeting the permission management requirements can be accurately screened, and unauthorized role access to sensitive or super permission information is effectively prevented. Further, by using the accurate comparison of the topic label and the label mapping table classification processing, the context segment screening based on the semantic level is realized, and it is ensured that the output result is highly related to the target role demand in the two dimensions of theme and permission. This screening method greatly improves the context adaptation accuracy of the system in the multi-role complex dialogue scene. For example, in the intelligent assistant application, when the ordinary user and the administrator user are switched, only the administrator can access the historical segments related to the management theme, and the ordinary user can only obtain the conversation content consistent with its permission and the current theme, thereby realizing efficient and safe multi-role context management.

[0039] The preset label mapping table specifically includes: The system pre-establishes a topic label mapping table, which contains all available topic labels and their corresponding relationships and category attributions. The label mapping table not only records the standard name of the label, but also can include the synonyms, similar words and the superordinate category to which the label belongs. For example, the label "after-sales support" can be mapped to the "customer service" category, and the labels "consultation" and "inquiry" are attributed to the same category or considered as synonyms. In the actual screening process, the system first reads the topic label of each context segment, and then compares it according to the corresponding relationship in the label mapping table. When the topic label of the context segment is completely consistent with the topic label of the second role, or is defined as belonging to the same category in the label mapping table, the system determines that it is a relevant label, and the segment is retained for subsequent processing. The mapping table can be established by combining manual sorting and automatic statistics, and supports dynamic expansion to adapt to the changes of topic labels in new business scenarios.

[0040] In a preferred embodiment of the present application, according to each context segment in the first segment screening set, the comprehensive semantic matching degree thereof with the current dialogue task is calculated through keyword extraction, intent recognition and semantic relevance, the context segment meeting the preset comprehensive semantic matching degree threshold is screened, and the second segment screening set is generated, including: The keyword extraction is performed on each context segment, the keyword field of the current dialogue task is compared, the keyword coverage and the core word matching degree are calculated, and the keyword relevance score is obtained by adding them according to the preset weight; The text content of each context segment and the current dialogue task is represented by a semantic feature vector, and the similarity score between the two semantic feature vectors is calculated as the semantic relevance score; For each context fragment, the content expression of the fragment is comprehensively analyzed in conjunction with the topic tag, keyword relevance score, and semantic relevance score to determine its relationship with the current dialogue task objective. Figure One The consistency is determined, and based on this, the score for matching the segment with the intent of the current dialogue task is determined; The keyword relevance score, intent matching score, and semantic relevance score of each context fragment are fused according to preset weights to calculate its comprehensive semantic matching score with the current dialogue task. Based on the overall semantic matching degree of all segments, context segments that are equal to or higher than the preset overall semantic matching degree threshold are selected to form a second segment selection set.

[0041] In this embodiment of the invention, comprehensive semantic matching degree calculation under multi-dimensional features is achieved by extracting keywords, recognizing intent, and analyzing semantic relevance for each context segment. This method integrates information such as keyword coverage, core word matching degree, intent matching, and semantic similarity to the current dialogue task of the context segment, and uses a weighted scoring method to comprehensively evaluate the correlation strength between the segment content and the dialogue task. By setting a comprehensive semantic matching degree threshold, the system can automatically filter out historical context content most closely related to the current dialogue task, significantly improving the accuracy of the AI ​​voice module in inheriting contextual information and understanding context. For example, in a project collaboration system, when a user switches to the role of technical lead, the system can accurately select historical segments involving technical solutions, project difficulties, etc., that are highly consistent with the current task, providing data support for efficient decision-making and intelligent suggestions.

[0042] Specifically, a semantic feature vector is generated for each context segment and the text content of the current dialogue task. A similarity score is calculated using the semantic feature vectors of the two segments, which serves as the semantic relevance score. This includes: The system extracts semantic features from the text content of each context segment and the text content of the current dialogue task. This processing is typically based on existing natural language understanding models (such as word vectors, sentence vectors, or pre-trained language models based on deep learning), transforming each text segment into a set of feature vectors with fixed dimensions and semantic distribution. The system then calculates the similarity between the two feature vectors, using methods such as the angle between vectors, distance, or relevance measures. In this invention, to avoid mathematical formulas, the system compares the values ​​of each dimension of the two vectors, calculates their similarity, and outputs a score between 0 and 1 according to predefined similarity rules; a higher score indicates stronger semantic relevance. Finally, this score serves as the semantic relevance score between the context segment and the current dialogue task, providing input for subsequent comprehensive matching calculations and filtering.

[0043] Specifically, for each context segment, the content expression of the segment is comprehensively analyzed in relation to the current dialogue task objective, combining topic tags, keyword relevance scores, and semantic relevance scores. Figure One The consistency score is used to determine the match between the segment and the intent of the current dialogue task, specifically including: For each context fragment, the system first determines whether the fragment's topic tag is consistent with or belongs to the same category as the topic tag of the current dialogue task. If they are consistent, a higher topic tag relevance weight is assigned. Subsequently, the system combines the calculated keyword relevance score (i.e., the weighted score of the fragment's keyword coverage and core word matching with the dialogue task's keywords) and the semantic relevance score (i.e., the overall semantic similarity score between the fragment text and the dialogue task text) to perform a weighted fusion of these multiple scores. The specific process of weighted fusion is as follows: the topic tag relevance weight, keyword relevance score, and semantic relevance score are added together according to preset weights to obtain a comprehensive score. The system uses this comprehensive score as the indicator of the fragment's content's relevance to the current dialogue task's objective. Figure One The system measures the consistency of the intent matching score and uses this score as the intent matching score for that segment. A higher intent matching score indicates greater applicability and reference value of the segment for the current dialogue task. The system can set a threshold based on the intent matching score, retaining only context segments with scores reaching or exceeding that threshold for subsequent calls.

[0044] In a preferred embodiment of the present invention, the context fragments in the second fragment filtering set are deduplicated, merged, and conflict resolved to generate a third fragment filtering set, including: Based on the second segment selection set, calculate the similarity score between any two context segments. When the similarity score is greater than the preset first similarity threshold, only the context segment with the highest comprehensive semantic matching score is retained, and redundant context segments are removed to form a deduplicated segment set. Based on the deduplication fragment set, the content structure and metadata of the context fragments are analyzed. For context fragments under the same topic tag but with different content, when the similarity scores of the two are greater than the preset second similarity threshold, they are merged into a context fragment with a unified expression, generating a merged fragment set. Based on the merged fragment set, the fragments are compared sequentially according to time order, permission level, and topic tag. Conflict detection is performed on context fragments with similarity scores greater than the preset third similarity threshold but with differences in metadata. When multiple context fragments under the same topic tag are detected to have inconsistent content or permission levels, the context fragment with the higher permission level is retained. If the permission levels are the same, the fragment with the latest time sequence is retained, and the remaining fragments are removed to generate a third fragment filtering set.

[0045] In the embodiments of the present application, by deduplication, merging and conflict resolution processing of the context fragments in the second fragment screening set, the uniqueness and consistency of historical context data can be significantly improved. By calculating the similarity scores between context fragments, only the fragments with the highest semantic matching degree are retained, effectively removing repeated or redundant information. When merging fragments with differences in content under the same topic label, different expressions of the same fact or event can be unified to avoid information fragmentation and improve the completeness of the context. Through conflict detection rules, the fragments with higher authority level or the latest time sequence are automatically identified and retained, so that the finally generated dataset has both accuracy and authority. For example, in the intelligent legal assistant scenario, when multiple lawyers submit similar opinions on the same case, the system can automatically merge, deduplicate and screen authoritative opinions to help users quickly obtain consistent and complete historical references.

[0046] wherein, according to the second fragment screening set, the similarity scores of any two context fragments are calculated, specifically including: After obtaining the second fragment screening set, the system compares the content of every two context fragments in the set. During the comparison process, the text content of each fragment is first preprocessed, including removing stop words, standardizing formats, and unifying punctuation, etc. to facilitate subsequent analysis. Then, each fragment is converted into a corresponding semantic feature vector using natural language processing methods (such as pre-trained language models or word segmentation techniques). For any pair of fragments, the system compares their respective semantic feature vectors to calculate the semantic similarity between the two fragments. The comparison method can be as follows: compare all semantic features of the two fragments one by one, and calculate the ratio of the number of identical or similar features to the total number of features, thereby obtaining a similarity score between 0 and 1. The higher the score, the stronger the similarity between the two fragments in terms of content expression and semantic intent. The system saves the similarity scores of all pairs of fragments to provide a basis for subsequent deduplication and merging.

[0047] wherein, according to the deduplicated fragment set, the content structure and metadata of the context fragments are analyzed, and for context fragments under the same topic label but with differences in content, when their similarity scores are greater than a preset second similarity threshold, they are merged into a unified expression context fragment, generating a merged fragment set, specifically including: After the deduplication process is completed, the system groups the remaining context fragments by topic labels, ensuring that each group contains only fragments with the same topic label. For multiple fragments within each group that have differences in content, the system retrieves the previously calculated similarity scores. When the similarity scores between two or more fragments are higher than a second similarity threshold preset by the system, it is considered that they express different descriptions of the same fact or event. At this time, the system performs content structure analysis on these fragments, and summarizes and fuses representative information points in different fragments to remove redundant or conflicting information. For example, if one fragment describes "the device cannot start" and another fragment describes "the device black screen on boot", and they both belong to the "device failure" topic and have high similarity, the system can summarize them as "the device has a problem of not starting or black screen on boot". The merged fragment will retain all valuable detailed information while unifying the expression method. Finally, all merged fragments and unmerged fragments together form a new merged fragment set, which prepares for subsequent conflict detection and context invocation.

[0048] In a preferred embodiment of the present application, for each context fragment in the third fragment screening set, an automatic sensitive information review process is triggered, context fragments that need cross-role confirmation or special permissions are reviewed and decided, and qualified context fragments are screened to generate a qualified fragment dataset, including: According to each context fragment in the third fragment screening set, whether the permission level and content attribute meet the preset sensitive information characteristics, cross-role calling rules or special permission transfer conditions are determined to automatically identify context fragments that need to be reviewed; For context fragments that need to be reviewed, they are reviewed according to the preset automatic review rules, role permission mapping table and sensitive information identification rules. If they are qualified, they will enter the subsequent process. If they are unqualified, they will be automatically isolated and stored or excluded from subsequent context processing; For context fragments that cannot be accurately determined by automatic rules, they are pushed to the human-assisted review link for review by designated roles or system administrators. After passing the review, a review pass mark is given. All context fragments that pass the review are generated as a qualified fragment dataset.

[0049] In the embodiments of the present application, by automatically auditing each context segment in the third segment screening set, sensitive information can be comprehensively investigated and isolated, and the security and compliance of historical data can be ensured. The automatic auditing rule can efficiently identify the segments that need to be controlled according to the permission level, content attribute and sensitive information characteristics, greatly reducing the burden of manual auditing. For the segments that cannot be accurately judged by the automatic rule, a manual assisted auditing process is introduced, so that the auditing result is more accurate and controllable. All the qualified segments are unified into a qualified segment dataset, which provides a compliant and safe data basis for subsequent context calling. For example, in the medical health consultation scenario, the historical content involving patient privacy or sensitive data can be automatically screened and isolated, and only authorized medical roles can access it, thereby improving system compliance and user data security.

[0050] The preset sensitive information characteristics, cross-role calling rules or special permission transfer conditions specifically include: The system defines the sensitive information characteristic library, cross-role calling rule and special permission transfer condition in advance according to actual business needs. The sensitive information characteristic library includes a group of keywords, phrases, regular expressions and context patterns for identifying sensitive content, such as content involving personal privacy, financial data, patent technology, etc., which can be pre-set through a keyword table, category annotation or rule script. The cross-role calling rule clearly specifies which roles have the right to access, modify or forward certain types of information, for example, only administrators and security auditors can call classified data across departments. The special permission transfer condition is used to restrict the flow of sensitive information, such as setting that only when a subordinate role obtains the authorization of a superior role, can it access a specific context segment. When the system audits the context segment, it first matches whether the content meets the sensitive information characteristics; if it hits, it further checks whether it meets the cross-role calling or permission transfer condition. Only when all conditions are met, the system allows the relevant role to access or call the context segment, otherwise it is isolated or prompted for permission, ensuring that the information flow is controllable and compliant throughout.

[0051] The preset automatic auditing rule, role permission mapping table and sensitive information identification rule specifically include: The system establishes an automatic auditing rule library by combining artificial experience and automatic learning, and performs sensitivity and permission compliance review on the context fragments. The automatic auditing rules usually include multi-dimensional standards at content level, behavior level and process level. The content level rules can automatically detect whether the text contains restricted words, confidential labels or special format strings according to the sensitive information feature library. The behavior level rules can detect the scene in which the user requests cross-role access. The process level rules can determine whether the permission transfer or superior approval has been completed. The role permission mapping table records the data access, editing, transfer and other permission ranges of various roles in a matrix or hierarchical structure, facilitating the system to automatically determine whether the access request is legal. The sensitive information identification rules combine semantic understanding algorithms, entity recognition tools and custom templates to check the text content item by item. If a sensitive entity is found or the information is labeled as controlled, the system automatically triggers the isolation, prompt or approval process. For example, when a context fragment involves sensitive fields such as "ID card number" and "bank card number", the system automatically marks the fragment as high-sensitivity content through matching and rule determination, and only allows the call after the audit is passed. All the above rules can be flexibly adjusted to support continuous expansion according to business development.

[0052] In a preferred embodiment of the present application, keyword extraction is performed on each context fragment, which is compared with the keyword field of the current dialogue task, the keyword coverage and core word matching degree are calculated, and the keyword relevance score is obtained by adding the preset weight, including: Keyword extraction is performed on the text content of each context fragment to obtain the keyword set of the fragment; The keyword set of the fragment is compared with the keyword field of the current dialogue task one by one, the number of keywords contained in the intersection is counted, and the keyword coverage of the fragment is calculated by ratio calculation with the total number of keywords of the current dialogue task; During the comparison process, the intersection number of the keyword set of the fragment and the core keyword set of the current dialogue task is counted, and the core word matching degree score of the fragment is obtained by dividing the intersection number by the total number of the core keyword set of the current dialogue task; The keyword coverage and core word matching degree are weighted and added according to the preset weight ratio to obtain the keyword relevance score between the context fragment and the current dialogue task.

[0053] In the embodiments of the present application, by keyword extraction on the text content of each context segment and systematic comparison with the keyword field of the current dialogue task, the keyword coverage and core keyword matching degree can be quantitatively calculated, and the association of the context segment with the current task is accurately quantified. The two indicators are weighted and fused by using a preset weight, which effectively improves the discrimination ability of the keyword relevance score, so that the system can intelligently filter out the content that best meets the current context demand from a large number of historical segments. For example, in the intelligent customer support scenario, when a user describes a complex problem, the system can automatically retrieve the most relevant past interactions based on the high matching and coverage of the core keywords, improve the accuracy and personalization level of the response, and enhance the user experience and problem solving efficiency.

[0054] In the embodiments of the present application, by keyword extraction on the text content of each context segment and systematic comparison with the keyword field of the current dialogue task, the keyword coverage and core keyword matching degree can be quantitatively calculated, and the association of the context segment with the current task is accurately quantified. The two indicators are weighted and fused by using a preset weight, which effectively improves the discrimination ability of the keyword relevance score, so that the system can intelligently filter out the content that best meets the current context demand from a large number of historical segments. For example, in the intelligent customer support scenario, when a user describes a complex problem, the system can automatically retrieve the most relevant past interactions based on the high matching and coverage of the core keywords, improve the accuracy and personalization level of the response, and enhance the user experience and problem solving efficiency. In the embodiments of the present application, by keyword extraction on the text content of each context segment and systematic comparison with the keyword field of the current dialogue task, the keyword coverage and core keyword matching degree can be quantitatively calculated, and the association of the context segment with the current task is accurately quantified. The two indicators are weighted and fused by using a preset weight, which effectively improves the discrimination ability of the keyword relevance score, so that the system can intelligently filter out the content that best meets the current context demand from a large number of historical segments. For example, in the intelligent customer support scenario, when a user describes a complex problem, the system can automatically retrieve the most relevant past interactions based on the high matching and coverage of the core keywords, improve the accuracy and personalization level of the response, and enhance the user experience and problem solving efficiency.

[0055] In order to improve the accuracy of keyword extraction, the system also combines word embedding technology (such as Word2Vec or BERT) to convert each word into a high-dimensional vector, and identifies potential core keywords by calculating the similarity between the word and the context semantics. All the keywords extracted from the context segment will be organized into a keyword set, which will represent the core content of the segment and help subsequent semantic analysis and matching. This process not only improves the accuracy of keyword extraction, but also ensures accurate analysis of long text content.

[0056] In the embodiments of the present application, by keyword extraction on the text content of each context segment and systematic comparison with the keyword field of the current dialogue task, the keyword coverage and core keyword matching degree can be quantitatively calculated, and the association of the context segment with the current task is accurately quantified. The two indicators are weighted and fused by using a preset weight, which effectively improves the discrimination ability of the keyword relevance score, so that the system can intelligently filter out the content that best meets the current context demand from a large number of historical segments. For example, in the intelligent customer support scenario, when a user describes a complex problem, the system can automatically retrieve the most relevant past interactions based on the high matching and coverage of the core keywords, improve the accuracy and personalization level of the response, and enhance the user experience and problem solving efficiency. First, the system identifies the main fields and semantic objects related to the task based on the specific content of the dialogue task and the task description or preset template. These semantic objects can be specific domain nouns, verbs, operation instructions, etc. Then, based on the topic labels or domain vocabularies defined by the task, the system uses semantic analysis tools to parse the text and extract the keywords directly related to the task, forming a preliminary keyword set for the task.

[0057] On the basis of the task keyword set, the system identifies core keywords through deep semantic matching technology. Core keywords refer to those elements that are most critical in the task goal or user demand. For example, for a "product query" task, core keywords may include "product", "query", and other keywords related to the product, such as "price", "model", etc. Through context analysis, the system can dynamically filter out the most representative words, ensuring the accuracy and precision of task keywords.

[0058] To further improve the identification of core keywords, the system also uses context association analysis to match the context of the task with the keyword set. Through the context information in the dialogue history, the system can better understand the user's intent, thereby improving the accuracy of task keyword extraction. In addition, the system can assign different weights to keywords according to the different priorities of the task, helping the system better identify the key content of the task in subsequent semantic matching. Ultimately, these keywords will be used for subsequent intent recognition and task matching, ensuring that the dialogue system can accurately respond to user needs.

[0059] Embodiments of the present application also provide a custom role switching device for an AI voice module, the device comprising: An instruction receiving module for receiving a user input role switching instruction, identifying and binding the native data of the current session with the first role before switching to form a first role session data set, and recording the current dialogue state of the first role; A target determination and archiving module for determining the switching target as the second role according to the user input role switching instruction, extracting and archiving the historical context information in the first role session data set to generate a context transfer data set associated with the second role, the role switching instruction including the switching target and the current dialogue task; A context filtering module for filtering the context transfer data set according to the dialogue task, combining the identity information, permission level and theme label of the second role, extracting historical context content suitable for the second role, and forming a context call data set exclusive to the second role; A session state updating module for updating the current session state with the second role according to the context call data set; A session recovery module for calling the saved current dialogue state of the first role and the first role session data set when the user switches back to the first role, recovering the historical context of the first role, to achieve accurate inheritance and tracking of the session state between multiple roles.

[0060] It should be noted that the device corresponds to the above method, and all implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0061] The above describes the preferred embodiments of the present application. It should be noted that, for those skilled in the art, several improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements should also be considered as falling within the scope of the present application.

Claims

1. A method for custom role switching in an AI voice module, characterized in that, The method includes: Receive the user's input of a role switching command, bind the original data of the current session with the first role before the switch to form a first role session data group, and record the current dialogue state of the first role; Based on the user's input role switching command, the switching target is determined to be the second role. The historical context information in the first role's conversation data group is extracted and archived to generate a context transfer data group for association with the second role. The role switching command includes the switching target and the current dialogue task. Based on the dialogue task, and combined with the identity information, permission level and topic tags of the second role, the context transition data group is filtered, and the historical context content applicable to the second role is extracted to form a context invocation dataset exclusive to the second role. Based on the context, invoke the dataset and update the current session state with the second role; When the user switches back to the first role, the saved current dialogue state and session data group of the first role are retrieved to restore the historical context of the first role, so as to achieve accurate inheritance and tracking of the session state between multiple roles.

2. The method for custom role switching in an AI voice module according to claim 1, characterized in that, Based on the user's input of a role switching command, the target role is determined to be the second role. Historical context information from the first role's session data group is extracted and archived to generate a context transfer data group for association with the second role, including: Based on the first role's conversation data group, the dialogue content is segmented according to time sequence and speaking rounds to obtain segmented data, and each data segment is assigned a unique timestamp and speaking sequence number; Based on the segmented data, user identity information, permission level and topic tags are extracted and bound to each segment to form a context segment with multidimensional metadata; Based on the context fragments, a unique identifier and index are established using their timestamps, speech numbers, identity information, topic tags, and permission levels to generate a context transfer data group for association with the second role.

3. The method for custom role switching in an AI voice module according to claim 1, characterized in that, Based on the dialogue task, and combined with the second role's identity information, permission level, and topic tags, the context transition data group is filtered to extract historical context content suitable for the second role, forming a context invocation dataset specific to the second role, including: Based on the context transition data set, context fragments that match permissions and are related to the topic are filtered out according to the identity information, permission level and topic tags of the second role, forming the first fragment filtering set; Based on each context fragment in the first fragment selection set, the comprehensive semantic matching degree with the current dialogue task is calculated through keyword extraction, intent recognition, and semantic relevance. Context fragments that meet the preset comprehensive semantic matching degree threshold are selected to generate the second fragment selection set. The context fragments in the second fragment selection set are deduplicated, merged, and conflict-resolved to generate the third fragment selection set. For each context fragment in the third fragment filtering set, the sensitive information review process is automatically triggered. Context fragments that require cross-role confirmation or have special permissions are reviewed and decided upon. Context fragments that pass the review are filtered out and a qualified fragment dataset is generated. The qualified fragment datasets are sorted according to time sequence to form a context call dataset specific to the second role.

4. The method for custom role switching in an AI voice module according to claim 2, characterized in that, Based on the segmented data, user identity information, permission level, and topic tags are extracted and bound to each segment to form a context segment with multidimensional metadata, including: Based on the segmented data, the source information of each segment is obtained. User identity information is identified through account identification or voiceprint recognition methods, and it is bound to the data segment as independent metadata to obtain the first segment data. Based on the first data segment, the segment content and context are analyzed. Combining the preset role permission model and content sensitivity judgment rules, permission levels are automatically assigned to each segment. The permission levels are then bound to the data segments as independent metadata to generate the second data segment. Based on the second data segment, keywords are extracted and themes are summarized from the segment content. The automatically identified theme tags are used as independent metadata and are bound to the data segment along with identity information and permission level to generate a context segment with multi-dimensional metadata.

5. A method for customizing role switching in an AI voice module according to claim 3, characterized in that, Based on the context transition data set, and using the second role's identity information, permission level, and topic tags, context fragments that match permissions and are related to the topic are filtered to form the first fragment filtering set, including: Based on the context transition data group, read the permission level of each context fragment and compare it with the permission level of the second role. Filter the context fragments with permission levels equal to or lower than the permission level of the second role to generate the first candidate set. Based on the first candidate set, extract the topic tags for each context fragment and compare them with the topic tags of the second character. Only when the topic tag content is completely consistent with the topic tag of the second character or is determined to belong to the same category in the preset tag mapping table, the fragment is retained and the rest of the fragments are removed to form the first fragment filtering set.

6. A method for customizing role switching in an AI voice module according to claim 3, characterized in that, For each context segment in the first segment selection set, its comprehensive semantic matching degree with the current dialogue task is calculated through keyword extraction, intent recognition, and semantic relevance. Context segments that meet the preset comprehensive semantic matching degree threshold are selected to generate the second segment selection set, including: For each context fragment, keywords are extracted and compared with the keyword field of the current dialogue task. Keyword coverage and core word matching are calculated and added together according to preset weights to obtain a keyword relevance score. Each context fragment and the text content of the current dialogue task are represented by a semantic feature vector, and a similarity score is calculated using the semantic feature vectors of the two, which is used as the semantic relevance score. For each context fragment, the content expression of the fragment is analyzed in conjunction with the topic tag, keyword relevance score and semantic relevance score to comprehensively analyze the consistency between the fragment's content expression and the intent of the current dialogue task objective, and the intent matching score of the fragment with the current dialogue task is determined accordingly. The keyword relevance score, intent matching score, and semantic relevance score of each context fragment are fused according to preset weights to calculate its comprehensive semantic matching score with the current dialogue task. Based on the overall semantic matching degree of all segments, context segments that are equal to or higher than the preset overall semantic matching degree threshold are selected to form a second segment selection set.

7. A method for customizing role switching in an AI voice module according to claim 4, characterized in that, The context fragments in the second fragment selection set are deduplicated, merged, and conflict resolved to generate the third fragment selection set, which includes: Based on the second segment selection set, calculate the similarity score between any two context segments. When the similarity score is greater than the preset first similarity threshold, only the context segment with the highest comprehensive semantic matching score is retained, and redundant context segments are removed to form a deduplicated segment set. Based on the deduplication fragment set, the content structure and metadata of the context fragments are analyzed. For context fragments under the same topic tag but with different content, when the similarity scores of the two are greater than the preset second similarity threshold, they are merged into a context fragment with a unified expression, generating a merged fragment set. Based on the merged fragment set, the fragments are compared sequentially according to time order, permission level, and topic tag. Conflict detection is performed on context fragments with similarity scores greater than the preset third similarity threshold but with differences in metadata. When multiple context fragments under the same topic tag are detected to have inconsistent content or permission levels, the context fragment with the higher permission level is retained. If the permission levels are the same, the fragment with the latest time sequence is retained, and the remaining fragments are removed to generate a third fragment filtering set.

8. A method for customizing role switching in an AI voice module according to claim 3, characterized in that, For each context fragment in the third fragment filtering set, a sensitive information review process is automatically triggered. Context fragments requiring cross-role confirmation or special permissions are reviewed and decided upon. Context fragments that pass the review are filtered out, generating a qualified fragment dataset, including: Based on each context fragment in the third fragment filtering set, the context fragments that need to be reviewed are automatically identified by determining whether their permission level and content attributes meet the preset sensitive information characteristics, cross-role call rules or special permission transfer conditions. For context fragments that need to be reviewed, they are reviewed according to preset automatic review rules, role and permission mapping table and sensitive information identification rules. If the review is successful, they will proceed to the next process. If the review is unsuccessful, the fragments will be automatically isolated and stored or removed from the subsequent context processing. For context fragments that cannot be accurately determined by automatic rules, they are pushed to the manual review stage, where they are reviewed by a designated role or system administrator. Once the review is passed, a review pass mark is assigned, and all qualified context fragments are generated into a qualified fragment dataset.

9. A method for customizing role switching in an AI voice module according to claim 6, characterized in that, For each context fragment, keywords are extracted and compared with the keyword field of the current dialogue task. Keyword coverage and core word matching are calculated and summed according to preset weights to obtain a keyword relevance score, including: Extract keywords from the text content of each context segment to obtain the keyword set for that segment; The keyword set of this segment is compared one by one with the keyword field of the current dialogue task. The number of keywords contained in the intersection of the two is counted and the ratio is calculated with the total number of keywords in the current dialogue task to obtain the keyword coverage of the segment. During the comparison process, the number of intersections between the keyword set of the segment and the core keyword set of the current dialogue task is counted. The number of intersections is divided by the total number of core keywords in the current dialogue task to obtain the core word matching score of the segment. Based on a preset weighting ratio, the keyword coverage and core word matching are weighted and summed to obtain the keyword relevance score between the context fragment and the current dialogue task.

10. A customizable role switching device for an AI voice module, characterized in that, The apparatus, used in the method according to any one of claims 1 to 9, comprises: The instruction receiving module is used to receive the role switching instruction input by the user, bind the original data of the current session with the first role before the switch to form the first role session data group, and record the current dialogue state of the first role. The target determination and archiving module is used to determine the switching target as the second role based on the role switching instruction input by the user, extract and archive the historical context information in the first role's conversation data group, and generate a context transfer data group for association with the second role. The role switching instruction includes the switching target and the current dialogue task. The context filtering module is used to filter the context transition data group based on the dialogue task, combined with the identity information, permission level and topic tags of the second role, and extract the historical context content applicable to the second role to form a context call dataset exclusive to the second role. The session state update module is used to call the dataset based on the context and update the current session state with the second role; The session recovery module is used to restore the historical context of the first role by calling the saved current dialogue state and session data group of the first role when the user switches back to the first role, so as to achieve accurate inheritance and tracking of the session state between multiple roles.

Citation Information

Patent Citations

  • Method and apparatus for session switching, and intelligent customer service robot

    CN105592237A

  • Multi-role intelligent chatting method and system

    CN105975622A

  • Dialogue assisting method and device based on multiple roles

    CN112836098A

  • Theme identification method and device, storage medium and electronic equipment

    CN115481697A

  • AI intelligent customer service response method and system based on remote digital service

    CN119719319A

Cited By

  • Marketing digital employee adaptive scheduling method based on skill atlas

    CN122198984A