Method, apparatus, equipment, and medium for generating target responses based on role consistency

By constructing a response generation method that integrates dialogue context and unified role constraint information, the problem of inconsistent responses and roles in intelligent dialogue systems in fintech business was solved, achieving coherence and consistency in dialogue content.

CN123117136APending Publication Date: 2026-11-17CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611540468.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-30
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing intelligent dialogue systems struggle to maintain the continuity of dialogue context in multi-turn conversations within the fintech business, resulting in inconsistent responses and poor role consistency. In particular, information is easily missed or duplicate or conflicting content is generated when switching between intelligent agents.

Method used

The dialogue context is constructed by acquiring the current dialogue information, dialogue status information, and historical dialogue information. The target response generation component is selected, the response information of the component is fused using unified role constraint information, and role consistency checks are performed to correct the fused response information to generate the target response.

Benefits of technology

It improves the coherence and role consistency of responses, ensuring that multiple response generation capabilities maintain consistent role characteristics in continuous dialogue, and reducing content omissions and conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123117136A_ABST
    Figure CN123117136A_ABST
Patent Text Reader

Abstract

This invention relates to the field of semantic parsing technology and discloses a method, apparatus, device, and medium for generating target responses based on role consistency. The method includes: acquiring current dialogue information, dialogue state information, and historical dialogue information to construct dialogue context information; determining target response generation components based on the dialogue context information and generating component response information; fusing the component response information with unified role constraint information, checking the role consistency of the fused response information, and retaining or correcting the fused response information based on the check results to obtain the target response information. This invention can be applied to business scenarios such as fintech. By fusing current dialogue information, dialogue state information, and historical dialogue information to construct dialogue context information, and selecting response generation capabilities accordingly, the method then fuses and checks the response content using unified role constraint information, ensuring that the content generated by various response generation capabilities maintains contextual coherence and role consistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of semantic parsing technology, and in particular to a method, apparatus, device, and medium for generating target responses based on role consistency. Background Technology

[0002] Existing intelligent dialogue systems typically employ either a single-agent processing approach or a multi-agent switching approach. A single agent needs to handle multiple types of dialogue tasks, while multiple agents each undertake different specialized tasks. During continuous interaction, existing methods struggle to simultaneously ensure the continuous use of dialogue context, the accurate invocation of specialized capabilities, and the consistency of responses from different roles.

[0003] In the fintech sector, intelligent dialogue systems are widely used in scenarios such as financial product consultation, insurance protection consultation, insurance demand analysis, insurance clause interpretation, and objection response. These scenarios involve the interaction partner's attribute information, past consultation content, risk concerns, and the content of the current consultation. As the number of dialogue rounds increases, this information is scattered across different rounds. A single intelligent agent is prone to missing information already acquired and struggles to accurately invoke relevant professional capabilities for different consultation content. The generated responses may contain inaccurate emphasis or incoherent content.

[0004] When multiple agents are used to handle financial consultation tasks, different agents typically have different areas of expertise and modes of expression. When agents switch roles or jointly participate in response generation, historical dialogue content and the current dialogue state may not be fully transmitted, and the content generated by different agents may also be repetitive, conflicting, or inconsistent in expression style. The combined response may also deviate from the pre-defined financial service role, exhibiting inconsistencies in identity positioning, expression style, or capability boundaries in different dialogue rounds. Summary of the Invention

[0005] The main objective of this invention is to provide a method, apparatus, device, and storage medium for generating target responses based on role consistency, aiming to solve the technical problem that existing intelligent dialogue technologies struggle to generate role-consistent response information based on a complete dialogue context when invoking multiple response generation capabilities.

[0006] To achieve the above objectives, the present invention provides a target response generation method based on role consistency, comprising: Obtain the current dialogue information, dialogue status information, and historical dialogue information, and construct dialogue context information based on the current dialogue information, dialogue status information, and historical dialogue information; Based on the dialogue context information, the target response generation component is determined from the preset candidate response generation components; The dialogue context information is input into the target response generation component, and the target response generation component is used to generate component response information; The component response information is fused based on the dialogue context information and the preset unified role constraint information to obtain fused response information; Based on the unified role constraint information, a role consistency check is performed on the fused response information, and the fused response information is retained or modified according to the check result to obtain the target response information.

[0007] Furthermore, to achieve the above objectives, the present invention provides a target response generation device based on role consistency, comprising: The context building module is used to obtain current dialogue information, dialogue state information, and historical dialogue information, and to build dialogue context information based on the current dialogue information, the dialogue state information, and the historical dialogue information; The component selection module is used to determine the target response generation component from the preset candidate response generation components based on the dialogue context information; The response generation module is used to input the dialogue context information into the target response generation component and use the target response generation component to generate component response information; The response fusion module is used to fuse the component response information based on the dialogue context information and the preset unified role constraint information to obtain fused response information; The role consistency check module is used to perform role consistency checks on the fused response information based on the unified role constraint information, and retain or correct the fused response information according to the check results to obtain the target response information.

[0008] Furthermore, to achieve the above objectives, the present invention also provides a computer device, the computer device including a memory, a processor, and a target response generation program based on role consistency stored in the memory and executable on the processor, wherein when the target response generation program based on role consistency is executed by the processor, it implements the steps of the target response generation method based on role consistency as described above.

[0009] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a target response generation program based on role consistency, wherein when the target response generation program based on role consistency is executed by a processor, it implements the steps of the target response generation method based on role consistency as described above.

[0010] Beneficial Effects: This invention relates to the field of semantic parsing technology and discloses a method, apparatus, device, and medium for generating target responses based on role consistency. The method includes: acquiring current dialogue information, dialogue state information, and historical dialogue information to construct dialogue context information; determining a target response generation component from candidate response generation components based on the dialogue context information; generating component response information using the target response generation component; fusing the component response information with the dialogue context information and unified role constraint information to obtain fused response information; checking the role consistency of the fused response information based on the unified role constraint information; retaining or correcting the fused response information based on the check results to obtain the target response information. This invention can be applied to business scenarios such as fintech. By fusing current dialogue information, dialogue state information, and historical dialogue information to form dialogue context information, selecting response generation capabilities based on the dialogue context information and generating component response information, and then using unified role constraint information for response fusion, role consistency checking, and deviation correction, the content generated by multiple response generation capabilities can maintain unified role characteristics by combining continuous dialogue context, improving the coherence and role consistency of response content. Attached Figure Description

[0011] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is a schematic diagram of an application environment for a target response generation method based on role consistency in one embodiment of the present invention; Figure 2 This is a flowchart illustrating an embodiment of the target response generation method based on role consistency of the present invention; Figure 3 for Figure 2 A detailed flowchart of step S10; Figure 4 for Figure 2 A detailed flowchart of step S20; Figure 5 for Figure 2 A detailed flowchart of step S30; Figure 6 for Figure 2 A detailed flowchart of step S40; Figure 7 for Figure 2 A detailed flowchart of step S50; Figure 8 for Figure 2 A detailed flowchart illustrating the processing steps following step S50. Figure 9 This is a schematic diagram of the functional modules of a preferred embodiment of the target response generation device based on role consistency of the present invention; Figure 10This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention; Figure 11 This is another structural schematic diagram of a computer device according to one embodiment of the present invention. Detailed Implementation

[0012] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0013] The target response generation method based on role consistency provided in this invention can be applied to, for example... Figure 1 In this application environment, the client communicates with the server via a network. The server can obtain current dialogue information, dialogue state information, and historical dialogue information from the client to construct dialogue context information; based on the dialogue context information, it determines the target response generation component from candidate response generation components and uses the target response generation component to generate component response information; it combines the dialogue context information and unified role constraint information to fuse the component response information to obtain fused response information; it checks the role consistency of the fused response information based on the unified role constraint information, and retains or corrects the fused response information based on the check results to obtain the target response information. This invention can be applied to business scenarios such as fintech. By fusing current dialogue information, dialogue state information, and historical dialogue information to form dialogue context information, it selects response generation capabilities and generates component response information based on the dialogue context information, and then uses unified role constraint information to perform response fusion, role consistency checks, and deviation corrections. This allows the content generated by multiple response generation capabilities to maintain unified role characteristics by combining continuous dialogue context, improving the coherence and role consistency of response content. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The invention will be described in detail below through specific embodiments.

[0014] Please see Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the target response generation method based on role consistency provided by the present invention. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0015] like Figure 2 As shown, the target response generation method based on role consistency proposed in this invention includes the following steps: S10, obtain the current dialogue information, dialogue status information and historical dialogue information, and construct dialogue context information based on the current dialogue information, dialogue status information and historical dialogue information; In this embodiment, the dialogue interface receives message data from the current round, and obtains the current round's dialogue information after character encoding unification, format cleaning, or speech-to-text correction. This current round's dialogue information can originate from text messages, speech-to-text results, or consultation content passed from the business interface. Dialogue status information is read from the session status storage area and may include interactive object attributes, current business status, and recorded key information. Historical dialogue information is read from the dialogue record storage area and is used to save message content, message direction, and occurrence time from previous rounds. These three types of information establish a correspondence through a session association identifier and distinguish between current and previous messages using time information. When constructing dialogue context information, the data format of the three types of information is unified, and the current round's dialogue information, dialogue status information, and historical dialogue information are written into their respective data areas to obtain structured data objects, serialized text, or composite data objects.

[0016] In the case of short text conversations for online insurance consultations, the system can simultaneously receive the current round of conversation information, read the conversation status information from the key-value storage area according to the conversation association identifier, and read the historical conversation information from the relational storage area. Then, the three types of information are written into a data object with independent fields.

[0017] In concurrent financial consultation scenarios, dialogue state information and historical dialogue information can be read in parallel. After verifying the session association identifier and state version identifier, dialogue context information can be constructed. In long dialogues with financial voice customer service, the speech-transcribed text can also be used as the information for the current round of dialogue. Dialogue state information can be read from the cache area, and historical dialogue information can be read from the document storage area according to the time range to generate serialized text with source and time markers.

[0018] In an insurance product consultation scenario, the inquirer has already asked about the coverage period, waiting period, and coverage liabilities, and the current round continues to inquire about the coverage content mentioned earlier. The dialogue interface obtains the current inquiry content, the session state storage area provides the product category, concerns, and consultation status, and the dialogue record storage area provides previous inquiries and corresponding responses. These three types of information are matched according to the session association identifier and written to the current message data area, status data area, and dialogue record area respectively, resulting in dialogue context information that simultaneously records the current inquiry, existing status, and previous dialogue content.

[0019] This embodiment obtains current messages, persistent states, and previous dialogue records, and constructs dialogue context information according to session correspondence and time relationships. This can reduce the omission of current messages, loss of states, and disorder of historical order in multi-turn dialogues, and enable information from different sources within the same session to be recorded coherently.

