Mental health conversation response control method, system, and storage medium

CN122366682BActive Publication Date: 2026-08-21SHENZHEN MSU-BIT UNIVERSITY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610842182.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-11
Publication Date
2026-08-21
Estimated Expiration
2046-06-11

AI Technical Summary

Technical Problem

[0004]本申请的主要目的在于提供一种心理健康对话响应控制方法、系统及存储介质,旨在解决如何根据当前会话的复杂度状态确定具体响应方式,从而提高对不同心理健康对话场景的适配能力的技术问题

Benefits of technology

首先,将用户当前输入与历史对话上下文共同构建当前会话状态,不再仅依赖单轮输入而忽略上下文依赖,实现对会话整体语义和情感脉络的完整表征,从而为复杂度评估提供准确的数据基础;进一步地,基于会话状态计算连续复杂度评估值并据此确定目标响应模式,解决只能进行粗粒度分类而无法连续量化复杂度的问题,实现对会话响应需求强度的精细度量;其次,依据复杂度评估值和目标响应模式联合生成会话长度预算,解决因统一长度策略导致低复杂度会话冗余、高复杂度会话不足的问题,实现响应长度与当前会话需求的动态匹配,提高资源利用效率;最后,在所述长度预算和响应模式的双重约束下生成对话响应,平衡响应充分性与系统开销,从而整体上解决根据当前会话的复杂度状态确定具体响应方式,提高对不同心理健康对话场景的适配能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122366682B_ABST
    Figure CN122366682B_ABST
Patent Text Reader

Abstract

The application discloses a mental health dialogue response control method and system and a storage medium, relates to the technical field of digital mental health services, and comprises the following steps: constructing a current session state based on pre-acquired user current input content and historical dialogue context associated with the user current input content; calculating a session complexity evaluation value according to the current session state to determine a target response mode; generating a session length budget based on the session complexity evaluation value and the target response mode; and generating dialogue response content under the constraints of the session length budget and the target response mode. By calculating the session complexity evaluation value, determining the target response mode and generating the session length budget, and determining the specific response mode according to the complexity state of the current session, the adaptation capability to different mental health dialogue scenarios is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of digital mental health service technology, and in particular to mental health dialogue response control methods, systems and storage media. Background Technology

[0002] In mental health dialogue assistance scenarios, the complexity of user input varies significantly. Some inputs are semantically clear and have low contextual dependence, making concise responses suitable. Other inputs contain multi-turn associations, are rich in emotional expression, and require deep guidance, demanding that the system provide more comprehensive and stable response content. However, existing dialogue systems generally adopt fixed generation strategies (such as uniform response length and uniform inference depth) or coarse-grained classification methods based on preset rules. They cannot continuously model complexity according to the current conversation state, and therefore cannot adaptively match response patterns that are appropriate for complexity. This results in low-complexity conversations being assigned excessively long responses, increasing computational redundancy, while high-complexity conversations suffer from insufficient responses, affecting the interaction effect.

[0003] Therefore, how to determine the specific response method based on the complexity of the current conversation, thereby improving the adaptability to different mental health dialogue scenarios, has become a technical problem that this application urgently needs to solve. Summary of the Invention

[0004] The main purpose of this application is to provide a method, system and storage medium for controlling responses to mental health dialogues, aiming to solve the technical problem of how to determine the specific response method according to the complexity of the current conversation, thereby improving the adaptability to different mental health dialogue scenarios.

[0005] To achieve the above objectives, this application proposes a method for controlling responses to mental health dialogues, the method comprising: The current session state is constructed based on the pre-acquired current user input and the historical dialogue context associated with the current user input. Calculate the session complexity evaluation value based on the current session state to determine the target response pattern; A session length budget is generated based on the session complexity evaluation value and the target response pattern; The dialogue response content is generated under the constraints of the session length budget and the target response pattern.

[0006] In one embodiment, the step of calculating a session complexity evaluation value based on the current session state to determine the target response pattern includes: Extract feature vectors from the current session state and assign corresponding weight vectors to the feature vectors; A complexity evaluation function for feature mapping is constructed based on the feature vector, the weight vector, and the preset bias parameters. The session complexity evaluation value is calculated based on the aforementioned complexity evaluation function; The target response pattern is determined based on the session complexity assessment value and the current session state.

[0007] In one embodiment, the step of determining the target response pattern based on the session complexity evaluation value and the current session state includes: Calculate the pattern score for each candidate pattern in the preset candidate pattern set based on the session complexity evaluation value and the current session state; The candidate mode with the highest mode score is selected as the target response mode.

[0008] In one embodiment, the step of generating a session length budget based on the session complexity evaluation value and the target response pattern includes: Determine the mode parameters corresponding to the target response mode; The session length budget is generated linearly based on the mode parameters and the session complexity evaluation value.

[0009] In one embodiment, the step of generating dialogue response content under the constraints of the session length budget and the target response pattern includes: Under the condition that the target response mode is a brief support mode, a brief support mode generation strategy is adopted; Under the condition that the target response mode is deep support mode, a deep support mode generation strategy is adopted; Based on the short support pattern generation strategy or the deep support pattern generation strategy, the initial response content is generated in combination with the session length budget and the current session state. Calculate the quality score of the initial response content; The dialogue response content is generated based on the quality score.

[0010] In one embodiment, the step of calculating the quality score of the initial response content includes: Calculate the stability score, context consistency score, and constraint satisfaction score of the initial response content, respectively. Assign corresponding weight parameters to the stability score, the context consistency score, and the constraint satisfaction score; The quality score of the initial response content is calculated based on the weight parameters, the stability score, the context consistency score, and the constraint satisfaction score.

[0011] In one embodiment, the step of generating the dialogue response content based on the quality score includes: Determine whether the quality score is less than a preset first threshold; If the quality score is less than the first threshold, the target response mode is switched to deep support mode; Recalculate the session length budget based on the deep support mode, and return to the execution step based on the recalculated session length budget: generate initial response content based on the short support mode generation strategy or the deep support mode generation strategy, combined with the session length budget and the current session state; If the quality score is not less than the first threshold, the initial response content will be output as the dialogue response content.

[0012] In one embodiment, the step of generating the dialogue response content under the constraints of the session length budget and the target response pattern further includes: Record and generate the actual response length and quality score corresponding to the dialogue response content to obtain historical dialogue records; The complexity evaluation function and the mode parameters corresponding to the target response mode are modified based on the historical dialogue records.

