Psychological counseling dialogue method and device, computer equipment and storage medium
By combining user dialogue and psychotherapy models, professional and personalized psychological counseling dialogue responses are generated, and the problem of lack of professionalism and personalization in the current technology is solved, which improves the professionalism and user satisfaction of psychological counseling.
Patent Information
- Application Number
- CN202411779389.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-28
AI Technical Summary
The existing psychological counseling dialogue model based on large language models lacks professionalism and personalization when generating replies, and cannot effectively meet the specific psychological needs of users.
By obtaining the user conversations, historical conversations, current psychotherapy types and current psychotherapy steps in the current consultation session, input them into the trained psychotherapy prediction model and psychological counseling dialogue model, generate psychological counseling dialogue responses with professional and personalized characteristics.
The standardization and coherence of the psychological counseling process are achieved, and the professionalism and efficiency of consultation are improved. The generated responses can combine psychotherapy professional knowledge and user specific situations to provide more targeted and flexible responses, which improves the effectiveness and user satisfaction of consultation.
Smart Images

Figure CN119724492A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a psychological counseling dialogue method, device, computer equipment and storage medium. Background Art
[0002] In the field of psychological counseling, psychotherapy, also known as psychotherapy, is an effective means of improving individual psychological distress, emotional problems or behavioral problems by using psychological methods and techniques. The core of psychotherapy is to deeply understand and adjust an individual's psychological state, way of thinking and coping strategies, thereby promoting the individual's mental health and self-growth. However, traditional psychological counseling methods are limited by the lack of human resources and geographical restrictions, and it is difficult to meet the psychological counseling needs of the general public.
[0003] In recent years, with the rapid development of technologies such as artificial intelligence, machine learning, deep learning, and big data, especially the emergence of large language model technology, new possibilities have been provided for the realization of intelligent psychological counseling. These technologies make it possible to build intelligent dialogue models with powerful natural language generation and understanding capabilities, thereby greatly improving the performance of psychological counseling models. However, although the psychological counseling dialogue model based on large language model technology has made significant technical progress, there are still many problems in practical applications. For example, these models lack professional and systematic psychological counseling knowledge guidance during the psychological counseling dialogue process, resulting in the lack of professionalism and systematization of the generated responses. In addition, the responses generated by the model are often too general and lack personalization and pertinence for individual situations, thus affecting the effect and satisfaction of psychological counseling. Therefore, how to combine artificial intelligence technology to build a psychological counseling dialogue solution that is both professional and personalized has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The purpose of the embodiments of the present application is to propose a psychological counseling dialogue method, device, computer equipment and storage medium, which can be combined with artificial intelligence technology to construct a psychological counseling dialogue solution that is both professional and personalized.
[0005] In order to solve the above technical problems, the present application embodiment provides a psychological consultation dialogue method, which adopts the following technical solution:
[0006] Obtain user dialogue entered in the current consultation session, historical dialogues from previous consultation sessions, current psychotherapy type, and current psychotherapy step;
[0007] Inputting the user conversation, the historical conversation, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model to predict the next psychotherapy type and the next psychotherapy step;
[0008] The user dialogue, the historical dialogue, the next psychotherapy type and the next psychotherapy step are input into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response.
[0009] In order to solve the above technical problems, the embodiment of the present application also provides a psychological consultation dialogue device, which adopts the following technical solution:
[0010] An acquisition module, for acquiring user dialogues inputted in the current consultation session, historical dialogues in previous consultation sessions, current psychotherapy type, and current psychotherapy steps;
[0011] A prediction module, configured to input the user conversation, the historical conversation, the current psychotherapy type and the current psychotherapy step into a trained psychotherapy prediction model, and predict the next psychotherapy type and the next psychotherapy step;
[0012] A generation module is used to input the user dialogue, the historical dialogue, the next psychotherapy type and the next psychotherapy step into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response.
[0013] In order to solve the above-mentioned technical problems, an embodiment of the present application also provides a computer device, which adopts the technical solution described below: the computer device includes a memory and a processor, the memory stores computer-readable instructions, and the processor implements the steps of the psychological counseling dialogue method as described in any one of the above-mentioned items when executing the computer-readable instructions.
[0014] In order to solve the above technical problems, an embodiment of the present application also provides a computer-readable storage medium, which adopts the following technical solution: the computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the psychological counseling dialogue method as described in any one of the above items are implemented.
[0015] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0016] The embodiment of the present application inputs the user dialogue input in the current consultation session, the historical dialogue of the previous consultation session, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model, and can predict the next psychotherapy type and the next psychotherapy step based on the context information of the dialogue, thereby ensuring the standardization and consistency of the psychological counseling process; adopts a standardized and coherent psychological counseling process, so that each consultation can be carried out according to the established psychotherapy path, reducing the interference of human factors, and effectively improving the professionalism and efficiency of psychological counseling; by inputting historical dialogues, current user dialogues, the next psychotherapy type and the next psychotherapy step into the trained psychological counseling dialogue model, a psychological counseling dialogue response with targeted and personalized characteristics is generated, which can not only provide professional responses in combination with psychotherapy expertise, but also provide flexible responses based on the context information and psychological state of the user dialogue, avoiding stereotyped responses and enhancing the effectiveness of psychological counseling and user satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0019] Figure 2 It is a flowchart of an embodiment of the psychological consultation dialogue method of the present application;
[0020] Figure 3 It is a structural diagram of an embodiment of the psychological consultation dialogue device of the present application;
[0021] Figure 4 It is a structural diagram of an embodiment of a computer device of the present application. DETAILED DESCRIPTION
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0023] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0025] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0026] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0027] The terminal device 101 can be any electronic device with a display screen and supporting web browsing. In addition to a laptop computer 1011, a tablet computer 1012 or a mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer, a desktop computer, etc.
[0028] The server 103 may be a server that provides various services, such as a background server that provides support for a web page displayed on the terminal device 101 .
[0029] It should be noted that the psychological counseling dialogue method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the psychological counseling dialogue device is generally set in the server / terminal device.
[0030] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0031] Continue to refer Figure 2 , showing a flow chart of an embodiment of the question-answering method according to the present application. The psychological consultation dialogue method comprises the following steps:
[0032] Step S201, obtaining the user dialogue input in the current consultation session, the historical dialogue of the previous consultation session, the current psychotherapy type and the current psychotherapy step;
[0033] In this embodiment, the electronic device (eg Figure 1 The server / terminal device shown in the figure can obtain historical conversations, user conversations in the current consultation session, current psychotherapy type and current psychotherapy steps through a wired connection or a wireless connection. It should be noted that the above wireless connection methods may include but are not limited to 2G / 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultrawideband) connections, and other wireless connection methods currently known or to be developed in the future.
[0034] Specifically, when the user inputs a user dialogue in the current consultation session, the user dialogue input in the current consultation session, the historical dialogue of the previous consultation session, the current psychotherapy type and the current psychotherapy step are obtained. Among them, the user dialogue refers to the dialogue content input by the user into the electronic device (the electronic device has a built-in psychotherapy prediction model and a psychological consultation dialogue model) in the current consultation session. The user dialogue may include the questions raised by the user in the current consultation session, the needs expressed, the psychological state described, etc. The historical dialogue refers to the dialogue content of the user interacting with the electronic device in the previous consultation session. The historical dialogue may include the questions raised by the user in the previous consultation session, the needs expressed, the psychological state described, and the feedback and suggestions given after model processing.
[0035] Specifically, the current psychotherapy type refers to the type of psychotherapy currently being implemented, which is determined by the built-in psychotherapy prediction model in the electronic device according to the user's psychological state and needs. Among them, the types of psychotherapy may include but are not limited to cognitive behavioral therapy CBT (Cognitive Behavioral Therapy), acceptance and commitment therapy ACT (Acceptance and Commitment Therapy) and psychoanalysis therapy (Psychoanalysis therapy), etc. Different types of psychotherapy have different knowledge theoretical foundations, methods and steps, and goals. The current psychotherapy step refers to the specific therapy step or plan formulated for the user by the built-in psychotherapy prediction model in the electronic device under the current psychotherapy type. For each type of psychotherapy, the psychotherapy steps contained therein are executed in a certain order, aiming to gradually solve the user's psychological problems.
[0036] For example, assuming that the type of psychotherapy is cognitive behavioral therapy CBT, the psychotherapy steps included in the cognitive behavioral therapy CBT can be set as follows:
[0037] “1. Establish a trusting relationship: Establish trust with visitors, help them feel safe, and facilitate in-depth communication;
[0038] 2. Problem assessment: understand the client’s specific problems, including negative thinking, emotions and behavior patterns;
[0039] 3. Goal setting: Work with the client to develop clear, achievable goals and identify specific areas that they want to improve;
[0040] 4. Identify and change negative thinking: Help clients identify irrational negative thoughts and change them through questioning and discussion;
[0041] 5. Behavioral practice: guide the client to try new behaviors and gradually change the response pattern through practice;
[0042] 6. Self-monitoring and recording: Encourage visitors to record their emotions, thoughts and behavioral responses for better analysis and feedback;
[0043] 7. Consolidation and summary: Summarize the results of the treatment, consolidate the skills learned, and help the client apply these skills when facing similar problems in the future.
[0044] Step S202, inputting the user conversation, the historical conversation, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model, and predicting the next psychotherapy type and the next psychotherapy step;
[0045] In this embodiment, the psychotherapy prediction model is a psychotherapy prediction scheme based on machine learning or deep learning technology. It is obtained by analyzing a large amount of historical consultation data, learning the correlation between different psychotherapy types and psychotherapy steps, and how these correlations are affected by user conversations, historical conversations and other factors.
[0046] Specifically, the acquired user conversation, historical conversation, current psychotherapy type and current psychotherapy step are input into the trained psychotherapy prediction model, and the psychotherapy prediction model is used to extract features of the input user conversation, historical conversation, current psychotherapy type and current psychotherapy step, and the next psychotherapy type and next psychotherapy step are predicted based on the extracted features. Among them, the next psychotherapy type refers to the type of psychotherapy that should be implemented after the current consultation session predicted by the model; the next psychotherapy step refers to the specific step that should be implemented after the current psychotherapy step predicted by the model.
[0047] In some optional implementations, the inputting of the user conversation, the historical conversation, the current psychotherapy type, and the current psychotherapy step into the trained psychotherapy prediction model to predict the next psychotherapy type and the next psychotherapy step may include the following steps:
[0048] Inputting the historical conversation, the user conversation, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model, and determining whether the current psychotherapy type and the current psychotherapy step are null values;
[0049] Specifically, the acquired user conversation, historical conversation, current psychotherapy type and current psychotherapy step are input into the trained psychotherapy prediction model, and the psychotherapy prediction model is used to determine whether the input current psychotherapy type and current psychotherapy step are null values. If both the current psychotherapy type and the current psychotherapy step are null values, it means that the current consultation session has not yet matched the corresponding psychotherapy type and psychotherapy step.
[0050] If the current psychotherapy type and the current psychotherapy step are null values, the target psychotherapy type is matched from a pre-built therapy type library based on the historical conversation and the user conversation as the next psychotherapy type, and the first step of the target psychotherapy type is determined as the next psychotherapy step.
[0051] Specifically, if both the current psychotherapy type and the current psychotherapy step are null values, the psychotherapy prediction model is used to obtain a pre-built therapy type library, and feature extraction is performed based on the input user dialogue and historical dialogue. The target psychotherapy type is matched from the therapy type library based on the extracted features as the next psychotherapy type, and the first step of the target psychotherapy type is determined as the next psychotherapy step. The target psychotherapy type is matched from the therapy type library based on the extracted features, for example, based on methods such as keyword matching or semantic similarity calculation, the matching results between the extracted features and each psychotherapy type in the therapy type library are calculated, and the target psychotherapy type is determined based on the matching results.
[0052] The embodiment of the present application can intelligently predict the next psychotherapy type and the next psychotherapy step based on multi-dimensional information such as user dialogue, historical dialogue, current psychotherapy type and steps through the trained psychotherapy prediction model. When the current psychotherapy type and step are null values, the appropriate psychotherapy type is matched from the pre-built therapy type library according to the historical dialogue and the user dialogue of the current consultation session, and its first step is determined as the next therapy step. Not only can the psychotherapy consultation process be quickly started in the initial state of consultation, but also through the null value processing mechanism, effective consultation suggestions can be provided in the case of incomplete information, and various abnormal situations such as missing data and format errors can be better dealt with, thereby enhancing the stability and reliability of the system.
[0053] In some optional implementations, after determining whether the current psychotherapy type and the current psychotherapy step are null values, the following steps may also be included:
[0054] If both the current psychotherapy type and the current psychotherapy step are not null values, determining whether the current psychotherapy step is the last step of the current psychotherapy type;
[0055] If it is not the last step of the current psychotherapy type, determining whether the current psychotherapy step is completed;
[0056] If the current psychotherapy step has not been completed, the current psychotherapy type is determined as the next psychotherapy type, and the current psychotherapy step is determined as the next psychotherapy step.
[0057] Specifically, the acquired user conversations, historical conversations, current psychotherapy type and current psychotherapy step are input into the trained psychotherapy prediction model, and the psychotherapy prediction model is used to determine whether the input current psychotherapy type and current psychotherapy step are null values. If the current psychotherapy type and the current psychotherapy step are not null values, it means that the current consultation session has been matched with the psychotherapy type and the psychotherapy step. When the current consultation session has been matched with the psychotherapy type and the psychotherapy step, determine whether the current psychotherapy step matched by the current consultation session is the last step of the current psychotherapy type. If the current psychotherapy step is not the last step of the current psychotherapy type, further determine whether the current psychotherapy step has been executed. If the current psychotherapy step has not been executed, there is no need to change the current psychotherapy type and the current psychotherapy step, that is, the current psychotherapy type is determined as the next psychotherapy type, and the current psychotherapy step is determined as the next psychotherapy step.
[0058] The embodiment of the present application realizes automated decision-making in the psychological counseling process by determining whether the current psychotherapy step is the last step of the current psychotherapy type when both the current psychotherapy type and the current psychotherapy step are not null values; determining whether the current psychotherapy step has been completed when the current psychotherapy step is not the last step of the current psychotherapy type; and not changing the current psychotherapy type and the current psychotherapy step when the current psychotherapy step has not been completed.
[0059] In some optional implementations, if it is not the last step of the current psychotherapy type, after determining whether the current psychotherapy step is completed, the following steps may also be included:
[0060] If the current psychotherapy step is completed, the current psychotherapy type is determined as the next psychotherapy type;
[0061] According to the current psychotherapy type, a psychotherapy step arranged after the current psychotherapy step is obtained as the next psychotherapy step.
[0062] Specifically, when the current psychotherapy step is not the last step of the current psychotherapy type, it is further determined whether the current psychotherapy step is completed. If the current psychotherapy step is completed, it is necessary to change the current psychotherapy step to the next psychotherapy step under the same psychotherapy type, that is, determine the current psychotherapy type as the next psychotherapy type, and obtain the psychotherapy step arranged after the current psychotherapy step according to the current psychotherapy type and all the arranged psychotherapy steps contained therein as the next psychotherapy step.
[0063] The embodiment of the present application can automatically identify the current type of psychotherapy and the status of the current psychotherapy step through layer-by-layer logical judgment, and dynamically adjust the next type of psychotherapy and the next psychotherapy step according to the completion of the current psychotherapy step. This dynamic adjustment capability makes the psychological counseling process more flexible and efficient, and improves the automation of the psychological counseling process.
[0064] In some optional implementations, if both the current psychotherapy type and the current psychotherapy step are not null values, after determining whether the current psychotherapy step is the last step of the current psychotherapy type, the following steps may also be included:
[0065] If it is the last step of the current psychotherapy type, determining whether the last step has been completed;
[0066] If the last step is not completed, the current psychotherapy type is determined as the next psychotherapy type, and the current psychotherapy step is determined as the next psychotherapy step;
[0067] If the last step is executed, the next psychotherapy type and the next psychotherapy step are both determined to be null values.
[0068] Specifically, after determining that the current consultation session has matched a psychotherapy type and a psychotherapy step, it is necessary to determine whether the current psychotherapy step matched by the current consultation session is the last step of the current psychotherapy type. If the current psychotherapy step is the last step of the current psychotherapy type, then further determine whether the last step of the current psychotherapy type has been completed. If the last step has not been completed, there is no need to change the current psychotherapy type and the current psychotherapy step, that is, determine the current psychotherapy type as the next psychotherapy type, and determine the current psychotherapy step as the next psychotherapy step. If the last step has been completed, both the next psychotherapy type and the next psychotherapy step are determined to be null values, indicating that the psychological counseling process corresponding to the current consultation session has been completed.
[0069] The embodiment of the present application realizes a personalized service experience by intelligently deciding whether to continue the current psychological counseling or end the counseling process based on the execution status of the last step when the user is in the last step of the psychological counseling process, which helps to improve user satisfaction and trust.
[0070] Step S203, inputting the user dialogue, the historical dialogue, the next psychological therapy type and the next psychological therapy step into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response.
[0071] In this embodiment, the psychological counseling dialogue model is a machine learning model for simulating and assisting psychological counseling dialogues. The psychological counseling dialogue model is trained based on a large amount of psychological counseling dialogue data (such as historical dialogue data, current user dialogue content, historical psychotherapy types, and historical psychotherapy steps), and is designed to understand and generate dialogue content related to psychological counseling.
[0072] Specifically, the acquired user conversations, historical conversations, next psychotherapy type and next psychotherapy steps are input into the trained psychological counseling conversation model, and the psychological counseling conversation model is used to extract features of the input user conversations, historical conversations, current psychotherapy type and current psychotherapy steps, and a psychological counseling conversation response is generated based on the extracted features.
[0073] In some optional implementations, the inputting of the historical dialogue, the user dialogue, the next psychological therapy type, and the next psychological therapy step into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response may include the following steps:
[0074] Inputting the historical dialogue, the user dialogue, the next psychological therapy type and the next psychological therapy step into the trained psychological counseling dialogue model, performing text feature extraction on the historical dialogue and the user dialogue to obtain a text feature vector;
[0075] Matching a target psychotherapy knowledge base from a plurality of pre-collected psychotherapy knowledge bases according to the next psychotherapy type, and acquiring target psychotherapy knowledge from the target psychotherapy knowledge base according to the next psychotherapy step;
[0076] A psychological counseling dialogue response is generated according to the text feature vector and the target psychological therapy knowledge.
[0077] Specifically, the acquired historical conversations, user conversations, next psychotherapy type and next psychotherapy step are input into the trained psychological counseling conversation model, and the trained psychological counseling conversation model is used to extract text features of the historical conversations and user conversations, so as to convert the historical conversations and user conversations from text form into vector representations, and obtain the extracted text feature vectors. According to the next psychotherapy type and the next psychotherapy step, the corresponding target psychotherapy knowledge is obtained, for example, multiple pre-collected psychotherapy knowledge bases are obtained, and the psychotherapy knowledge base is a database or knowledge graph containing information such as different psychotherapy types, steps, principles, techniques and cases; according to the next psychotherapy type, the target psychotherapy knowledge base is matched from multiple psychotherapy knowledge bases, and according to the next psychotherapy step, the corresponding target psychotherapy knowledge is obtained from the target psychotherapy knowledge base. The target psychotherapy knowledge may include therapy principles, operating steps and precautions, etc. The extracted text feature vector and the target psychotherapy knowledge are combined with the trained psychological counseling dialogue model to extract key information from the text feature vector. The key information may include the core topic of the user conversation, the user's current emotional state, the user's psychological needs and concerns, etc.; a preset psychological counseling dialogue template is obtained, and the content that conforms to the psychological counseling dialogue template is filtered out from the extracted key information and the target psychotherapy knowledge respectively, and the filtered content is integrated with the psychological counseling dialogue template to generate a psychological counseling dialogue response.
[0078] The embodiment of the present application inputs historical conversations and user conversations so that the trained psychological counseling conversation model can capture key features such as the user's specific context, emotional state, past experiences, etc., and by combining the psychotherapy knowledge base, the model can generate psychological counseling responses based on professional psychology theory and practical experience, which helps to accurately understand user needs and generate more personalized and accurate conversation responses.
[0079] In some optional implementations, before inputting the historical dialogue, the user dialogue, the next psychological therapy type, and the next psychological therapy step into the trained psychological counseling dialogue model and generating a psychological counseling dialogue response, the following steps may also be included:
[0080] Acquire a pre-collected training data set, wherein the training data set includes historical conversations for training, current user conversations for training, psychological therapy types for training, and psychological therapy steps for training;
[0081] Inputting the historical conversation for training, the current user conversation for training, the psychological therapy type for training and the psychological therapy steps for training into a pre-trained psychological counseling conversation model, performing text feature extraction on the historical conversation for training and the current user conversation for training to obtain a text feature vector for training;
[0082] Acquiring a psychotherapy knowledge base according to the psychotherapy type for training and the psychotherapy steps for training;
[0083] Generate a training psychological counseling dialogue response based on the training text feature vector and the psychotherapy knowledge base;
[0084] Using a preset loss function, calculating the loss function value of the psychological consultation dialogue response for training;
[0085] The model parameters of the pre-trained psychological counseling dialogue model are updated according to the loss function value, and when the model meets the convergence condition, the trained psychological counseling dialogue model is obtained.
[0086] In this embodiment, before inputting the historical dialogue, user dialogue, next psychological therapy type and next psychological therapy step into the trained psychological counseling dialogue model, a process of training the psychological counseling dialogue model is also included. The psychological counseling dialogue model is trained based on the speech model.
[0087] Specifically, in order to construct a trained psychological counseling dialogue model, a pre-collected training data set is first obtained, and the training data set includes a number of historical dialogues for training, current user dialogues for training, psychological therapy types for training, and psychological therapy steps for training. Then, the data contained in the training data set are sequentially input into the pre-trained psychological counseling dialogue model, and within the model, text feature extraction is performed on the historical dialogues for training and the current user dialogues for training to generate a text feature vector for training.
[0088] Furthermore, within the model, a pre-built psychotherapy knowledge base is obtained based on the training psychotherapy types and training psychotherapy steps, and the psychotherapy knowledge base contains information on different psychotherapy types, steps, principles, techniques, and cases. Then, the training text feature vector and the psychotherapy knowledge base are combined to generate training psychological counseling dialogue responses.
[0089] In order to evaluate the quality of the training psychological counseling dialogue responses, a preset loss function is used to calculate the loss function value of the training psychological counseling dialogue responses. This loss function value can reflect the difference between the pre-trained model responses and the real psychological counseling dialogue responses. Based on the loss function value, the model parameters of the pre-trained psychological counseling dialogue model are continuously updated to optimize its performance.
[0090] When the model meets the convergence condition, that is, the loss function value reaches the preset threshold or the variation range is small enough, it indicates that the model has been trained and the trained psychological counseling dialogue model is obtained. The trained psychological counseling dialogue model can generate professional and personalized psychological counseling dialogue responses based on the input historical dialogues, current user dialogues, psychological therapy types and psychological therapy steps.
[0091] The embodiment of the present application adopts the above scheme, specifically by inputting the user dialogue input in the current consultation session, the historical dialogue of the previous consultation session, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model, so that the next psychotherapy type and the next psychotherapy step can be predicted based on the context information of the dialogue, thereby ensuring the standardization and consistency of the psychological counseling process; adopting a standardized and coherent psychological counseling process, so that each consultation can be carried out according to the established psychotherapy path, reducing the interference of human factors, and effectively improving the professionalism and efficiency of psychological counseling; by inputting the historical dialogue, the current user dialogue, the next psychotherapy type and the next psychotherapy step into the trained psychological counseling dialogue model, a psychological counseling dialogue response with targeted and personalized characteristics is generated, which can not only make professional responses in combination with psychotherapy professional knowledge, but also make flexible responses according to the context information and psychological state of the user dialogue, avoiding stereotyped responses, and enhancing the effectiveness of psychological counseling and user satisfaction.
[0092] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned historical conversations, user conversations in the current consultation session, current psychotherapy type and current psychotherapy steps and other information as well as other relevant data, the above-mentioned historical conversations, user conversations in the current consultation session, current psychotherapy type and current psychotherapy steps and other information as well as other relevant data can also be stored in a blockchain node.
[0093] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0094] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0095] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0096] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a psychological consultation dialogue device, and the embodiment of the device is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0097] like Figure 3 As shown, the psychological consultation dialogue device 400 described in this embodiment includes: an acquisition module 401, a prediction module 402 and a generation module 403. Among them:
[0098] Acquisition module 401, for acquiring user dialogues inputted in the current consultation session, historical dialogues in previous consultation sessions, current psychotherapy type and current psychotherapy steps;
[0099] A prediction module 402, configured to input the user conversation, the historical conversation, the current psychotherapy type and the current psychotherapy step into a trained psychotherapy prediction model, and predict the next psychotherapy type and the next psychotherapy step;
[0100] The generation module 403 is used to input the user dialogue, the historical dialogue, the next psychological therapy type and the next psychological therapy step into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response.
[0101] In this embodiment, the acquisition module 401 is used to obtain the user dialogue input in the current consultation session, the historical dialogue of the previous consultation session, the current psychotherapy type and the current psychotherapy step when the user inputs the user dialogue in the current consultation session. Among them, the user dialogue refers to the dialogue content input by the user into the electronic device (the electronic device has a built-in psychotherapy prediction model and a psychological consultation dialogue model) in the current consultation session. The user dialogue may include the questions raised by the user in the current consultation session, the needs expressed, the psychological state described, etc. The historical dialogue refers to the dialogue content of the user interacting with the electronic device in the previous consultation session. The historical dialogue may include the questions raised by the user in the previous consultation session, the needs expressed, the psychological state described, and the feedback and suggestions given after model processing.
[0102] Specifically, the current psychotherapy type refers to the type of psychotherapy currently being implemented, which is determined by the built-in psychotherapy prediction model in the electronic device according to the user's psychological state and needs. Among them, the types of psychotherapy may include but are not limited to cognitive behavioral therapy CBT (Cognitive Behavioral Therapy), acceptance and commitment therapy ACT (Acceptance and Commitment Therapy) and psychoanalysis therapy (Psychoanalysis therapy), etc. Different types of psychotherapy have different knowledge theoretical foundations, methods and steps, and goals. The current psychotherapy step refers to the specific therapy step or plan formulated for the user by the built-in psychotherapy prediction model in the electronic device under the current psychotherapy type. For each type of psychotherapy, the psychotherapy steps contained therein are executed in a certain order, aiming to gradually solve the user's psychological problems.
[0103] For example, assuming that the type of psychotherapy is cognitive behavioral therapy CBT, the psychotherapy steps included in the cognitive behavioral therapy CBT can be set as follows:
[0104] “1. Establish a trusting relationship: Establish trust with visitors, help them feel safe, and facilitate in-depth communication;
[0105] 2. Problem assessment: understand the client’s specific problems, including negative thinking, emotions and behavior patterns;
[0106] 3. Goal setting: Work with the client to develop clear, achievable goals and identify specific areas that they want to improve;
[0107] 4. Identify and change negative thinking: Help clients identify irrational negative thoughts and change them through questioning and discussion;
[0108] 5. Behavioral practice: guide the client to try new behaviors and gradually change the response pattern through practice;
[0109] 6. Self-monitoring and recording: Encourage visitors to record their emotions, thoughts and behavioral responses for better analysis and feedback;
[0110] 7. Consolidation and summary: Summarize the results of the treatment, consolidate the skills learned, and help the client apply these skills when facing similar problems in the future.
[0111] Specifically, the psychotherapy prediction model is a psychotherapy prediction scheme based on machine learning or deep learning technology. It is obtained by analyzing a large amount of historical consultation data, learning the correlation between different psychotherapy types and psychotherapy steps, and how these correlations are affected by factors such as user conversations and historical conversations.
[0112] Specifically, the prediction module 402 is used to input the acquired user dialogue, historical dialogue, current psychotherapy type and current psychotherapy step into the trained psychotherapy prediction model, use the psychotherapy prediction model to extract features of the input user dialogue, historical dialogue, current psychotherapy type and current psychotherapy step, and predict the next psychotherapy type and next psychotherapy step based on the extracted features. Among them, the next psychotherapy type refers to the type of psychotherapy that should be implemented after the current consultation session predicted by the model; the next psychotherapy step refers to the specific step that should be implemented after the current psychotherapy step predicted by the model.
[0113] Specifically, the psychological counseling dialogue model is a machine learning model used to simulate and assist psychological counseling dialogues. The psychological counseling dialogue model is trained based on a large amount of psychological counseling dialogue data (such as historical dialogue data, current user dialogue content, historical psychotherapy types, and historical psychotherapy steps), and aims to understand and generate dialogue content related to psychological counseling.
[0114] Specifically, generation module 403 is used to input the acquired user conversations, historical conversations, next psychotherapy type and next psychotherapy step into the trained psychological counseling conversation model, use the psychological counseling conversation model to extract features of the input user conversations, historical conversations, current psychotherapy type and current psychotherapy step, and generate a psychological counseling conversation response based on the extracted features.
[0115] The psychological counseling dialogue device 400 of the embodiment of the present application, by inputting the user dialogue input in the current consultation session, the historical dialogue of the previous consultation session, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model, can predict the next psychotherapy type and the next psychotherapy step based on the context information of the dialogue, thereby ensuring the standardization and consistency of the psychological counseling process; adopting a standardized and coherent psychological counseling process, so that each consultation can be carried out according to the established psychotherapy path, reducing the interference of human factors, and effectively improving the professionalism and efficiency of psychological counseling; by inputting the historical dialogue, the current user dialogue, the next psychotherapy type and the next psychotherapy step into the trained psychological counseling dialogue model, a psychological counseling dialogue response with targeted and personalized characteristics is generated, which can not only make professional responses in combination with psychotherapy professional knowledge, but also make flexible responses according to the context information and psychological state of the user dialogue, avoiding stereotyped responses, and enhancing the effectiveness of psychological counseling and user satisfaction.
[0116] In some optional implementations of this embodiment, the prediction module 402 may include a first input submodule and a first determination submodule.
[0117] A first input submodule, configured to input the historical conversation, the user conversation, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model, and determine whether the current psychotherapy type and the current psychotherapy step are null values;
[0118] The first determination submodule is used to match the target psychotherapy type from a pre-built therapy type library as the next psychotherapy type based on the historical conversation and the user conversation if the current psychotherapy type and the current psychotherapy step are null values, and determine the first step of the target psychotherapy type as the next psychotherapy step.
[0119] Specifically, the first input submodule is used to input the acquired user dialogue, historical dialogue, current psychotherapy type and current psychotherapy step into the trained psychotherapy prediction model, and use the psychotherapy prediction model to determine whether the input current psychotherapy type and current psychotherapy step are null values. If both the current psychotherapy type and the current psychotherapy step are null values, it means that the current consultation session has not yet matched the corresponding psychotherapy type and psychotherapy step.
[0120] Specifically, the first determination submodule is used to obtain a pre-built therapy type library using the psychotherapy prediction model if both the current psychotherapy type and the current psychotherapy step are null values, perform feature extraction based on the input user dialogue and historical dialogue, match the target psychotherapy type from the therapy type library based on the extracted features as the next psychotherapy type, and determine the first step of the target psychotherapy type as the next psychotherapy step. Wherein, matching the target psychotherapy type from the therapy type library based on the extracted features may, for example, be based on methods such as keyword matching or semantic similarity calculation, calculating the matching results between the extracted features and each psychotherapy type in the therapy type library, and determining the target psychotherapy type based on the matching results.
[0121] The prediction module 402 of the embodiment of the present application can intelligently predict the next psychotherapy type and the next psychotherapy step based on multi-dimensional information such as user dialogue, historical dialogue, current psychotherapy type and steps through the trained psychotherapy prediction model. When the current psychotherapy type and step are null values, according to the historical dialogue and the user dialogue of the current consultation session, the appropriate psychotherapy type is matched from the pre-built therapy type library, and its first step is determined as the next therapy step. Not only can the psychotherapy consultation process be quickly started in the initial state of consultation, but also through the null value processing mechanism, effective consultation suggestions can be provided in the case of incomplete information, and various abnormal situations, such as missing data, format errors, etc., are better dealt with, thereby enhancing the stability and reliability of the system.
[0122] In some optional implementations of this embodiment, the prediction module 402 may include a second determination submodule, a third determination submodule, and a fourth determination submodule.
[0123] A second determination submodule is used to determine whether the current psychotherapy step is the last step of the current psychotherapy type if both the current psychotherapy type and the current psychotherapy step are not null values;
[0124] A third determination submodule, for determining whether the current psychotherapy step is completed if it is not the last step of the current psychotherapy type;
[0125] The fourth determination submodule is used to determine the current psychotherapy type as the next psychotherapy type and the current psychotherapy step as the next psychotherapy step if the current psychotherapy step has not been completed.
[0126] Specifically, the acquired user conversations, historical conversations, current psychotherapy type and current psychotherapy steps are input into the trained psychotherapy prediction model, and the psychotherapy prediction model is used to determine whether the input current psychotherapy type and current psychotherapy step are null values. The second determination submodule is used to indicate that if the current psychotherapy type and the current psychotherapy step are not null values, the current consultation session has been matched with the psychotherapy type and the psychotherapy step. When the current consultation session has been matched with the psychotherapy type and the psychotherapy step, determine whether the current psychotherapy step matched by the current consultation session is the last step of the current psychotherapy type. The third determination submodule is used to further determine whether the current psychotherapy step has been executed if the current psychotherapy step is not the last step of the current psychotherapy type. The fourth determination submodule is used to determine that if the current psychotherapy step has not been executed, there is no need to change the current psychotherapy type and the current psychotherapy step, that is, determine the current psychotherapy type as the next psychotherapy type, and determine the current psychotherapy step as the next psychotherapy step.
[0127] The prediction module 402 of the embodiment of the present application realizes automated decision-making in the psychological counseling process by determining whether the current psychotherapy step is the last step of the current psychotherapy type when both the current psychotherapy type and the current psychotherapy step are not null values; determining whether the current psychotherapy step has been executed when the current psychotherapy step is not the last step of the current psychotherapy type; and not changing the current psychotherapy type and the current psychotherapy step when the current psychotherapy step has not been executed.
[0128] In some optional implementations of this embodiment, the prediction module 402 may include a fifth determination submodule and a sixth determination submodule, wherein:
[0129] A fifth determination submodule is used to determine the current psychotherapy type as the next step psychotherapy type if the current psychotherapy step is completed;
[0130] The sixth determination submodule is used to obtain, according to the current psychotherapy type, a psychotherapy step arranged after the current psychotherapy step as the next psychotherapy step.
[0131] Specifically, when the current psychotherapy step is not the last step of the current psychotherapy type, it is further determined whether the current psychotherapy step has been completed. The fifth determination submodule is used to change the current psychotherapy step to the next psychotherapy step under the same psychotherapy type if the current psychotherapy step has been completed, that is, to determine the current psychotherapy type as the next psychotherapy type. The sixth determination submodule is used to obtain the psychotherapy step arranged after the current psychotherapy step as the next psychotherapy step according to the current psychotherapy type and all the arranged psychotherapy steps contained therein.
[0132] The prediction module 402 of the embodiment of the present application can automatically identify the current psychotherapy type and the status of the current psychotherapy step through layer-by-layer logical judgment, and dynamically adjust the next psychotherapy type and the next psychotherapy step according to the completion status of the current psychotherapy step. This dynamic adjustment capability makes the psychological counseling process more flexible and efficient, and improves the automation level of the psychological counseling process.
[0133] In some optional implementations of this embodiment, the prediction module 402 may include a seventh determination submodule, an eighth determination submodule, and a ninth determination submodule.
[0134] a seventh determination submodule, for determining whether the last step is completed if it is the last step of the current psychotherapy type;
[0135] an eighth determination submodule, for determining the current psychotherapy type as the next psychotherapy type and the current psychotherapy step as the next psychotherapy step if the last step is not completed;
[0136] The ninth determination submodule is used to determine the next step of psychotherapy type and the next step of psychotherapy step as null values if the last step is completed.
[0137] Specifically, after determining that the current consultation session has matched a psychotherapy type and a psychotherapy step, it is necessary to determine whether the current psychotherapy step matched by the current consultation session is the last step of the current psychotherapy type. The seventh determination submodule is used to determine whether the last step of the current psychotherapy type has been completed if the current psychotherapy step is the last step of the current psychotherapy type. The eighth determination submodule is used to determine if the last step has not been completed, without changing the current psychotherapy type and the current psychotherapy step, that is, determining the current psychotherapy type as the next psychotherapy type, and determining the current psychotherapy step as the next psychotherapy step. The ninth determination submodule is used to determine if the last step has been completed, then determine the next psychotherapy type and the next psychotherapy step as null values, indicating that the psychological counseling process corresponding to the current consultation session has been completed.
[0138] The prediction module 402 of the embodiment of the present application realizes a personalized service experience by intelligently deciding whether to continue the current psychological counseling or end the counseling process based on the execution status of the last step when the user is in the last step of the psychological counseling process, thereby helping to improve user satisfaction and trust.
[0139] In some optional implementations of this embodiment, the generation module 403 may include a second input submodule, a knowledge acquisition submodule, and a reply generation submodule.
[0140] A second input submodule is used to input the historical dialogue, the user dialogue, the next psychological therapy type and the next psychological therapy step into the trained psychological counseling dialogue model, and perform text feature extraction on the historical dialogue and the user dialogue to obtain a text feature vector;
[0141] A knowledge acquisition submodule, used for matching a target psychotherapy knowledge base from a plurality of pre-collected psychotherapy knowledge bases according to the next psychotherapy type, and acquiring target psychotherapy knowledge from the target psychotherapy knowledge base according to the next psychotherapy step;
[0142] The response generation submodule is used to generate a psychological consultation dialogue response based on the text feature vector and the target psychotherapy knowledge.
[0143] Specifically, the second input submodule is used to input the acquired historical conversations, user conversations, next psychotherapy type and next psychotherapy step into the trained psychological counseling conversation model, and use the trained psychological counseling conversation model to extract text features from the historical conversations and user conversations, so as to convert the historical conversations and user conversations from text form into vector representations, and obtain the extracted text feature vectors. The knowledge acquisition submodule is used to acquire the corresponding target psychotherapy knowledge according to the next psychotherapy type and the next psychotherapy step. For example, it can be to acquire multiple pre-collected psychotherapy knowledge bases, which are databases or knowledge graphs containing information such as different psychotherapy types, steps, principles, techniques and cases; match the target psychotherapy knowledge base from multiple psychotherapy knowledge bases according to the next psychotherapy type, and acquire the corresponding target psychotherapy knowledge from the target psychotherapy knowledge base according to the next psychotherapy step. The target psychotherapy knowledge may include therapy principles, operating steps and precautions, etc. The reply generation submodule is used to extract key information from the text feature vector by combining the extracted text feature vector with the target psychotherapy knowledge through the trained psychological counseling dialogue model. The key information may include the core theme of the user's conversation, the user's current emotional state, the user's psychological needs and concerns, etc.; obtain the preset psychological counseling dialogue template, and filter out the content that conforms to the psychological counseling dialogue template from the extracted key information and the target psychotherapy knowledge, and integrate the filtered content with the psychological counseling dialogue template to generate a psychological counseling dialogue reply.
[0144] The generation module 403 of the embodiment of the present application inputs historical conversations and user conversations so that the trained psychological counseling dialogue model can capture key features such as the user's specific context, emotional state, past experiences, etc., and by combining the psychotherapy knowledge base, the model can generate psychological counseling responses based on professional psychology theory and practical experience, which helps to accurately understand user needs and generate more personalized and accurate dialogue responses.
[0145] In some optional implementations of this embodiment, the psychological consultation dialogue device 400 may further include a training module. The training module is used to obtain a pre-collected training data set, wherein the training data set includes historical dialogues for training, current user dialogues for training, psychological therapy types for training, and psychological therapy steps for training;
[0146] Inputting the historical conversation for training, the current user conversation for training, the psychological therapy type for training and the psychological therapy steps for training into a pre-trained psychological counseling conversation model, performing text feature extraction on the historical conversation for training and the current user conversation for training to obtain a text feature vector for training;
[0147] Acquiring a psychotherapy knowledge base according to the psychotherapy type for training and the psychotherapy steps for training;
[0148] Generate a training psychological counseling dialogue response based on the training text feature vector and the psychotherapy knowledge base;
[0149] Using a preset loss function, calculating the loss function value of the psychological consultation dialogue response for training;
[0150] The model parameters of the pre-trained psychological counseling dialogue model are updated according to the loss function value, and when the model meets the convergence condition, the trained psychological counseling dialogue model is obtained.
[0151] In this embodiment, before inputting the historical dialogue, user dialogue, next psychological therapy type and next psychological therapy step into the trained psychological counseling dialogue model, a process of training the psychological counseling dialogue model is also included. The psychological counseling dialogue model is trained based on the speech model.
[0152] Specifically, in order to construct a trained psychological counseling dialogue model, a training module is used to obtain a pre-collected training data set, which includes a number of historical dialogues for training, current user dialogues for training, psychological therapy types for training, and psychological therapy steps for training. Then, the data contained in the training data set is sequentially input into the pre-trained psychological counseling dialogue model, and within the model, text feature extraction is performed on the historical dialogues for training and the current user dialogues for training to generate a text feature vector for training.
[0153] Furthermore, within the model, a pre-built psychotherapy knowledge base is obtained based on the training psychotherapy types and training psychotherapy steps, and the psychotherapy knowledge base contains information on different psychotherapy types, steps, principles, techniques, and cases. Then, the training text feature vector and the psychotherapy knowledge base are combined to generate training psychological counseling dialogue responses.
[0154] In order to evaluate the quality of the training psychological counseling dialogue responses, a preset loss function is used to calculate the loss function value of the training psychological counseling dialogue responses. This loss function value can reflect the difference between the pre-trained model response and the real psychological counseling dialogue response. Based on the loss function value, the model parameters of the pre-trained psychological counseling dialogue model are continuously updated to optimize its performance. When the model meets the convergence condition, that is, the loss function value reaches the preset threshold or the range of variation is small enough, it indicates that the model has been trained and the trained psychological counseling dialogue model is obtained. Using the trained psychological counseling dialogue model, professional and personalized psychological counseling dialogue responses can be generated based on the input historical dialogues, current user dialogues, psychotherapy types, and psychotherapy steps.
[0155] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0156] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 6 with a memory 61, a processor 62, and a network interface 63, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0157] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0158] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk equipped on the computer device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 61 can also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as computer-readable instructions of the psychological counseling dialogue method, etc. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or are to be output.
[0159] The processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run the computer-readable instructions stored in the memory 61 or process data, such as computer-readable instructions for running the psychological counseling dialogue method.
[0160] The network interface 63 may include a wireless network interface or a wired network interface. The network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0161] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the psychological counseling dialogue method as described above.
[0162] The computer device, computer-readable storage medium and computer-readable instructions thereof provided in the embodiments of the present application can input the user dialogue input into the current consultation session, the historical dialogue of the previous consultation session, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model through the processor execution, and can predict the next psychotherapy type and the next psychotherapy step based on the context information of the dialogue, thereby ensuring the standardization and consistency of the psychological counseling process; adopting a standardized and coherent psychological counseling process, so that each consultation can be carried out according to the established psychotherapy path, reducing the interference of human factors, and effectively improving the professionalism and efficiency of psychological counseling; by inputting the historical dialogue, the current user dialogue, the next psychotherapy type and the next psychotherapy step into the trained psychological counseling dialogue model, a psychological counseling dialogue response with targeted and personalized characteristics is generated, which can not only provide professional responses in combination with psychotherapy professional knowledge, but also provide flexible responses based on the context information and psychological state of the user dialogue, avoiding stereotyped responses, and enhancing the effectiveness of psychological counseling and user satisfaction.
[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0164] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to replace some of the technical features therein with equivalents. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
[0165] The non-Company software tools or components appearing in the embodiments of this application are merely examples and do not represent actual use.
Claims
1. A psychological consultation dialogue method, characterized in that: The steps include: Obtain user dialogue entered in the current consultation session, historical dialogues from previous consultation sessions, current psychotherapy type, and current psychotherapy step; Inputting the user conversation, the historical conversation, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model to predict the next psychotherapy type and the next psychotherapy step; The user dialogue, the historical dialogue, the next psychotherapy type and the next psychotherapy step are input into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response.
2. The psychological consultation dialogue method according to claim 1, characterized in that: The step of inputting the user conversation, the historical conversation, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model to predict the next psychotherapy type and the next psychotherapy step includes: Inputting the historical conversation, the user conversation, the current psychotherapy type and the current psychotherapy step into the trained psychotherapy prediction model, and determining whether the current psychotherapy type and the current psychotherapy step are null values; If the current psychotherapy type and the current psychotherapy step are null values, the target psychotherapy type is matched from a pre-built therapy type library based on the historical conversation and the user conversation as the next psychotherapy type, and the first step of the target psychotherapy type is determined as the next psychotherapy step.
3. The psychological consultation dialogue method according to claim 2, characterized in that: After the step of determining whether the current psychotherapy type and the current psychotherapy step are null values, the method further includes: If both the current psychotherapy type and the current psychotherapy step are not null values, determining whether the current psychotherapy step is the last step of the current psychotherapy type; If it is not the last step of the current psychotherapy type, determining whether the current psychotherapy step is completed; If the current psychotherapy step has not been completed, the current psychotherapy type is determined as the next psychotherapy type, and the current psychotherapy step is determined as the next psychotherapy step.
4. The psychological consultation dialogue method according to claim 3, characterized in that: After the step of determining whether the current psychotherapy step is completed if it is not the last step of the current psychotherapy type, the method further includes: If the current psychotherapy step is completed, the current psychotherapy type is determined as the next psychotherapy type; According to the current psychotherapy type, a psychotherapy step arranged after the current psychotherapy step is obtained as the next psychotherapy step.
5. The psychological consultation dialogue method according to claim 3, characterized in that: After the step of determining whether the current psychotherapy step is the last step of the current psychotherapy type if both the current psychotherapy type and the current psychotherapy step are not null values, the method further includes: If it is the last step of the current psychotherapy type, determining whether the last step has been completed; If the last step is not completed, the current psychotherapy type is determined as the next psychotherapy type, and the current psychotherapy step is determined as the next psychotherapy step; If the last step is executed, the next psychotherapy type and the next psychotherapy step are both determined to be null values.
6. The psychological consultation dialogue method according to claim 1, characterized in that: The step of inputting the user dialogue, the historical dialogue, the next psychological therapy type and the next psychological therapy step into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response includes: Inputting the historical dialogue, the user dialogue, the next psychological therapy type and the next psychological therapy step into the trained psychological counseling dialogue model, performing text feature extraction on the historical dialogue and the user dialogue to obtain a text feature vector; Matching a target psychotherapy knowledge base from a plurality of pre-collected psychotherapy knowledge bases according to the next psychotherapy type, and acquiring target psychotherapy knowledge from the target psychotherapy knowledge base according to the next psychotherapy step; A psychological counseling dialogue response is generated according to the text feature vector and the target psychological therapy knowledge.
7. The psychological consultation dialogue method according to claim 6, characterized in that: Before the step of inputting the user dialogue, the historical dialogue, the next psychological therapy type and the next psychological therapy step into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response, the step further includes: Acquire a pre-collected training data set, wherein the training data set includes historical conversations for training, current user conversations for training, psychological therapy types for training, and psychological therapy steps for training; Inputting the historical conversation for training, the current user conversation for training, the psychological therapy type for training and the psychological therapy steps for training into a pre-trained psychological counseling conversation model, performing text feature extraction on the historical conversation for training and the current user conversation for training to obtain a text feature vector for training; Acquiring a psychotherapy knowledge base according to the psychotherapy type for training and the psychotherapy steps for training; Generate a training psychological counseling dialogue response based on the training text feature vector and the psychotherapy knowledge base; Using a preset loss function, calculating the loss function value of the psychological consultation dialogue response for training; The model parameters of the pre-trained psychological counseling dialogue model are updated according to the loss function value, and when the model meets the convergence condition, the trained psychological counseling dialogue model is obtained.
8. A psychological consultation dialogue device, characterized in that: The device comprises: An acquisition module, for acquiring user dialogues inputted in the current consultation session, historical dialogues in previous consultation sessions, current psychotherapy type, and current psychotherapy steps; A prediction module, configured to input the user conversation, the historical conversation, the current psychotherapy type and the current psychotherapy step into a trained psychotherapy prediction model, and predict the next psychotherapy type and the next psychotherapy step; A generation module is used to input the user dialogue, the historical dialogue, the next psychotherapy type and the next psychotherapy step into the trained psychological counseling dialogue model to generate a psychological counseling dialogue response.
9. A computer device, characterized in that: It comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the psychological counseling dialogue method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the psychological counseling dialogue method as described in any one of claims 1 to 7 are implemented.