[0020] S20, Based on the dialogue context information, determine the target response generation component from the preset candidate response generation components; In this embodiment, the response generation component is a software functional unit capable of receiving dialogue context information and generating text within the corresponding response content range. The response generation component can encapsulate a text generation model, or it can employ text templates, information retrieval, and text concatenation logic, or a combination of these methods to generate response content. When using a text generation model, the text generation model is an internal generation part of the response generation component. The response generation component can also include functions such as input format conversion, component configuration reading, and output data encapsulation; therefore, the response generation component and the text generation model have different scopes. In the background technology, intelligent agents typically maintain role settings, session states, and dialogue logic independently, and can directly output responses to the inquiring object. The candidate response generation component does not maintain an external role facing the inquiring object separately, nor does it independently undertake the complete dialogue process; it is used to generate component response content within the corresponding response content range. Therefore, the candidate response generation component is an internally callable response capability unit, not an independent intelligent agent that switches roles in the background technology.

[0021] Dialogue context information can be structured data objects, serialized text, or composite data objects. During the reading process, the current message, session state, and history are parsed to extract content categories, information objects, and status markers that distinguish the response request. Candidate response generation components are pre-registered in the component configuration area. Each candidate response generation component can be configured with a component identifier, supported data types, response content range, and invocation status. The registration information of candidate response generation components can be written to a configuration file, component registry, or configuration database, and can be updated as components are added or removed. When determining the target response generation component, the content extracted from the dialogue context information is matched with the registration information of each candidate response generation component. Candidate response generation components with unavailable invocation status or inconsistent response content range are excluded. The target response generation component is then selected from the matching results. There can be one or more target response generation components, and their corresponding component identifiers are retained.

[0022] When the number of candidate response generation components is small and the range of response content is stable, a matching table is used to select the component. The matching table records the correspondence between content category, status flag, and component identifier. After reading the corresponding fields from the dialogue context information, the matching table is queried to obtain the target response generation component.

[0023] When there are many candidate response generation components or the registered content changes frequently, a component registry and an inverted index are used to select components. The component registry stores the response content range of each candidate response generation component, and the inverted index stores the correspondence between content terms and component identifiers. Content terms are extracted from the dialogue context information, candidate results are obtained by querying the inverted index, and the target response generation component is determined by combining the call status and the number of matches.

[0024] In an insurance consultation scenario, the dialogue context information records that the inquirer is asking about the meaning of the waiting period, and the history records the insurance product categories mentioned earlier. Candidate response generation components include a needs analysis component, a product introduction component, a terms interpretation component, and an objection handling component. The terms consultation category, waiting period information object, and product category are extracted from the dialogue context information, and the extracted content is matched with the response content scope of each candidate response generation component. The terms interpretation component's registered content includes the terms consultation category and waiting period information object, and its call status is available; therefore, it is identified as the target response generation component.

[0025] This embodiment parses the dialogue context information and matches it with the registered content of the preset candidate response generation component. It can determine the component corresponding to the response requirement based on the current message, session state and history, reducing the situation where the component selection is inconsistent with the dialogue content and avoiding the calling of components that do not match the scope of the response content.

[0026] S30, input the dialogue context information into the target response generation component, and use the target response generation component to generate component response information; In this embodiment, the dialogue context information is converted according to the data format supported by the target response generation component. The current message, session state, and history maintain their respective data boundaries and are written to the target response generation component through the component interface. The target response generation component can be a software component with an independent input interface and text generation capabilities. The component interface can receive structured data, serialized text, or word sequences. The target response generation component reads the content object, state information, and preceding content from the dialogue context information and outputs the response text according to the component's internal generation logic. When there are multiple target response generation components, each component receives the dialogue context information and generates its corresponding response content. The generation result is text data or structured data records containing text fields as the component's response information, thus preserving the complete boundaries of the component's generated content.

[0027] In insurance business queries with relatively fixed response formats, a template generation component is used to generate component response information. Content objects and status information from the dialogue context are mapped to template fields. A text template is selected through conditional matching, and the field content is then written to the corresponding location to obtain the component response information.

[0028] When financial product consultation content exhibits significant semantic variation, a text generation network is employed to generate component response information. This network comprises a token embedding layer, a context encoding layer, an attention decoding layer, and an output layer, all sequentially connected. Training data consists of dialogue context and the target response, with network parameters updated using token prediction loss. The dialogue context information is converted into a token sequence and input into the token embedding layer. After context encoding and attention decoding, an output token sequence is obtained, and component response information is generated based on the output length parameter and a termination marker.

[0029] In insurance policy consultation scenarios, the dialogue context information records the current inquiry, the insurance product category already inquired about, and previously discussed policy terms. The target response generation component is the policy response generation component. The dialogue context information is converted into input data supported by the policy response generation component, where the current inquiry is written to the message field, the insurance product category to the status field, and the previously discussed policy terms to the history field. The policy response generation component reads the content from each field, generates a response text for the current policy question, and records the response text as the component's response information.

[0030] This embodiment reduces the omission of contextual content during response generation by inputting dialogue context information with clear data boundaries into the target response generation component, and having the target response generation component read the current message, session state, and history to generate the component's response information. This ensures that the content generated by the component is consistent with the current dialogue environment.

[0031] S40, the component response information is fused based on the dialogue context information and the preset unified role constraint information to obtain fused response information; In this embodiment, component response information is segmented according to text boundaries, and duplicate, complementary, and conflicting content is identified by comparing text content and information objects. Dialogue context information provides the current message, session state, and history, used to determine the matching relationship between each response and the current dialogue. Unified role constraint information is read from the role configuration area and may include role attributes, language style, expression range, and output format. During the fusion process, duplicate content is deleted, complementary content is merged, and content matching the current message and session state is retained based on the dialogue context information. The retained content is adjusted in terms of word choice, sentence structure, and tone according to the unified role constraint information to generate fused response information with continuous semantics. When component response information is a single item, it can also be supplemented and its expression adjusted by combining dialogue context information and unified role constraint information.

[0032] When the component's response information uses structured fields and has a stable output format, field merging and text templates are used to achieve response integration. Content with the same field name is removed by content comparison, and content with different field names is written into the corresponding template position. Then, the wording is replaced and the sentence structure is adjusted according to the unified role constraint information.

[0033] When component responses use free text with complex semantic relationships, a fusion text generation network is employed to achieve response fusion. This network comprises a lexical embedding layer, an attention encoding layer, a constraint decoding layer, and an output layer. During training, dialogue context information, unified role constraint information, component response information, and the target fusion text are used as samples. After lexicalization, these samples are input into the network. The target fusion text serves as supervision data. Network parameters are updated using cross-entropy loss, and the learning rate, batch size, and maximum sequence length are adjusted based on the validation set loss. In application, the three types of inputs are converted into lexical sequences with data boundary markers, which are then processed through attention encoding and constraint decoding to generate the fusion response information.

[0034] In insurance product consultation scenarios, the product introduction component generates a description of the coverage, while the terms interpretation component generates a description of the waiting period. The dialogue context records the waiting period the inquirer is currently concerned about and the insurance products they previously asked about. The unified role constraint information specifies the requirements for professional, clear, and calm expression. During the fusion process, duplicate product names in the responses from the two components are identified, and the terms content matching the current waiting period question is retained. The description of the coverage is then included as related content in the response text. All content is adjusted in terms of wording and sentence structure according to the unified role constraint information to obtain a fused response that simultaneously includes both the description of the coverage and the waiting period.

[0035] This embodiment reduces content duplication, semantic conflict, and expression differences between different component outputs by identifying duplicate content, merging complementary content, and filtering conflicting content in the component response information, and by adjusting the response content in combination with dialogue context information and unified role constraint information, thus obtaining fused response information that matches the current dialogue and has unified role expression.

[0036] S50, perform a role consistency check on the fused response information based on the unified role constraint information, and retain or modify the fused response information according to the check result to obtain the target response information.

[0037] In this embodiment, the fused response information is split into text to be checked according to statement boundaries. Unified role constraint information is read from the role configuration area and can be in the form of structured fields, constraint text, or a combination of both. The content can include role attributes, expression style, and content scope. The role consistency check compares the text to be checked with the unified role constraint information item by item, determining whether there are deviations in word choice, tone, role identity, and response content, and generates a check result including the check status and deviation location. If the check result does not indicate a deviation, the fused response information is retained as the target response information; if the check result indicates a deviation, the words, sentence structure, or response content is adjusted according to the deviation location and the corresponding role constraints to obtain the target response information.

[0038] When the role requirements for online insurance customer service are recorded using structured fields, a constraint matching table is used to perform role consistency checks. The constraint matching table stores role terms, prohibited terms, expression formats, and replacement content. The terms and sentence structures in the merged response information are compared with the constraint matching table; if no deviation is found, the original text is retained; if a deviation is found, the corresponding position is corrected using replacement content.

[0039] When the role of comprehensive financial consultant requires the use of natural language text records, semantic vector comparison is used to complete the role consistency check. The unified role constraint information and the integrated response information are segmented into words separately, and semantic vectors are generated according to preset term weights. The semantic matching degree of each statement with the role constraint information is compared. When the matching degree is lower than a preset threshold, a semantically similar statement is selected from the candidate statements that meet the role constraints to replace the deviating statement, thus obtaining the target response information.

[0040] In insurance product consultation scenarios, the integrated response information includes explanations of coverage and terms, but some statements use certain profit promises, which are inconsistent with the prudent expression requirements recorded in the unified role constraint information. A role consistency check identifies the corresponding statements and generates a check result indicating a deviation. Based on the prudent expression requirements, the certain promises are adjusted to product benefit explanations and risk warnings, while retaining coverage and terms that meet the role requirements, resulting in a target response information consistent with the role's identity and expression style.

[0041] This embodiment compares the fused response information with the unified role constraint information, and retains the content that meets the role requirements or corrects the content that deviates based on the inspection results. This can reduce the changes in role identity, conflicts in expression style and deviations in content scope caused by the fusion of multiple component content, and keep the target response information consistent with the role characteristics.

[0042] In one embodiment, such as Figure 3 As shown, step S10 above includes: S101, Read the text to be processed and the session identifier from the dialogue interface, and use the text to be processed as the dialogue information for this round; S102, read the dialogue state information and historical dialogue information from the session storage area according to the session identifier, and extract the interaction object attribute information, current session stage, dialogue stage history and key dialogue information from the dialogue state information; S103, input the current round of dialogue information into the semantic recognition model to perform object entity recognition, obtain dialogue object information including object entities, extract information that records the same object as the object entity from the key dialogue information, and obtain the key information of the current round; S104, Arrange the dialogue records in the historical dialogue information according to the recording time, and extract a preset number of consecutive dialogue records at the end from the arranged dialogue records to obtain recent dialogue information. S105, Read the attribute name and the attribute content corresponding to the attribute name from the attribute information of the interactive object, and generate attribute description information in the order of attribute name first and corresponding attribute content last. S106, write the current round dialogue information into the current round dialogue field, write the attribute description information into the attribute description field, write the current session stage into the current session stage field, write the dialogue stage history into the dialogue stage history field, write the current round key information into the current round key information field, and write the recent dialogue information into the recent dialogue field to obtain dialogue context information.