[0013] In addition, to achieve the above objectives, this application also proposes a mental health dialogue response control system, the system comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the mental health dialogue response control method as described above.

[0014] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the mental health dialogue response control method described above.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: First, the current conversation state is constructed by combining the user's current input with the historical dialogue context, moving beyond reliance on single-turn input and ignoring contextual dependencies. This achieves a complete representation of the overall semantics and emotional context of the conversation, providing an accurate data foundation for complexity assessment. Furthermore, a continuous complexity assessment value is calculated based on the conversation state, and the target response pattern is determined accordingly. This addresses the problem of only being able to perform coarse-grained classification without continuously quantifying complexity, enabling a fine-grained measurement of the intensity of conversation response demands. Second, a conversation length budget is jointly generated based on the complexity assessment value and the target response pattern. This solves the problem of redundancy in low-complexity conversations and insufficient complexity in high-complexity conversations due to a uniform length strategy, achieving dynamic matching of response length with current conversation demands and improving resource utilization efficiency. Finally, a dialogue response is generated under the dual constraints of the length budget and the response pattern, balancing response sufficiency with system overhead. This comprehensively addresses the issue of determining the specific response method based on the complexity state of the current conversation, improving adaptability to different mental health dialogue scenarios. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating the first embodiment of the mental health dialogue response control method of this application; Figure 2 A flowchart illustrating the second embodiment of the mental health dialogue response control method of this application; Figure 3 This is a flowchart illustrating the fifth embodiment of the mental health dialogue response control method of this application. Figure 4 A flowchart illustrating a psychological health dialogue response control method provided in this application; Figure 5 This is a schematic diagram of the module structure of the mental health dialogue response control device according to an embodiment of this application; Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the mental health dialogue response control method in the embodiments of this application.

[0019] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0021] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0022] The main solution of this application embodiment is: to construct the current session state based on the user's current input content obtained in advance and the historical dialogue context associated with the user's current input content; to calculate the session complexity evaluation value according to the current session state to determine the target response mode; to generate a session length budget based on the session complexity evaluation value and the target response mode; and to generate dialogue response content under the constraints of the session length budget and the target response mode.

[0023] In this embodiment, for ease of description, the psychological health dialogue response control system will be used as the execution subject in the following description.

[0024] This application's embodiments take into account that: in mental health dialogue assistance scenarios, the complexity of user input varies significantly. Some inputs are semantically clear and have low contextual dependence, making them suitable for concise responses, while other inputs contain multi-turn associations, dense emotional expressions, and require deep guidance, demanding that the system provide more comprehensive and stable response content. However, existing dialogue systems generally adopt fixed generation strategies (such as uniform response length and uniform inference depth) or coarse-grained classification methods based on preset rules, which cannot continuously model complexity according to the current conversation state. Consequently, they cannot adaptively match response patterns that are appropriate for complexity, resulting in low-complexity conversations being assigned excessively long responses, increasing computational redundancy, while high-complexity conversations suffer from insufficient responses, affecting the interaction effect.

[0025] Therefore, this application provides a solution. First, it constructs the current conversation state by combining the user's current input with the historical dialogue context, no longer relying solely on single-turn input while ignoring contextual dependencies. This achieves a complete representation of the overall semantics and emotional context of the conversation, thus providing an accurate data foundation for complexity assessment. Furthermore, it calculates continuous complexity assessment values ​​based on the conversation state and determines the target response pattern accordingly, solving the problem of only being able to perform coarse-grained classification and not continuously quantifying complexity, thus achieving a fine-grained measurement of the intensity of conversation response needs. Second, it jointly generates a conversation length budget based on the complexity assessment value and the target response pattern, solving the problem of redundancy in low-complexity conversations and insufficient complexity in high-complexity conversations due to a uniform length strategy. This achieves dynamic matching of response length with current conversation needs, improving resource utilization efficiency. Finally, it generates dialogue responses under the dual constraints of the length budget and response pattern, balancing response sufficiency and system overhead. This comprehensively solves the problem of determining specific response methods based on the complexity state of the current conversation, improving adaptability to different mental health dialogue scenarios.

[0026] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or a mental health dialogue response control system capable of performing the above functions. The following description uses a mental health dialogue response control system as an example to illustrate this embodiment and the subsequent embodiments.

[0027] Based on this, embodiments of this application provide a method for controlling responses to mental health dialogues, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the mental health dialogue response control method of this application.

[0028] In this embodiment, the mental health dialogue response control method includes steps S10 to S40: Step S10: Construct the current session state based on the pre-acquired current user input content and the historical dialogue context associated with the current user input content; It should be noted that the user's current input refers to the latest statement or message issued by the user in the current dialogue round; the historical dialogue context refers to the user input and system output content in the previous several rounds, including the interaction records between the two parties.

[0029] The current session state is a data representation formed by structurally combining the current input with the historical context, used for subsequent calculations, and fully reflects the overall semantic and emotional continuity of the dialogue up to the current round.

[0030] Understandably, mental health dialogues are highly context-dependent; current input alone cannot accurately determine a user's true intentions, emotional changes, and depth of needs. Without incorporating historical context, the system will lack clues from multiple rounds of interaction, leading to inaccurate complexity assessments. Therefore, it is necessary to jointly construct the session state from the current input and historical context to provide a global and continuous basis for subsequent adaptive response control.

[0031] Specifically, the system receives the user input text from round t and extracts the user input and system output from previous rounds from the memory unit or dialogue cache, concatenating or encoding them into a sequence in chronological order. The current input is combined with the historical context into a structured state object, which may contain round markers, role identifiers (user / system), and the original text content. This state object is standardized to a format that can be processed by subsequent feature extraction modules, such as a string sequence or a data structure containing multiple fields.

[0032] In one specific implementation, the system obtains the user's information at the first... Wheel input content and obtain the input content Related historical dialogue context Based on input content Context of dialogue with history Build the current session state :

[0033] Among them, the historical dialogue context Represented as , Indicates the user's position in the first month. The content entered in the wheel, Indicates the system at the 1st The content of the round of answers.

[0034] Step S20: Calculate the session complexity evaluation value based on the current session state to determine the target response pattern; It should be noted that the session complexity evaluation value is a value normalized to the range [0,1], used to quantify the intensity of the current session's need for a full and in-depth response. The higher the value, the more sufficient and in-depth the response is required.

