Customer service statement generation method and generation device
By acquiring and labeling element information of a preset flowchart, constructing structured descriptive text, and using a question-and-answer model to generate customer service statements, the problem of insufficient intelligence and determinism in existing technologies is solved, and intelligent and process-controllable customer service dialogue is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-15
- Publication Date
- 2026-04-10
AI Technical Summary
Existing customer service statement generation methods cannot balance intelligence and determinism. Traditional rule engines cannot handle real-time user dialogues, and customer service statements generated by intelligent models are prone to deviating from the process and have poor consistency.
By acquiring the preset process description text, parsing and adding the element marker text information of the preset flowchart, constructing the structured description text, and using the preset question-and-answer model to generate dialogue customer service statements, the process constraints are strictly followed.
It achieves an organic unity of intelligence and determinism in customer service statement generation, reduces the probability of process deviation, and improves the controllability and efficiency of the dialogue process.
Smart Images

Figure CN121833904A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of natural language processing technology, and in particular to a method and apparatus for generating customer service statements. Background Technology
[0002] In automotive customer service scenarios, intelligent customer service systems need to generate dialogue messages for users in order to achieve efficient dialogue and interaction.
[0003] However, existing customer service statement generation methods cannot simultaneously achieve both intelligence and determinism in statement generation. On the one hand, generation methods based on traditional rule engines cannot flexibly handle real-time user dialogues, resulting in insufficient intelligent interaction capabilities and difficulty in adapting to diverse user needs. On the other hand, generation methods based on intelligent models are prone to issues such as deviations from the flow and poor consistency in wording across similar customer service dialogue scenarios, failing to meet the requirements of business standardization and execution stability in customer service scenarios. Summary of the Invention
[0004] To address this issue, this disclosure provides a method and apparatus for generating customer service statements, thereby resolving the problem that existing technologies cannot simultaneously achieve both intelligence and determinism in generating customer service statements.
[0005] To achieve the above objectives, the first aspect of this disclosure provides a method for generating customer service statements. The method includes: obtaining a preset process description text corresponding to a target dialogue scenario, wherein the preset process description text is a textual representation of a preset flowchart; parsing the preset process description text, adding marker text information corresponding to elements of the preset flowchart to the preset process description text to obtain a structured description text; constructing prompt information based on the structured description text, and generating a dialogue customer service statement corresponding to the user's target dialogue based on the prompt information using a preset question-and-answer model.
[0006] In one optional implementation, the elements of the preset flowchart include: multiple nodes representing the dialogue flow, and connecting edges representing the jump relationships between nodes; adding the marker text information corresponding to the elements of the preset flowchart to the preset flow description text to obtain the structured description text includes: generating a node identifier for each node in the preset flowchart; generating a jump condition corresponding to the connecting edge output by the condition judgment type node in the preset flowchart; adding the node identifier and the jump condition to the preset flow description text as annotations to obtain the structured description text; wherein, the marker text information corresponding to the node includes the node identifier, and the marker text information corresponding to the connecting edge includes the jump condition.
[0007] In one optional implementation, the target dialogue includes multiple rounds of dialogue; the step of constructing prompt information based on the structured description text and generating a customer service statement corresponding to the user's target dialogue based on the prompt information using a preset question-answering model includes: for the i-th round of dialogue in the target dialogue, obtaining the target node identifier corresponding to the first node, wherein the first node is the node selected by the preset question-answering model when generating the customer service statement for the (i-1)-th round of dialogue; extracting the subgraph description text corresponding to the first node from the structured description text based on the target node identifier; constructing prompt information for the i-th round of dialogue based on the subgraph description text; selecting the second node corresponding to the i-th round of dialogue based on the prompt information using the preset question-answering model; and generating the customer service statement for the i-th round of dialogue based on the second node.
[0008] In one optional implementation, the step of extracting the subgraph description text corresponding to the first node from the structured description text based on the target node identifier includes: determining the context node window of the first node based on the process complexity corresponding to the first node; determining the node subgraph corresponding to the first node in the structured description text based on the context node window and the target node identifier, the node subgraph including the first node and the associated nodes of the first node located in the context node window; and extracting the description text corresponding to the node subgraph from the structured description text to obtain the subgraph description text.
[0009] In one optional implementation, when the first node is a conditional judgment type, the step of selecting the second node corresponding to the i-th round of dialogue based on the prompt information of the i-th round of dialogue using a preset question-and-answer model includes: based on the preset question-and-answer model, determining the adjacent successor node of the first node and the first jump condition corresponding to the connecting edge from the first node to the adjacent successor node based on the prompt information of the i-th round of dialogue; based on the preset question-and-answer model, determining whether the first node satisfies the first jump condition based on the dialogue information of the user in the (i-1)-th round, and determining the second node corresponding to the i-th round of dialogue based on the determination result.
[0010] In one optional implementation, the jump condition includes a semantic similarity threshold; determining whether the first node satisfies the first jump condition based on the user's dialogue information in the (i-1)th round includes: obtaining a preset condition text vector corresponding to the first jump condition; performing semantic similarity calculation between the preset condition text vector and the semantic vector of the user's dialogue information in the (i-1)th round to obtain a similarity value; and determining that the first node satisfies the first jump condition if the similarity value is greater than the semantic similarity threshold included in the first jump condition.
[0011] In one optional implementation, determining the second node corresponding to the i-th round of dialogue based on the judgment result includes: if the judgment result is that the first node satisfies the first jump condition, determining the second node corresponding to the i-th round of dialogue based on the adjacent successor node pointed to by the connecting edge corresponding to the first jump condition; if the judgment result is that the first node does not satisfy the first jump condition, determining the first node as the second node corresponding to the i-th round of dialogue.
[0012] In one optional implementation, after generating the customer service statement for the i-th round of dialogue based on the second node, the method further includes: verifying whether the second node is included in a preset node set to obtain a first verification result, wherein the preset node set includes the first node and its successor nodes; if the predecessor node of the second node includes a node of the mandatory access type, verifying whether the node of the mandatory access type has been selected by the preset question-and-answer model when generating the customer service statement for the first i-th round of dialogue to obtain a second verification result; if the first node is a node of the condition judgment type, verifying whether the first node meets the jump condition to the second node to obtain a third verification result; and verifying the statement generation effect of the customer service statement for the i-th round of dialogue based on the first verification result, the second verification result, and the third verification result.
[0013] In one optional implementation, after generating the customer service dialogue statement for the target dialogue with the user based on the prompt information, the method further includes: in response to a query request for the target dialogue, obtaining node selection information, node jump information, and dialogue association information corresponding to the target dialogue; the node selection information includes nodes corresponding to each round of dialogue in the target dialogue; the node jump information includes jump information between nodes corresponding to adjacent dialogue rounds; the dialogue association information includes interaction records corresponding to each round of dialogue in the target dialogue; and generating a dialogue flowchart corresponding to the target dialogue based on the node selection information, the node jump information, and the dialogue association information to achieve a visual display of the target dialogue.
[0014] Secondly, this disclosure provides a customer service statement generation device, which includes: an acquisition module, used to acquire a preset process description text corresponding to a target dialogue scenario, wherein the preset process description text is a textual representation of a preset flowchart; a parsing module, used to parse the preset process description text, and add marker text information corresponding to the elements of the preset flowchart to the preset process description text to obtain a structured description text; and a generation module, used to construct prompt information based on the structured description text, and generate a dialogue customer service statement corresponding to the user's target dialogue based on the prompt information according to a preset question-and-answer model.
[0015] This disclosure has the following advantages:
[0016] This disclosure provides a method for generating customer service statements. First, a preset process description text corresponding to the target dialogue scenario is obtained. This preset process description text is a textual representation of a preset flowchart. Then, the preset process description text is parsed, and marker text information corresponding to the elements of the preset flowchart is added to it to obtain a structured description text. This achieves the structured constraints of the preset process description text, facilitating the accurate parsing of the flow control logic by the preset question-and-answer model. Finally, prompt information is constructed based on the structured description text, and the preset question-and-answer model generates a customer service statement corresponding to the user's target dialogue based on the prompt information. In this disclosure, because the prompt information of the preset question-and-answer model contains structured description text, the preset question-and-answer model can strictly adhere to flow constraints when generating customer service statements, thereby reducing the probability of flow deviation during the dialogue process.
[0017] Therefore, the customer service statement generation method of this disclosure combines the flexibility of dialogue generation of the preset question-and-answer model with the controllability of the dialogue process with the user, thereby achieving an organic unity of intelligence and determinism in customer service statement generation.
[0018] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0019] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which:
[0020] Figure 1A flowchart of a customer service statement generation method provided in this disclosure embodiment;
[0021] Figure 2 A flowchart illustrating a customer service statement generation method provided in this embodiment of the disclosure;
[0022] Figure 3 A block diagram of a customer service statement generation device provided in this disclosure embodiment;
[0023] Figure 4 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0024] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.
[0025] As used in this disclosure, the term "and / or" includes any and all combinations of one or more of the related enumerated entries.
[0026] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to limit the disclosure. As used in this disclosure, the singular forms “a” and “the” are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0027] When the terms “comprising” and / or “made of” are used in this disclosure, they specify the presence of the said feature, integral, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or groups thereof.
[0028] Unless otherwise specified, all terms used in this disclosure (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so specified in this disclosure.
[0029] In automotive customer service scenarios, intelligent customer service systems are needed to generate dialogue messages for users to achieve efficient interaction. However, existing methods for generating customer service messages cannot simultaneously achieve both intelligence and determinism in message generation.
[0030] Specifically, traditional rule-based engines primarily rely on keyword matching and fixed paths to generate customer service statements. This approach cannot handle non-standard dialogue behaviors such as users' colloquial expressions, disjointed question-and-answer sessions, and long-distance contextual dependencies. It suffers from weak semantic understanding and a lack of contextual processing mechanisms, resulting in insufficient intelligent interaction capabilities and difficulty in adapting to diverse user needs.
[0031] The intelligent model-based generation method primarily embeds business processes and operation sequences into prompts using a "role setting + instruction list" approach, leveraging the model's instruction-following ability and contextual memory to control the dialogue flow. However, due to the probabilistic generation characteristics and the risk of illusion inherent in this method, the generated customer service statements are prone to deviating from the flow and exhibiting poor consistency in wording across similar customer service dialogue scenarios, failing to meet the requirements of business standardization and execution stability in customer service scenarios.
[0032] In view of this, this disclosure provides a method for generating customer service statements. First, a preset process description text corresponding to the target dialogue scenario is obtained. This preset process description text is a textual representation of a preset flowchart. Then, the preset process description text is parsed, and marker text information corresponding to the elements of the preset flowchart is added to it to obtain structured description text. This achieves the structured constraints of the preset process description text, making it easier for the preset question-and-answer model to accurately parse the flow control logic of the preset process description text. Finally, prompt information is constructed based on the structured description text, and the preset question-and-answer model generates dialogue customer service statements corresponding to the user's target dialogue based on the prompt information. In this disclosure, because the prompt information of the preset question-and-answer model contains structured description text, the preset question-and-answer model can strictly follow the flow constraints when generating dialogue customer service statements, thereby reducing the probability of flow deviation during the dialogue process.
[0033] Therefore, the customer service statement generation method of this disclosure combines the flexibility of dialogue generation of the preset question-and-answer model with the controllability of the dialogue process with the user, thereby achieving an organic unity of intelligence and determinism in customer service statement generation.
[0034] Firstly, embodiments of this disclosure provide a method for generating customer service statements. Figure 1 A flowchart of a customer service statement generation method provided in this disclosure embodiment is shown below. Figure 1 The method includes:
[0035] Step S110: Obtain the preset process description text corresponding to the target dialogue scenario. The preset process description text is a textual representation of the preset flowchart.
[0036] The target dialogue scenario can be a customer service scenario within a preset domain, such as an auto finance customer service scenario, and this embodiment of the disclosure does not impose any limitations on it. The target dialogue scenario has corresponding preset process description text.
[0037] The preset process description text is a textual representation of a preset flowchart, and it can be constructed based on a textual process description language. For example, the preset process description text can be in Mermaid text format, or in a custom YAML or JSON text format, etc., and this embodiment of the disclosure does not impose any limitations on this.
[0038] For example, when the preset process description text is in Mermaid text format, the elements of the preset flowchart can be described using their corresponding text languages. For instance, for a rounded rectangle node of the process start point type in the preset flowchart, its corresponding description text would be something like Start([Customer Answers]). For a rectangle node of the action type in the preset flowchart, its corresponding description text would be something like Operation[Identity Verification]. For a diamond node of the condition judgment type in the preset flowchart, its corresponding description text would be something like Decision{Customer Intention?}. For a connecting edge representing the jump relationship between nodes in the preset flowchart, its corresponding description text would be something like -->.
[0039] The preset process description text can be adaptively constructed by business personnel according to the actual business needs of the target dialogue scenario, and this embodiment of the disclosure does not impose any restrictions on this. For example, the preset process description text is as follows:
[0040] graph TD
[0041] A ([User answers]) --> B ([Introduces themselves])
[0042] B --> C {Is it convenient for the user to make a call?}
[0043] C -->|Convenient| D[Explain the purpose of the call and provide a prompt]
[0044] C -->|Inconvenient| E [Schedule a time for next communication]
[0045] D --> F [Time to confirm user requirements]
[0046] F --> G {Is the requirement clearly defined?}
[0047] G -->|Clarify| H[Introduce the compatible product solution]
[0048] G -->|Fuzzy| I [Conducting needs probing]
[0049] H --> J{Does the user accept the proposal?}
[0050] J -->|Accept| K[Push processing link]
[0051] J -->|Refuse| L [Record the reasons and try to retain]
[0052] Therefore, in this embodiment of the present disclosure, the preset process description text is actually a textualized preset flowchart, which describes the graph structure of the preset flowchart through a textualized process description language. The preset flowchart can be obtained by visually rendering the preset process description text.
[0053] Step S120: Parse the preset process description text, add the marker text information corresponding to the elements of the preset flowchart to the preset process description text, and obtain the structured description text.
[0054] The elements in the preset flowchart can include multiple nodes and connecting edges between them. Nodes represent specific dialogue flows, such as "Introduce yourself" or "Schedule the next communication time." Connecting edges between nodes represent the jump relationships between them. For example, a connecting line from node B to node C represents a jump relationship from node B to node C.
[0055] In the process of parsing the preset process description text, an abstract syntax tree (AST) of the preset process description text can be generated. By traversing the abstract syntax tree, the tag text information corresponding to the elements of the preset flowchart can be added to the preset process description text.
[0056] The labeled text information is used to identify elements of the preset flowchart or to add process constraints to the elements. The labeled text information can help the preset question-and-answer model to understand the process logic of the preset flowchart more accurately.
[0057] Therefore, by adding the tag text information corresponding to the elements of the preset flowchart to the preset process description text, a structured description text can be obtained, which is used to construct the prompt information of the preset question-and-answer model.
[0058] In other words, in this embodiment of the disclosure, tagged text information is added to the textual representation of the preset flowchart to obtain structured description text. Based on this structured description text, prompt information is constructed, enabling the preset question-and-answer model to understand the overall topological structure of the process and flexibly generate dialogue customer service statements within the constraint framework. Therefore, the above method can reduce system complexity and improve execution efficiency and maintainability.
[0059] In one optional implementation, the elements of the preset flowchart include: multiple nodes representing the dialogue flow, and connecting edges representing the jump relationships between nodes; in the preset flow description text, the marker text information corresponding to the elements of the preset flowchart is added to obtain the structured description text, including: generating a node identifier for each node in the preset flowchart; generating jump conditions corresponding to the connecting edges output by nodes of the condition judgment type in the preset flowchart; adding the node identifier and jump conditions to the preset flow description text in the form of comments to obtain the structured description text; wherein, the marker text information corresponding to the node includes the node identifier, and the marker text information corresponding to the connecting edge includes the jump conditions.
[0060] Among them, a conditional node means that a jump to the corresponding successor node can only be made if a certain condition is met. For example, for node C in the above graph TD, which is a conditional node, a jump to node D can only be made if it is determined that the user is available to make a call.
[0061] The node identifier is used to globally uniquely identify each node, enabling the pre-defined question-answering model to accurately distinguish each node in the pre-defined flowchart. The jump condition is used to limit the triggering logic corresponding to the connection edges between nodes. The jump condition may include a semantic similarity threshold.
[0062] For example, regarding the connection edge between node C and node D in the above graph TD, the corresponding jump condition is "SJ:0.85". Therefore, the connection edge can only be triggered and node C can jump to node D when the semantic information of the user's reply and the similarity between the condition text "convenient" corresponding to the connection edge exceed the semantic similarity threshold of 0.85.
[0063] The jump conditions can be adaptively set according to actual application needs, and this embodiment does not impose any restrictions on them. After generating node identifiers and jump conditions, the node identifiers and jump conditions can be added to the preset process description text in the form of comments to obtain structured description text.
[0064] Specifically, for the abstract syntax tree corresponding to the preset process description text, by traversing the abstract syntax tree, node identifiers and jump conditions can be added as metadata to the corresponding elements in the abstract syntax tree. Thus, based on the abstract syntax tree with added metadata, a structured description text with annotation information containing node identifiers and jump conditions can be obtained.
[0065] For example, a node identifier in annotation form is...<!-- Node_ID:B_Intro --> ,<!-- Node_ID:D_Purpose --> The jump condition in comment form is:<!-- SJ:0.85 -->, where SJ is the semantic similarity threshold.
[0066] When adding annotation-style marker text information to the preset process description text, it can be added to the end of the text line containing the corresponding element; this embodiment of the disclosure does not impose any restrictions on this.
[0067] For example, regarding A([User Answers]) --> B[Self-Introduction] in the graph TD above, adding the tag text information corresponding to node A would result in A([User Answers]) --> B[Self-Introduction).<!-- Node_ID:A_Start --> .
[0068] For example, the structured description text is as follows:
[0069] graph TD
[0070] A ([User answers]) --> B ([Introduces themselves])<!-- Node_ID:A_Start -->
[0071] B --> C {Is it convenient for the user to make a call?}<!-- Node_ID:B_Intro -->
[0072] C --> | Convenient | D [Explain the purpose of the call]<!-- SJ:0.85 -->
[0073] C -->|Inconvenient| E [Schedule a later time]<!-- SJ:0.80 -->
[0074] Furthermore, rule hooks can be embedded as comments in the preset process description text. For example, when the preset question-and-answer model output flows to a certain node, regular expressions or lightweight scripts are first used to verify whether the user's reply content contains preset information. If the verification passes, the subsequent dialogue process continues. This embodiment of the disclosure does not impose any limitations on this.
[0075] In this embodiment, by adding node identifiers and jump conditions as annotations to the preset process description text, the original flowchart structure is not changed, while the readability of each element in the flowchart is increased. Furthermore, by adding jump conditions to the connection edges of node outputs with condition judgment types, this embodiment achieves accurate conditional control over jumps between nodes, thereby facilitating the accurate generation of customer service statements from large models.
[0076] Step S130: Construct prompt information based on structured description text, and generate dialogue customer service statements corresponding to the user's target dialogue based on the prompt information according to the preset question-and-answer model.
[0077] Specifically, prompts can be constructed based on structured descriptive text, historical dialogues with the user (such as the previous three rounds of dialogue), and system instruction templates. Furthermore, corresponding prompts can be generated for each round of dialogue in the target conversation, enabling the preset question-and-answer model to generate the corresponding customer service statements for that round of dialogue based on the prompts.
[0078] In addition, in order to improve the efficiency of generating customer service dialogue statements by the preset question-and-answer model, it is also possible to extract only the part of the description text that is relevant to the core of the current dialogue from the structured description text to construct the prompt information. This disclosure does not limit this approach.
[0079] For example, a dynamic switching mechanism using a hierarchical prompt information architecture can be employed. For extremely long processes (flowcharts exceeding a preset number of nodes), if the node corresponding to the previous round of dialogue is a high-level node in the flowchart, the prompt information in the current round of dialogue can only include the subgraph description text, i.e., loading the description text of that node and its outgoing edges' corresponding associated nodes, improving the statement generation efficiency of the preset question-and-answer model. When the user's response in the previous round of dialogue does not match any of the outgoing edge conditions, the system determines it as a "complex scenario" or "abnormal problem." At this time, the lower-level prompt information loading logic can be triggered, including complete structured description text or complete description text of the relevant process of the node corresponding to the previous round of dialogue in the prompt information of the current round of dialogue, enabling the preset question-and-answer model to have global planning capabilities.
[0080] In one optional implementation, the target dialogue includes multiple rounds of dialogue. Prompt information is constructed based on structured description text, and a customer service statement corresponding to the user's target dialogue is generated based on the prompt information using a preset question-answering model. This includes: for the i-th round of dialogue in the target dialogue, obtaining the target node identifier corresponding to the first node, where the first node is the node selected by the preset question-answering model when generating the customer service statement for the (i-1)-th round of dialogue; extracting the subgraph description text corresponding to the first node from the structured description text based on the target node identifier; constructing prompt information for the i-th round of dialogue based on the subgraph description text; selecting the second node corresponding to the i-th round of dialogue based on the prompt information using the preset question-answering model; and generating the customer service statement for the i-th round of dialogue based on the second node.
[0081] In each round of dialogue in the target dialogue, the preset question-and-answer model selects the corresponding node in the preset flowchart and generates the dialogue customer service statement for that round of dialogue based on the selected node.
[0082] Accordingly, based on the target node identifier corresponding to the first node selected in the (i-1)th round of dialogue by the pre-defined question-answering model, the subgraph description text corresponding to the first node can be extracted from the structured description text. For example, the subgraph description text corresponding to the first node can be extracted from the structured description text using a graph traversal algorithm based on the target node identifier.
[0083] For example, the subgraph description text includes the description text of the first node, the description text of all outgoing edges of the first node and the description text of the successor nodes connected to the outgoing edges (used to identify the legal jump range), and the description text of the predecessor node of the first node (used for abnormal backtracking scenarios).
[0084] It should be noted that in this embodiment, i is a natural number. For the first round of dialogue in the target dialogue, the starting node in the preset flowchart can be directly used as the first node, and the prompt information of the first round of dialogue can be constructed based on the subgraph description text corresponding to the starting node.
[0085] Therefore, in this embodiment, it is not necessary to load the complete structured description text to construct the prompt information. Instead, for each round of dialogue, only the description text corresponding to the core process node associated with that round of dialogue is selected to construct the prompt information. Accordingly, by inputting the prompt information of the i-th round of dialogue into a preset question-and-answer model, the preset question-and-answer model can select the second node corresponding to the i-th round of dialogue based on the prompt information, and generate the dialogue customer service statement for the i-th round of dialogue based on the second node.
[0086] In this embodiment of the disclosure, for each round of dialogue in the target dialogue, it is necessary to determine the node selected by the preset question-and-answer model when generating the customer service statement in the previous round of dialogue. Then, in the structured description text, only the subgraph description text associated with that node is extracted. Furthermore, the prompt information for that round of dialogue is generated only based on this subgraph description text, enabling the model to select the corresponding node for that round of dialogue based on the prompt information and generate the corresponding customer service statement based on the selected node. This method, by including only a "partial view of the process" in the prompt information, allows the preset question-and-answer model to focus on the current decision point. This not only reduces the risk of illusion when the preset question-and-answer model generates statements and improves the accuracy of generating customer service statements for each round of dialogue, but also improves the efficiency of statement generation.
[0087] In one alternative implementation, if the first node is a non-conditional judgment type, the pre-defined question-answering model can select the adjacent successor node of the first node (i.e., the node pointed to by the connection edge output by the first node) as the second node. If the first node does not have an adjacent successor node, this indicates that the dialogue flow is at an end point, thus terminating the dialogue flow of the target dialogue.
[0088] In one optional implementation, when the first node is a conditional judgment type, the second node corresponding to the i-th round of dialogue is selected based on the prompt information of the i-th round of dialogue according to the preset question-answering model. This includes: based on the preset question-answering model, determining the adjacent successor nodes of the first node and the first jump condition corresponding to the connecting edge from the first node to the adjacent successor node according to the prompt information of the i-th round of dialogue; based on the preset question-answering model, determining whether the first node satisfies the first jump condition according to the dialogue information of the user in the (i-1)-th round, and determining the second node corresponding to the i-th round of dialogue according to the determination result.
[0089] For the first node of the condition judgment type, there may be multiple outgoing edges, and for each outgoing edge there is a corresponding jump condition.
[0090] Therefore, the pre-defined question-answering model needs to determine whether the first node satisfies the first jump condition corresponding to its outgoing edge based on the user's dialogue information in the (i-1)th round, and then determine the second node corresponding to the i-th round of dialogue based on the judgment result, and generate the dialogue customer service statement corresponding to the i-th round of dialogue based on the second node.
[0091] The jump condition may include a semantic similarity threshold, meaning the jump condition is determined by the semantic similarity threshold. Accordingly, the similarity between the semantic vector of the user's dialogue information in the (i-1)th round and the preset condition text vector corresponding to the first jump condition can be calculated. Based on the comparison between the obtained similarity value and the semantic similarity threshold included in the first jump condition, it is determined whether the first node satisfies the first jump condition.
[0092] In one optional implementation, the jump condition includes a semantic similarity threshold; determining whether the first node meets the first jump condition based on the user's dialogue information in the (i-1)th round includes: obtaining a preset condition text vector corresponding to the first jump condition; calculating the semantic similarity between the preset condition text vector and the semantic vector of the user's dialogue information in the (i-1)th round to obtain a similarity value; and determining that the first node meets the first jump condition if the similarity value is greater than the semantic similarity threshold included in the first jump condition.
[0093] The preset condition text vector is used to represent the semantic vector of the expected user response text corresponding to the first jump condition. For example, for the connection edge between node C and node D, C -->|Convenient| D, the preset condition text vector corresponding to its first jump condition is the vectorized representation of "Convenient".
[0094] Among them, the preset condition text vectors corresponding to the jump conditions of the outgoing edges of all condition judgment types of nodes can be preloaded, and all preset condition text vectors can be pre-stored in the local cache to facilitate real-time semantic matching and improve semantic matching efficiency.
[0095] For example, for the first node C of the conditional judgment type, its associated descriptive text is:
[0096] C --> | Convenient | D [Explain the purpose of the call]<!-- SJ:0.85 -->
[0097] C -->|Inconvenient| E [Schedule a later time]<!-- SJ:0.80 -->
[0098] Correspondingly, the first jump condition for the connection edge between node C and node D is "SJ:0.85", which means that the semantic similarity threshold included in the first jump condition is 0.85. The first jump condition for the connection edge between node C and node E is "SJ:0.80", which means that the semantic similarity threshold included in the first jump condition is 0.80.
[0099] Therefore, for the first jump condition corresponding to the connection edge between node C and node D, the corresponding preset condition text vector, i.e., the vectorized representation of "convenient", can be obtained. Semantic similarity is calculated between this preset condition text vector and the semantic vector of the user's dialogue information in the (i-1)th round. For example, the cosine similarity between the two can be calculated to obtain a similarity value. When this similarity value is greater than the semantic similarity threshold of 0.85 contained in the first jump condition, it is determined that the first node satisfies the first jump condition.
[0100] For the first jump condition corresponding to the connection edge between node C and node E, the corresponding preset condition text vector, i.e., the vectorized representation of "inconvenient", can be obtained. Semantic similarity is calculated between this preset condition text vector and the semantic vector of the user's dialogue information in the (i-1)th round. For example, the cosine similarity between the two can be calculated to obtain a similarity value. When this similarity value is greater than the semantic similarity threshold of 0.80 contained in the first jump condition, it is determined that the first node satisfies the first jump condition.
[0101] In this embodiment of the disclosure, by including a semantic similarity threshold in the jump conditions, i.e. applying a controllable jump factor, when a user reply is received, the similarity value between its vector and all candidate preset condition text vectors is calculated in real time. Jumping is only allowed when the score exceeds the semantic similarity threshold and the predecessor node constraint is met. This enables the system to have the ability to understand fuzzy logic. Users do not need to use standard wording to reply, and the system can be accurately identified by the preset question-and-answer model, thus achieving accurate jump node selection.
[0102] In one optional implementation, determining the second node corresponding to the i-th round of dialogue based on the judgment result includes: if the judgment result is that the first node satisfies the first jump condition, determining the second node corresponding to the i-th round of dialogue based on the adjacent successor node pointed to by the connecting edge corresponding to the first jump condition; if the judgment result is that the first node does not satisfy the first jump condition, determining the first node as the second node corresponding to the i-th round of dialogue.
[0103] Specifically, when selecting the second node, if the first node does not meet the first jump condition corresponding to its outgoing edge, the first node can be set as the second node. This allows the preset question-and-answer model to continue the dialogue flow of the current node until it is determined that the first node meets the jump condition corresponding to its outgoing edge. If, after multiple rounds of interaction, the first node still does not meet the first jump condition corresponding to its outgoing edge, an abnormal process can be triggered, such as a human responding to the user's dialogue.
[0104] If the first node satisfies the first jump condition corresponding to its outgoing edge, the second node can be determined based on the adjacent successor node pointed to by the connecting edge that satisfies the first jump condition. Thus, the preset question-and-answer model can generate the corresponding dialogue customer service statement based on the second node.
[0105] For example, in the (i-1)th round of dialogue, the pre-defined question-answering model selects node C as the first node, and the user's reply is "convenience". Therefore, in the i-th round of dialogue, the pre-defined question-answering model determines that node C satisfies the first transition condition corresponding to the connection edge between it and node D, thus identifying node D as the second node in the i-th round of dialogue.
[0106] It should be noted that the preset flowchart may include nodes of the "must-access" type. These nodes represent that the dialogue flow corresponding to the node must be triggered at least once in the target dialogue with the user. Therefore, when the first node satisfies the first jump condition corresponding to its outgoing edge, it is also possible to determine whether all predecessor nodes of the second node (including adjacent predecessor nodes whose outgoing edges directly point to the second node and interval predecessor nodes whose outgoing edges indirectly point to the second node) contain nodes of the "must-access" type.
[0107] If there is a node of the type that must be accessed, it is necessary to further determine whether the node of the type that must be accessed has been selected by the preset question-answering model in the previous round of dialogue. Only when the node of the type that must be accessed has been selected can the adjacent successor node pointed to by the connection edge corresponding to the first jump condition be determined as the second node corresponding to the i-th round of dialogue.
[0108] If the first node does not meet the first jump condition corresponding to its outgoing edge, the first node can be directly determined as the second node corresponding to the i-th round of dialogue. Thus, the pre-defined question-answering model can generate the corresponding customer service dialogue based on this second node.
[0109] Correspondingly, after the user replies to the customer service statement in the i-th round of dialogue, the prompt information for the (i+1)-th round of dialogue is further generated, so that the preset question-and-answer model can further generate the customer service statement for the (i+1)-th round of dialogue.
[0110] It should be noted that the prompt information may also include the output format requirements of the preset question-and-answer model, so that the preset question-and-answer model outputs relevant result information, such as the selected node, the dialogue customer service statement, the statement confidence level, the node jump type, etc. This disclosure embodiment does not limit this.
[0111] For example, the prompt message corresponding to a certain round of dialogue in the target dialogue could be:
[0112] graph TD
[0113] A ([User answers]) --> B ([Introduces themselves])<!-- Node_ID:A_Start -->
[0114] B --> C {Is it convenient for the customer to make a call?}<!-- Node_ID:B_Intro -->
[0115] C --> | Convenient | D [Explain the purpose of the call]<!-- SJ:0.85 -->
[0116] C -->|Inconvenient| E [Schedule a later time]<!-- SJ:0.80 -->
[0117] The dialogue must proceed strictly according to the order of the process nodes, and nodes that require access must not be skipped. If a user's reply has a semantic similarity greater than 0.85 to "convenient," the process can proceed to node D; if a user's reply has a semantic similarity greater than 0.80 to "inconvenient," the process can proceed to node E. If the similarity is insufficient, the process must remain at the current node and continue with follow-up questions. The output format must meet the following requirements:
[0118] {
[0119] "next_node_id": "D_Purpose",
[0120] "response": "Thank you for your cooperation..."
[0121] "confidence": 0.92
[0122] "jump_type":"condition_match"
[0123] }".
[0124] Therefore, in this embodiment, the prompt message is assembled by combining the instruction template (used to emphasize process constraints), subgraph description text, anonymized records of the most recent n rounds of historical dialogue, and the JSON model output format requirements into a prompt message. Based on this prompt message, a preset question-and-answer model can be invoked to obtain the model's output, which is structured JSON data containing information such as the selected node, the dialogue customer service statement, the statement confidence level, and the node jump type.
[0125] This disclosure provides a method for generating customer service statements. First, a preset process description text corresponding to the target dialogue scenario is obtained. This preset process description text is a textual representation of a preset flowchart. Then, the preset process description text is parsed, and marker text information corresponding to the elements of the preset flowchart is added to it to obtain a structured description text. This achieves the structured constraints of the preset process description text, facilitating the accurate parsing of the flow control logic by the preset question-and-answer model. Finally, prompt information is constructed based on the structured description text, and the preset question-and-answer model generates a customer service statement corresponding to the user's target dialogue based on the prompt information. In this disclosure, because the prompt information of the preset question-and-answer model contains structured description text, the preset question-and-answer model can strictly adhere to flow constraints when generating customer service statements, thereby reducing the probability of flow deviation during the dialogue process.
[0126] Therefore, the customer service statement generation method of this disclosure combines the flexibility of dialogue generation of the preset question-and-answer model with the controllability of the dialogue process with the user, thereby achieving an organic unity of intelligence and determinism in customer service statement generation.
[0127] In one optional implementation, the step of extracting the subgraph description text corresponding to the first node from the structured description text based on the target node identifier includes: determining the context node window of the first node based on the process complexity corresponding to the first node; determining the node subgraph corresponding to the first node in the structured description text based on the context node window and the target node identifier, wherein the node subgraph includes the first node and the associated nodes of the first node located within the context node window; and extracting the description text corresponding to the node subgraph from the structured description text to obtain the subgraph description text.
[0128] Specifically, for the target dialogue with the user, the system can load a complete flowchart object compiled from the structured description text. This object contains a set of nodes (NodeSet), a set of transition edges (EdgeSet), and a jump condition map (JumpConditionMap). Simultaneously, it can initialize the dialogue state stack of the target dialogue, recording the selected node paths in list form, such as `stack = ["A_Start", "B_Intro"]`, where the top of the stack is the identifier of the target node corresponding to the first node.
[0129] The context node window of the first node can be flexibly determined based on the process complexity corresponding to the first node. The higher the process complexity, the larger the context node window, and thus the more text content is covered in the subgraph description text.
[0130] For example, the size parameter of the context node window is set to 2 based on the process complexity, so that the subgraph description text includes the description text of the first node and its direct predecessor and successor nodes.
[0131] Specifically, based on the target node identifier and the context node window, a graph traversal algorithm is used to traverse the structured description text to obtain the node subgraph corresponding to the first node. The node subgraph includes the first node and its associated nodes (such as the first node's adjacent predecessor nodes and adjacent successor nodes) located within the context node window.
[0132] Therefore, by extracting the description text corresponding to the subgraph of the node from the structured description text, the subgraph description text can be obtained.
[0133] For example, for node B, its node subgraph includes node B, its adjacent predecessor node A, and its adjacent successor node C. Correspondingly, its subgraph description text can be:
[0134] graph TD
[0135] A ([Customer answers]) --> B ([Introduces themselves])<!-- Node_ID:A_Start -->
[0136] B --> C {Is it convenient for the customer to make a call?}<!-- Node_ID:B_Intro -->
[0137] In this embodiment of the disclosure, the size of the context window of a node is adaptively determined by the process complexity corresponding to the node, thereby enabling flexible extraction of the subgraph description text corresponding to the node, improving the accuracy of the subgraph description text extraction, and generating dynamic prompt information for each dialogue round by using the subgraph description text extracted through the context window, which can ensure that the prompt information for each dialogue round only contains the minimum necessary description text of the current node and its associated nodes, such as one node before and one node after it, avoiding information overload.
[0138] In one alternative implementation, after generating the customer service dialogue statement, a triple verification can be performed: node validity verification, node redirection accuracy verification, and guaranteed node integrity detection. This verifies the effectiveness of the generated customer service statement and reduces the probability of deviation from the dialogue flow.
[0139] Accordingly, after generating the customer service statement for the i-th round of dialogue based on the second node, the method further includes: verifying whether the second node is included in a preset node set to obtain a first verification result, wherein the preset node set includes the first node and its successor nodes; if the predecessor node of the second node includes a node of the mandatory access type, verifying whether the node of the mandatory access type has been selected by the preset question-and-answer model when generating the customer service statement for the first i rounds of dialogue to obtain a second verification result; if the first node is a node of the condition judgment type, verifying whether the first node meets the jump condition to the second node to obtain a third verification result; and verifying the statement generation effect of the customer service statement for the i-th round of dialogue based on the first verification result, the second verification result, and the third verification result.
[0140] The concept of nodes that must be accessed can be referred to the above description, and will not be repeated here.
[0141] Specifically, a preset node search algorithm (such as depth-first search) can be used to confirm whether the second node selected by the model (i.e., next_node_id) is included in the preset node set. That is, it can be confirmed whether the second node is the first node or a successor node of the first node (i.e., in the outgoing edge list of the first node), thus obtaining the first verification result. If the second node is included in the preset node set, the first verification result is that the verification passes.
[0142] Specifically, if the first node is a conditional judgment node, the third verification result is passed if the similarity value is compared with the semantic similarity threshold in the jump condition corresponding to the connection edge pointing to the second node. This similarity value is used to characterize the semantic similarity between the preset conditional text vector corresponding to the jump condition and the semantic vector of the user's dialogue information in the (i-1)th round.
[0143] If the predecessor nodes of the second node (including adjacent predecessor nodes whose outgoing edges directly point to the second node and interval predecessor nodes whose outgoing edges indirectly point to the second node) include nodes of the required access type, it is necessary to determine whether the nodes of the required access type have been selected by the preset question-and-answer model in the previous rounds of dialogue customer service statements in the target dialogue. If all the nodes of the required access type have been selected, the second verification result is verification passed.
[0144] For example, if by accessing the dialogue state stack, it is determined that a node of the required access type (such as a compliance node marked as `required`, such as a "risk warning" node) in the predecessor node of the second node has been accessed, then the second verification result is that the verification passed.
[0145] It should be noted that if the validation is not triggered, for example, if the first node is not a conditional judgment type node, the validation result will default to validation passed.
[0146] Accordingly, based on the first, second, and third verification results, the generation effect of the customer service dialogue statement in the i-th round of dialogue can be verified. For example, if verification fails, it indicates that the statement generation effect is poor, and an interception can be triggered to retry and regenerate the customer service dialogue statement or trigger a manual takeover process. If the verification result is successful, the generated customer service dialogue statement can be fed back to the user, and the next_node_id of the second node corresponding to the i-th round of dialogue can be pushed onto the dialogue state stack. Correspondingly, a structured log containing {the node identifier of the second node, timestamp, model output, user reply, and jump type} can also be generated for the i-th round of dialogue record.
[0147] In one alternative implementation, the dialogue flowchart of the target dialogue can be generated in reverse based on the nodes selected in each round of the target dialogue by the preset question-and-answer model, the jump information between nodes in adjacent rounds, and the dialogue records of each round, so as to realize the visualization of the target dialogue.
[0148] Accordingly, after generating the customer service dialogue statement for the target dialogue with the user based on the prompt information, the method further includes: in response to a query request for the target dialogue, obtaining node selection information, node jump information, and dialogue association information corresponding to the target dialogue; the node selection information includes the nodes corresponding to each round of dialogue in the target dialogue; the node jump information includes the jump information between nodes corresponding to adjacent dialogue rounds; the dialogue association information includes the interaction records corresponding to each round of dialogue in the target dialogue; and generating a dialogue flowchart corresponding to the target dialogue based on the node selection information, node jump information, and dialogue association information to achieve a visual display of the target dialogue.
[0149] For each target conversation with a user, a unique conversation identifier (session_id) can be generated. This conversation identifier is associated with a tracking log, which contains information such as the node selection, node jump, and conversation association information corresponding to the target conversation.
[0150] The node selection information can be an array of execution paths, including the nodes selected by the preset question-answering model in each round of the target dialogue. The node jump information includes jump information between nodes corresponding to adjacent dialogue rounds, such as the source node, target node, jump type, and semantic score for each jump. The dialogue association information includes the interaction records corresponding to each round of the target dialogue, such as the compliance check result for compliance nodes (e.g., "identity verification: passed"), the user's dialogue information in each round, the output information of the preset question-answering model in each round, and the node verification results.
[0151] After being anonymized, the tracking log can be stored in a time-series database for easy access to the target conversation.
[0152] Accordingly, for a query request for a target dialogue, after obtaining the node selection information, node jump information, and dialogue association information corresponding to the target dialogue, it can be rendered in reverse as a dialogue flowchart (such as a Mermaid flowchart) through a visualization platform. Node selection information is used to determine the nodes in the dialogue flowchart, node jump information is used to determine the connecting edges between nodes in the dialogue flowchart, and dialogue association information is used to determine the node attributes of the nodes in the dialogue flowchart.
[0153] The execution path of a node in the dialogue flowchart can be configured to be highlighted, and the dialogue flowchart can be configured to display the interaction record corresponding to the dialogue turn of any node when it is triggered.
[0154] In related technologies, the black-box nature of models makes it impossible to record the dialogue decision-making process in a structured way, making it difficult to locate specific steps and decision-making basis during anomaly investigation. In the embodiments of this disclosure, the entire dialogue execution process can be recorded in a structured way, thereby enabling the visualization of the target dialogue based on the structured record, which facilitates node-level tracing and tracking of decision-making basis for the target dialogue.
[0155] In one optional implementation, before constructing the prompt information for the i-th round of dialogue based on the subgraph description text, the method further includes: determining the user's dialogue intent in the (i-1)-th round based on the user's dialogue information in the (i-1)-th round, and detecting whether the dialogue intent matches the dialogue flow represented by the first node; if the dialogue intent does not match the dialogue flow represented by the first node, constructing the prompt information corresponding to the i-th round of dialogue based on the subgraph description text, including: determining the description text of the third node that matches the dialogue intent in the structured description text; and constructing the prompt information for the i-th round of dialogue based on the description text of the third node and the subgraph description text.
[0156] During the conversation, users may exhibit leaps in thinking, for example, directly inquiring about products during the identity verification phase. Therefore, this embodiment of the disclosure can determine the user's conversational intent from the (i-1)th round of conversation information. If the conversational intent does not match the conversation flow represented by the first node, it indicates that the user has jumped between intentions.
[0157] Correspondingly, in this case, the description text of the third node that matches the dialogue intent can be found in the structured description text, and the prompt information of the i-th round of dialogue can be constructed together with the description text of the third node and the description text of the subgraph.
[0158] For example, the semantic vector of the user's dialogue information in the (i-1)th round is used to perform batch similarity calculation with the preset conditional text vectors corresponding to the outgoing edges of all conditional judgment type nodes (i.e., Decision nodes) in the preset flowchart, so as to find the third node based on the calculation results.
[0159] For example, if the similarity value of the preset conditional text vector corresponding to the outgoing edge of the "Product Introduction" node is found to be 0.88, which exceeds the preset semantic similarity threshold (such as 0.80), and all the predecessor nodes of the required access types of this node have been visited, then jumping to this node is allowed.
[0160] Correspondingly, a description of the node can be temporarily injected into the prompt message, and its jump type can be marked as forced jump `forced_jump`. This allows the preset question-and-answer model to first respond to the user's question based on the node, and then naturally transition back to the main process to select the corresponding process node.
[0161] To facilitate understanding, the following specific example illustrates the detailed implementation of the above method:
[0162] In customer service scenarios such as auto finance, intelligent customer service systems are needed to generate dialogue messages for users to achieve efficient interaction. However, existing methods for generating customer service messages cannot simultaneously achieve both intelligence and determinism in message generation.
[0163] Specifically, based on the traditional rule engine generation method, business personnel need to complete the process orchestration through a graphical process designer. For example, business personnel build various business processes by "drag and drop nodes and configure connections," generating structured process definition files. Therefore, during system runtime, the rule engine needs to parse and execute each node in a preset order, with node behavior determined by configuration items. The system uses fixed keywords or regular expressions to match the input for each node in the flowchart. Upon successful matching, it invokes the preset action corresponding to that node, such as playing pre-recorded audio, jumping to the next node, or triggering external system commands.
[0164] However, the above methods have the following drawbacks: First, they lack flexibility and adaptability, resulting in a rigid, linear process that cannot handle users' colloquial, disjointed, and non-standard responses, and is prone to interruption or repetition when faced with sudden intent. Second, they are costly to maintain and have poor scalability. Each business adjustment or script update requires manual modification and redeployment, and as the number of customer service scenarios and rules increases, the system is prone to "rule bloat," leading to decreased maintainability. Third, they have weak semantic understanding and context processing capabilities, heavily relying on keyword matching, making it difficult to recognize diverse expressions and long-distance contextual dependencies, resulting in low intent recognition accuracy. Fourth, the low level of intelligence leads to a poor user experience and an inability to generate personalized interactive content.
[0165] The generation method based on intelligent models mainly relies on manually writing lengthy natural language prompts, embedding business processes, operation sequences, and precautions into the prompts in a "role setting + instruction list" manner. For example, in the automotive finance customer service scenario, the dialogue flow is usually explicitly written into the prompt in text form, such as "You are an automotive finance customer service assistant, please strictly follow the following steps... Step 1... Step 2...", thereby leveraging the model's instruction-following ability and contextual memory to control the direction of the dialogue.
[0166] However, the above approach has the following drawbacks: First, the determinism and controllability of process execution are insufficient. The probabilistic generation characteristics of large models and the risk of "illusion" make it easy to skip key nodes or cause the same input to have drastically different output paths in different sessions, failing to meet the requirements of business standardization and reproducibility. Second, there is a lack of formal process constraint mechanisms. It mainly relies on defining logic such as "must be executed" and "loop branches" in the Prompt, which cannot be strictly parsed by machines to ensure that the intent is not distorted. It is also difficult to perform dead loop detection and node coverage verification through static analysis. Furthermore, maintenance relies solely on manual word-by-word modification, making version management difficult and prone to introducing contradictions. Third, verifiability and traceability are lacking. The black-box nature of the model makes it impossible to trace the dialogue process in a structured way. When errors occur, it is difficult to locate the specific link and decision basis, and it is impossible to provide a complete execution trajectory, thus failing to achieve quality control of the dialogue process.
[0167] In light of this, this example provides a customer service statement generation method with the following advantages: First, it enables dynamic arrangement and flexible adjustment of dialogue logic based on a pre-defined question-and-answer model, enhancing its intelligent adaptability to diverse user expressions, deep contextual relationships, and sudden intents. Second, it imposes structured and enforceable deterministic constraints on the dialogue flow of the pre-defined question-and-answer model, ensuring strict adherence to key business nodes and precise execution of the process along the pre-defined path. Third, it constructs a formalized, machine-parseable dialogue flow description language and a strong constraint mechanism, enabling precise expression, automated verification, and version management of dialogue logic. Fourth, it achieves structured recording, node-level traceability, and decision basis tracking throughout the entire dialogue execution process. Fifth, it enables modular and component-based configuration and low-code maintenance of the dialogue flow, supporting rapid iteration of business rules and reuse across multiple scenarios, reducing maintenance costs, and improving system scalability.
[0168] Figure 2 This example provides a flowchart illustrating a customer service statement generation method. (Refer to...) Figure 2 The method includes:
[0169] Step S201: Obtain the preset process description text corresponding to the target dialogue scenario. The preset process description text is a textual representation of the preset flowchart.
[0170] Specifically, user history and tags can be pre-mapped to sub-process modules in a preset process description text. When a user is identified as belonging to a specific profile, the corresponding sub-process branch in the preset process description text is dynamically loaded directly.
[0171] Furthermore, modular reuse and combination of process segments can be implemented to improve configuration efficiency. For example, frequently used standard sub-processes can be independently written as Mermaid file modules. These file modules can then be referenced in the pre-defined process description text using syntax. When process adjustments are needed, only the corresponding module file needs to be modified, and all processes referencing that module will automatically take effect, achieving configuration reuse and unified management.
[0172] Step S202: Parse the preset process description text, add the marker text information corresponding to the elements of the preset flowchart to the preset process description text, and obtain the structured description text.
[0173] Specifically, if the system detects a change in the preset process description text through file system monitoring or real-time configuration center, it can trigger the compiler to regenerate the structured description text. The new structured description text takes effect immediately on subsequently created session instances. Existing active sessions can choose to retain the original process to complete the loop, or smoothly migrate to the new process based on business importance, achieving a balance between agile business iteration and user experience. In addition, the hash value of each version of the preset process description text can be recorded to ensure that any dialogue record can be traced back to the corresponding process version.
[0174] Step S203: Validate the structured description text.
[0175] Specifically, a three-level static validation can be performed on the abstract syntax tree corresponding to the structured description text: First, an infinite loop is detected using the Tarjan algorithm. Then, the reachability of all key compliance nodes is verified using a depth-first search. Finally, the reasonableness of the semantic similarity threshold is checked. If the validation fails, business personnel can be prompted to revise the preset process description text.
[0176] Step S204: Initialize the dialogue state stack corresponding to the target dialogue with the user.
[0177] The dialogue state can be persisted to the Redis database in real time to support state takeover during fault recovery and manual intervention.
[0178] Furthermore, the system can deploy a multi-layered caching mechanism to improve efficiency. For example, the compiled subgraph description text can be cached in Redis according to node identifiers to avoid redundant parsing overhead. Semantic vectors can be generated offline from the conditional text corresponding to nodes with conditional judgment types, resulting in preset conditional text vectors. Therefore, at runtime, only the semantic vectors of the user's dialogue information need to be calculated in real time, reducing the time spent on similarity calculations. Comments and whitespace characters in the structured description text are compressed, and token indexes are created for high-frequency node descriptions to reduce token transmission volume. An asynchronous non-blocking architecture is used to handle model calls of the preset question-answering model, reducing response latency.
[0179] Step S205: For the i-th round of dialogue in the target dialogue, obtain the dialogue information of the user's reply in the (i-1)-th round of dialogue, and obtain the target node identifier of the first node corresponding to the (i-1)-th round of dialogue in the dialogue state stack.
[0180] In this step, the i-th round of dialogue will only begin if a response from the user in the (i-1)-th round of dialogue is received. If the user's response times out, the process can backtrack to the previous node, allowing the preset question-and-answer model to regenerate differentiated customer service statements based on that previous node.
[0181] In this step, the system can also detect whether the user intends to skip ahead based on the dialogue information from the (i-1)th round of dialogue. If such an intention exists, the semantic similarity between the dialogue information and the preset conditional text vectors corresponding to the outgoing edges of nodes of each conditional judgment type in the preset flowchart is calculated. If a node meets the semantic similarity threshold, a forced jump to that node is allowed, and the corresponding descriptive text is obtained. This descriptive text, along with the subgraph descriptive text corresponding to the first node, is used to construct a prompt message. If no node meets the semantic similarity threshold, the system can continue to wait for the user's response.
[0182] Step S206: Based on the target node identifier and the context node window corresponding to the first node, extract the subgraph description text corresponding to the first node from the structured description text information.
[0183] Step S207: Construct the prompt information for the i-th round of dialogue based on the subgraph description text, and call the preset question-and-answer model based on the prompt information to obtain the JSON output result of the preset question-and-answer model.
[0184] In this step, the preset question-and-answer model will select the second node corresponding to the i-th round of dialogue based on the prompt information, and generate the dialogue customer service statement for the i-th round of dialogue based on the second node.
[0185] The JSON output of the preset question-and-answer model can include the customer service statement of the i-th round of dialogue, the selected node "next_node_id", and other information.
[0186] Step S208: Validate the JSON output. If the validation passes, proceed to step S209. If the validation fails, proceed to step S210.
[0187] Step S209: Update the dialogue state stack.
[0188] In this step, the corresponding customer service statement for the i-th round of dialogue can be provided to the user, the verified selected node next_node_id can be pushed onto the dialogue state stack, a structured log containing {node_id, timestamp, user_input, model_output, jump_type} can be recorded, and the context node window can be updated for use in the next round of dialogue.
[0189] Step S210: Trigger a retry or manual processing procedure.
[0190] In this embodiment, a multi-layered protection mechanism can be set up to deal with various anomalies. For example, in deviation detection, if the node selected by the preset question-answering model is not in the allowed list, it will be immediately intercepted and a retry will be triggered. A stronger constraint such as "Warning: Illegal jump attempt, you must select one of the following nodes..." can be added to the retry prompt message.
[0191] For example, if a user's clear intention to refuse is identified (e.g., by matching samples such as "don't need" or "not interested" through semantic similarity), the process is forced to move to the predefined `End_Reject` endpoint, which in turn enables the pre-defined question-and-answer model to generate a polite hanging-up message and record the reason for the rejection.
[0192] For example, in a timeout rollback scenario, if a user does not respond after a preset time, the system automatically rolls back to the previous node and resends the customer service dialogue with a different expression to avoid awkward silences.
[0193] Step S211: Confirm whether the node corresponding to the i-th round of dialogue is the end node. If it is the end node, proceed to step S212. If the node corresponding to the i-th round of dialogue is not the end node, increment i by 1 and return to proceed to step S205.
[0194] Step S212: Archive the conversation log.
[0195] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0196] Secondly, embodiments of this disclosure provide a customer service statement generation device. Figure 3 A block diagram of a customer service statement generation device provided in this disclosure embodiment, referring to... Figure 3 The device includes:
[0197] The acquisition module 31 is used to acquire the preset process description text corresponding to the target dialogue scenario, wherein the preset process description text is a textual representation of the preset flowchart;
[0198] Parsing module 32 is used to parse the preset process description text, and add the marker text information corresponding to the elements of the preset flowchart to the preset process description text to obtain structured description text;
[0199] The generation module 33 is used to construct prompt information based on the structured description text, and generate a dialogue customer service statement corresponding to the user's target dialogue based on the prompt information according to the preset question-and-answer model.
[0200] In one optional implementation, the elements of the preset flowchart include: multiple nodes representing the dialogue flow, and connecting edges representing the jump relationships between nodes; adding the marker text information corresponding to the elements of the preset flowchart to the preset flow description text to obtain the structured description text includes: generating a node identifier for each node in the preset flowchart; generating a jump condition corresponding to the connecting edge output by the condition judgment type node in the preset flowchart; adding the node identifier and the jump condition to the preset flow description text as annotations to obtain the structured description text; wherein, the marker text information corresponding to the node includes the node identifier, and the marker text information corresponding to the connecting edge includes the jump condition.
[0201] In one optional implementation, the target dialogue includes multiple rounds of dialogue; the step of constructing prompt information based on the structured description text and generating a customer service statement corresponding to the user's target dialogue based on the prompt information using a preset question-answering model includes: for the i-th round of dialogue in the target dialogue, obtaining the target node identifier corresponding to the first node, wherein the first node is the node selected by the preset question-answering model when generating the customer service statement for the (i-1)-th round of dialogue; extracting the subgraph description text corresponding to the first node from the structured description text based on the target node identifier; constructing prompt information for the i-th round of dialogue based on the subgraph description text; selecting the second node corresponding to the i-th round of dialogue based on the prompt information using the preset question-answering model; and generating the customer service statement for the i-th round of dialogue based on the second node.
[0202] In one optional implementation, the step of extracting the subgraph description text corresponding to the first node from the structured description text based on the target node identifier includes: determining the context node window of the first node based on the process complexity corresponding to the first node; determining the node subgraph corresponding to the first node in the structured description text based on the context node window and the target node identifier, the node subgraph including the first node and the associated nodes of the first node located in the context node window; and extracting the description text corresponding to the node subgraph from the structured description text to obtain the subgraph description text.
[0203] In one optional implementation, when the first node is a conditional judgment type, the step of selecting the second node corresponding to the i-th round of dialogue based on the prompt information of the i-th round of dialogue using a preset question-and-answer model includes: based on the preset question-and-answer model, determining the adjacent successor node of the first node and the first jump condition corresponding to the connecting edge from the first node to the adjacent successor node based on the prompt information of the i-th round of dialogue; based on the preset question-and-answer model, determining whether the first node satisfies the first jump condition based on the dialogue information of the user in the (i-1)-th round, and determining the second node corresponding to the i-th round of dialogue based on the determination result.
[0204] In one optional implementation, the jump condition includes a semantic similarity threshold; determining whether the first node satisfies the first jump condition based on the user's dialogue information in the (i-1)th round includes: obtaining a preset condition text vector corresponding to the first jump condition; performing semantic similarity calculation between the preset condition text vector and the semantic vector of the user's dialogue information in the (i-1)th round to obtain a similarity value; and determining that the first node satisfies the first jump condition if the similarity value is greater than the semantic similarity threshold included in the first jump condition.
[0205] In one optional implementation, determining the second node corresponding to the i-th round of dialogue based on the judgment result includes: if the judgment result is that the first node satisfies the first jump condition, determining the second node corresponding to the i-th round of dialogue based on the adjacent successor node pointed to by the connecting edge corresponding to the first jump condition; if the judgment result is that the first node does not satisfy the first jump condition, determining the first node as the second node corresponding to the i-th round of dialogue.
[0206] In one optional implementation, after generating the customer service statement for the i-th round of dialogue based on the second node, the method further includes: verifying whether the second node is included in a preset node set to obtain a first verification result, wherein the preset node set includes the first node and its successor nodes; if the predecessor node of the second node includes a node of the mandatory access type, verifying whether the node of the mandatory access type has been selected by the preset question-and-answer model when generating the customer service statement for the first i-th round of dialogue to obtain a second verification result; if the first node is a node of the condition judgment type, verifying whether the first node meets the jump condition to the second node to obtain a third verification result; and verifying the statement generation effect of the customer service statement for the i-th round of dialogue based on the first verification result, the second verification result, and the third verification result.
[0207] In one optional implementation, after generating the customer service dialogue statement for the target dialogue with the user based on the prompt information, the method further includes: in response to a query request for the target dialogue, obtaining node selection information, node jump information, and dialogue association information corresponding to the target dialogue; the node selection information includes nodes corresponding to each round of dialogue in the target dialogue; the node jump information includes jump information between nodes corresponding to adjacent dialogue rounds; the dialogue association information includes interaction records corresponding to each round of dialogue in the target dialogue; and generating a dialogue flowchart corresponding to the target dialogue based on the node selection information, the node jump information, and the dialogue association information to achieve a visual display of the target dialogue.
[0208] The apparatus provided in this disclosure can have functions or include modules that can be used to perform the methods described in the first aspect of the method embodiments above. The specific implementation and technical effects can be referred to the description of the method embodiments above. For the sake of brevity, they will not be repeated here.
[0209] It should be noted that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this disclosure, this embodiment does not introduce units that are not closely related to solving the technical problems proposed in this disclosure; however, this does not mean that other units are absent from this embodiment.
[0210] Reference Figure 4 This disclosure provides an electronic device, which includes:
[0211] One or more processors 401;
[0212] The memory 402 stores one or more programs that, when executed by one or more processors, cause the one or more processors to implement any of the above-mentioned customer service statement generation methods.
[0213] One or more I / O interfaces 403 are connected between the processor and the memory and configured to enable information exchange between the processor and the memory.
[0214] Among them, processor 401 is a device with data processing capabilities, including but not limited to central processing unit (CPU); memory 402 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); I / O interface (read-write interface) 403 is connected between processor 401 and memory 402, and can realize information interaction between processor 401 and memory 402, including but not limited to data bus (Bus).
[0215] In some embodiments, the processor 401, memory 402, and I / O interface 403 are interconnected via a bus, and thus connected to other components of the computing device.
[0216] This embodiment also provides a computer-readable medium having a computer program stored thereon. When the program is executed by a processor, it implements the customer service statement generation method provided in this embodiment. To avoid repetition, the specific steps of the customer service statement generation method will not be repeated here.
[0217] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device executes the above-described customer service statement generation method.
[0218] Those skilled in the art will understand that all or some of the steps, systems, or apparatuses in the methods, systems, and apparatuses described above can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0219] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0220] Those skilled in the art will understand that although some embodiments described herein include certain features that are included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of this embodiment and form different embodiments.
[0221] It is understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of this disclosure, and this disclosure is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and substance of this disclosure, and these modifications and improvements are also considered to be within the scope of protection of this disclosure.
Claims
1. A method for generating customer service statements, characterized in that, include: Obtain the preset process description text corresponding to the target dialogue scenario, wherein the preset process description text is a textual representation of the preset flowchart; Parse the preset process description text, and add the tag text information corresponding to the elements of the preset flowchart to the preset process description text to obtain the structured description text; Based on the structured description text, prompt information is constructed, and based on the preset question-and-answer model, a dialogue customer service statement corresponding to the user's target dialogue is generated.
2. The method according to claim 1, characterized in that, The elements of the preset flowchart include: multiple nodes representing the dialogue flow, and connecting edges representing the jump relationships between nodes; the preset flowchart elements are added to the preset flow description text to obtain structured description text, including: For each node in the preset flowchart, generate a node identifier corresponding to that node; For the connection edges output by nodes of the condition judgment type in the preset flowchart, generate the jump conditions corresponding to the connection edges; The node identifier and the jump condition are added as comments to the preset process description text to obtain the structured description text; The labeled text information corresponding to the node includes the node identifier, and the labeled text information corresponding to the connecting edge includes the jump condition.
3. The method according to claim 2, characterized in that, The target dialogue includes multiple rounds of dialogue; the step of constructing prompt information based on the structured description text, and generating dialogue customer service statements corresponding to the user's target dialogue based on the prompt information using a preset question-and-answer model, includes: For the i-th round of dialogue in the target dialogue, obtain the target node identifier corresponding to the first node, where the first node is the node selected when the preset question-and-answer model generates the dialogue customer service statement for the (i-1)-th round of dialogue; Based on the target node identifier, extract the subgraph description text corresponding to the first node from the structured description text; Based on the subgraph description text, construct the prompt information for the i-th round of dialogue. Based on the preset question-and-answer model, select the second node corresponding to the i-th round of dialogue according to the prompt information for the i-th round of dialogue, and generate the dialogue customer service statement for the i-th round of dialogue based on the second node.
4. The method according to claim 3, characterized in that, The step of extracting the subgraph description text corresponding to the first node from the structured description text based on the target node identifier includes: The context node window of the first node is determined based on the process complexity corresponding to the first node. Based on the context node window and the target node identifier, a node subgraph corresponding to the first node is determined in the structured description text. The node subgraph includes the first node and the associated nodes of the first node located in the context node window. Extract the description text corresponding to the node subgraph from the structured description text to obtain the subgraph description text.
5. The method according to claim 3, characterized in that, When the first node is a conditional judgment type, the step of selecting the second node corresponding to the i-th round of dialogue based on the prompt information of the i-th round of dialogue using a preset question-answering model includes: Based on the preset question-and-answer model, according to the prompt information of the i-th round of dialogue, the adjacent successor nodes of the first node and the first jump condition corresponding to the connecting edge from the first node to the adjacent successor node are determined. Based on the preset question-and-answer model, according to the user's dialogue information in the (i-1)th round, it is determined whether the first node meets the first jump condition, and based on the determination result, the second node corresponding to the i-th round of dialogue is determined.
6. The method according to claim 5, characterized in that, The jump condition includes a semantic similarity threshold; determining whether the first node meets the first jump condition based on the user's dialogue information in the (i-1)th round includes: Obtain the preset condition text vector corresponding to the first jump condition; The semantic similarity between the preset conditional text vector and the semantic vector of the user's dialogue information in the (i-1)th round is calculated to obtain a similarity value; If the similarity value is greater than the semantic similarity threshold included in the first jump condition, the first node is determined to satisfy the first jump condition.
7. The method according to claim 5, characterized in that, The step of determining the second node corresponding to the i-th round of dialogue based on the judgment result includes: If the judgment result is that the first node satisfies the first jump condition, the second node corresponding to the i-th round of dialogue is determined according to the adjacent successor node pointed to by the connection edge corresponding to the first jump condition. If the judgment result is that the first node does not meet the first jump condition, the first node is determined as the second node corresponding to the i-th round of dialogue.
8. The method according to any one of claims 3-7, characterized in that, After generating the customer service dialogue statement for the i-th round of dialogue based on the second node, the method further includes: Verify whether the second node is included in a preset node set to obtain a first verification result. The preset node set includes the first node and the successor node of the first node. If the predecessor node of the second node includes a node of the required access type, verify whether the node of the required access type has been selected by the preset question-and-answer model when generating the dialogue customer service statement of the first i rounds of dialogue, and obtain the second verification result; If the first node is a condition judgment type node, check whether the first node meets the jump condition to jump to the second node, and obtain the third verification result; Based on the first verification result, the second verification result, and the third verification result, verify the statement generation effect of the customer service statement in the i-th round of dialogue.
9. The method according to any one of claims 1-7, characterized in that, After generating the target dialogue customer service statement for the user based on the prompt information, the method further includes: In response to a query request for the target dialogue, node selection information, node jump information, and dialogue association information corresponding to the target dialogue are obtained; the node selection information includes the nodes corresponding to each round of dialogue in the target dialogue; the node jump information includes the jump information between nodes corresponding to adjacent dialogue rounds; and the dialogue association information includes the interaction records corresponding to each round of dialogue in the target dialogue. Based on the node selection information, the node jump information, and the dialogue association information, a dialogue flowchart corresponding to the target dialogue is generated to achieve the visual display of the target dialogue.
10. A customer service statement generation device, characterized in that, include: The acquisition module is used to acquire the preset process description text corresponding to the target dialogue scenario, wherein the preset process description text is a textual representation of the preset flowchart; The parsing module is used to parse the preset process description text and add the marker text information corresponding to the elements of the preset flowchart to the preset process description text to obtain the structured description text. The generation module is used to construct prompt information based on the structured description text, and generate a dialogue customer service statement corresponding to the user's target dialogue based on the prompt information according to a preset question-and-answer model.