[0043] In this embodiment, the dialogue interface receives a data message containing the text to be processed and a session identifier. It reads the text to be processed from the message body and the session identifier from the message header or a session association field. The text to be processed, after communication decoding, serves as the information for this round of dialogue, retaining the object name, negation words, numerical values, and word order. The session identifier can be generated when the session is established and transmitted with messages within the same session, used to associate the information for this round of dialogue with previously saved session data.

[0044] The session storage area can be a memory data area, database records, or distributed storage space. The corresponding storage entry is queried based on the session identifier to read the dialogue state information and historical dialogue information. The dialogue state information stores interactive object attribute information, the current session stage, dialogue stage history, and key dialogue information according to field names or data paths. Interactive object attribute information records attribute names and their corresponding content; the current session stage records the currently saved stage marker; the dialogue stage history retains the stages already experienced and their order; and key dialogue information stores the recorded information objects and their corresponding content. During the reading process, data boundaries between different fields are maintained to avoid mixing stage markers, attribute content, and historical messages.

[0045] The dialogue information in this round is converted into input data for the semantic recognition model through word segmentation and lexical encoding. The semantic recognition model may include a lexical embedding layer, a context encoding layer, and a sequence labeling layer connected in sequence. The lexical embedding layer converts words into vectors, the context encoding layer generates a contextual representation by combining the text before and after the words, and the sequence labeling layer outputs entity start, entity continuation, and non-entity tags. Text fragments are reconstructed based on continuous entity tags to obtain object entities, which are then saved to the dialogue object information. Object entities may contain object names, object numbers, or text fragments that can point to specific objects.

[0046] The training data for the semantic recognition model can consist of dialogue text and entity location annotations. The start and end positions of entities in the text are converted into word-level tags. The sequence labeling layer is trained according to the word labeling results, and the network parameters are updated using cross-entropy loss. Training and validation data can be divided by session to reduce the simultaneous inclusion of similar text from the same session in different datasets. The training batch can be set to sixteen texts, the maximum input length can be set to 512 words, and the initial learning rate can be set to 0.003%, adjusted according to the validation loss. Text exceeding the input length can be divided into segments along sentence boundaries, and when recovering object entities, the segment positions are converted to their positions in the current dialogue information.

[0047] The system reads object entities from the dialogue object information and compares them item by item with the recorded objects stored in the dialogue key information. When an object name has an abbreviation or alias, it can be converted to a unified name using an object name mapping table before determining if it points to the same object. If a match is found, the information content corresponding to the recorded object is read and saved as the key information for this round. When the dialogue object information contains multiple object entities, the correspondence between the information content and the object entity can be matched separately and preserved. The key information for this round comes from the already saved dialogue key information and is filtered according to the object entities identified in this round; if no object entity is identified or no matching object is found, an empty record can be used to represent the matching result.

[0048] The dialogue records in the historical dialogue information are arranged from earliest to latest recording time, with the last record in the arrangement corresponding to the most recent record in the current round. When the recording times are the same, message sequence markers can be used to determine the order. The preset number can be read from the session configuration and is used to control the number of dialogue records extracted. Continuous records are retrieved from the end of the arrangement backwards, maintaining the chronological order before extraction, to obtain the recent dialogue information. If the historical record is insufficient, existing records can be retained; if the historical record is empty, the recent dialogue information can be recorded as an empty set.

[0049] Interactive object attribute information can be stored as key-value pairs, tabular records, or structured objects. Each attribute name and its corresponding content are read, and attribute description fragments are generated in order of attribute name first, followed by attribute content. These fragments are then connected using attribute separators to obtain the attribute description information. Separating boundaries are set between attribute names and attribute content to prevent incorrect pairing of adjacent attributes. When attribute content contains multiple values, the original list relationship can be preserved; when attribute content is empty, a null value marker can be retained to avoid converting missing content into deterministic attribute content.

[0050] When constructing dialogue context information, data containers are created according to fixed field names. The "Current Dialogue" field, attribute description field, and current session stage field can respectively store the text of the current dialogue information, attribute description information, and the marker of the current session stage. The "Dialogue Stage History" field and "Recent Dialogue" field can use ordered lists to retain the stage order of the historical dialogue and the record order of the recent dialogue information, respectively. The "Current Key Information" field can use a data structure that corresponds to the object and the information content. After all fields are written, the data containers are saved as structured objects or serialized text to obtain the dialogue context information, while preserving field boundaries and null value states.

[0051] This embodiment associates current messages, dialogue status, and history with session identifiers, filters key information for the current round according to object entities, and constructs dialogue context information by combining recent dialogue information arranged by time and attribute description information that maintains attribute pairing relationships. This can reduce cross-session data mixing, object information mismatch, and historical order disorder, and enable current messages, existing status, and historical content to be centrally stored with clear data boundaries.

[0052] In one embodiment, such as Figure 4 As shown, step S20 above includes: S201, Read the current round of dialogue information from the current round dialogue field of the dialogue context information, and read the current session stage from the current session stage field of the dialogue context information; S202, input the current round of dialogue information into the intent recognition model to perform intent semantic recognition, and obtain the current round intent category and the current round intent object; S203, obtain preset candidate response generation component configuration information, wherein the candidate response generation component configuration information records the triggering session stage, response processing category and response processing object corresponding to each candidate response generation component; S204, the candidate response generation component whose corresponding triggering session stage is the same as the current session stage is determined as the stage matching response generation component; S205, for each stage matching response generation component, the current round intent category, the current round intent object, and the response processing category and response processing object corresponding to the stage matching response generation component are respectively input into the component selection model for category semantic comparison and object semantic comparison, to obtain the category comparison result and object comparison result corresponding to the stage matching response generation component; S206, the stage matching response generation component that has the same category semantics as the corresponding category comparison result and the same object semantics as the corresponding object comparison result is determined as the target response generation component.

[0053] In this embodiment, when the dialogue context information uses structured data objects, the fields for the current round of dialogue and the current session stage are located based on the field names, and the current round of dialogue information and the current session stage are read respectively. When the dialogue context information uses serialized text, the field names and field contents can be recovered according to the field separator markers, and then the corresponding data can be read. The current round of dialogue information retains the complete text of the current message, and the current session stage uses the stage markers saved in the session state to avoid changing the stage meaning during field reading.

[0054] The dialogue information in this round is input into the intent recognition model after word segmentation and lexical encoding. The intent recognition model can adopt a structure that connects the category classification branch and the object annotation branch using a shared text encoding layer. The shared text encoding layer obtains the text representation through lexical embedding and context encoding. The category classification branch outputs the intent category for this round based on the entire text representation, and the object annotation branch identifies the text segment to which the intent points based on the context representation of the lexical position and outputs the intent object for this round. The intent category for this round is used to distinguish response requests such as inquiries, comparisons, and confirmations. The intent object for this round records the actual object to which the response request points, avoiding the mixing of objects mentioned in the text but not belonging to the current query target into the recognition result.

[0055] Training data for the intent recognition model can include dialogue text, intent category labels, and text position annotations of intent objects. The start and end positions of intent objects are converted into word-level tags, and supervised training is performed on both the category classification branch and the object annotation branch. The shared text encoding layer is jointly updated using the category classification loss and the object annotation loss. Training data can include text with different expressions for the same intent category, as well as text containing multiple objects but with different query targets, allowing category classification and object annotation to learn the relationship between the response request and the target object, respectively. Training and validation sets can be divided according to the conversation, and network parameters are preserved based on the validation loss.

[0056] The configuration information for the candidate response generation component can be read from the configuration file, component registry, or configuration database. Each configuration record is associated with the component identifier of the candidate response generation component and stores the trigger session stage, response processing category, and response processing object. The trigger session stage records the stage marker in which the component participates in the processing, the response processing category records the response task undertaken by the component, and the response processing object records the object to which the response task is directed. Categories and objects can be stored using names, category codes, or text descriptions; when stored using codes, the mapping between codes and names can be used to convert them into text that the model can read, maintaining the meaning of the registration.

[0057] The corresponding triggering session stage is read based on the component identifier of the candidate response generation component and compared with the current session stage. The triggering session stage and the current session stage can use the same stage code; when using stage names, they can be converted to a unified code based on the stage name mapping table before comparison. If the comparison results are the same, the candidate response generation component is recorded as a stage-matching response generation component, retaining its component identifier, corresponding response processing category, and response processing object. The stage-matching response generation component uses the same data records as the candidate response generation component; stage filtering does not change the response processing category and response processing object.

[0058] The component selection model can employ a structure that connects the category comparison branch and the object comparison branch using a shared semantic encoding layer. For each stage of matching and generating the response component, the current intent category and its corresponding response processing category are paired to form a category text pair, and the current intent object and its corresponding response processing object are paired to form an object text pair. These two text pairs are then encoded using tokens and semantics, and input into the category comparison branch and the object comparison branch respectively, outputting the category comparison result and the object comparison result. Category comparison determines whether two categories express the same response task, while object comparison determines whether two objects point to the same response target. Different names can be identified using synonyms to obtain consistent results, while inputs with related content but different tasks or pointing to different objects retain inconsistent results.

[0059] The training data for the component selection model can consist of the current intent category, the current intent object, the response processing category, the response processing object, and two semantic consistency labels. Training samples can include input combinations where both category and object are consistent, the category is consistent but the object is inconsistent, the category is inconsistent but the object is consistent, and both are inconsistent. The category comparison branch and the object comparison branch are trained using classification loss respectively and jointly update the shared semantic encoding layer. The model output can be a consistency probability, converted into category comparison results and object comparison results through category decision thresholds and object decision thresholds. Both thresholds are determined based on validation set annotations to avoid using merged scores to mask individual inconsistencies. The maximum input length, batch size, and learning rate of both models can be adjusted based on the input text length, available storage capacity, and validation loss, while preserving the correspondence between lexical encodings and label positions during training.

[0060] The stage-matching response generation component can be selected item by item or arranged into batch input records according to component identifiers. During batch input, the response processing category and response processing object in each record are taken from the same stage-matching response generation component, and the model output is associated with the original component identifier according to the input position. The category comparison result and object comparison result corresponding to each stage-matching response generation component are read, and the stage-matching response generation component whose semantics are consistent in both results is determined as the target response generation component. When multiple stage-matching response generation components simultaneously meet the conditions, multiple target response generation components can be retained, maintaining the correspondence between each selection result and the component identifier.