[0035] The target response mode refers to the type of response strategy selected by the system based on complexity, including the short support mode (concise and focused output) and the deep support mode (detailed and highly guiding output).

[0036] Specifically, the system extracts a set of predefined features (such as input length, sentiment density, and context dependency strength) from the current session state, constructing a feature vector from these features. Using a pre-trained linear mapping function (containing weight vectors and biases), a weighted sum of the feature vectors is calculated, and then normalized using the sigmoid function to obtain a complexity evaluation value. Subsequently, the complexity evaluation value and the current session state are input into a pattern scoring function to calculate scores for short support patterns and deep support patterns, respectively. The pattern with the higher score is selected as the target response pattern for output.

[0037] Step S30: Generate a session length budget based on the session complexity evaluation value and the target response pattern; It should be noted that the session length budget refers to the maximum length of the response content that the system allows to be generated in this session (which can be measured by the number of tokens, characters, or words). The session complexity assessment value provides a quantitative indicator of the intensity of demand, and the target response pattern indicates whether a short or deep strategy should be adopted. The three factors together determine the reasonable upper limit of resources that should be allocated to this response.

[0038] Specifically, the system presets a pair of linear parameters for each target response mode. Based on the determined target response mode, the corresponding linear parameters are selected, and the session length budget is calculated using a linear formula. Under the same mode, the higher the complexity evaluation value, the larger the length budget; at the same complexity value, the budget value in the deep support mode is higher than the budget value in the short support mode.

[0039] Step S40: Generate dialogue response content under the constraints of the session length budget and the target response pattern.

[0040] The dialogue response content is the natural language reply that the system ultimately outputs to the user. The session length budget and the target response pattern work together in the generation process to ensure that the output conforms to both the length resource allocation and the content richness required by the pattern.

[0041] Specifically, the system uses the current session state (current input + historical context) as input to the generative model and sets the generation stopping condition to reaching the length budget limit. Based on the target response pattern, sampling parameters are adjusted or pattern-specific cue prefixes are introduced during the decoding phase to encourage the generation of semantic content that conforms to the pattern requirements. The final output is a response text that does not exceed the length budget and whose style matches the pattern. If the budget boundary is reached during generation, soft truncation or natural termination is performed.

[0042] This embodiment provides a method for controlling responses in mental health dialogues. First, the current conversation state is constructed by combining the user's current input with the historical dialogue context, moving beyond reliance on single-turn input and ignoring contextual dependencies. This achieves a complete representation of the overall semantics and emotional context of the conversation, providing an accurate data foundation for complexity assessment. Further, a continuous complexity assessment value is calculated based on the conversation state, and the target response pattern is determined accordingly. This addresses the problem of only being able to perform coarse-grained classification without continuously quantifying complexity, enabling a fine-grained measurement of the intensity of conversation response demands. Second, a conversation length budget is jointly generated based on the complexity assessment value and the target response pattern. This solves the problem of redundancy in low-complexity conversations and insufficient complexity in high-complexity conversations due to a uniform length strategy, achieving dynamic matching of response length with current conversation demands and improving resource utilization efficiency. Finally, a dialogue response is generated under the dual constraints of the length budget and the response pattern, balancing response sufficiency and system overhead. This comprehensively solves the problem of determining the specific response method based on the complexity state of the current conversation, improving adaptability to different mental health dialogue scenarios.

[0043] Based on the first embodiment of this application, a second embodiment of this application is proposed. In the second embodiment of this application, content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter.

[0044] Based on this, please refer to Figure 2 , Figure 2 This is a flowchart illustrating the second embodiment of this application, as shown below. Figure 2 As shown, step S20, which calculates the session complexity evaluation value based on the current session state to determine the target response pattern, may include steps S21 to S24: Step S21: Extract feature vectors from the current session state and assign corresponding weight vectors to the feature vectors; It should be noted that the feature vector is an ordered set of quantifiable numerical features extracted from the current session state. Each feature reflects the attributes of the session in a certain dimension, such as the current input length, the degree of multiple intent expression, the density of emotion expression, the strength of context dependence, and the effectiveness of historical short responses.

[0045] The weight vector is a parameter vector with the same dimension as the feature vector. Each component corresponds to the weight coefficient of a feature, which is used to represent the importance of that feature in the complexity evaluation.

[0046] For example, in one possible implementation, the system first parses the current session state. Five feature vectors are extracted from it: current input length feature, multi-intent expression feature, sentiment expression density feature, context dependency strength feature, and historical short response effectiveness feature. Specifically: Through calculation The current input length feature is extracted by counting the number of characters or tokens and normalizing the result; detection is performed using keyword matching or a lightweight classifier. The text is analyzed by determining whether it contains multiple questions or requests, outputting a score between 0 and 1 to obtain multi-intent expression features; statistical analysis is then performed using an emotion dictionary. The proportion of emotion words in the data yields the emotion expression density feature; by comparing... and The frequency of occurrence of linguistic phenomena such as pronouns, reference, and ellipsis, or calculation Compared with the previous system output The semantic overlap is used to obtain the context dependency strength feature; whether users continue to ask follow-up questions or express dissatisfaction after the system outputs a short response in history is statistically analyzed to obtain an effectiveness decay index, which is used as the effectiveness feature of historical short responses. The above feature values ​​are combined to obtain the feature vector. , is the feature vector Each feature vector in the dataset is assigned a corresponding weight. .

[0047] Step S22: Construct a complexity evaluation function for feature mapping based on the feature vector, the weight vector, and the preset bias parameters; Step S23: Calculate the session complexity evaluation value based on the complexity evaluation function; A complexity evaluation function based on feature mapping is constructed using the following formula, and the session complexity evaluation value is calculated:

[0048] in, represents the normalization function; b represents the preset bias parameter, which is an adjustable constant term in the function used to adjust the reference offset of the mapping result; For feature vectors, The weights corresponding to the feature vectors, This is the session complexity evaluation value.

[0049] It should be noted that, The larger the value, the more the current session is likely to require a more comprehensive response. The smaller the value, the more suitable a simple response method is for the current session.

[0050] Step S24: Determine the target response mode based on the session complexity evaluation value and the current session state.

[0051] Specifically, the system inputs the complexity evaluation value and the current session state into the pattern scoring function to calculate the scores for the short support pattern and the deep support pattern, and selects the pattern with the higher score as the target response pattern for output.