[0061] This embodiment filters candidate response generation components by the current session stage and compares the current intent category with the response processing category and the current intent object with the response processing object. It can constrain component selection from three aspects: session stage, response task, and response goal, reducing the selection of components that meet the stage but not the task, or the task but not the object, while maintaining an accurate correspondence between the comparison results and the components.

[0062] In one embodiment, such as Figure 5 As shown, step S30 above includes: S301, respectively obtain the response generation configuration information corresponding to each target response generation component, the response generation configuration information including component identifier, knowledge base identifier and response generation instruction information; S302, the dialogue context information is input into the retrieval condition recognition model to identify the retrieval object and the retrieval limitation condition, and the knowledge retrieval object information and the knowledge retrieval limitation information are obtained. S303, for each target response generation component, determine the target knowledge base according to the corresponding knowledge base identifier, and use the knowledge retrieval object information and the knowledge retrieval limitation information to retrieve component knowledge information corresponding to the target response generation component from the target knowledge base; S304, the dialogue context information, the component knowledge information corresponding to the target response generation component, and the response generation instruction information are respectively input into the corresponding target response generation component to generate text with knowledge constraints, thereby obtaining single-component response information corresponding to the target response generation component; S305, write the component identifier corresponding to the target response generation component into the corresponding single component response information to obtain single component response information with component identifier; S306, Collect the single component response information with component identifiers to obtain component response information.

[0063] In this embodiment, each target response generation component establishes a correspondence with the response generation configuration information through a component identifier. The response generation configuration information can be stored in a configuration file, component registry, or configuration database, and indexed according to the component identifier. After reading the configuration record, the component identifier, knowledge base identifier, and response generation instruction information are obtained respectively. The component identifier is used to distinguish different target response generation components, the knowledge base identifier is used to point to the knowledge base that the component can access, and the response generation instruction information is used to record the response task, input content requirements, and output format requirements. The same target response generation component can be associated with one knowledge base identifier, or multiple knowledge base identifiers can be associated in the response generation configuration information; multiple knowledge base identifiers can be read separately according to the configuration order.

[0064] The dialogue context information is converted into a sequence of lexical terms supported by the retrieval condition recognition model. The retrieval condition recognition model may include a lexical embedding layer, a context encoding layer, a retrieval object annotation branch, and a retrieval condition annotation branch. The lexical embedding layer converts lexical terms in the dialogue context information into vectors, and the context encoding layer combines the content before and after the lexical terms to generate a contextual representation. The retrieval object annotation branch identifies the object name, object category, or object number pointed to by the knowledge query, obtaining knowledge retrieval object information. The retrieval condition annotation branch identifies categories, statuses, times, versions, and attribute content related to the retrieval scope, obtaining knowledge retrieval limiting information. The knowledge retrieval object information is used to determine the knowledge subject to be queried, and the knowledge retrieval limiting information is used to narrow the retrieval scope corresponding to the knowledge subject.

[0065] The training data for the retrieval condition recognition model can consist of dialogue context text, retrieval object location annotations, and retrieval condition location annotations. The start and end positions of objects and conditions are converted into word-level labels. The retrieval object annotation branch and the retrieval condition annotation branch are trained separately, and the context encoding layer is jointly updated using two annotation losses. Training data can include content where the same retrieval object has different names, the same condition uses different expressions, and multiple objects appear simultaneously in the text. The maximum input length, training batch size, and learning rate can be set according to the length of the dialogue context information and the validation loss; data exceeding the maximum input length can be segmented and encoded according to field boundaries, and then the recognition results are merged based on field positions.

[0066] Knowledge base identifiers can correspond to structured databases, document storage areas, inverted indexes, or vector indexes. The target knowledge base is determined by querying its storage address and data access interface based on the identifier. The target knowledge base can store knowledge objects, knowledge content, attribute fields, version information, and status information, and establish an index relationship between knowledge objects and knowledge content. When different target knowledge bases use different field names, the mapping relationship of search fields can be recorded in the knowledge base configuration, converting the knowledge retrieval object information and knowledge retrieval limitation information into query fields that the corresponding knowledge base can recognize.

[0067] When the target knowledge base uses structured data, knowledge retrieval object information can be written into the object query field, and knowledge retrieval constraint information into the condition query field. Knowledge records can then be filtered by comparing field values. When the target knowledge base uses text indexing, the knowledge retrieval object information can be segmented and name normalized. The inverted index can be queried to obtain knowledge records containing the corresponding terms, and records that do not meet the conditions can be filtered based on the knowledge retrieval constraint information. When the target knowledge base uses vector indexing, the knowledge retrieval object information and knowledge retrieval constraint information can be encoded into query vectors. Similarity can be compared with knowledge record vectors, and matching results can be selected from records that meet the retrieval constraint information. The retrieved knowledge text, structured fields, and version information can be written into component knowledge information according to the record boundaries in the knowledge base, ensuring that each component knowledge information maintains a correspondence with the target response generation component and the target knowledge base.

[0068] The response generation instruction information can be structured or natural language instructions, and its content can include the generation task, output content range, text format, and termination conditions. When inputting data to the target response generation component, the corresponding dialogue context information, component knowledge information, and response generation instruction information are determined based on the component identifier, and these three types of data are written into an input data object with independent boundaries. The dialogue context information provides the current message, session state, and historical content; the component knowledge information provides knowledge content retrieved from the target knowledge base; and the response generation instruction information controls the generation task and output format. Multiple target response generation components can receive their respective component knowledge information and response generation instruction information separately, avoiding the mixing of knowledge content and generation requirements from different components.

[0069] When the target response generation component uses a text template, it can select a template based on the response generation instruction information, write the field content from the dialogue context information and component knowledge information into the template location, and generate single-component response information. When the target response generation component uses a text generation network, it can include a lexical embedding layer, a context encoding layer, a knowledge encoding layer, a cross-attention layer, a constraint decoding layer, and an output layer. The context encoding layer encodes the dialogue context information, the knowledge encoding layer encodes the component knowledge information, the cross-attention layer establishes the correspondence between context content and knowledge content, the constraint decoding layer combines the response generation instruction information to generate output lexical units, and the output layer converts the lexical sequence into single-component response information.

[0070] The training data for the text generation network can consist of dialogue context information, component knowledge information, response generation instruction information, and target response text. Each type of input is segmented and written into different data regions, with boundary markers used to distinguish their source. During training, the word sequence of the target response text is used as supervision data, and the network parameters are updated using word prediction loss. Training samples can include inputs with similar knowledge content but different response tasks, as well as inputs with the same response task but different component knowledge information, enabling the network to distinguish the role of response generation instruction information and component knowledge information. Training parameters can include maximum input length, maximum output length, batch size, learning rate, and stopping condition; these parameters are adjusted based on the validation loss and the coverage of knowledge content in the response text. During generation, a termination marker and output length can be set to control the end position of the single-component response information.

[0071] After each single-component response is generated, the component identifier is read based on the correspondence between the target response generation component and the response generation configuration information. When the single-component response uses structured data, the component identifier can be written to the component identifier field, and the response text can be written to the response content field. When the single-component response uses text data, a data record containing both the component identifier and the response text can be created. After writing, the single-component response with the component identifier is obtained, ensuring that the component identifier and the corresponding response content are kept in the same data record.

[0072] The aggregation operation can use ordered lists, key-value sets, or message arrays to store single-component response information with component identifiers. When using ordered lists, data records can be written according to the configuration order of the target response generating components. When using key-value sets, component identifiers can be used as indexes to store the corresponding single-component response information. During aggregation, the data boundaries, component identifiers, and original text of each response content are preserved to obtain the component response information. When multiple target response generating components are associated with the same knowledge base, each response is still recorded separately according to its component identifier. When the same target response generating component corresponds to multiple knowledge contents, the generation results can be stored in the data record associated with the same component identifier.

[0073] This embodiment associates component identifiers with response generation configuration information, target knowledge bases, and single-component response information. It uses knowledge retrieval object information and knowledge retrieval limitation information to filter component knowledge information from the corresponding knowledge base, and combines dialogue context information, component knowledge information, and response generation instruction information to generate response content. This can reduce errors in knowledge base selection, deviations in retrieval scope, and mixing of data from different components. By writing component identifiers into single-component response information and preserving the data boundaries of each record, the component response information can accurately reflect the content generated by each target response generation component.

[0074] In one embodiment, such as Figure 6 As shown, step S40 above includes: S401, Read the single component reply information with component identifier from the component reply information, and extract the reply object and the reply content corresponding to the reply object from the single component reply information with component identifier to obtain a reply information point including the component identifier, the reply object and the reply content; S402, Read the current session stage, attribute description information, and key information of this round from the dialogue context information; S403, Obtain preset reply arrangement information, and read the component priority order corresponding to the current session stage from the reply arrangement information; S404, Arrange the response information points according to the component identifier and the component priority to obtain ordered response information points; S405, for each response information point, extract information from the attribute description information and the key information of this round that is the same as the response object in the response information point, and obtain the context supplementary information corresponding to the response information point; S406, Read role definition information and expression style information from the preset unified role constraint information; S407, the ordered response information points, the contextual supplementary information, the role definition information, and the expression style information are input into the response fusion model for content fusion and expression reconstruction to obtain fused response information.

[0075] In this embodiment, component response information can be stored as an ordered list, key-value set, or message array, containing single-component response information with component identifiers. Each data record is read, and record boundaries are preserved to obtain the component identifier. When single-component response information uses structured data, corresponding data can be read from the response object field and response content field; when using text data, the response object can be identified according to an object name mapping table, and the response content can be extracted according to the statement containing the object. When a single-component response information contains multiple response objects, it can be split into multiple response information points, each storing the component identifier, response object, and response content.

[0076] The current session stage, attribute description information, and key information for this round are read from the dialogue context information based on the field names. Attribute names in the attribute description information can be used as information objects, and attribute content as the corresponding information content. Key information for this round can be obtained using a data structure that maps information objects to information content. When the dialogue context information uses serialized text, field boundaries can be restored based on field separators before reading the content of the three fields.

[0077] Response ordering information can be stored in configuration files, sorting configuration tables, or configuration databases, and indexed according to session phases. Each configuration record stores the session phase and the corresponding component priority order. The component priority order can be a list of component identifiers or a data structure corresponding to component identifiers and order values. The component priority order is read based on the current session phase, and then the ordering position is queried according to the component identifier in the response information point to obtain the ordered response information points. When the same component generates multiple response information points, the original relative order can be maintained.

[0078] For each response information point, the response object is compared with the attribute description information and the information object in the current round of key information. When the object names are different, they can be converted to a unified name using an object name mapping table; when the object numbers are the same, the objects can be directly identified as identical. The attribute content and key information content corresponding to the matched object are read to obtain supplementary context information. The supplementary context information can save the information object, information content, and associated response information point identifiers, ensuring that the supplementary content corresponds to the response information point.