[0052] In this embodiment, the system achieves continuous complexity quantification modeling of mental health dialogue sessions by calculating a session complexity assessment value, replacing traditional coarse-grained classification. This approach can precisely reflect the intensity of the session's need for adequacy in response. Simultaneously, based on the complexity assessment value and the current session state, a mode score is calculated, and the optimal response mode is automatically selected, enabling adaptive switching between brief support and deep support modes. Therefore, low-complexity sessions avoid redundant responses, while high-complexity sessions receive sufficient support, significantly improving the system's adaptability to diverse dialogue scenarios and resource utilization efficiency.

[0053] Furthermore, in one feasible implementation, step S24 may include steps S241-S242: Step S241: Calculate the pattern score for each candidate pattern in the preset candidate pattern set based on the session complexity evaluation value and the current session state; Step S242: Select the candidate mode with the highest mode score as the target response mode.

[0054] Preset candidate pattern set It contains two elements: a short support mode. and deep support mode The pattern score is a numerical value calculated for each candidate pattern, used to measure how suitable the pattern is to be used in the current session state. A higher score indicates that the pattern is more suitable for the current round. The session complexity evaluation value and the current session state serve as the two input sources for the scoring function.

[0055] Specifically, the system reads the complexity evaluation value. and current session state For the candidate pattern set Each candidate pattern is scored separately, and the candidate pattern with the highest score is selected as the target response pattern. The calculation formula is as follows:

[0056] in, Indicate candidate pattern In the t Pattern scoring in round-robin sessions is used by the system to evaluate the complexity of the current session. Current session state Based on the suitability of the candidate modes themselves, the most suitable response mode for the current round is selected as the target response mode. .

[0057] Based on the above embodiments of this application, a third embodiment of this application is proposed. In this third embodiment, content that is the same as or similar to that in the above embodiments can be referred to the above description, and will not be repeated hereafter.

[0058] In this embodiment, step S30, which generates a session length budget based on the session complexity evaluation value and the target response pattern, may include steps S31-S32: Step S31: Determine the mode parameters corresponding to the target response mode; Step S32: Linearly generate the session length budget based on the mode parameters and the session complexity evaluation value.

[0059] Determining the target response mode Then, the system evaluates the session complexity value. and target response mode Generate the output length budget for the current session. , Linear generation based on the target response pattern and session complexity evaluation value:

[0060] in, and To provide mode parameters corresponding to the target response mode, two sets of mode parameters are pre-stored in the system's configuration memory: for the brief support mode, the corresponding mode parameter pair and For deep support mode, the corresponding parameter pairs and If the target response mode is a brief support mode, then = , = .

[0061] It should be noted that, ,therefore, The value may not be an integer; the system will assign it based on the length measurement unit (e.g., the number of tokens). Rounding or up is performed to obtain the final integer value of the session length budget. The system can also set absolute upper and lower limits (e.g., the minimum length must not be less than 10, and the maximum length must not exceed 512) to prune the calculation results.

[0062] It should also be noted that, and For target response mode The corresponding length budget function parameters. Used to characterize the session complexity evaluation value Output length budget The intensity of the impact, Used to characterize the target response pattern The base output length budget is determined by the complexity. Therefore, under the same mode, the higher the complexity, the larger the output length allowed by the system; under the same complexity, the output length budget corresponding to the deep support mode is higher than that of the short support mode.

[0063] Furthermore, during the initial operation or cold start phase of the system, the system pre-sets a corresponding minimum output length budget for each target response mode. and maximum output length budget And the session complexity evaluation value Normalized to [0,1]. Wherein, Representation pattern m Budget for the minimum allowed output length. Representation pattern m Budget for the maximum allowed output length.

[0064] Specifically, the pattern m Corresponding initial mode parameters and Determine as follows:

[0065]

[0066] Therefore, the initial session length budget can be expressed as:

[0067] when hour, ;when hour, Therefore, the system is able to map the normalized complexity evaluation value to the length budget interval corresponding to the target response pattern.

[0068] In this embodiment, the length budget is linearly generated based on the mode parameters corresponding to the target response mode and the session complexity evaluation value. Under the same mode, the higher the complexity, the larger the budget; at the same complexity, the budget for the deep mode is higher than that for the short mode. Thus, low-complexity sessions avoid redundant length overhead, while high-complexity sessions receive sufficient resource support, significantly improving system resource utilization efficiency and adaptability.

[0069] Based on the above embodiments of this application, a fourth embodiment of this application is proposed. In this fourth embodiment, content that is the same as or similar to that in the above embodiments can be referred to the above description, and will not be repeated hereafter.

[0070] In this embodiment, step S40, which generates the dialogue response content under the constraints of the session length budget and the target response pattern, may include steps S41 to S45: Step S41: Under the condition that the target response mode is a brief support mode, a brief support mode generation strategy is adopted. The concise support mode generation strategy refers to a set of generation parameters and behavioral rules adopted by the system when the target response mode is concise support mode. It aims to produce concise, focused, and direct response content that addresses the core issue of the current input, avoiding further explanation, guidance, or additional background information.

[0071] Specifically, the system makes a judgment based on the target response pattern; if If this is not the case, the short support pattern generation strategy will be activated. In practice, a lower sampling temperature (e.g., 0.3~0.5) can be set in the decoding parameters of the generated model to reduce randomness, and a system prompt prefix can be added, such as "Please answer the user's question briefly in one sentence, without adding explanations or suggestions." At the same time, the use of guiding phrases (such as "You can try...") or emotional extensions should be prohibited during generation. The strategy configuration is loaded from the pattern configuration file.

[0072] Step S42: Under the condition that the target response mode is deep support mode, a deep support mode generation strategy is adopted. The deep support mode generation strategy refers to a set of generation parameters and behavioral rules adopted by the system when the target response mode is deep support mode. It aims to generate response content that is well explained, emotionally resonant, and fully guided, including background information, empathetic expressions, step-by-step suggestions, or open-ended questions.

[0073] Specifically, the system makes a judgment based on the target response pattern; if The system activates a deep support pattern generation strategy. Specific implementations include: setting a higher sampling temperature (e.g., 0.7~0.9) to increase the diversity of expressions; adding detailed system prompts to the input of the generated model, such as "Please fully understand the user's emotions, empathize first before analyzing, provide step-by-step suggestions, and maintain a warm and professional tone"; enabling a longer context window to allow the model to reference earlier historical information; and enabling thought chains or multiple sampling for optimization when necessary. Strategy parameters are also stored in the pattern configuration.

[0074] Step S43: Based on the short support pattern generation strategy or the deep support pattern generation strategy, and in combination with the session length budget and the current session state, generate the initial response content; The system formats the current session state into the input sequence for the generative model, and sets the decoding parameters (temperature, etc.) according to the selected generation strategy. top_p(This includes penalties for duplicate tokens, etc.). In the generation loop, the length is incremented after each token is generated. When the accumulated length reaches or exceeds the length budget, generation is forcibly stopped and truncation is performed (e.g., deleting the last incomplete sentence). The final result is a response text that does not exceed the budget, marked as the initial response content.

[0075] Step S44: Calculate the quality score of the initial response content; The quality score is a comprehensive numerical value used to quantify the performance of the initial response content across three dimensions: stability, contextual consistency, and constraint satisfaction. A higher score indicates a better response quality and a greater likelihood of it being output directly.

[0076] Specifically, the system calls the quality assessment module, inputs the initial response content, current session state, target response mode, and session length budget. Based on the input, the system calculates the stability score, context consistency score, and constraint satisfaction score in sequence, and then sums them up by weight to obtain the final quality score.

[0077] Step S45: Generate the dialogue response content based on the quality score.

[0078] The dialogue response content refers to the response text that the system finally outputs to the user. It can be the initial response that has passed the quality assessment, or the response that is regenerated after a retry is triggered.

[0079] Specifically, the system obtains a quality score and compares it with a preset first threshold. If the score is greater than or equal to the first threshold, the initial response is output to the user interface as the final dialogue response, and a success log for that round is recorded. If the score is less than the first threshold, a retry process is initiated: the target response mode is forcibly switched to deep support mode, a length budget is generated based on the new mode, the initial response is regenerated, and finally, a quality assessment is performed again until the quality score is not less than the first threshold. The qualified response obtained after the retry is used as the final output. If the number of retries is exhausted and the response is still unqualified, a safe fallback response (such as "Let me think about it and get back to you later") is output.

[0080] In this embodiment, by distinguishing between concise and in-depth generation strategies, and combining quality scoring (stability, consistency, and constraint satisfaction) with threshold judgment, closed-loop control of response quality is achieved. When the quality is unsatisfactory, the system automatically switches to in-depth support mode and regenerates the length budget and response, ensuring that the final output meets the safety, coherence, and adequacy requirements of mental health dialogue, significantly improving the system's output reliability.

[0081] Furthermore, in one feasible implementation, step S44 may include steps S441 to S443: Step S441: Calculate the stability score, context consistency score, and constraint satisfaction score of the initial response content, respectively. The stability score measures whether the response content is semantically consistent, free from repetition or contradiction, and free from degradation (such as repeated use of the same phrases); the contextual consistency score measures the logical and semantic coherence between the response and the historical dialogue context (including previous user input and previous system output); and the constraint satisfaction score measures whether the response meets the content style requirements of the current target response pattern and whether it is within the length budget.

[0082] In one feasible implementation, the stability score is calculated by assessing the n-gram repetition rate (e.g., the proportion of consecutively repeated triples), the number of perplexity abrupt changes, and self-contradiction detection (using a lightweight natural language inference model to determine whether sentences contradict each other). Each anomaly indicator is converted into a deduction between 0 and 1, starting with 1 and decreasing by 0.1 for each detected anomaly, with a minimum of 0.

[0083] Context consistency scoring calculates the relationship between the initial response content and the historical context. The system calculates semantic similarity and detects the correctness of referential resolution (e.g., whether "he" refers to a specific historical figure). The output is a weighted average of the similarity score and the referential accuracy.

[0084] The constraint satisfaction score is determined by checking whether the actual length of the response does not exceed the session length budget; and whether the response contains pattern-specific keywords: short patterns should not contain lengthy structures such as "firstly" or "secondly," while deep patterns should contain at least one empathetic expression or suggestive sentence. A score between 0 and 1 is given.

[0085] Step S442: Assign corresponding weight parameters to the stability score, the context consistency score, and the constraint satisfaction score; The system reads preset weight parameters from the configuration file and assigns corresponding weight parameters to the stability score, the context consistency score, and the constraint satisfaction score. It should be noted that the weight parameters can be statically configured or dynamically adjusted based on session history.

[0086] Step S443: Calculate the quality score of the initial response content based on the weight parameters, the stability score, the context consistency score, and the constraint satisfaction score.

[0087] The system performs a weighted summation operation to calculate the quality score of the initial response content based on the weight parameters, the stability score, the context consistency score, and the constraint satisfaction score.

[0088] In this implementation, three scores—stability, contextual consistency, and constraint satisfaction—are calculated separately and weighted by adjustable weights. This avoids the limitations of a single indicator and comprehensively reflects the response's performance in terms of semantic consistency, dialogue coherence, and pattern constraints, providing a reliable and quantifiable quality control basis for subsequent threshold judgment and pattern switching.

[0089] Furthermore, in one feasible implementation, step S45, which generates the dialogue response content based on the quality score, may include steps S451-S454: Step S451: Determine whether the quality score is less than a preset first threshold. The preset first threshold is an empirical value (e.g., 0.6 or 0.7) used to distinguish between "qualified" and "unqualified" responses; a value less than this threshold indicates insufficient quality and requires a retry; otherwise, it is considered qualified.

[0090] The system reads a pre-stored first threshold, compares the quality score with the first threshold, and if the quality score is less than the first threshold, it is determined that the quality is unqualified; otherwise, it is determined that the quality is qualified.

[0091] Step S452: If the quality score is less than the first threshold, then the target response mode is switched to deep support mode. Switching to deep support mode means that the system abandons the currently selected response mode (which may be the short mode or the original deep mode) and forces the target response mode to be set to deep support mode in order to obtain a more complete and stable response generation capability.

[0092] If the quality score is less than the first threshold, the system execution mode switch is initiated: the target response mode is changed. Updated to The reason for the switch is recorded (e.g., "Insufficient quality, automatically upgrade to deep mode"). Understandably, even if the original mode is already deep mode, the switch operation will still maintain deep mode (i.e., deep mode will still be used during retries, but a new length budget will be generated, potentially resulting in a larger budget). The switched mode value overwrites the original storage.