[0079] Unified role constraint information can be read from the role configuration area. Role definition information can include role name, role responsibilities, and role identity attributes, while expression style information can include language formality, vocabulary range, sentence structure, and paragraph structure. Both types of information can be stored as structured fields or natural language text and converted into a word sequence that the response fusion model can accept.

[0080] The response fusion model can include an input embedding layer, a response encoding layer, a supplementary information encoding layer, a role constraint encoding layer, a cross-attention layer, a fusion decoding layer, and an output layer. Ordered response information points are input into the response encoding layer in sequence, and the component priority is preserved through positional encoding. Contextual supplementary information is input into the supplementary information encoding layer, and a connection is established with the corresponding response object through response information point identifiers. Role definition information and expression style information are input into the role constraint encoding layer. The cross-attention layer associates the response content, supplementary content, and role constraints; the fusion decoding layer generates response tokens; and the output layer converts the response tokens into fused response information.

[0081] The training data for the response fusion model can consist of ordered response information points, contextual supplementary information, character definition information, expression style information, and the target fusion text. Various inputs are distinguished by data region labeling, with the target fusion text used as supervised data, and model parameters updated using lexical prediction loss. During generation, duplicate content can be merged, complementary content can be connected according to component priority, conflicting content can be selected based on contextual supplementary information, and the narrative perspective, vocabulary, and sentence structure can be adjusted according to character definition information and expression style information to obtain the fused response information.

[0082] This embodiment arranges the response information points according to the priority of the components and configures the contextual supplementary information for each response information point according to the response object, which can reduce the mixing of attribute content and key information of different objects; by combining role definition information and expression style information for content fusion and expression reconstruction, it can reduce content repetition, semantic conflict and expression difference in component response information, and obtain fused response information with coherent content and unified role expression.

[0083] In one embodiment, such as Figure 7 As shown, step S50 above includes: S501, Read role definition information, expression style information, prohibited mode information and capability boundary information from the unified role constraint information; S502, the fused response information is split according to the statement boundaries to obtain a set of statements to be checked; S503, the set of statements to be checked, the role definition information, the expression style information, the prohibited mode information and the capability boundary information are input into the role consistency check model to perform semantic comparison of role definition, semantic comparison of expression style, semantic comparison of prohibited mode and semantic comparison of capability boundary, and the check result is obtained. The check result includes the check status. S504, when the inspection status indicates a deviation, the deviation statement, deviation category, text position to be corrected, and corresponding constraint information are read from the inspection result. The deviation statement, deviation category, text position to be corrected, and corresponding constraint information are input into the response correction model for text replacement and sentence reconstruction to obtain the corrected statement. The corrected statement is used to replace the deviation statement in the fused response information to obtain the target response information. S505, when the inspection status indicates that there is no deviation, the fused response information is retained as the target response information.

[0084] In this embodiment, unified role constraint information can be stored in a role configuration file, a role configuration table, or a configuration database. Role definition information may include role name, role responsibilities, and identity attributes, describing the role's perspective in the response. Expression style information may include the range of vocabulary, language formality, sentence structure, and paragraph structure. Prohibited pattern information may include prohibited words, sentence structures, and content types. Capability boundary information may include the allowed content range of responses and the response format used when exceeding the range. Each constraint can be configured with a constraint identifier, enabling the inspection results to record the source of the constraint when a deviation occurs.

[0085] The merged response information can be split based on periods, question marks, exclamation marks, line breaks, and paragraph boundaries. During the splitting process, the start and end positions of each statement in the merged response information are recorded, while maintaining the original order of the statements. Consecutive punctuation marks or abbreviations can be identified using a punctuation combination table to avoid incorrectly splitting complete statements. The split statements and their corresponding text positions are written into a set of statements to be checked.

[0086] The role consistency check model can include a statement encoding layer, a role constraint encoding layer, four semantic comparison branches, and a deviation position annotation layer. The statement encoding layer converts the statement to be checked into a semantic representation. The role constraint encoding layer encodes role definition information, expression style information, prohibited pattern information, and capability boundary information, respectively. The role definition comparison branch determines whether the identity and responsibility used in the statement are consistent with the role definition information; the expression style comparison branch determines whether the word choice, tone, and sentence structure are consistent with the expression style information; the prohibited pattern comparison branch determines whether the statement contains content pointed to by the prohibited pattern information; and the capability boundary comparison branch determines whether the content of the statement is within the response range recorded in the capability boundary information. The deviation position annotation layer outputs the position of the deviated lexical unit.

[0087] The training data for the role consistency check model can consist of statements to be checked, four types of role constraint information, check status, deviation category, deviation text position, and corresponding constraint identifier. Training samples can include statements with identity deviation, style deviation, prohibited mode triggering, capability range deviation, and statements without deviation. The four semantic comparison branches are trained using classification loss, while the deviation position annotation layer is trained using lexical position loss, and both branches jointly update the statement encoding layer. The training and validation sets can be divided according to role configuration, ensuring that similar statements from the same role are not simultaneously distributed across different datasets. The maximum input length, training batch size, and learning rate can be adjusted based on the constraint text length and validation loss.

[0088] The set of statements to be checked can be input into the role consistency check model sentence by sentence, or it can be batched into input data according to the order of the statements. The model output corresponds to the position of the statement in the set of statements to be checked. When any semantic comparison branch indicates a deviation, the check status is recorded as "deviation exists," and the deviation category is determined according to the corresponding branch; the position of the text to be corrected is determined according to the output of the deviation position annotation layer, and the corresponding constraint information is read from the corresponding role constraint information. The check results can be stored in structured data, including the check status, the deviating statement, the deviation category, the position of the text to be corrected, and the corresponding constraint information. When no deviation occurs in any statement, the check status is recorded as "no deviation exists."

[0089] The response correction model can include a deviation statement encoding layer, a correction position encoding layer, a constraint information encoding layer, a constraint decoding layer, and a text output layer. The deviation statement encoding layer generates a semantic representation of the statement; the correction position encoding layer marks the range of terms that need to be changed; and the constraint information encoding layer encodes the deviation category and corresponding constraint information. The constraint decoding layer retains content outside the text position to be corrected and generates replacement terms or reconstructed sentence structures based on the corresponding constraint information. The text output layer generates the corrected statement. Text replacement is suitable for situations where local words deviate, while sentence structure reconstruction is suitable for situations where tone, perspective, or content scope deviates.

[0090] The training data for the response correction model can consist of the deviation statement, deviation category, the position of the text to be corrected, corresponding constraint information, and the corrected statement. During training, the position of the text to be corrected is converted into a positional marker, and the corrected statement is used as supervision data. The model parameters are updated using lexical prediction loss. Training samples can include correction types such as word substitution, word order adjustment, sentence transformation, and out-of-bounds content removal. During generation, positional masks can be used to limit the range of text changes, and the output length and termination marker can be set to obtain the complete corrected statement.

[0091] When the check indicates a deviation, the corresponding content is read according to the text position of the deviated statement in the fused response information. The deviated statement, deviation category, text position to be corrected, and corresponding constraint information are input into the response correction model. After obtaining the corrected statement, the deviated statement in the fused response information is replaced according to its original text position. When there are multiple deviated statements, they can be replaced item by item in the order of the statement set to be checked, while keeping the non-deviated statements and their order unchanged, to obtain the target response information. When the check indicates no deviation, the text content of the fused response information remains unchanged and is directly saved as the target response information.

[0092] This embodiment breaks down the fused response information into sentences and performs semantic comparisons based on role definition information, expression style information, prohibited mode information, and capability boundary information. This allows for the identification of deviations in role identity, expression form, and response scope. By correcting the deviation sentences according to the deviation category, the position of the text to be corrected, and the corresponding constraint information, the content changes caused by the expansion of the correction scope can be reduced, while ensuring that the target response information maintains a consistent role identity, expression style, and capability scope.

[0093] In one embodiment, such as Figure 8 As shown, after step S50 above, the following steps are also included: S601, Read the session identifier from the dialogue interface, output the target response information through the dialogue interface according to the session identifier, and read the current session stage from the dialogue status information; S602, Obtain preset session phase configuration information, and read the current phase target and phase transition order corresponding to the current session phase from the session phase configuration information; S603, compare the current round dialogue information, the target response information and the current stage target input stage judgment model with dialogue semantics, response semantics and stage target semantics to obtain stage target achievement status and stage advancement intention information; S604, when the stage goal achievement status indicates that the current stage goal has been achieved and the stage advancement intention information indicates that the session stage is being advanced, the target session stage is determined according to the stage transition order; when the stage goal achievement status indicates that the current stage goal has not been achieved or the stage advancement intention information indicates that the session stage is being maintained, the current session stage is determined as the target session stage. S605, extract the interaction object attribute update information and the key information of the current round of dialogue from the current round of dialogue information, update the interaction object attribute information in the dialogue state information according to the interaction object attribute update information, write the key information of the current round of dialogue into the key information of the dialogue state information, when the target session stage is different from the current session stage, add the target session stage to the dialogue stage history in the dialogue state information, and update the current session stage in the dialogue state information to the target session stage, to obtain the updated dialogue state information; S606, add the current dialogue information and the target response information to the historical dialogue information according to the order in which the dialogue occurs, to obtain the updated historical dialogue information, and store the updated dialogue status information and the updated historical dialogue information according to the session identifier.

[0094] In this embodiment, the dialogue interface can be a message interface, a network service interface, or an inter-process communication interface. After reading the session identifier, the session identifier and the target reply information are written into the output data message. The session identifier determines the session channel corresponding to the target reply information, and then the dialogue interface sends the output data message. The session identifier also serves as a query index for the session storage area, used to read the dialogue state information corresponding to the current session and obtain the current session stage from the dialogue state information. The target reply information in the output data message retains the text content at the time of generation, avoiding changes to the interface encapsulation after role consistency checks.

[0095] Session phase configuration information can be stored in configuration files, phase configuration tables, or configuration databases, and indexed according to session phases. Each configuration record can include a session phase flag, phase goal, and phase transition position. The corresponding configuration record is queried based on the current session phase to retrieve the current phase goal and phase transition order. The current phase goal can be stored as natural language text or structured conditions, describing the interactive content that needs to be completed in the current session phase. The phase transition order can be an ordered list of phases or a data structure corresponding to the current session phase and the next session phase. When the current session phase is at the end, the phase transition order can associate the end position with the current session phase.

[0096] The current dialogue information, target response information, and current stage goal are segmented and encoded into words, and then input into the stage judgment model. The stage judgment model can include a dialogue encoding layer, a response encoding layer, a stage goal encoding layer, a cross-attention layer, a goal achievement classification branch, and a stage advancement classification branch. The dialogue encoding layer extracts the intent semantics from the current dialogue information, the response encoding layer extracts the response semantics from the target response information, and the stage goal encoding layer extracts the target semantics from the current stage goal. The cross-attention layer associates the three semantic representations; the goal achievement classification branch outputs the stage goal achievement status (whether the current stage goal has been achieved or not), and the stage advancement classification branch outputs the stage advancement intent information for advancing or maintaining the conversation stage.

[0097] The training data for the stage judgment model can consist of current dialogue information, target response information, current stage target, target achievement label, and stage progress label. Training samples can include input combinations of targets that have been achieved and are suitable for progress, targets that have been achieved but are suitable for maintenance, targets that have not yet been achieved but are suitable for maintenance, and targets that have not yet been achieved but show progress semantics. The two classification branches are trained using classification losses respectively and jointly update three encoding layers and a cross-attention layer. The training and validation sets can be divided according to the conversation, and the maximum input length, training batch size, learning rate, and classification threshold can be adjusted based on the validation loss.

[0098] The stage determination model outputs two classification probabilities, which are then converted into stage goal achievement status and stage advancement intention information through the goal achievement threshold and stage advancement threshold, respectively. When the stage goal achievement status indicates that the current stage goal has been achieved, and the stage advancement intention information indicates advancing the session stage, the next session stage is read based on the current session stage's position in the stage transition order to obtain the target session stage. When the stage goal achievement status indicates that the current stage goal has not yet been achieved, or the stage advancement intention information indicates maintaining the session stage, the current session stage is recorded as the target session stage. Both outputs participate in the determination separately to avoid one classification result overriding the other.

[0099] The dialogue information in this round can be segmented, object entity identified, and attribute name matched to identify the attribute content of the interactive objects. Attribute name matching can convert attribute names, attribute aliases, and attribute content in the text into attribute fields and corresponding values ​​based on the attribute configuration table, thus obtaining the interactive object attribute update information. The interactive object attribute update information can include the attribute name, attribute content, and text position to be updated. For information that is not an interactive object attribute, a correspondence can be established between the object name and the information content to obtain the key information of this round of dialogue. The interactive object attribute update information and the key information of this round of dialogue are stored separately to avoid mixing attribute content and key dialogue information.

[0100] The system queries the interaction object's attribute information in the dialogue state information based on the attribute name in the interaction object's attribute update information, and writes the corresponding attribute content into the attribute field. When an attribute field stores a single item, the existing content can be updated using the attribute content identified in this round; when an attribute field stores multiple items, new content can be added and duplicates removed. Key information from this round of dialogue can be written into the dialogue key information according to the information object; if the information object already exists, the corresponding content can be updated or information items with different recording times can be added; if the information object does not yet exist, a new object record can be created.

[0101] Compare the target session stage with the current session stage. If they differ, add the target session stage to the dialogue stage history, maintaining the existing stage order, and then update the current session stage in the dialogue state information to the target session stage. If they are the same, do not add duplicate stage records and retain the current session stage. After writing the interaction object attribute information, key dialogue information, current session stage, and dialogue stage history, the updated dialogue state information is obtained.

[0102] Separate dialogue records are created for the current round of dialogue and the target's response. Each dialogue record can include message content, message direction, recording time, and message sequence markers. The two dialogue records are added to the historical dialogue information in the order that the current round of dialogue occurred before the target's response, resulting in updated historical dialogue information. If the recording times are the same, the order can be maintained using message sequence markers.

[0103] The session storage location is determined based on the session identifier, and the updated session state information and updated historical session information are written to the corresponding storage records. These two pieces of information can be written in the same transaction or in separate writes controlled by a status version identifier. When using a status version identifier, the read version is compared with the current stored version before writing. If the versions match, the update is committed; if the versions do not match, the session data is reread and the updated content is merged, reducing the risk of concurrent messages overwriting already written session state or historical records.

[0104] This embodiment outputs target response information and associates it with session data by using session identifiers. By combining the current round of dialogue information, target response information, and current stage target to determine the stage target achievement status and stage progress intention information, the current session stage can be updated according to the stage transition order. At the same time, the interaction object attribute information, key dialogue information, dialogue stage history, and historical dialogue information are updated, which can reduce the duplication of session stage recording, omission of attribute content, and disorder of the current round of messages and responses, so as to keep the session state and dialogue records continuous.

[0105] In one embodiment, during a series of insurance consultation sessions, the client is a 34-year-old married individual with one 4-year-old child, an annual income of approximately 180,000 yuan, and a monthly mortgage payment of approximately 6,500 yuan. The client hopes to reduce the annual premium for insurance products to around 6,000 yuan. Their past health information includes mild fatty liver disease. The client has already gone through the opening, empathy, needs discovery, product introduction, and policy details stages, and is currently in the objection handling stage. Previous conversations have discussed family financial responsibilities, income interruption risks, term life insurance coverage periods, and coverage amounts. This round of consultation addresses the client's concerns about the waiting period, exclusions, and whether their health condition will affect subsequent claims. The client also expresses a desire to understand the next steps in the application process if the terms are acceptable.

[0106] The dialogue interface receives the current consultation content and session identifier 20260901001, treating the current consultation text as the current dialogue information. Based on the session identifier, it reads the dialogue status information and historical dialogue information from the session storage area. The dialogue status information records the interaction object attributes such as age, family situation, income level, mortgage payments, premium budget, and health status. The current dialogue stage is recorded as objection handling. The historical dialogue stage records the stages already experienced: icebreaker, empathy, needs analysis, product introduction, and terms interpretation. Key dialogue information records the consultation recipient's concerns regarding family financial responsibility, waiting period, exclusions, and health disclosure. The semantic recognition model identifies entities such as term life insurance, mild fatty liver, waiting period, exclusions, and claims impact from the current dialogue information, and extracts existing records identical to these entities from the key dialogue information to obtain the key information for this round.

[0107] Historical dialogue information is arranged from earliest to latest recording time. The most recent 8 consecutive dialogue records are extracted from the end of the list to obtain recent dialogue information. The interaction object's attribute information is converted into attribute description information in the format of attribute name first, attribute content last. This includes age 34, family status: married with 1 child, annual income approximately 180,000 yuan, monthly mortgage payment approximately 6,500 yuan, annual insurance premium budget approximately 6,000 yuan, and health condition: mild fatty liver. The current consultation text is written to the current dialogue field, the attribute description information is written to the attribute description field, the objection handling stage is written to the current conversation stage field, the stages already experienced are written to the dialogue stage history field, the waiting period, exclusions, and health disclosure records are written to the current key information field, and the most recent 8 dialogue records are written to the recent dialogue field to obtain dialogue context information.

[0108] The current dialogue information is read from the "Current Dialogue" field in the dialogue context information, and the objection handling stage is read from the "Current Session Stage" field. The intent recognition model performs semantic recognition on the current dialogue information, obtaining the intent category as "Terms and Claims Objection Handling," and the intent object as the waiting period and the scope of exemptions related to health conditions. The candidate response generation component configuration information registers the following components: Needs Analysis Component, Product Introduction Component, Terms Interpretation Component, Objection Handling Component, Closing Component, and After-Sales Component. Both the Terms Interpretation Component and the Objection Handling Component register the objection handling stage as a triggerable stage. The triggering session stages registered by the Needs Analysis Component, Product Introduction Component, Closing Component, and After-Sales Component are different from the current session stage; therefore, the Terms Interpretation Component and the Objection Handling Component are identified as stage-matching response generation components.

[0109] The component selection model compares the intent category of this round with the response processing categories of the response generation components in both stages, and also compares the intent object of this round with the response processing object of the response generation components in both stages. The response processing categories registered by the terms interpretation component include terms and claims objection handling, with response processing objects including waiting periods, exclusions, and health conditions. The response processing categories registered by the objection handling component include responding to customer concerns, with response processing objects including long waiting periods, complex exclusions, and claims uncertainty. The component selection model identifies that the semantics of both categories and objects are consistent with the content of this round of consultation. Therefore, the terms interpretation component and the objection handling component are jointly determined as the target response generation components. The response in this round is completed through collaboration of internal multi-capability modules, while maintaining a unified virtual advisor role for the consultation recipient.

[0110] The component identifier for the terms interpretation component is 2101, and the corresponding knowledge base identifier is 3101. The response generation instruction requires explaining the relationship between the waiting period, exclusions, and health disclosures based on the valid terms. The component identifier for the objection handling component is 2102, and the corresponding knowledge base identifier is 3102. The response generation instruction requires identifying the concerns of the inquirer, responding with empathy but not overly marketing, and avoiding making definitive underwriting or claims commitments. The retrieval condition identification model obtains knowledge retrieval object information from the dialogue context, including the waiting period for term life insurance, exclusions, and health disclosures related to mild fatty liver. It also obtains knowledge retrieval limitation information, including the current product category, valid terms version, health disclosure status, and objection handling stage.

[0111] Based on knowledge base identifier 3101, the policy knowledge base is determined. Knowledge records regarding the 90-day waiting period, exclusions, health disclosures, and underwriting conclusions in the current valid version are retrieved to obtain the component knowledge information corresponding to the policy interpretation component. Based on knowledge base identifier 3102, the sales strategy knowledge base is determined. Communication content regarding waiting period objections, exclusion objections, and claims uncertainty objections is retrieved to obtain the component knowledge information corresponding to the objection handling component. The policy interpretation component, combining dialogue context information, policy knowledge records, and response generation instructions, generates a single-component response regarding the scope of the waiting period, the exclusions being based on the insurance contract, and the requirement for truthful disclosure of health conditions, confirmed by the underwriting results. The objection handling component, considering the client's family responsibilities, annual premium budget of 6000 yuan, and current concerns, generates a single-component response that first addresses concerns, then distinguishes between the waiting period and exclusions, and finally explains subsequent processing arrangements. Component identifiers 2101 and 2102 are written into the corresponding single-component response information, which are then aggregated to obtain the component response information.

[0112] The system reads two single-component response messages with component identifiers from the component response information, extracts the response objects and corresponding response content such as waiting period, scope of exemption, health notification, and follow-up handling arrangements, and obtains multiple response information points. It also reads the current conversation stage, attribute description information, and key information of this round from the dialogue context information. The response arrangement information corresponding to the objection handling stage places the factual explanations of the clauses before the objection response and the follow-up handling arrangements after the explanations of concerns. Therefore, the response information points generated by the clause interpretation component are arranged before the response and handling suggestions of the objection handling component, resulting in ordered response information points.

[0113] Regarding the waiting period response, we extracted the inquirer's concerns about the 90-day waiting period from the key information in this round. Regarding the exclusions response, we extracted the inquirer's concerns about the impact of health conditions on claims. Regarding the subsequent processing arrangements response, we extracted the annual premium budget of 6000 yuan from the attribute description information and the inquirer's willingness to continue learning about the processing arrangements from the key information in this round, obtaining corresponding supplementary contextual information. The unified role constraint information defines the external role as a unified virtual insurance advisor, requiring a professional, enthusiastic, and friendly demeanor. The communication style information requires a friendly yet professional approach, avoiding excessive sales pitches; using "I understand" when expressing understanding, and "we" when bridging the communication gap; and keeping answers direct and clear.