[0093] Step S453: Recalculate the session length budget according to the deep support mode, and return to the execution step based on the recalculated session length budget: Generate initial response content based on the short support mode generation strategy or the deep support mode generation strategy, combined with the session length budget and the current session state; The system recalculates the session length budget based on the deep support mode. Then, using the new session length budget and the target response mode now switched to deep support mode, it proceeds to the following steps: Based on the short support mode generation strategy or the deep support mode generation strategy, it generates an initial response content by combining the session length budget and the current session state, and performs a quality assessment again after each retry. If the retry still fails and the maximum number of attempts has been reached, a fallback response is output.

[0094] Step S454: If the quality score is not less than the first threshold, then the initial response content is output as the dialogue response content.

[0095] If the quality score is not less than the first threshold, the system terminates the quality assessment loop and uses the current initial response content as the final dialogue response content. Then, the output interface is called to send the response text to the user, and the quality score is marked as satisfactory in this round's record. Simultaneously, the system can record information such as the generated mode, budget, and score for subsequent parameter optimization or offline analysis. After output is complete, this round of adaptive response control flow ends.

[0096] In another feasible implementation, the currently generated initial response content The system calculates its quality score according to the following formula. :

[0097] In this embodiment, the quality score is further expressed as:

[0098] in, This indicates a stability-related score. Indicates the context consistency score. Indicates the constraint satisfaction score. is the weighting parameter. All three scores can be normalized to [0,1], and satisfy .

[0099] In one alternative implementation, the system is in the current session state. Target response mode and session length budget Generate under constraints There are 1 candidate response, denoted as: .

[0100] in, Indicates the first One candidate response, This represents the number of candidate responses. For any given candidate response... The system calculates its overall quality score:

[0101] First, calculate the stability-related score: The stability-related score measures the consistency between a candidate response and other candidate responses within the same session state, and whether there are any obvious conflicts. For candidate responses... Its stability-related score is defined as follows:

[0102] in, These are the weighting parameters in the stability score. ; Indicates candidate response Average semantic similarity between the response and other candidate responses; Indicates candidate response The average degree of conflict with other candidate responses. These are expressed as follows:

[0103]

[0104] in, Indicates candidate response text (The following is for ease of understanding, and is referred to as) )and (The following is for ease of understanding, and is referred to as) The semantic similarity between ) can be determined by the text semantic encoding function E( The calculation yielded:

[0105] Among them, E( ) represents the text semantic encoding function, and cos(·,·) represents the cosine similarity. Con(a,b) represents the text With text b The degree of conflict between candidate responses can be obtained from natural language inference models, semantic conflict detection models, or rule-based discriminant functions, with a value range of [0,1]. The closer a candidate response is to other candidate responses and the lower its degree of conflict, the higher its stability-related score. The higher.

[0106] Specifically, a context consistency score is calculated: the context consistency score measures whether a candidate response is consistent with the current user input and the context of the historical dialogue. For candidate responses... Its context consistency score Defined as:

[0107] in, To calculate the weight parameters for the context consistency score, the following conditions must be met: . This indicates the relevance between the candidate response and the current user input; This indicates the weighted correlation between candidate responses and historical context; This indicates the weighted degree of conflict between the candidate response and its historical context. Specifically:

[0108]

[0109]

[0110] in, Indicates the first t Scroll through the user's current input. Indicates the first in the historical context i The content of the conversation, This represents the correlation calculation function. Indicates the weight of historical context. The following time decay method can be used for calculation:

[0111] in, The time decay coefficient, ≥0. The larger the value, the more the system focuses on recent rounds of dialogue; The smaller the value, the more evenly the historical context weights are distributed. The following normalized semantic similarity can be used for calculation:

[0112] Therefore, the more relevant a candidate response is to the current input, the more consistent it is with the historical context, and the fewer conflicts it has with historical content, the higher its context consistency score will be. The higher.

[0113] Specifically, a constraint satisfaction score is calculated. This score measures whether the candidate response satisfies the current target response pattern, output length budget, and safety boundary constraints in a mental health dialogue assistance scenario. For candidate responses... Its constraint satisfaction score is defined as:

[0114] in, For the weight parameters, satisfying . Indicates the degree of satisfaction with the length budget. Indicates the degree of satisfaction of the response pattern. This indicates the degree of satisfaction with the safety boundary.

[0115] The length budget satisfaction is defined as:

[0116] in, Indicates candidate response The actual length can be calculated based on the number of tokens, the number of characters, or the number of sentences. Indicates the current output length estimate; To prevent extremely small constants with a denominator of zero, when the candidate response length does not exceed the output length budget, When the candidate response length exceeds the output length budget, the larger the excess portion, the better. The smaller.

[0117] Response pattern satisfaction is defined as:

[0118] in, The pattern discrimination function is used to determine candidate responses. Does it conform to the target response pattern? .like For concise support mode, determine whether the candidate response is concise and focuses on the current problem; if In the deep support mode, it is determined whether the candidate response has more sufficient explanation, guidance and support content.

[0119] The safety boundary satisfaction is defined as:

[0120] in, This represents a safety risk detection function, used to output the probability that a candidate response will trigger inappropriate guidance, risky expression, or failure to meet the requirements of mental health dialogue assistance in the current session state. Its value ranges from [0,1]. The lower the risk, the higher the probability. The higher.

[0121] The system calculates the overall quality score for each candidate response and selects the candidate response with the highest quality score as the current candidate output.

[0122] In one optional implementation, the system determines whether the current response meets preset requirements based on a comparison between the overall quality score and a preset threshold. The system presets a quality score threshold. ;when When the system determines that the current response result meets the preset requirements, it directly outputs the response content; when If the system determines that the current response does not meet the preset requirements, it will adjust the current response process. The adjustment method is as follows: the target response mode is switched to deep support mode, and the response content is regenerated. During regeneration, the system recalculates the output length budget based on the deep support mode and outputs a new response result under the new mode and budget constraints.

[0123] Furthermore, in a preferred embodiment, the preset requirements include not only the overall quality score threshold requirement but also the key sub-score threshold requirement. The system can further set a context consistency threshold. and constraint satisfaction threshold The system determines that the current response meets the preset requirements when the following conditions are met simultaneously:

[0124]

[0125]

[0126] If any of the above conditions are not met, the system determines that the current response result does not meet the preset requirements. This approach avoids masking problems of insufficient contextual consistency or inadequate constraint satisfaction simply because of a high overall quality score.

[0127] When it is necessary to switch to deep support mode and regenerate, the system command is:

[0128] And recalculate the output length budget based on the deep support mode:

[0129] Subsequently, the system adopted a new target response mode. and new output length budget The response content is regenerated under the constraints.

[0130] Based on the above embodiments of this application, a fifth embodiment of this application is proposed. In this fifth embodiment, content that is the same as or similar to that in the above embodiments can be referred to the above description, and will not be repeated hereafter.

[0131] Based on this, please refer to Figure 3 , Figure 3 This is a schematic flowchart of the fifth embodiment of this application, as shown below. Figure 3 As shown, after step S40, which generates the dialogue response content under the constraints of the session length budget and the target response pattern, steps S50-S60 are further included: Step S50: Record the actual response length and quality score corresponding to the generated dialogue response content to obtain historical dialogue records; Specifically, after generating the current round of dialogue response content, the system collects the following fields to obtain historical dialogue records: session identifier (or timestamp), complexity assessment value, target response pattern, output length budget, actual response length, quality score, and whether a retry was triggered. These fields are then assembled into a record and appended to a database, log file, or circular buffer.

[0132] Step S60: Based on the historical dialogue records, modify the complexity evaluation function and the mode parameters corresponding to the target response mode.

[0133] In one feasible implementation, the system adjusts parameters according to a preset period or online in each round. Records that meet the quality standards are selected, and their actual complexity labels (which can be inferred from the actual response length and pattern) are used as monitoring signals. Gradient descent or linear regression is then used to update the complexity evaluation function.

[0134] In one feasible implementation, let the historical set recorded by the system in the first T rounds be:

[0135] in, Indicates the first Round-robin session complexity evaluation value, Indicates the first Target response mode, Indicates the first The output length budget allocated by the round-robin session system Indicates the first Actual response length of the wheel, Indicates the first Round response quality scoring. System filtering belongs to the mode. And a history of meeting quality standards:

[0136] This is the first threshold.

[0137] Specifically, regarding the target response mode The system uses the actual length of the quality-compliant response as a reference target, and applies the mode parameters corresponding to the target response mode. and After correction, the system solves for the following optimization objective:

[0138] in, For pattern The length allowance is used to avoid overly tight output length budget; Let be the weight of the i-th historical record; This is the regularization coefficient, used to prevent the updated parameters from deviating too much from the initial parameters; and Let m be the initial parameters corresponding to pattern m. The historical record weights can be expressed as:

[0139] in, This is the time decay coefficient. Therefore, the higher the quality score, the greater the impact of more recent historical records on parameter correction.

[0140] In another alternative implementation, the system can also correct the parameters through online updates. For the record of round t, if... Then construct the target length:

[0141] And calculate the budget error accordingly:

[0142] Furthermore, update the parameters corresponding to the current target response mode as follows:

[0143]

[0144] in, For learning rate, The update weight for the current record can be represented as: ; For indicator functions, satisfying The value is 1 if the condition is met, and 0 otherwise. Therefore, only historical records that meet the quality standards are included in the length budget parameter correction.

[0145] To avoid parameter anomalies after updates, the system can project parameters to a set of feasible parameters. The feasible parameter set is defined as follows:

[0146] And execute after each update:

[0147] in, This indicates projecting the parameters onto the set of feasible parameters. Through the above constraints, when At that time, output length budget Located within a reasonable length range of pattern m, when Output length budget Also in the mode m Within a reasonable length range.

[0148] In this embodiment, historical dialogue records are generated by recording actual response lengths and quality scores. The complexity evaluation function and mode parameters are then corrected using a time-decay weighted method based on quality-compliant samples, achieving closed-loop self-optimization of the adaptive response control system. The system can continuously improve the accuracy of complexity evaluation, the rationality of length budgets, and the adaptability of mode switching, thereby maintaining efficient and stable response control performance under different session distributions.

[0149] For example, to help understand the implementation flow of the mental health dialogue response control method described in the above embodiments, please refer to... Figure 4 , Figure 4 A simplified flowchart of a method for controlling responses to mental health dialogues is provided, specifically: First, the session state building module obtains the user's current input. Context of dialogue with history Build the current session state : This provides a globally continuous dialogue representation for subsequent complexity assessment.

[0150] Furthermore, the complexity evaluation module is based on the current session state. Calculate the session complexity evaluation value Specifically, it adopts a feature mapping method: starting from the current session state Features such as current input length, multi-intent expression, sentiment expression density, context dependency strength, and historical short response effectiveness are extracted to form a feature vector. After weighted summation and sigmoid normalization, the output is used to characterize the strength of the current session's demand for the degree of response expansion.

[0151] Furthermore, the mode selection module selects the mode based on the complexity evaluation value. and current session state For each pattern in the candidate pattern set (short support pattern, deep support pattern), a pattern score is calculated, and the pattern with the highest score is selected as the target response pattern. This enables adaptive switching of response modes.

[0152] The output length budget generation module selects the corresponding mode parameters based on the determined target response mode, and generates the output length budget for the current session according to a linear formula, in conjunction with the complexity evaluation value. This ensures that, under the same mode, higher complexity requires a larger budget, and for the same complexity, the deep mode has a higher budget than the short mode.

[0153] The response generation module invokes the generation model under the dual constraints of the current session state, the target response mode, and the output length budget. If the short support mode is selected, a concise and focused response is generated; if the deep support mode is selected, a fully explained and guided response is generated, while the actual length is controlled to not exceed the budget. Output initial response .

[0154] The quality assessment module generates the initial response. Calculate the overall quality score The quality score is obtained by weighted fusion of stability score, context consistency score and constraint satisfaction score. The stability score measures the consistency and conflict between the response and other candidate responses, the context consistency score measures the coherence of the response with the current input and historical context, and the constraint satisfaction score measures whether the response meets the pattern requirements, length budget and safety boundary.

[0155] Quality rating With preset threshold When comparing, When the system determines that the current response result meets the preset requirements, it directly outputs the response content; when If the system determines that the current response does not meet the preset requirements, it will adjust the current response process. The adjustment method is as follows: the target response mode is switched to deep support mode, and the response content is regenerated. During regeneration, the system recalculates the output length budget based on the deep support mode and outputs a new response result under the new mode and budget constraints.

[0156] Finally, the system outputs the dialogue response that meets the requirements and records information such as the complexity assessment value, target response mode, output length budget, and quality score in this round of the conversation. This information is used for subsequent parameter correction and strategy optimization to form a closed-loop adaptive system.

[0157] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the mental health dialogue response control method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0158] This application also provides a mental health dialogue response control device, please refer to... Figure 5 The mental health dialogue response control device includes: The session state construction module 10 is used to construct the current session state based on the pre-acquired current user input content and the historical dialogue context associated with the current user input content; Complexity assessment module 20 is used to calculate a session complexity assessment value based on the current session state in order to determine the target response mode; Session length budget module 30 is used to generate a session length budget based on the session complexity evaluation value and the target response pattern; The response content generation module 40 is used to generate dialogue response content under the constraints of the session length budget and the target response pattern.