[0114] The integrated response model combines the interpretation of the policy terms and responses to objections according to the order of the information points. It places the inquirer's concerns about the waiting period, health condition, and premium budget in the corresponding positions, and adjusts the tone and sentence structure according to unified role constraints. The integrated response information explains that it understands the inquirer's concerns about the waiting period and exclusions, suggesting that the waiting period, exclusions, and health disclosures can be confirmed separately. Specifically, the waiting period is recorded as 90 days according to the current effective policy, and the specific applicable liability is subject to the contract terms. Mild fatty liver requires truthful information provided during the health disclosure stage; whether or not coverage is provided and underwriting conditions are determined by the underwriting results. If the policy terms and premium budget are acceptable, the health disclosure and confirmation of application materials can continue.

[0115] The unified role constraint information also prohibits excessive sales pitches, mechanical responses, and switching personas, and sets certainty of underwriting and claims commitments outside the capability boundary. The role consistency check model breaks down and merges response information according to statement boundaries, comparing role definitions, expression styles, prohibited patterns, and capability boundaries. During the check, it was found that one piece of original content provided by the objection handling component contained a certainty that claims would be paid after truthful disclosure. This content constituted a deviation from the capability boundary, and the check result recorded the deviation, along with the corresponding statement, the category of capability boundary deviation, the text location of the certainty judgment, and the constraint information prohibiting claims commitments. The response correction model reconstructs the relevant statements to emphasize that truthful disclosure is a crucial basis for underwriting and subsequent claims review. Specific underwriting and payment results need to be determined based on contract terms, disclosure details, and review results. The corrected statements replace the deviating statements to obtain the target response information. The corrected response maintains the unified virtual consultant role, a friendly yet professional expression style, and a service approach that avoids excessive marketing. The client is unaware of the collaboration between the internal terms interpretation component and the objection handling component.

[0116] The dialogue interface reads the session identifier 20260901001, outputs the target response information to the corresponding session according to the session identifier, and reads the current session stage as objection handling from the dialogue status information. The session stage configuration information records that the current stage goal of the objection handling stage is to clarify customer doubts and confirm whether they are willing to continue processing. The stage transition order includes objection_handling, closing (closing), and after_sales (after-sales confirmation). The stage judgment model semantically compares the current round of dialogue information, target response information, and current stage goal, identifying that the waiting period, scope of exemption, and health status have received targeted responses, and the stage goal achievement status indicates that the current stage goal has been achieved; if the current round of dialogue information contains the intention to understand the next processing arrangements when the terms are acceptable, and the target response information also provides the connection content of health notification and document confirmation, then the stage advancement intention information indicates that the session stage is being advanced. According to the stage transition order, the closing stage is determined as the target session stage.

[0117] This process extracts updated information about the interacting party's attributes from the current dialogue, including an annual premium budget of approximately 6,000 yuan, a mild fatty liver condition, and a willingness to continue learning about the application process. It also extracts key information from the current dialogue, such as the waiting period, exclusions, health disclosures, and subsequent application arrangements. The updated interacting party attributes are written into the interacting party attribute information, and the key information from this round of dialogue is written into the dialogue key information. Since the target conversation stage differs from the current conversation stage, the closing stage is added to the conversation stage history, and the current conversation stage is updated from objection handling to closing, resulting in updated conversation status information. Following the order of the dialogue, the content of this round of consultation and the target response are added to the historical conversation information, resulting in updated historical conversation information. Finally, based on the conversation identifier, the updated conversation status information and the updated historical conversation information are written to the conversation storage area. At this point, the customer profile, sales progress, stage history, key information, and recent conversations are all maintained. The next round of dialogue can continue with external communication by a unified virtual consultant, and internal capability modules can participate in collaboration based on the closing stage.

[0118] In one embodiment, a target response generation device based on role consistency is provided, which corresponds one-to-one with the target response generation method based on role consistency described in the above embodiments. (Refer to...) Figure 9 , Figure 9 This is a schematic diagram of the functional modules of a preferred embodiment of the target response generation device based on role consistency of the present invention. The target response generation device based on role consistency includes: a context construction module 10, a component selection module 20, a response generation module 30, a response fusion module 40, and a role consistency check module 50. Detailed descriptions of each functional module are as follows: Context building module 10 is used to obtain current dialogue information, dialogue state information and historical dialogue information, and to build dialogue context information based on the current dialogue information, the dialogue state information and the historical dialogue information; The component selection module 20 is used to determine the target response generation component from the preset candidate response generation components based on the dialogue context information; The response generation module 30 is used to input the dialogue context information into the target response generation component and generate component response information using the target response generation component; The response fusion module 40 is used to fuse the component response information according to the dialogue context information and the preset unified role constraint information to obtain fused response information; The role consistency check module 50 is used to perform role consistency checks on the fused response information based on the unified role constraint information, and retain or correct the fused response information according to the check results to obtain the target response information.

[0119] In one embodiment, the context building module 10 is specifically used for: Read the text to be processed and the session identifier from the dialogue interface, and use the text to be processed as the dialogue information for this round. Based on the session identifier, read the dialogue state information and historical dialogue information from the session storage area, and extract the interaction object attribute information, current session stage, dialogue stage history and key dialogue information from the dialogue state information; The current dialogue information is input into a semantic recognition model for object entity recognition to obtain dialogue object information including object entities. Information that records the same object as the object entity is extracted from the key dialogue information to obtain the key information of the current round. The dialogue records in the historical dialogue information are arranged according to the recording time. A preset number of consecutive dialogue records at the end are extracted from the arranged dialogue records to obtain the recent dialogue information. Read the attribute name and the attribute content corresponding to the attribute name from the attribute information of the interactive object, and generate attribute description information in the order of attribute name first and corresponding attribute content last. Write the current round of dialogue information into the current round of dialogue field, write the attribute description information into the attribute description field, write the current session stage into the current session stage field, write the dialogue stage history into the dialogue stage history field, write the current round of key information into the current round of key information field, and write the recent dialogue information into the recent dialogue field to obtain the dialogue context information.

[0120] In one embodiment, the component selection module 20 is specifically used for: Read the current round of dialogue information from the current round of dialogue field of the dialogue context information, and read the current session stage from the current session stage field of the dialogue context information; The current dialogue information is input into the intent recognition model for intent semantic recognition to obtain the current intent category and the current intent object. Obtain preset candidate response generation component configuration information, wherein the candidate response generation component configuration information records the triggering session stage, response processing category and response processing object corresponding to each candidate response generation component; The candidate response generation component whose corresponding triggering session stage is the same as the current session stage is determined as the stage matching response generation component; For each stage of the matching response generation component, the current intent category, the current intent object, and the response processing category and response processing object corresponding to the stage matching response generation component are respectively input into the component selection model for category semantic comparison and object semantic comparison, so as to obtain the category comparison result and object comparison result corresponding to the stage matching response generation component. The stage matching response generation component that represents a semantically consistent category and an semantically consistent object is determined as the target response generation component.

[0121] In one embodiment, the response generation module 30 is specifically used for: Obtain the response generation configuration information corresponding to each target response generation component. The response generation configuration information includes component identifier, knowledge base identifier, and response generation instruction information. The dialogue context information is input into the retrieval condition recognition model to identify the retrieval object and the retrieval limitation conditions, thereby obtaining knowledge retrieval object information and knowledge retrieval limitation information. For each target response generation component, a target knowledge base is determined based on the corresponding knowledge base identifier. The component knowledge information corresponding to the target response generation component is retrieved from the target knowledge base using the knowledge retrieval object information and the knowledge retrieval limitation information. The dialogue context information, the component knowledge information corresponding to the target response generation component, and the response generation instruction information are respectively input into the corresponding target response generation component to generate text with knowledge constraints, thereby obtaining single-component response information corresponding to the target response generation component; Write the component identifier corresponding to the target response generation component into the corresponding single component response information to obtain single component response information with component identifier; The component response information is obtained by aggregating the single component response information with component identifiers.

[0122] In one embodiment, the response fusion module 40 is specifically used for: Read single-component response information with component identifier from the component response information, and extract the response object and the response content corresponding to the response object from the single-component response information with component identifier to obtain a response information point including the component identifier, the response object and the response content; Read the current session stage, attribute description information, and key information of this round from the dialogue context information; Obtain preset reply arrangement information, and read the component priority order corresponding to the current session stage from the reply arrangement information; The response information points are arranged according to the component identifier and the component priority to obtain ordered response information points; For each response information point, extract information from the attribute description information and the key information of this round that is the same as the response object in the response information point to obtain the context supplementary information corresponding to the response information point; Read the role definition information and expression style information from the preset unified role constraint information; The ordered response information points, the contextual supplementary information, the role definition information, and the expression style information are input into the response fusion model for content fusion and expression reconstruction to obtain fused response information.

[0123] In one embodiment, the role consistency check module 50 is specifically used for: Read role definition information, expression style information, prohibited mode information, and capability boundary information from the unified role constraint information; The fused response information is split according to statement boundaries to obtain a set of statements to be inspected; The set of statements to be checked, the role definition information, the expression style information, the prohibited mode information, and the capability boundary information are input into the role consistency check model to perform semantic comparison of role definition, semantic comparison of expression style, semantic comparison of prohibited mode, and semantic comparison of capability boundary to obtain the check result, which includes the check status. When the inspection status indicates a deviation, the deviation statement, deviation category, text position to be corrected, and corresponding constraint information are read from the inspection result. The deviation statement, deviation category, text position to be corrected, and corresponding constraint information are input into the response correction model for text replacement and sentence reconstruction to obtain the corrected statement. The corrected statement is then used to replace the deviation statement in the fused response information to obtain the target response information. When the inspection status indicates that there is no deviation, the fused response information is retained as the target response information.

[0124] In one embodiment, the role consistency check module 50 is specifically used for: Read the session identifier from the dialogue interface, output the target response information through the dialogue interface according to the session identifier, and read the current session stage from the dialogue status information; Obtain preset session phase configuration information, and read the current phase target and phase transition order corresponding to the current session phase from the session phase configuration information; By comparing the current round of dialogue information, the target response information, and the current stage target input stage judgment model with dialogue semantics, response semantics, and stage target semantics, the stage target achievement status and stage advancement intention information are obtained. When the stage goal achievement status indicates that the current stage goal has been achieved and the stage advancement intention information indicates that the session stage is being advanced, the target session stage is determined according to the stage transition order. When the stage goal achievement status indicates that the current stage goal has not been achieved or the stage advancement intention information indicates that the session stage is being maintained, the current session stage is determined as the target session stage. Extract the interaction object attribute update information and the key information of the current round of dialogue from the current dialogue information. Update the interaction object attribute information in the dialogue state information according to the interaction object attribute update information. Write the key information of the current round of dialogue into the key information of the dialogue state information. When the target session stage is different from the current session stage, add the target session stage to the dialogue stage history in the dialogue state information and update the current session stage in the dialogue state information to the target session stage to obtain the updated dialogue state information. The current dialogue information and the target response information are added to the historical dialogue information according to the order in which the dialogue occurs, to obtain the updated historical dialogue information. The updated dialogue status information and the updated historical dialogue information are then stored according to the session identifier.