[0159] The mental health dialogue response control device provided in this application, employing the mental health dialogue response control method in the above embodiments, can solve the technical problems of mental health dialogue response control. Compared with the prior art, the beneficial effects of the mental health dialogue response control device provided in this application are the same as those of the mental health dialogue response control method provided in the above embodiments, and other technical features in the mental health dialogue response control device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0160] This application provides a mental health dialogue response control device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the mental health dialogue response control method in the above embodiment 1.

[0161] The following is for reference. Figure 6 The diagram illustrates a structural schematic of a mental health dialogue response control device suitable for implementing embodiments of this application. The mental health dialogue response control device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The mental health dialogue response control device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0162] like Figure 6As shown, the mental health dialogue response control device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the mental health dialogue response control device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the mental health dialogue response control device to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows a mental health dialogue response control device with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0163] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0164] The mental health dialogue response control device provided in this application, employing the mental health dialogue response control method in the above embodiments, can solve the technical problem of mental health dialogue response control. Compared with the prior art, the beneficial effects of the mental health dialogue response control device provided in this application are the same as the beneficial effects of the mental health dialogue response control method provided in the above embodiments, and other technical features in this mental health dialogue response control device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0165] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0166] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0167] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the mental health dialogue response control method in the above embodiments.

[0168] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0169] The aforementioned computer-readable storage medium may be included in the mental health dialogue response control device; or it may exist independently and not be assembled into the mental health dialogue response control device.

[0170] The aforementioned computer-readable storage medium carries one or more programs that, when executed by a mental health dialogue response control device, cause the mental health dialogue response control device to: construct a current session state based on pre-acquired current user input content and historical dialogue context associated with the current user input content; calculate a session complexity evaluation value based on the current session state to determine a target response pattern; generate a session length budget based on the session complexity evaluation value and the target response pattern; and generate dialogue response content under the constraints of the session length budget and the target response pattern.

[0171] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0172] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0173] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0174] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described mental health dialogue response control method, thereby solving the technical problem of mental health dialogue response control. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the mental health dialogue response control method provided in the above embodiments, and will not be repeated here.

[0175] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described mental health dialogue response control method.

[0176] The computer program product provided in this application can solve the technical problem of psychological health dialogue response control. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the psychological health dialogue response control method provided in the above embodiments, and will not be repeated here.

[0177] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for controlling responses to psychological health dialogues, characterized in that, The aforementioned psychological health dialogue response control method includes: The current session state is constructed based on the pre-acquired current user input and the historical dialogue context associated with the current user input. Calculate the session complexity evaluation value based on the current session state to determine the target response pattern; A session length budget is generated based on the session complexity evaluation value and the target response pattern; The dialogue response content is generated under the constraints of the session length budget and the target response pattern; The step of generating dialogue response content under the constraints of the session length budget and the target response pattern includes: Under the condition that the target response mode is a brief support mode, a brief support mode generation strategy is adopted; Under the condition that the target response mode is deep support mode, a deep support mode generation strategy is adopted; Based on the short support pattern generation strategy or the deep support pattern generation strategy, the initial response content is generated in combination with the session length budget and the current session state. Calculate the quality score of the initial response content; The dialogue response content is generated based on the quality score; The step of generating the dialogue response content based on the quality score includes: Determine whether the quality score is less than a preset first threshold; If the quality score is less than the first threshold, the target response mode is switched to deep support mode; Recalculate the session length budget based on the deep support mode, and return to the execution step based on the recalculated session length budget: generate initial response content based on the short support mode generation strategy or the deep support mode generation strategy, combined with the session length budget and the current session state; If the quality score is not less than the first threshold, the initial response content will be output as the dialogue response content.

2. The psychological health dialogue response control method as described in claim 1, characterized in that, The step of calculating the session complexity evaluation value based on the current session state to determine the target response pattern includes: Extract feature vectors from the current session state and assign corresponding weight vectors to the feature vectors; A complexity evaluation function for feature mapping is constructed based on the feature vector, the weight vector, and the preset bias parameters. The session complexity evaluation value is calculated based on the aforementioned complexity evaluation function; The target response pattern is determined based on the session complexity assessment value and the current session state.

3. The psychological health dialogue response control method as described in claim 2, characterized in that, The step of determining the target response pattern based on the session complexity evaluation value and the current session state includes: Calculate the pattern score for each candidate pattern in the preset candidate pattern set based on the session complexity evaluation value and the current session state; The candidate mode with the highest mode score is selected as the target response mode.

4. The psychological health dialogue response control method as described in claim 1, characterized in that, The step of generating a session length budget based on the session complexity evaluation value and the target response pattern includes: Determine the mode parameters corresponding to the target response mode; The session length budget is generated linearly based on the mode parameters and the session complexity evaluation value.

5. The psychological health dialogue response control method as described in claim 1, characterized in that, The steps for calculating the quality score of the initial response content include: Calculate the stability score, context consistency score, and constraint satisfaction score of the initial response content, respectively. Assign corresponding weight parameters to the stability score, the context consistency score, and the constraint satisfaction score; The quality score of the initial response content is calculated based on the weight parameters, the stability score, the context consistency score, and the constraint satisfaction score.

6. The psychological health dialogue response control method as described in claim 1, characterized in that, The step of generating dialogue response content under the constraints of the session length budget and the target response pattern further includes: Record and generate the actual response length and quality score corresponding to the dialogue response content to obtain historical dialogue records; The complexity evaluation function and the mode parameters corresponding to the target response mode are modified based on the historical dialogue records.

7. A psychological health dialogue response control system, characterized in that, The system includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the mental health dialogue response control method as described in any one of claims 1 to 6.

8. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the mental health dialogue response control method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Multi-round dialogue complexity assessment method and device, electronic equipment and computer readable storage medium

    CN121765045A