[0125] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a role-consistent target response generation method on the server side.

[0126] In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be as follows: Figure 11 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements the client-side functions or steps of a role-consistency-based target response generation method.

[0127] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps: Obtain the current dialogue information, dialogue status information, and historical dialogue information, and construct dialogue context information based on the current dialogue information, dialogue status information, and historical dialogue information; Based on the dialogue context information, the target response generation component is determined from the preset candidate response generation components; The dialogue context information is input into the target response generation component, and the target response generation component is used to generate component response information; The component response information is fused based on the dialogue context information and the preset unified role constraint information to obtain fused response information; Based on the unified role constraint information, a role consistency check is performed on the fused response information, and the fused response information is retained or modified according to the check result to obtain the target response information.

[0128] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, and a computer program is stored thereon, which, when executed by a processor, performs the following steps: Obtain the current dialogue information, dialogue status information, and historical dialogue information, and construct dialogue context information based on the current dialogue information, dialogue status information, and historical dialogue information; Based on the dialogue context information, the target response generation component is determined from the preset candidate response generation components; The dialogue context information is input into the target response generation component, and the target response generation component is used to generate component response information; The component response information is fused based on the dialogue context information and the preset unified role constraint information to obtain fused response information; Based on the unified role constraint information, a role consistency check is performed on the fused response information, and the fused response information is retained or modified according to the check result to obtain the target response information.

[0129] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0130] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0131] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0132] It should be noted that any AI models, software tools, or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application has been authorized (with the knowledge and consent) by the relevant parties or has been fully authorized by all parties, and the executing entity may obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.

[0133] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for generating target responses based on role consistency, characterized in that, Includes the following steps: Obtain the current dialogue information, dialogue status information, and historical dialogue information, and construct dialogue context information based on the current dialogue information, dialogue status information, and historical dialogue information; Based on the dialogue context information, the target response generation component is determined from the preset candidate response generation components; The dialogue context information is input into the target response generation component, and the target response generation component is used to generate component response information; The component response information is fused based on the dialogue context information and the preset unified role constraint information to obtain fused response information; Based on the unified role constraint information, a role consistency check is performed on the fused response information, and the fused response information is retained or modified according to the check result to obtain the target response information.

2. The target response generation method based on role consistency according to claim 1, characterized in that, Obtain current dialogue information, dialogue state information, and historical dialogue information; construct dialogue context information based on the current dialogue information, the dialogue state information, and the historical dialogue information, including: Read the text to be processed and the session identifier from the dialogue interface, and use the text to be processed as the dialogue information for this round. Based on the session identifier, read the dialogue state information and historical dialogue information from the session storage area, and extract the interaction object attribute information, current session stage, dialogue stage history and key dialogue information from the dialogue state information; The current dialogue information is input into a semantic recognition model for object entity recognition to obtain dialogue object information including object entities. Information that records the same object as the object entity is extracted from the key dialogue information to obtain the key information of the current round. The dialogue records in the historical dialogue information are arranged according to the recording time. A preset number of consecutive dialogue records at the end are extracted from the arranged dialogue records to obtain the recent dialogue information. Read the attribute name and the attribute content corresponding to the attribute name from the attribute information of the interactive object, and generate attribute description information in the order of attribute name first and corresponding attribute content last. Write the current round of dialogue information into the current round of dialogue field, write the attribute description information into the attribute description field, write the current session stage into the current session stage field, write the dialogue stage history into the dialogue stage history field, write the current round of key information into the current round of key information field, and write the recent dialogue information into the recent dialogue field to obtain the dialogue context information.

3. The target response generation method based on role consistency according to claim 1, characterized in that, Based on the dialogue context information, a target response generation component is determined from a preset pool of candidate response generation components, including: Read the current round of dialogue information from the current round of dialogue field of the dialogue context information, and read the current session stage from the current session stage field of the dialogue context information; The current dialogue information is input into the intent recognition model for intent semantic recognition to obtain the current intent category and the current intent object. Obtain preset candidate response generation component configuration information, wherein the candidate response generation component configuration information records the triggering session stage, response processing category and response processing object corresponding to each candidate response generation component; The candidate response generation component whose corresponding triggering session stage is the same as the current session stage is determined as the stage matching response generation component; For each stage of the matching response generation component, the current intent category, the current intent object, and the response processing category and response processing object corresponding to the stage matching response generation component are respectively input into the component selection model for category semantic comparison and object semantic comparison, so as to obtain the category comparison result and object comparison result corresponding to the stage matching response generation component. The stage matching response generation component that represents a semantically consistent category and an semantically consistent object is determined as the target response generation component.

4. The target response generation method based on role consistency according to claim 1, characterized in that, The dialogue context information is input into the target response generation component, and the target response generation component is used to generate component response information, including: Obtain the response generation configuration information corresponding to each target response generation component. The response generation configuration information includes component identifier, knowledge base identifier, and response generation instruction information. The dialogue context information is input into the retrieval condition recognition model to identify the retrieval object and the retrieval limitation conditions, thereby obtaining knowledge retrieval object information and knowledge retrieval limitation information. For each target response generation component, a target knowledge base is determined based on the corresponding knowledge base identifier. The component knowledge information corresponding to the target response generation component is retrieved from the target knowledge base using the knowledge retrieval object information and the knowledge retrieval limitation information. The dialogue context information, the component knowledge information corresponding to the target response generation component, and the response generation instruction information are respectively input into the corresponding target response generation component to generate text with knowledge constraints, thereby obtaining single-component response information corresponding to the target response generation component; Write the component identifier corresponding to the target response generation component into the corresponding single component response information to obtain single component response information with component identifier; The component response information is obtained by aggregating the single component response information with component identifiers.

5. The target response generation method based on role consistency according to claim 1, characterized in that, The component response information is fused based on the dialogue context information and the preset unified role constraint information to obtain fused response information, including: Read single-component response information with component identifier from the component response information, and extract the response object and the response content corresponding to the response object from the single-component response information with component identifier to obtain a response information point including the component identifier, the response object and the response content; Read the current session stage, attribute description information, and key information of this round from the dialogue context information; Obtain preset reply arrangement information, and read the component priority order corresponding to the current session stage from the reply arrangement information; The response information points are arranged according to the component identifier and the component priority to obtain ordered response information points; For each response information point, extract information from the attribute description information and the key information of this round that is the same as the response object in the response information point to obtain the context supplementary information corresponding to the response information point; Read the role definition information and expression style information from the preset unified role constraint information; The ordered response information points, the contextual supplementary information, the role definition information, and the expression style information are input into the response fusion model for content fusion and expression reconstruction to obtain fused response information.

6. The target response generation method based on role consistency according to claim 1, characterized in that, Based on the unified role constraint information, a role consistency check is performed on the fused response information, and the fused response information is retained or modified according to the check result to obtain the target response information, including: Read role definition information, expression style information, prohibited mode information, and capability boundary information from the unified role constraint information; The fused response information is split according to statement boundaries to obtain a set of statements to be inspected; The set of statements to be checked, the role definition information, the expression style information, the prohibited mode information, and the capability boundary information are input into the role consistency check model to perform semantic comparison of role definition, semantic comparison of expression style, semantic comparison of prohibited mode, and semantic comparison of capability boundary to obtain the check result, which includes the check status. When the inspection status indicates a deviation, the deviation statement, deviation category, text position to be corrected, and corresponding constraint information are read from the inspection result. The deviation statement, deviation category, text position to be corrected, and corresponding constraint information are input into the response correction model for text replacement and sentence reconstruction to obtain the corrected statement. The corrected statement is then used to replace the deviation statement in the fused response information to obtain the target response information. When the inspection status indicates that there is no deviation, the fused response information is retained as the target response information.

7. The target response generation method based on role consistency according to claim 1, characterized in that, After performing a role consistency check on the fused response information based on the unified role constraint information, and retaining or correcting the fused response information according to the check result to obtain the target response information, the process further includes: Read the session identifier from the dialogue interface, output the target response information through the dialogue interface according to the session identifier, and read the current session stage from the dialogue status information; Obtain preset session phase configuration information, and read the current phase target and phase transition order corresponding to the current session phase from the session phase configuration information; By comparing the current round of dialogue information, the target response information, and the current stage target input stage judgment model with dialogue semantics, response semantics, and stage target semantics, the stage target achievement status and stage advancement intention information are obtained. When the stage goal achievement status indicates that the current stage goal has been achieved and the stage advancement intention information indicates that the session stage is being advanced, the target session stage is determined according to the stage transition order. When the stage goal achievement status indicates that the current stage goal has not been achieved or the stage advancement intention information indicates that the session stage is being maintained, the current session stage is determined as the target session stage. Extract the interaction object attribute update information and the key information of the current round of dialogue from the current dialogue information. Update the interaction object attribute information in the dialogue state information according to the interaction object attribute update information. Write the key information of the current round of dialogue into the key information of the dialogue state information. When the target session stage is different from the current session stage, add the target session stage to the dialogue stage history in the dialogue state information and update the current session stage in the dialogue state information to the target session stage to obtain the updated dialogue state information. The current dialogue information and the target response information are added to the historical dialogue information according to the order in which the dialogue occurs, to obtain the updated historical dialogue information. The updated dialogue status information and the updated historical dialogue information are then stored according to the session identifier.

8. A target response generation device based on role consistency, characterized in that, The target response generation device based on role consistency includes: The context building module is used to obtain current dialogue information, dialogue state information, and historical dialogue information, and to build dialogue context information based on the current dialogue information, the dialogue state information, and the historical dialogue information; The component selection module is used to determine the target response generation component from the preset candidate response generation components based on the dialogue context information; The response generation module is used to input the dialogue context information into the target response generation component and use the target response generation component to generate component response information; The response fusion module is used to fuse the component response information based on the dialogue context information and the preset unified role constraint information to obtain fused response information; The role consistency check module is used to perform role consistency checks on the fused response information based on the unified role constraint information, and retain or correct the fused response information according to the check results to obtain the target response information.

9. A computer device, characterized in that, The computer device includes a memory, a processor, and a role-consistency-based target response generation program stored in the memory and executable on the processor, wherein the role-consistency-based target response generation program, when executed by the processor, implements the steps of the role-consistency-based target response generation method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a target response generation program based on role consistency, which, when executed by a processor, implements the steps of the target response generation method based on role consistency as described in any one of claims 1-7.