Text processing method, mental health intervention system, equipment and medium

Through a multi-agent collaborative architecture, it addresses the shortcomings of existing AI-assisted psychological products in task decomposition, knowledge fusion, and security, achieving a refined understanding of user input and efficient and safe psychological intervention. It is particularly suitable for handling childhood trauma in East Asian cultural contexts, providing a low-stress, high-participation digital psychological intervention experience.

CN122065832APending Publication Date: 2026-05-19BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
Filing Date
2026-01-08
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing AI-assisted psychological products lack fine task decomposition and scheduling, have low integration of professional knowledge, simple interaction modes, and insufficient system controllability and security when dealing with complex mental health intervention tasks, making it difficult to effectively intervene in traumas from specific cultural backgrounds.

Method used

A multi-agent collaborative architecture is adopted, including a scheduling agent, a first processing agent, and a second processing agent. Through a hierarchical architecture with contextual access permissions, it performs emotional and factual content classification, scene analysis, and intent recognition, dynamically retrieves professional knowledge bases, and generates positive guidance text and expressive writing suggestions to ensure the professionalism and security of the guidance content.

Benefits of technology

It achieves a refined understanding of user input and efficient and safe psychological intervention. Through semantic correction and narrative continuation, it enhances the scientific nature and effectiveness of intervention, and is particularly suitable for childhood trauma treatment in the context of East Asian culture, providing a low-stress, high-participation digital psychological intervention experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122065832A_ABST
    Figure CN122065832A_ABST
Patent Text Reader

Abstract

The invention provides a text processing method, a mental health intervention system, equipment and a medium, and relates to the technical field of text processing, in particular to the technical fields of artificial intelligence, intelligent agents, mental health and the like. According to the specific implementation scheme, a natural language input text of a user is received; performing emotion content and fact content classification on the input text by using a scheduling agent, performing scene analysis and intention recognition based on a classification result, and querying a professional knowledge base in the mental health intervention field based on a recognition result to obtain intervention strategy related knowledge; and executing at least one guide operation on the acquired intervention strategy related knowledge: operation A: performing semantic correction on a fragment which is identified as containing negative emotion expression in the input text by utilizing a first processing agent to generate a forward guide text; and operation B: utilizing a second processing agent to generate a continuous writing suggestion text for promoting expressive writing according to the narrative clues of the input text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of text processing technology, and more particularly to the fields of artificial intelligence, intelligent agents, and mental health. Specifically, this disclosure relates to a text processing method based on multi-agent collaboration, a mental health intervention system based on multi-agent collaboration, an electronic device, and a computer-readable storage medium. Background Technology

[0002] As society places increasing emphasis on mental health, the application of artificial intelligence technology in the fields of psychological assistance and emotional support is constantly deepening.

[0003] Traditional mental health interventions mainly rely on offline professional psychological counseling, which is effective but has limitations in time and space, high costs, and for issues involving deep trauma (such as childhood trauma), users may find it difficult to speak up due to cultural shame or fear of confronting painful memories, resulting in high intervention thresholds and low compliance. Summary of the Invention

[0004] This disclosure provides a text processing method based on multi-agent collaboration, a mental health intervention system based on multi-agent collaboration, an electronic device, and a computer-readable storage medium.

[0005] According to a first aspect of this disclosure, a text processing method based on multi-agent collaboration is provided, applied to mental health intervention scenarios, the method comprising: Receive natural language input text from the user; The input text is analyzed and processed using a scheduling agent. The analysis and processing includes: classifying the input text into emotional content and factual content; performing scene analysis and intent recognition based on the classification results; and querying a professional knowledge base in the field of mental health intervention based on the recognition results to obtain relevant knowledge on intervention strategies. Based on the acquired knowledge related to the intervention strategy, perform at least one guiding operation: Operation A: Using the first processing agent, semantically correct the segments in the input text identified as containing negative emotional expressions, and generate positive guidance text; Operation B: Using a second processing agent, generate continuation suggestion text to promote expressive writing based on the narrative clues of the input text; The scheduling agent, the first processing agent, and the second processing agent constitute a hierarchical architecture with hierarchical context access permissions. The scheduling agent is configured to access the output context of the first and second processing agents, while the first and second processing agents are restricted from accessing the internal decision context of the scheduling agent.

[0006] According to a second aspect of this disclosure, a mental health intervention system based on multi-agent collaboration is provided, the system comprising: The input receiving module is used to receive natural language input text from users; The scheduling agent module is used to classify the input text into emotional and factual content using a scheduling agent, perform scene analysis and intent recognition based on the classification results, and query a professional knowledge base in the field of mental health intervention based on the recognition results to obtain relevant knowledge of intervention strategies. The first processing module is used to perform semantic correction on the segments of the input text identified as containing negative emotional expressions based on the acquired knowledge related to the intervention strategy, using the first processing agent, and generate positive guidance text. The second processing module is used to generate continuation suggestion text to promote expressive writing based on the acquired knowledge related to the intervention strategy and using the second processing agent according to the narrative clues of the input text. The scheduling agent, the first processing agent, and the second processing agent constitute a hierarchical architecture with hierarchical context access permissions. The scheduling agent is configured to access the output context of the first and second processing agents, while the first and second processing agents are restricted from accessing the internal decision context of the scheduling agent.

[0007] According to a third aspect of this disclosure, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to at least one of the aforementioned processors; wherein, The memory stores instructions that can be executed by at least one processor, which, when executed by at least one processor, enables the at least one processor to perform the text processing method based on multi-agent cooperation.

[0008] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the above-described text processing method based on multi-agent cooperation.

[0009] According to a fifth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described text processing method based on multi-agent cooperation.

[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0011] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 This is a flowchart illustrating a mental health intervention method based on multi-agent collaboration provided in an embodiment of this disclosure; Figure 2 This is a flowchart illustrating some steps of another mental health intervention method based on multi-agent collaboration provided in this embodiment of the disclosure; Figure 3 This is a flowchart illustrating some steps of another mental health intervention method based on multi-agent collaboration provided in this embodiment of the disclosure; Figure 4 This is a flowchart illustrating some steps of another mental health intervention method based on multi-agent collaboration provided in this embodiment of the disclosure; Figure 5 This is a flowchart illustrating some steps of another mental health intervention method based on multi-agent collaboration provided in this embodiment of the disclosure; Figure 6 This is a flowchart illustrating some steps of another mental health intervention method based on multi-agent collaboration provided in this embodiment of the disclosure; Figure 7 This is a flowchart illustrating some steps of another mental health intervention method based on multi-agent collaboration provided in this embodiment of the disclosure; Figure 8 This is a flowchart illustrating some steps of another mental health intervention method based on multi-agent collaboration provided in this embodiment of the disclosure; Figure 9 This is a schematic diagram of the structure of a mental health intervention system based on multi-agent collaboration provided in an embodiment of this disclosure; Figure 10 This is a block diagram of an electronic device used to implement the multi-agent collaborative mental health intervention method according to the embodiments of this disclosure. Detailed Implementation

[0012] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0013] A variety of AI-based mental health support products have emerged in the industry.

[0014] The first type is the emotional companionship intelligent agent, which engages in open dialogue with users through anthropomorphic AI (Artificial Intelligence) characters (such as cartoon animals), and uses NLP (Natural Language Processing) and affective computing technologies to provide empathetic responses and generate simple emotion analysis reports.

[0015] These products aim to meet users' immediate need for emotional expression, but their interaction usually remains at the level of generalized comfort and support, lacking structured and professional guidance for specific psychological mechanisms (such as trauma processing), and the depth of intervention is limited, often "treating the symptoms but not the root cause".

[0016] The second category is AI-powered companion hardware, such as bionic robots or smart devices. These provide a sense of physical companionship through multimodal sensors and anthropomorphic interaction, primarily serving children, the elderly, or users seeking immersive emotional support. However, the functionality of these hardware products focuses on emotional companionship and interactive entertainment, making it difficult to implement professional psychological intervention processes that require complex cognitive engagement and narrative reconstruction.

[0017] The third category consists of comprehensive AI-powered psychological service platforms, which integrate services such as psychological testing, emotion assessment, and dialogue tools based on cognitive behavioral therapy. While these platforms incorporate more psychological models, their AI interaction modules are typically part of a standardized toolkit, resulting in relatively generic dialogue processes. They fail to deeply integrate specific intervention techniques that require highly personalized guidance and contextual coherence, such as expressive writing and narrative therapy.

[0018] In particular, for childhood traumas originating from specific cultural backgrounds, such as East Asian cultural backgrounds and closely related to "shame," existing products generally lack culturally adapted intervention strategies and knowledge systems, making it difficult to guide users to safely and effectively complete the deep process from trauma exposure to emotional integration.

[0019] At the technical architecture level, existing AI-assisted mental health products mostly employ a single dialogue model or a simple task pipeline. This architecture has significant limitations when handling complex mental health intervention tasks: 1. Lack of refined task decomposition and scheduling: When faced with user input text that mixes factual statements and emotional expressions, the system struggles to perform accurate classification, scenario analysis, and intent recognition, resulting in a lack of targeted responses.

[0020] 2. Low integration of professional knowledge: The intervention process is difficult to dynamically and accurately call upon the structured psychological professional knowledge base (such as trauma intervention cases and expressive writing examples), resulting in insufficient professionalism and effectiveness of guidance.

[0021] 3. Limited interaction modes: Most are limited to the dialogue mode of "user asks questions - AI responds", failing to innovatively position AI as a "guide" to actively guide users to complete cognitive reconstruction tasks with therapeutic effects through multi-path and structured methods (such as text correction and narrative continuation).

[0022] 4. Insufficient system controllability and security: The system lacks access control over the internal processing flow of AI, making it difficult to ensure the consistent execution of intervention strategies. It also lacks integrated real-time risk warning and enhanced privacy protection mechanisms.

[0023] The text processing method based on multi-agent collaboration, the mental health intervention system based on multi-agent collaboration, the electronic device, and the computer-readable storage medium provided in the embodiments of this disclosure are intended to solve at least one of the above-mentioned technical problems of the prior art.

[0024] The text processing method based on multi-agent collaboration provided in this disclosure can be executed by electronic devices such as terminal devices or servers. Terminal devices can be in-vehicle devices, user equipment (UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. The method can be implemented by a processor calling computer-readable program instructions stored in memory. Alternatively, the method can be executed by a server.

[0025] The text processing method based on multi-agent collaboration provided in this disclosure is applied to mental health intervention scenarios. It aims to assist users, especially those with childhood psychological trauma, in engaging in expressive writing with lower psychological stress through structured guidance, thereby promoting emotional integration and cognitive reconstruction.

[0026] Among them, multi-agent collaboration refers to a system paradigm in which multiple artificial intelligence modules (agents) with specific functions cooperate with each other to complete complex tasks.

[0027] Specifically, the text processing method based on multi-agent collaboration provided in this disclosure can be used in a hierarchical architecture for context access permissions, consisting of multiple agents such as a scheduling agent, a first processing agent, and a second processing agent. In this hierarchical architecture, each agent performs its own function and collaborates through information transmission and permission rules.

[0028] In artificial intelligence systems, context refers to the historical information, intermediate states, and instructions that an agent can refer to when processing a task. The hierarchical context access permission in this disclosure refers to setting differentiated context reading ranges for agents with different functions, forming a hierarchical constraint that "high-privilege agents can access the output of low-privilege agents, but low-privilege agents cannot access the internal decision-making logic of high-privilege agents," thereby ensuring the controllability of the intervention process and information security.

[0029] In this embodiment of the disclosure, the scheduling agent, as the core scheduling unit of the multi-agent collaborative system, is responsible for coordinating the task allocation of text classification, scene analysis, intent recognition, knowledge base query and processing agents, and is configured to access the output context of the first processing agent and the second processing agent.

[0030] The first processing agent, dedicated to correcting negative emotional expressions, has its core function of reconstructing negative text fragments in user input into positive guiding content based on professional intervention knowledge. Access to the internal decision-making context of the scheduling agent is restricted.

[0031] The second processing agent, designed specifically for guiding expressive writing, has its core function of generating continuation suggestions based on the narrative clues in the user's text to encourage users to deepen their emotional expression. It is also restricted from accessing the internal decision-making context of the scheduling agent.

[0032] In other words, compared to the first and second processing agents, the scheduling agent acts as a "commander" and is a "high-authority agent".

[0033] Figure 1 A flowchart illustrating a text processing method based on multi-agent collaboration provided in an embodiment of this disclosure is shown. Figure 1 As shown in the embodiments of this disclosure, the text processing method based on multi-agent cooperation may include the following steps: S110, Receive natural language input text from the user.

[0034] Specifically, natural language text input by users describing their past experiences or current feelings can be received through text interaction interfaces (such as web page input boxes or APP dialogue windows). The text format is not limited (it can include various forms such as narrative, emotional expression, and questions), and may contain both objective factual descriptions and subjective emotional expressions.

[0035] The input text is transmitted to the scheduling agent after being processed by standardization (such as removing special characters and unifying the encoding format).

[0036] S120. The input text is analyzed and processed using a scheduling agent. The analysis and processing include: classifying the input text into emotional content and factual content; performing scene analysis and intent recognition based on the classification results; and querying a professional knowledge base in the field of mental health intervention based on the recognition results to obtain relevant knowledge on intervention strategies.

[0037] This step is the decision-making center, aiming to deeply understand user input and retrieve the most suitable professional knowledge. Its specific implementation includes three sub-steps: 1. Categorization of Emotional Content and Factual Content: The scheduling agent invokes multiple internal or related sub-agents (such as behavior analysis agent, scene analysis agent, and intent analysis agent) to perform sentence-by-sentence or segment-by-segment analysis on the input text.

[0038] First, the behavioral analysis agent is invoked to distinguish between emotional content and factual content in the text.

[0039] Specifically, behavioral analysis agents can use natural language processing models to segment and classify input text by identifying emotional keywords (such as "pain", "helplessness", "anger") and entity keywords (such as time "childhood", place "family", event "being criticized"), clearly distinguishing between emotional content text segments and factual content text segments.

[0040] In some possible implementations, the classification results are fed back to the scheduling agent in real time, so that the scheduling agent can then feed back the classification results to the scene analysis agent and the intent analysis agent.

[0041] In some possible implementations, behavior analysis agents, scene analysis agents, and intent analysis agents can be incorporated into a hierarchical architecture with layered context access permissions. The behavior analysis agent, acting as a "low-privilege agent," can have its classification results acquired by the behavior analysis agent and scene analysis agent, which act as "high-privilege agents."

[0042] However, the authority levels of agents such as behavior analysis agents, scene analysis agents, and intent analysis agents are lower than those of the first and second processing agents, and naturally also lower than those of the scheduling agent. Therefore, the scheduling agent, the first processing agent, and the second processing agent can obtain the classification results output by the behavior analysis agent.

[0043] 2. Scene Analysis and Intent Recognition If the classification result is a factual text fragment, the scheduling agent calls the scene analysis agent to generate a structured scene analysis result (such as "Scene: Family environment during childhood, Event: Being severely criticized by parents for poor grades") by parsing elements such as time, place, relationships between people, and event background in the text. The scene can include school (toilet, classroom, corner, playground), home, other open places, other enclosed places, etc.

[0044] If the classification result is an emotional content text fragment, the scheduling agent calls the intent analysis agent. Combining the scene analysis results, the agent determines the user's corresponding mental health intervention problem type by matching the mental health intervention problem type tag library (such as "domestic violence", "emotional neglect", "school bullying", "difficulty in letting go" and "other categories").

[0045] 3. Professional knowledge base query Retrieve and return relevant knowledge of intervention strategies that have the highest semantic match with the current user context from the professional knowledge base.

[0046] In some possible implementations, a structured query request can be generated based on the identified problem types and key elements in the scenario analysis results. This request can then be sent to a pre-built professional knowledge base for mental health intervention, where relevant knowledge about intervention strategies can be obtained through the query and transmitted to the subsequent processing agent.

[0047] In some possible implementations, the key elements in the determined problem type and scenario analysis results can be vector-encoded to generate a joint query vector. The joint query vector is then input into a professional knowledge base for mental health intervention. Relevant knowledge entries are retrieved using a similarity matching algorithm (such as cosine similarity) and transmitted to the subsequent processing agent as knowledge related to intervention strategies.

[0048] In some possible implementations, the above query process can be performed by an intent analysis agent.

[0049] The intervention strategy-related knowledge acquired is not a statement directly given to the user, but a "strategy blueprint" used to guide subsequent guidance operations. It is a set of structured information or instructions, specifically a series of rules, templates, examples, or meta-instructions that guide AI on how to generate guidance content.

[0050] In some possible implementations, a professional knowledge base in the field of mental health intervention is constructed using RAG (Retrieval-augmented Generation) technology. Its knowledge sources include, but are not limited to: clinical psychology literature, verified healing dialogue records, expressive writing examples, and trauma intervention case libraries for specific cultural contexts (such as East Asian culture), providing professional knowledge support for intervention operations.

[0051] In some possible implementations, knowledge related to the intervention strategy can be fed back to the scheduling agent in real time, so that the scheduling agent can feed back the classification results to the first processing agent and the second processing agent.

[0052] In some possible implementations, the scene analysis agent and the intent analysis agent can be incorporated into a hierarchical architecture with layered context access permissions. The permission levels of these agents are set to be lower than those of the first and second processing agents, and naturally, lower than those of the scheduling agent. Therefore, the first and second processing agents can access the scheduling agent.

[0053] S130. Based on the acquired knowledge of the intervention strategy, perform at least one guiding operation: Operation A: Using the first processing agent, semantically correct the segments in the input text that are identified as containing negative emotional expressions, and generate positive guidance text; Operation B: Using a second processing agent, generate continuation suggestion text to promote expressive writing based on the narrative clues of the input text.

[0054] Based on the acquired knowledge of the intervention strategy, at least one guidance operation is performed. That is, this embodiment does not engage in open-ended dialogue, but rather proactively initiates a structured guidance task based on strategy knowledge, specifically divided into two operation paths that can be executed in parallel or selectively: Operation A (Semantic Correction Guidance): This operation is performed by the first processing agent. When a fragment containing negative emotional expressions (such as "I am such a useless person") is identified in the input text, the first processing agent performs semantic reconstruction on the fragment based on the acquired intervention strategy-related knowledge (e.g., "self-deprecation needs to be transformed into a statement of self-compassion").

[0055] The implementation method can be as follows: extract the positive guidance principle from the relevant knowledge of intervention strategies, match a positive expression template (such as "I felt powerless at that time, but that does not mean I was bad") from the standardized script library of psychological counselors according to the strategy guidance, replace and polish the original negative paragraphs, and finally generate positive guidance text, which is presented to the user in the form of pop-up or underline.

[0056] Operation B (Narrative Continuation Guidance): This operation is performed by the second processing agent. Its purpose is to encourage the user to continue their narrative and deepen their expression. Based on acquired intervention strategy-related knowledge (e.g., "The user is describing the beginning of a traumatic event and needs guidance to expand on sensory details"), the second processing agent analyzes the narrative clues in the input text. According to the strategy, it selects a suitable narrative framework from the "Expressive Writing Example Library" and uses Chain-of-Thought Prompt technology to generate a specific, open-ended continuation suggestion text.

[0057] The implementation can be achieved by: analyzing the narrative structure (such as "event-emotion-question") and emotional thread (such as from "suppression" to "confusion") of the input text to determine the continuation writing guidance strategy (such as "encouraging the addition of specific feelings" and "guiding the sorting out of the impact of the event"); retrieving suitable narrative frameworks from the expressive writing example library; using mind chain prompting technology and combining the context of the input text to generate continuation writing suggestions for users to refer to or adopt with one click.

[0058] The generated positive guidance text aims to transform users' negative, self-deprecating expressions into neutral or positive suggestions with a sense of self-compassion. The continuation suggestion text aims to encourage users to continue writing, expand on details, and further release emotions and organize thoughts through words, based on their existing narratives, by asking questions or providing openings.

[0059] In the text processing method based on multi-agent collaboration provided in this disclosure, by scheduling agents to perform fine-grained emotion / fact classification, scene analysis, and intent recognition on user input, and dynamically retrieving a structured professional knowledge base, the agent's guidance can be tailored to specific needs. This upgrades the approach from generalized empathetic responses to highly customized intervention strategies based on psychological evidence and specific cultural contexts, significantly improving the scientific rigor and effectiveness of the intervention. The agent is also repositioned from a "speaker" to a "guide" or "collaborator," helping users overcome expression barriers through two proactive and structured guidance operations: "semantic correction" and "narrative continuation." In particular, by simulating facilitation techniques in expressive writing therapy through "continuation suggestions" and conducting real-time cognitive reconstruction through "positive guidance," a novel, low-stress, and highly participatory digital psychological intervention experience is provided.

[0060] Meanwhile, as described above, the scheduling agent, the first processing agent, and the second processing agent in this embodiment of the present disclosure implement hierarchical context access control through a preset permission configuration file: The scheduling agent's permissions are configured to "read all associated agent output contexts", which allows it to obtain in real time the classification results of the behavior analysis agent, the parsing results of the scene analysis agent, the recognition results of the intent analysis agent, and the output text of the first and second processing agents for process optimization and anomaly adjustment.

[0061] The permissions of the first and second processing agents are configured as "only the output context of the behavior analysis agent, the scene analysis agent, and the intent analysis agent can be read". Therefore, they can obtain the classification results of the behavior analysis agent, the parsing results of the scene analysis agent, the recognition results of the intent analysis agent, and knowledge related to the intervention strategy. However, they cannot access the internal decision-making logic of the scheduling agent (such as agent call priority and knowledge base retrieval weight settings) to avoid irrelevant information from interfering with the processing results.

[0062] In other words, the scheduling agent, acting as a high-level coordinator, is configured to access and read the output context of the first and second processing agents (i.e., the draft guidance texts or intermediate results they generate) for global coordination and policy fine-tuning. Conversely, the first and second processing agents, acting as task execution units, have strictly limited access permissions and cannot read the internal decision context of the scheduling agent.

[0063] This access control design separates "decision-making" from "execution," ensuring the closed and secure nature of the core decision-making logic, guaranteeing that the guidance content strictly follows professional strategies, preventing the behavior of execution units from deviating from the established strategies, and making the behavior of the entire system more controllable, predictable, and auditable.

[0064] This is similar to a medical team: experts (scheduling agents) develop treatment plans (intervention strategies) based on a comprehensive diagnosis (analysis and processing), and nurses (processing agents) strictly execute specific nursing procedures (generating guidance text). Nurses do not need to know the entire reasoning process of the experts' decisions, but the experts need to supervise whether the nursing procedures conform to the plan.

[0065] A strict permission architecture is itself a form of security design. It also provides a natural foundation for integrating real-time risk warnings (such as monitoring high-risk words) and advanced privacy protections (such as permission-based data access control), which can better protect users' psychological and data security and comply with the ethical norms of mental health services.

[0066] The text processing method provided in the embodiments of this disclosure will be described in detail below.

[0067] Figure 2 The diagram illustrates a process for classifying input text into sentiment and factual content, and then performing scene analysis and intent recognition based on the classification results. Figure 2As shown, the following steps may be included: S210. Invoke the behavior analysis agent to classify the input text to distinguish between the text portion containing emotional content and the text portion containing factual content.

[0068] Among them, the behavior analysis agent is an agent specifically designed to distinguish between emotional content and factual content in text. It is based on pre-trained natural language processing models, such as BERT (Bidirectional Encoder Representations from Transformers), and sentiment computing technology. It achieves text classification by recognizing keyword features, which is the foundation for subsequent scene analysis and intent recognition.

[0069] The scheduling agent sends the user input text and classification instructions to the behavior analysis agent. The behavior analysis agent loads the pre-trained text classification model, identifies sentiment keywords and entity keywords in the text, performs semantic judgment on the overall text, and outputs the classification result of "sentimental content text" or "factual content text", which is then synchronously fed back to the scheduling agent.

[0070] Figure 3 This diagram illustrates a specific implementation of a behavior analysis agent classifying input text to distinguish between emotional and factual content. Figure 3 As shown, the following steps may be included: S310. Perform sentence segmentation on the input text to obtain multiple text sentences.

[0071] Sentence segmentation of the input text can be achieved by breaking down the complete text entered by the user into the smallest semantic units based on punctuation marks (period, comma, exclamation mark, etc.). For example, "I was often bullied by my classmates when I was a child and I was very scared" can be broken down into two sentences: "I was often bullied by my classmates when I was a child" and "I was very scared", thus achieving refined classification.

[0072] In other words, after the behavior analysis agent receives the user input text transmitted by the scheduling agent, it first performs sentence segmentation, splitting the complete text into multiple independent text sentences to ensure that the classification granularity is refined to the smallest semantic unit.

[0073] S320. Identify entity keywords and sentiment keywords from multiple text sentences.

[0074] Entity keywords are core words representing factual information, including time, place, event, and people, and are the core basis for judging factual content. Emotional keywords are core words representing emotional states, including negative and positive emotion words, and are the core basis for judging emotional content.

[0075] For each text unit, the behavior analysis agent performs two analyses simultaneously: 1. Entity recognition and fact extraction: Identify entities such as names, locations, times, and objects in the sentence, and determine whether the sentence describes an objectively occurring or existing event or state; 2. Identification of emotional keywords and expression patterns: Identify obvious emotional words, emotional intensity modifiers, and self-negating sentence patterns.

[0076] Specifically, identifying entity keywords and sentiment keywords from multiple text sentences can be achieved using keyword extraction algorithms in natural language processing, such as TF-IDF combined with sentiment dictionary matching, to identify entity keywords and sentiment keywords from each text sentence.

[0077] Entity keywords are determined by matching a pre-defined "fact element dictionary" (containing categories such as time, place, and event), while sentiment keywords are determined by matching a Chinese sentiment dictionary. The recognition results are labeled with the type of each keyword.

[0078] S330. Based on multiple text sentences and identified keywords, a behavioral analysis agent is used for classification to distinguish between text sentences containing emotional content and text sentences containing factual content.

[0079] In some possible implementations, the behavior analysis agent classifies sentences based on the distribution of keywords: if a sentence contains only entity keywords and no sentiment keywords, it is determined to be a "factual text sentence"; if a sentence contains sentiment keywords (regardless of whether it contains entity keywords), it is determined to be a "sentimental text sentence".

[0080] After classification is completed, the sentence classification results and the corresponding keyword list can be fed back to the scheduling agent.

[0081] The above method achieves sentence-level sentiment / fact classification, avoiding the "ambiguity in judging mixed sentiment and factual content" problem caused by the "whole text classification" of related technologies. It is especially suitable for scenarios where "factual narration and emotional expression alternate" when users write letters. Through the accurate identification of entity and sentiment keywords, it provides a clear basis for the classification results, improves the classification accuracy, and reduces "false positives" and "false negatives".

[0082] The above is just an example of how a behavior analysis agent classifies input text. This disclosure does not limit the specific implementation of the behavior analysis agent classifying input text. Any method that can classify input text is within the protection scope of this disclosure.

[0083] S220. If the classification result is the text portion of the factual content, then the scene analysis agent is invoked to analyze the time, location, and environmental elements of the factual content to obtain the scene analysis result.

[0084] If the classification result is factual content text, the scheduling agent activates the scene analysis agent, and inputs the factual text and relevant information from the user's historical interactions (such as the previously mentioned keywords such as "childhood" and "family") into the scene analysis agent. The scene analysis agent can extract the core elements that constitute the psychological event scene from the text through named entity recognition technology, and integrate these elements to generate a structured scene analysis result.

[0085] The core elements may include: time element: the specific time point, period or age group in which the event occurred; space element: the location and environmental characteristics of the event; interpersonal relationship element: the people involved and their relationship with the user; and behavioral sequence element: the key actions or processes of the event.

[0086] S230. If the classification result is the text portion of emotional content, then call the intent analysis agent and, in conjunction with the scene analysis results, determine the type of mental health intervention problem corresponding to the emotional content.

[0087] If the classification result is sentiment content text, the scheduling agent calls the intent analysis agent, and simultaneously inputs the scene analysis result (if there is factual content pre-analysis) and sentiment text fragments. The intent analysis agent does not analyze sentiment words in isolation, but closely combines the scene analysis result generated by S220. Through semantic matching (jointly semantically encoding sentiment content and scene elements to generate feature vectors, and performing similarity matching with the mental health intervention problem type label library) or classification model, it finally outputs a clear mental health intervention problem type and feeds it back to the scheduling agent.

[0088] By combining the results of scene analysis, the intention analysis provides contextual support for the scene parsing of factual content to the recognition of emotional intentions, which solves the problem of "detachment from the scene and one-sided judgment" in single intention recognition. It is especially suitable for the "strong scene correlation" characteristic of East Asian childhood trauma (such as the same critical behavior, family scene and school scene correspond to different trauma types).

[0089] Through the above implementation, the embodiments of this disclosure achieve a refined and structured understanding of user input, decompose general text into "emotion" and "facts", and enable the scene analysis agent and the intent analysis agent to work together, so that the system can more accurately grasp the "surface content" and "deep psychological needs" of the user's narrative, providing a reliable basis for subsequent accurate knowledge retrieval and intervention strategy formulation, and avoiding the deviation or information loss that may occur when a single model performs end-to-end understanding.

[0090] As mentioned above, knowledge related to intervention strategies can be obtained by generating structured query requests or by generating joint query vectors. This step can be performed by an intent analysis agent.

[0091] Figure 4 This diagram illustrates a flowchart of an implementation method for generating a joint query vector based on the recognition results, querying a professional knowledge base in the field of mental health intervention, and obtaining knowledge related to intervention strategies. Figure 4 As shown, the following steps may be included: S410. Use the identified problem type and key elements from the scenario analysis results as the joint query vector.

[0092] The "question type" obtained from intent recognition and the "key elements" in the scene analysis results are semantically encoded to obtain a joint query vector. The joint query vector integrates the core intent and the scene context and is the core carrier for achieving accurate knowledge base retrieval.

[0093] Specifically, the intent analysis agent can combine the "question type" obtained from intent analysis with the key elements in the scene analysis results into a unified text, and then perform semantic encoding on the text to generate a high-dimensional joint query vector, ensuring that the vector can simultaneously represent the core intent and scene details.

[0094] S420. Input the joint query vector into a pre-built professional knowledge base in the field of mental health intervention for retrieval, and obtain knowledge entries that match the joint query vector as knowledge related to intervention strategies; Among them, the professional knowledge base in the field of mental health intervention should include at least a knowledge base of childhood trauma cases and intervention strategies based on specific cultural backgrounds.

[0095] A knowledge base of childhood trauma cases and intervention strategies in a specific cultural context can be a segmented knowledge base built on RAG technology. Its core content includes real cases of childhood trauma in the context of East Asian culture, intervention principles adapted to cultural characteristics (such as avoiding the cultural taboo of "direct confession"), and targeted communication templates. This is the core feature that distinguishes it from general mental health knowledge bases.

[0096] Knowledge entries are structured data units stored in the knowledge base. Each entry can contain fields such as "problem type label - scenario characteristics - intervention strategy - dialogue example", such as "criticism and negativity type - family scenario - strengthening self-acceptance - dialogue: The criticism at that time was not your fault, you have done your best at that time".

[0097] Specifically, the intent analysis agent inputs the joint query vector into a professional knowledge base for mental health intervention pre-built based on RAG technology. This knowledge base includes a "Knowledge Base of East Asian Childhood Trauma Cases and Intervention Strategies". The intent analysis agent uses a cosine similarity algorithm to compare the joint query vector with the vectors of all knowledge entries in the knowledge base, and selects the top N (N is a positive integer) knowledge entries with the highest similarity to form preliminary search results. The preliminary results are then sorted a second time, prioritizing the retention of entries with strong "adaptability to East Asian culture" and "targeting of intervention strategies". Finally, a preset number of core knowledge entries are output as intervention strategy-related knowledge and transmitted to the first and second processing agents.

[0098] By integrating "problem type + scenario elements" into a joint query vector, the problem of "missed detection" and "false detection" in single-keyword searches is avoided, which is especially suitable for the characteristic of childhood trauma that "different intervention strategies are needed for the same problem type in different scenarios". At the same time, the core knowledge base focuses on "childhood trauma in specific cultural contexts", and the search results avoid the "cultural disconnect" defect of general knowledge bases, making the intervention strategies more acceptable to users.

[0099] In some possible implementations, the keywords obtained in step S320 can also be used to acquire knowledge related to intervention strategies.

[0100] The identified keywords will be used as the basis for the search, and a pre-built professional knowledge base in the field of mental health intervention will be searched to obtain background knowledge items related to the keywords as knowledge related to intervention strategies.

[0101] Specifically, the scheduling agent extracts all identified keywords, concatenates them into a search keyword string, inputs it into a professional knowledge base for mental health intervention, and retrieves background knowledge entries related to the keywords based on a keyword matching algorithm. These entries are then used as supplementary knowledge related to intervention strategies and are synchronously transmitted to the first and second processing agents.

[0102] Among them, the background knowledge entries are supplementary knowledge related to the keywords retrieved from the professional knowledge base, including the trauma types, common effects, and basic intervention principles corresponding to the keywords, which can be used to provide contextual support for subsequent intervention operations.

[0103] Background knowledge based on keyword retrieval provides contextual support for subsequent intervention operations, solving the deficiency of "relying solely on classification results without in-depth knowledge", making subsequent correction and continuation guidance of negative content more targeted (e.g., the keyword "being bullied" corresponds to school bullying-related rhetoric, rather than general comforting content).

[0104] As mentioned above, in some possible implementations, scene analysis agents and intent analysis agents can also be incorporated into a hierarchical architecture with layered context access permissions.

[0105] The intent analysis agent, behavior analysis agent, and scene analysis agent are all configured to only access the context related to their own tasks; the scheduling agent, the first processing agent, and the second processing agent are configured to be able to read the output context of the intent analysis agent, behavior analysis agent, and scene analysis agent.

[0106] The context related to a task refers to the core data and intermediate results generated or relied upon by each analytical agent when performing its own task, excluding the decision logic of other agents, undisclosed knowledge base details, or cross-task irrelevant information.

[0107] For example, the context of a behavior analysis agent is the text segmentation results and entity / sentiment keyword recognition records; the context of a scene analysis agent is the parsed data of time / location / environmental elements; and the context of an intent analysis agent is the question type matching criteria and label matching scores.

[0108] The output context refers to the structured results data output by each analytical agent after completing its task. It serves as the core input for subsequent tasks executed by the agent and may also include internal algorithmic logic, parameter configurations, or temporary computational data. For example, the output context of a behavior analysis agent might be a "list of sentiment content sentences + list of factual content sentences," the output context of a scene analysis agent might be a structured dictionary of scene elements, and the output context of an intent analysis agent might be a clearly defined type of mental health intervention question and its matching confidence level.

[0109] Specifically, during architecture initialization, explicit context access permission rules can be set for each agent through a permission configuration file. This file is stored in JSON format and associates the agent's unique identifier with its permission scope. The specific configuration is as follows: Behavior analysis agent, scene analysis agent, intent analysis agent: The permission type is set to "access only to its own task context". The allowed context fields to be read are limited to "its own task input data (such as user text fragments, summary of previous analysis results) + its own task output cache". Access to the internal decision data of other agents (such as the agent call priority of the scheduling agent and the positive guidance strategy weight of the first processing agent) is prohibited. Scheduling agent: The permission type is set to "Full output context access" to allow reading the output context of the behavior analysis, scene analysis, and intent analysis agents, while retaining exclusive access to its own internal decision context (such as task allocation logic and knowledge base retrieval weight settings); First processing agent (negative content correction), second processing agent (continuation suggestion generation): permission type is set to "analysis agent output context access", only allowing reading of the output context of the above three analysis agents, and prohibiting access to the internal decision data of the scheduling agent and the task execution details of other processing agents (such as the first processing agent cannot read the continuation framework selection logic of the second processing agent).

[0110] During task execution, each analytical agent completes the task based solely on the context within its own scope of authority: After receiving user text, the behavior analysis agent only calls upon its own task-related context (text segmentation tool, keyword recognition model parameters) for classification, generates output context, and stores it in a public data buffer; the scene analysis agent only reads the output context (factual content segmentation) of the behavior analysis agent, combines it with its own task-related scene element dictionary to complete parsing, and does not access the classification algorithm logic of the behavior analysis agent; the intent analysis agent only reads the output context (emotional content segmentation) of the behavior analysis agent and the output context (structured scene elements) of the scene analysis agent, and completes recognition based on its own task-related question type tag library; The scheduling agent reads the output context of the three analysis agents through the common data buffer, and assigns tasks to the first and second processing agents in combination with its own internal decision-making logic (such as task priority and agent load status). The first and second processing agents only obtain the output context of the analysis agents from the common data buffer, and perform correction or continuation tasks in combination with the relevant knowledge of the intervention strategy. They cannot access the internal data of other agents outside the common data buffer. The system has a built-in access interception mechanism. If an agent attempts to access a context outside its access permission scope (such as a behavior analysis agent attempting to read the decision parameters of a scheduling agent), the interception module will immediately block the access request and generate an access exception log to ensure the rigid execution of access control.

[0111] In some possible implementations, the context data of each agent is isolated using a "partitioned storage + access key" mechanism: the output context of the analysis agent is stored in a public data partition, and only authorized agents (scheduling agent, first processing agent, and second processing agent) hold access keys; the internal decision context of the scheduling agent is stored in a dedicated encrypted partition, without access keys from other agents, thus ensuring the boundary of permissions at the physical storage level.

[0112] By limiting the analytical agent to access only the context relevant to its own task, it prevents cross-task irrelevant information (such as the decision logic of the scheduling agent and the continuation framework of the processing agent) from interfering with its core tasks (classification, scene parsing, and intent recognition). This is especially suitable for East Asian childhood trauma text processing, which requires accurate extraction of scene and emotional core, and reduces analytical bias caused by irrelevant information.

[0113] The internal decision-making context of the scheduling agent is isolated from the sensitive processing data (such as user trauma-related text fragments) of the analysis agent, avoiding the leakage of core decision-making logic and the spread of user privacy data. It also effectively prevents potential error propagation, data leakage, or manipulation of the entire architecture by maliciously injected prompts. Even if a certain agent (such as the intent analysis agent) has a temporary deviation, its impact is isolated and will not pollute the core decision-making logic of the scheduling agent. This aligns with the design of the "privacy protection mechanism" and solves the defect of "data security risks caused by chaotic permissions" in existing multi-agent systems.

[0114] Meanwhile, clearly defined permission boundaries reduce interaction conflicts between agents, making the "classification-analysis-correction-resume writing" process smoother and adapting to the interaction requirements of real-time guidance and low-latency response. It also ensures that each agent has a single function and a clear interface, facilitating independent development, testing, optimization, and replacement. For example, the model of the scene analysis agent can be upgraded without affecting other modules.

[0115] Figure 5 The diagram illustrates a flowchart of one implementation method that utilizes a first processing agent to semantically correct segments of input text identified as containing negative emotional expressions, thereby generating positive guidance text. Figure 5 As shown, the following steps may be included: S510, the first processing agent receives knowledge related to intervention strategies.

[0116] Among them, the first processing agent is an agent specifically designed for semantic correction of negative emotional expression fragments. Its core is based on positive psychology theory and intervention strategies adapted to East Asian culture, generating positive guidance text without changing the user's original narrative logic, only optimizing the emotional expression direction.

[0117] The first processing agent acquires intervention strategy-related knowledge from the scheduling agent, retrieved from a professional knowledge base. This knowledge consists of conclusive instructions obtained by the scheduling agent after comprehensive analysis of user intent and scenario. From this, core correction principles (e.g., for trauma from school bullying, avoiding harsh guidance like "You have to be strong," and adopting an accepting expression like "Your fear is a normal reaction") and cultural adaptation requirements (e.g., avoiding direct confessions and self-disclosure-related statements) are extracted to form a clear basis for correction.

[0118] In some possible implementations, if the intent analysis agent is incorporated into a hierarchical architecture with hierarchical context access permissions, the first processing agent can also directly read the output context of the intent analysis agent and thus obtain knowledge related to the intervention strategy.

[0119] S520. Based on knowledge related to intervention strategies, determine the strategy orientation for semantic modification of negative emotional expression fragments.

[0120] Among them, the strategy orientation is the core direction of modification determined based on knowledge related to mental health intervention strategies, such as "strengthening self-acceptance", "weakening negative attribution", and "affirming the effort process". It needs to be adapted to the psychological characteristics of East Asian users with childhood trauma who "avoid being judged" and does not force positive expression.

[0121] In some possible implementations, the first processing agent parses the received knowledge related to the intervention strategy and extracts the specific correction target and policy rules from it.

[0122] For example, based on the knowledge mentioned above, the intelligent agent will clearly understand that the strategy for this correction is: 1. to identify and confirm the user's painful emotions (emotional confirmation); 2. to provide an alternative, more constructive perspective on self-awareness (cognitive reconstruction). This strategy serves as the meta-instruction for all subsequent operations of the first processing agent.

[0123] In some possible implementations, the first processing agent performs semantic parsing on the negative emotional expression fragments input by the user, and combines this with knowledge of intervention strategies to clarify the policy direction: If the negative segment is self-deprecating (such as "I am such a waste"), the strategy should be "affirm your own value + weaken absolute evaluation"; If the negative segment is of the helplessness type (such as "I can't do anything right"), the strategy orientation is "acknowledge the effort process + list potential abilities"; If the negative fragment is of the type of traumatic self-blame (such as "It's all my fault that I was bullied"), the strategy is to "remove self-attribution + clarify the boundaries of responsibility".

[0124] S530. Based on strategy orientation, semantically reconstruct negative emotion expression fragments to generate positive guidance text that conforms to the orientation of positive psychology.

[0125] Semantic reconstruction involves optimizing and adjusting negative expressions at the linguistic level while preserving the user's original emotional core and narrative background. This avoids abrupt replacements and ensures that the revised text conforms to the user's expression habits and is emotionally authentic.

[0126] Positive psychology is an intervention approach centered on accepting emotions, affirming values, and encouraging growth. It differs from the traditional model of denying negative emotions and aligns with the core principle of emotion validation in trauma intervention.

[0127] Positive guidance text is text that acknowledges the legitimacy of users' negative emotions while guiding them to see their own value or potential for growth.

[0128] The first processing agent operates on the identified "fragments of negative emotion" in the input text according to a predetermined policy. It does not perform simple synonym replacement, but rather deep semantic reconstruction.

[0129] This process may include: analyzing the semantic roles, emotional intensity, and underlying cognitive distortions of the original fragment; then, based on strategy guidance, generating one or more new expressions that are more positive, inclusive, and psychologically sound in terms of emotional tone and cognitive perspective. Finally, generating one or more positive guiding texts as suggestions for the user.

[0130] In some possible implementations, the first processing agent can load a language generation model adapted to East Asian culture and perform semantic reconstruction of negative fragments based on policy orientation. The first step is to retain the core facts and emotions (such as the experience of being "bullied" and the emotion of "fear"), without denying the user's true feelings; The second step is to replace negative descriptive words (such as "useless" to "you who are growing up" and "can't do anything right" to "haven't found a suitable method yet"). The third step is to supplement the content with appropriate guidance (such as adding expressions like "You were very brave to be able to silently endure it at that time" based on the characteristics of "subtle encouragement" in East Asian culture). The fourth step is to output positive guidance text, ensuring that the language style is consistent with the user's original writing style (e.g., if the user's language is concise, the revised text should not be verbose; if the user's expression is delicate, the revised text should retain the details).

[0131] The revised paradigm, based on strategic knowledge and deep semantic reconstruction, ensures that positive guidance is not merely mechanical, motivational encouragement, but rather a psychologically grounded and targeted cognitive intervention. It upgrades the agent from a "repeater" to a "cognitive coach," giving the guidance process therapeutic significance and significantly enhancing the professional depth and effectiveness of the intervention. Semantic reconstruction does not alter the user's original narrative logic and core emotions; it only optimizes the expression direction, avoiding situations where "the revised text deviates from the user's true feelings," allowing the user to feel "seen" rather than "rejected."

[0132] Figure 6 This diagram illustrates a process for semantically reconstructing negative emotion expressions based on a strategy-oriented approach to generate positive guidance text aligned with positive psychology principles. Figure 6 As shown, the following steps may be included: S610. Based on strategy orientation, retrieve positive expression templates that match the current expression of negative emotions from a pre-built standardized script library for psychological counselors.

[0133] The standardized script library for psychological counselors is a sub-library of a professional knowledge base built using RAG technology. It stores standardized scripts for trauma intervention adapted to East Asian cultures, covering various scenarios such as emotional acceptance, de-blaming, and self-affirmation. Each script has been reviewed by professional psychological counselors to ensure its scientific validity and suitability. It can also be a structured database storing a large number of positive expression templates validated by professional psychological counselors for different negative thought patterns. Each template is associated with specific strategy guidance and triggering keywords.

[0134] Positive expression templates are structured positive expression frameworks in the script library. They contain a fixed logic of "emotional recognition + value affirmation + guidance for growth", but leave room for users to fill in personalized content, such as "[emotional description] is a normal reaction. You have already achieved [positive behavior] in [specific scenario] and will gradually break through in the future as you grow."

[0135] The first processing agent, based on the "strategy orientation" determined by S620, initiates a query to a pre-built standardized script library for psychological counselors. By matching the keywords of the strategy orientation and the original negative passage, it retrieves one or more most suitable templates.

[0136] Specifically, a dual search logic of keyword matching and scene association is adopted. Keywords include negative emotion types and trauma scenarios. Templates labeled "East Asian cultural compatibility" are prioritized for matching. For example, templates that do not conform to cultural taboos, such as "boldly express your pain," are excluded, and templates with subtle expressions, such as "the predicament you are unwilling to mention requires great courage to face," are selected.

[0137] S620. Based on the positive expression template, semantic replacement and polishing of negative emotional expression fragments are performed to generate positive guidance text.

[0138] Semantic substitution and polishing, on the basis of positive expression templates, incorporates specific scenes, characters, and emotional details from the user's original text to make natural adjustments to the language, avoid the stiffness of templates, and ensure that the positive guidance text is consistent with the user's writing style.

[0139] The first processing agent uses the retrieved positive expression template as a "skeleton" and fills in the corresponding positions of the original negative fragment with elements (such as subject and specific event). Subsequently, the agent invokes its language generation capabilities to perform grammatical polishing, coherence adjustment, and tone fine-tuning on the filled-in sentence, ensuring that the final generated positive guidance text conforms to the professional framework of the template while also being natural and fluent.

[0140] Specifically, extract specific information from the user's original negative fragments and fill the reserved space in the positive expression template.

[0141] If the user uses colloquial expressions, maintain the colloquial style after polishing; if the user's expressions are more formal, maintain the rigor and delicacy after polishing; avoid using mandatory words such as "must" and "should," and use gentle guiding words such as "perhaps," "actually," and "already" to ensure that the text meets the ethical requirement of "respecting the user's rhythm" in trauma intervention.

[0142] The first processing agent can have a built-in "emotion authenticity verification" module (used to detect whether the user's original emotion is denied) and a "cultural compatibility verification" module (used to detect whether there are culturally taboo expressions). After the polished text is checked by the emotion authenticity verification module and the cultural compatibility verification module, it is output to the front-end interface as the final positive guidance text for the user to adopt.

[0143] Based on a standardized script library reviewed by professional psychological counselors, this avoids the pitfalls of related technologies such as "generalized comfort" and "unprofessional guidance," ensuring that positive guidance texts conform to the scientific norms of trauma intervention. Positive expression templates provide a fixed logical framework, while personalized polishing incorporates specific user information, resolving the contradiction between "rigid templates" and "lack of professional support for personalization," allowing users to experience personalized guidance. Automated template retrieval and semantic replacement processes reduce the cost of agent generation while ensuring that the guidance direction does not deviate from the intervention strategy, adapting to the interaction requirements of "real-time guidance and low-latency response."

[0144] Figure 7 The diagram illustrates a flowchart of one implementation method that utilizes a second processing agent to generate continuation suggestion text to promote expressive writing, based on narrative cues from the input text. Figure 7 As shown, the following steps may be included: S710, the second processing agent receives knowledge related to intervention strategies.

[0145] The second processing agent is specifically designed to generate suggested texts for continuing expressive writing. Based on expressive writing theory, it guides users to deepen their narratives and organize their emotions. It does not replace the user's expression but only provides exploratory guidance.

[0146] The second processing agent obtains knowledge related to intervention strategies from the scheduling agent and extracts narrative guidance, which may include principles for continuing the writing and expressive writing frameworks as a basis for continuing the writing.

[0147] In some possible implementations, if the intent analysis agent is incorporated into a hierarchical architecture with hierarchical context access permissions, the second processing agent can also directly read the output context of the intent analysis agent and thus obtain knowledge related to the intervention strategy.

[0148] S720. Based on knowledge related to intervention strategies, analyze the narrative structure and emotional context of the input text to form a continuation writing guidance strategy.

[0149] Narrative structure refers to the way user text is organized, such as "scene description + emotional expression" or "event summary + inner questions". Continuation suggestions should conform to this structure to avoid disrupting the user's narrative rhythm.

[0150] Emotional trajectory is the change in a user's emotions, such as "from suppression to release" or "from ambiguity to clarity." Continuation suggestions should follow this trajectory to guide users to further clarify any unexpressed emotions.

[0151] The continuation guidance strategy is a direction for continuation determined based on knowledge of intervention strategies and the characteristics of user narratives, such as "supplementing scene details", "deepening emotional feelings" and "exploring unexpressed needs", which is adapted to the East Asian user's habit of "subtle expression" and avoids excessive questioning.

[0152] The second processing agent first performs narratological analysis on the user's input text, identifying the current "story stage" (e.g., beginning, development, climax, stagnation), main characters, spatiotemporal context, and expressed emotional curves. Simultaneously, it analyzes the received intervention strategy-related knowledge. Combining these two aspects, the agent formulates a specific writing guidance strategy. This strategy clarifies the guidance objectives (e.g., "deepening sensory details"), focus (e.g., "describing the ambient sounds"), and suggested guiding phrases (e.g., open-ended questions).

[0153] Specifically, the second processing agent uses natural language processing technology to parse the user's input text: Narrative structure analysis: Identify text types (such as scene description, emotional expression, and event summary) and determine core narrative elements (time, place, characters, and core event). Emotional context analysis: By identifying emotional keywords (such as "sad", "fear", "wronged") and analyzing semantic intensity, the user's current emotional state and unexpressed emotional points are determined (such as the text only mentioning "bad things" without specifying the emotion, which is judged as "insufficient emotional expression").

[0154] Based on relevant knowledge of intervention strategies and the analysis results, a targeted continuation guidance strategy was determined: If the narrative structure is incomplete (e.g., only the event is mentioned without details), the strategy is to "supplement scene details to guide the narrative"; If the emotional context is vague (e.g., only saying "sad" without explaining why), the strategy is to "deeper the emotional experience and guide the reader's understanding." If the text reflects unmet needs (such as "My parents have never praised me"), the strategy is to "guide the exploration of needs expression".

[0155] S730. Based on the continuation writing guidance strategy, generate continuation writing suggestion text to guide users to continue the narrative and deepen emotional expression.

[0156] Among them, the continuation suggestion text is presented in the form of open-ended questions, scenario prompts, and detailed guidance, aiming to lower the threshold for users to express themselves.

[0157] Based on the writing guidance strategy formed by S620, the second processing agent generates specific writing suggestion text. This text is not a complete paragraph continuation, but a guiding prompt, question, or opening sentence, designed to "scaffold" the writing process and reduce the cognitive load and emotional pressure on the user to continue writing.

[0158] Specifically, the second processing agent retrieves suitable guiding sentence templates from the expressive writing library and generates continuation suggestion text based on the user's narrative logic: Use open-ended questions (avoid closed-ended "yes / no" questions); incorporate elements of the scenario already mentioned by the user to ensure the suggestions fit the narrative; control the length of the suggestion text to avoid being verbose and ensure that the user can quickly understand and respond.

[0159] By first conducting professional narrative and sentiment analysis, then developing a strategic guidance plan, and finally generating specific suggestions, this process ensures that the guidance always serves the core therapeutic goal of "promoting users' self-expression and exploration," effectively avoiding the problem of the agent overly dominating the narrative or deviating from the user's emotional trajectory.

[0160] Figure 8 The diagram illustrates a process for generating continuation suggestion text to guide users in continuing the narrative and deepening emotional expression, based on a continuation guidance strategy. Figure 8 As shown, the following steps may be included: S810. Based on the continuation writing guidance strategy, retrieve a suitable narrative framework from the pre-built library of expressive writing examples.

[0161] The Expressive Writing Examples Library is a sub-library of a professional knowledge base built on RAG technology. It stores expressive writing examples on trauma themes adapted to East Asian culture, covering various narrative frameworks such as "scene description", "emotional expression" and "self-dialogue". It is indexed by tags such as narrative techniques (e.g., sensory description, inner monologue, time jump) and themes (e.g., trauma, loss, growth). All examples have been de-identified to avoid disclosing the privacy of real cases.

[0162] A narrative framework is a structured template for expressive writing, containing a fixed paragraph logic such as "beginning (scene introduction) - development (details) - climax (emotional outburst) - ending (self-dialogue)". It does not restrict specific content, but only provides support for writing ideas.

[0163] Based on the continuation guidance strategy and user narrative structure formed by S720, the second processing agent initiates a query to a pre-built expressive writing example library. The second processing agent retrieves narrative frameworks or classic fragment structures that match the current guidance strategy and user story theme as references.

[0164] Specifically, the search keywords include continuation guidance strategy type, narrative structure type, and trauma scene tag; priority is given to "low-stress narrative frameworks", such as excluding the "forced confrontation with pain" framework and choosing the "bystander perspective description" framework, which is in line with the cultural psychology of East Asian users to "avoid self-exposure".

[0165] S820: Using mind chain prompting technology, based on the narrative framework and the context of the input text, generate suggested continuation text.

[0166] Among them, the thought chain prompting technology is a prompting word technology that guides the agent's reasoning step by step, so that the suggested text for continuing the writing follows the logical chain of "user's existing narrative - supplementing details - deepening emotions - exploring needs", ensuring that the suggestions are coherent and in line with the user's expression rhythm.

[0167] The second processing agent does not simply replicate the example, but uses thought chain prompting technology. It takes the retrieved narrative framework, the user's current text, and the continuation guidance strategy as input, requiring the large language model to perform step-by-step reasoning.

[0168] Specifically, the second processing agent combines the context of the user's input text and the narrative framework logic to construct a three-layered thought chain, Prompt: The first layer (current situation analysis): "The user's current text describes the scene of [ ], the emotional keyword is [ ], the narrative structure is incomplete, and it lacks environmental details and descriptions of inner feelings"; The second layer (guidance direction): "It is necessary to base it on the strategy of [ ] and follow the narrative framework logic of [ ]"; The third layer (expression requirements): "Use open-ended questions, use gentle language, avoid probing too deeply, conform to the implicit expression habits of East Asian culture, and do not use mandatory vocabulary."

[0169] The second processing agent inputs the thought chain Prompt into the content generation model, combines the narrative framework with the user context, and generates a continuation suggestion text: The content generation model is based on thought chain logic, first prompting environmental details, then guiding bodily sensations, and finally exploring inner expectations.

[0170] After generation, the system undergoes a "stress level check" to ensure that the suggestions do not exceed the user's psychological tolerance. If the system detects that the probing questions are too probing, it will automatically adjust to a gentler wording and finally output the suggested continuation text.

[0171] By combining an expressive writing example library with mind chain prompting technology, a high-level, intelligent writing guidance system has been achieved. This system enables the AI ​​agent to mimic the thinking patterns of professional writing therapists, providing guidance that not only explains the "what" but also the "why." This approach greatly enriches the dimensions and depth of guidance, stimulating deeper memories and emotions in users, and is a key technological support for enhancing user experience and therapeutic outcomes.

[0172] In some possible implementations, in the step of generating positive guidance text or continuing suggestion text, a mandatory structured output language is used to constrain the format and content of the text generation process of the first or second processing agent to ensure that the output text conforms to the predetermined mental health intervention guidance specifications.

[0173] In this embodiment of the disclosure, the forced structured output language specifically refers to SGLang (Structured Generation Language), which is a language tool that forcibly standardizes the text generation process of intelligent agents through preset syntax rules, field constraints and output format templates. Its core function is to ensure that the output content conforms to preset standards and avoid unstructured and non-standard expressions.

[0174] The pre-defined guidelines for mental health intervention are a set of standardized rules based on East Asian cultural adaptability, trauma intervention ethics, and expressive writing theory. They cover three dimensions: content boundaries, language style, and ethical constraints, and serve as the core guidelines for text generation.

[0175] Format constraints are mandatory requirements for the structure, paragraph division, and presentation of key information in the output text. For example, positive guidance text must include two fields: "emotional recognition + value affirmation," and continuation suggestion text must be presented only in the form of open-ended questions.

[0176] Content constraints are restrictive requirements on the core semantics and expression direction of the output text, such as prohibiting the use of mandatory words, prohibiting the denial of the user's original emotions, and prohibiting in-depth questioning that exceeds the boundaries of trauma intervention.

[0177] During initialization, based on preset mental health intervention guidance guidelines, SGLang's two-dimensional constraint rules (i.e., content constraint rules and format constraint rules) are defined and simultaneously embedded into the first and second processing agents: Content constraints may include: 1. Positive guidance texts must meet the semantic structure of "emotional recognition + value affirmation" and prohibit unilateral positive preaching; 2. Continuation suggestion texts must be limited to open-ended questions and prohibit closed-ended questions and deeply provocative follow-up questions; 3. All output texts must be adapted to the "subtle guidance" characteristics of East Asian culture and prohibit expressions that violate cultural taboos.

[0178] Formatting rules: 1. Positive guidance text should use a short sentence structure of "[emotional affirmation sentence] + [value affirmation sentence]", with each sentence not exceeding the preset word count to avoid being verbose; 2. Continuation suggestion text should use a fixed sentence structure of "question word + scene / emotional connection details", with each suggestion containing only one question to avoid overwhelming the user with multiple questions; 3. Sensitive words should be avoided in the text and replaced with appropriate expressions.

[0179] Configure SGLang's structured generation template for the first and second processing agents. When the agents generate text, SGLang uses a syntax parser to force verification that the output content matches the template structure. If the generated content is missing the "emotional approval" field (first processing agent) or uses a closed-ended question (second processing agent), SGLang will automatically block the output and trigger the agent to regenerate until it meets the template constraints.

[0180] After the initial text is generated using SGLang structured constraints, a dual verification mechanism is triggered: 1. Ethical Compliance Verification: Utilize the ethical rule base for mental health interventions to verify whether the text complies with the ethical requirements of "no judgment, no forced positive reinforcement, and respect for the user's pace" (e.g., check for forced expressions such as "You should be strong"). 2. Cultural Adaptation Verification: Compare with the East Asian cultural taboo word database and the norms of implicit expression, and correct expressions such as "direct confession" that do not conform to cultural habits.

[0181] If the verification fails, SGLang will output a correction prompt based on the error type to guide the agent to optimize the text. If the verification passes, it will generate the final positive guidance text or continuation suggestion text.

[0182] After the structured text is transmitted to the front end, it is displayed in a preset format. For example, positive guidance text is highlighted in green, and the "emotional recognition + value affirmation" is clearly presented in separate lines. The continuation suggestion text is displayed in the form of a "continuation suggestion" pop-up window, with each question occupying a separate line to ensure that users can understand it intuitively. At the same time, it is compatible with the front end's "one-click adoption with the Tab key" interaction logic without breaking the structured format.

[0183] By leveraging SGLang's mandatory structured constraints, all positive guidance and continuation suggestion texts are ensured to comply with trauma intervention norms and cultural adaptation requirements. This avoids the shortcomings of related technologies, such as "fragmented and unprofessional output content," providing users with a stable and reliable guidance experience. The content constraint rules strictly prohibit forced positive responses, provocative questioning, and other expressions that violate trauma intervention ethics, technically preventing "secondary harm." This aligns with "ethical constraints" and "risk warning mechanisms," resolving the core issue of "blurred ethical boundaries" in large-scale model-generated text.

[0184] The following is a detailed description of the hierarchical architecture with hierarchical context access permissions provided by the embodiments of this disclosure, which is the core implementation scheme of the embodiments of this disclosure at the system architecture and data infrastructure level.

[0185] Among some possible implementations, hierarchical architectures with hierarchical context access permissions include: Basic task agents have their context access permissions limited to contexts related to their own tasks. Short-term processing agents have context access permissions that include the output context of the basic task agent. The process scheduling agent has context access permissions that include the output context of the basic task agent and the short-term processing agent. The global policy agent has context access permissions including the context of the basic task agent, the short-term processing agent, and the process scheduling agent. Among them, the scheduling agent corresponds to the process scheduling agent or the global policy agent, and the first processing agent and the second processing agent correspond to the short-term processing agent.

[0186] In other words, the abstract "hierarchical architecture" is concretized into an implementation model containing four clearly defined logical levels, each with strictly defined context access permissions: Basic task agents: These correspond to agents for behavior analysis, scene analysis, and intent analysis. They are implemented as single-function, stateless atomic services. Their context access permissions are strictly limited: each agent can only receive the currently assigned task input (such as a text sentence) and process it based on its own built-in model or rules. It cannot be aware of the existence of other agents, access user history sessions, or obtain the system's global state. Its output is structured analysis results.

[0187] Short-term processing agents: These correspond to the first and second processing agents. They are implemented as services capable of performing slightly more complex tasks requiring short-term memory. Their context access permissions include: 1. Receive instructions and context from the upper layer (process scheduling agent); 2. It can read the output context of its direct subordinate layer (such as the intent analysis agent), i.e., the results of behavior analysis, etc. For example, the first processing agent can know the "problem type" determined by the intent analysis agent.

[0188] Process scheduling agent: This corresponds to the core scheduling agent. It is implemented as the system's process engine or orchestrator. Its context access permissions are more extensive. 1. It can call and read the output of all basic task agents; 2. It can read the intermediate states and final outputs of short-term processing agents; 3. Possess a complete view of the current task session and be responsible for generating the final "intervention strategy-related knowledge" based on the retrieval results from the professional knowledge base and distributing it to the short-term processing agent.

[0189] Global Policy Agent: This is an optional higher-level module that can be implemented as a monitoring, optimization, and long-term policy formulation module. It has the broadest context access permissions, enabling it to analyze patterns across sessions and users, evaluate the effectiveness of interventions, and dynamically inject optimized policy rules or parameters into the process scheduling agent, achieving system self-evolution.

[0190] Specifically, a "role-permission-resource" model is adopted for each agent, assigning a unique role identifier to each agent and binding it to the corresponding context access resources (basic task agent output, short-term processing agent output, and upper-level decision data).

[0191] Data is transmitted between different levels through a dedicated channel. The output context of the basic task agent is stored in the "public data pool", which can be read by the short-term processing agent, the process scheduling agent, and the global policy agent. The internal decision data of the process scheduling agent (such as agent call priority and retrieval weight) is stored in the "private decision pool", which can only be accessed by itself. The access channel of the global policy agent is closed by default and needs to be enabled by the administrator.

[0192] When an agent initiates a context access request, the permission control module verifies the match between its role identifier and the requested resource. If the verification passes, access is allowed; otherwise, interception is triggered and logs are recorded to ensure that the permission rules are strictly enforced.

[0193] After the user inputs text, the process scheduling agent (such as the scheduling agent) triggers the basic task agent to work. The behavior analysis agent first completes the text classification and stores the results in the public data pool. The scene analysis agent / intent analysis agent reads the classification results from the public data pool, completes scene parsing / intent recognition, and updates the output to the public data pool. The short-term processing agent (first processing agent / second processing agent) reads the output of the basic task agent from the public data pool and performs text processing in combination with the intervention strategy.

[0194] The process scheduling agent monitors data updates in the public data pool in real time, coordinates the execution order of each agent, and avoids task conflicts. If the global policy agent is enabled, it reads data from the public data pool and the private decision pool and outputs policy optimization suggestions periodically (such as adjusting the depth of follow-up questions in the continuation guidance).

[0195] This clear four-level model brings significant architectural advantages: 1. Access Control and Security Assurance It implements a strict hierarchical access control system from "atomic tasks" to "comprehensive decision-making," ensuring the secure isolation of sensitive data processing and analysis logic, and conforming to security design principles.

[0196] 2. Modularization and high cohesion Each layer has clearly defined responsibilities and interfaces, making the system easy to develop, test, deploy, and extend. For example, the algorithm of the "scenario analysis agent" can be upgraded independently without affecting the upper-layer scheduling logic.

[0197] 3. The explainability and auditability of the decision-making process Information flows from bottom to top, while decision-making flows from top to bottom, making the entire system's decision-making chain clear and traceable. The generation of any guiding output can be traced back to which basic task agent's analysis result it came from, which scheduling strategy it passed through, and which processing agent it triggered, greatly enhancing the system's transparency and credibility.

[0198] In some possible implementations, based on the aforementioned four-level architecture, two key middleware service agents can be introduced to optimize system resource utilization and achieve personalization.

[0199] In other words, the hierarchical architecture also includes multiple independent middleware service agents: The context compression agent is configured to compress and summarize the historical context in the basic task agent, short-term processing agent, process scheduling agent, or global policy agent. Long-term memory agents are configured to store, manage, and retrieve permanent knowledge, and to inject historical conclusions or user preference information relevant to the current task into process scheduling agents or global policy agents.

[0200] Specifically, the context compression agent is a service agent specifically responsible for optimizing computational and storage resources. As a dialogue or writing process progresses, the historical messages (context) of the flow scheduling agent or short-term processing agent will continuously grow, potentially exceeding the processing window of a large language model or impacting processing speed. The context compression agent is configured to compress and summarize these lengthy contexts in real time or periodically. For example, it can compress a user's self-narration of thousands of words into a summary of a hundred words that retains the core facts, sentiments, and appeals. This summary is injected back into the context, replacing or supplementing the original long text for subsequent decision-making, thereby significantly improving system efficiency while preserving key information.

[0201] The long-term memory agent is a core component for achieving user-level personalization. It is configured as a secure vector or graph database for storing, managing, and retrieving persistent knowledge. This knowledge is primarily divided into two categories: 1. User preferences and historical conclusions: With user authorization, it stores stable characteristics formed after multiple user interactions (such as "sensitive to negative topics" or "more receptive to metaphorical guidance"), as well as summaries of important past intervention conclusions; 2. General persistent knowledge: such as validated deep intervention strategies. At the start of each new task, the long-term memory agent, based on the user identifier, injects historical information or preferences relevant to the current task into the context of the process scheduling agent or global policy agent, ensuring that each guidance is built upon historical cognition, achieving continuous and coherent personalized support.

[0202] Specifically, compression is automatically triggered when the amount of context data in a multi-turn dialogue reaches a preset threshold (e.g., the number of characters exceeds the preset number of words) or the number of dialogue turns exceeds the predetermined number of turns. The compression adopts the "key information extraction + redundancy filtering" technology, based on a pre-trained summarization model, to extract core contextual information (e.g., the user's core trauma scenario, corrected negative content, key intent tags), and filter out repetitive expressions and irrelevant details (e.g., interjections, repeated follow-up questions). The compressed context summary is stored in a public data pool to replace the original redundant context, making it accessible to all agents and ensuring model processing efficiency while preserving core information.

[0203] The long-term memory agent can receive permanent knowledge (such as user preferences, historical intervention conclusions, and user trauma tags) transmitted by the process scheduling agent. It adopts the "hash encryption + partitioned storage" method, associates with the user's anonymous identifier, and does not store information that can identify the individual. It also updates the stored data regularly (such as updating synchronously when the user adds a trauma scene tag) and cleans it up regularly (such as completely removing the corresponding memory when the user deletes personal data) to ensure the timeliness and security of the data.

[0204] When the process scheduling agent or global policy agent executes a task, relevant data is retrieved from the long-term memory agent through keyword retrieval to optimize intervention strategies (such as adjusting the language style of positive guidance).

[0205] The context compression agent provides a "lightweight context" for the hierarchical architecture, reducing the processing burden on each agent; the long-term memory agent provides "long-term data support" for the process scheduling agent and the global policy agent, making the intervention strategy more in line with the user's personalized needs (such as if the user has reported "discomfort from excessive questioning", the long-term memory agent stores this preference, and the process scheduling agent adjusts the depth of the continuation guidance accordingly).

[0206] Context compression effectively overcomes the bottleneck of large model token limitations, enabling the system to handle longer and more complex narratives, ensuring system stability and response speed. The long-term memory mechanism breaks the traditional chatbot limitation of "each conversation being a new beginning," allowing the system to provide continuous and progressively deeper interventions, much like a professional supporter who understands the user's history, greatly improving user experience and intervention effectiveness.

[0207] Designing compression and memory functions as independent "middleware services" allows the core business processing agents (process scheduling, short-term processing) to focus more on their core logic, which aligns with the design principles of modern software architecture.

[0208] In some possible implementations, the knowledge base is constructed using retrieval-enhanced generation techniques, with knowledge sources including clinical psychology literature, verified healing dialogue records, and culturally adapted emotional expression materials.

[0209] Specifically, the core construction technology for the professional knowledge base in the field of mental health intervention that supports the entire system is retrieval-enhanced generation technology.

[0210] Among them, retrieval-enhanced generation technology is a technological paradigm that combines information retrieval with the ability to generate large language models. Its construction process is as follows: We collect primary knowledge from multiple dimensions, including clinical psychology literature (textbooks, academic papers), verified healing dialogue records (desensitized consultation records labeled with intervention techniques), and culturally appropriate emotional expression materials (such as poems, metaphors, and self-compassion statements that conform to East Asian cultural expressions).

[0211] The collected unstructured text (such as a chapter of a paper or a dialogue record) is segmented into semantically complete fragments, i.e., knowledge blocks. Each knowledge block is then converted into a high-dimensional vector using a deep learning embedding model (vectorization) and stored in a dedicated vector database. Simultaneously, the original text corresponding to the "knowledge block" is preserved.

[0212] When a user query (such as a joint query vector) arrives, a similarity search is performed in the vector database to find the most relevant "knowledge block" vectors, and their corresponding original text is extracted. This text serves as "enhanced" context, which, together with the user's original question, forms a richer set of prompts, which is then fed into the large language model to generate the final answer.

[0213] RAG technology enables the system to dynamically retrieve the latest and most relevant professional knowledge, overcoming the shortcomings of traditional models such as knowledge lag and difficulty in updating, thus ensuring the scientific rigor of intervention strategies. The generated content is based on specific retrieved literature or cases, allowing for traceability and enhancing the system's professional credibility, while also facilitating human review and oversight. Because the specific knowledge required to answer the questions comes from professional databases, rather than solely relying on the model's internal parameterized knowledge, large models can reliably handle highly specialized mental health intervention questions.

[0214] The text processing method based on multi-agent collaboration provided in this disclosure can be specifically encapsulated into an application. Specifically, the text processing method based on multi-agent collaboration provided in this disclosure can be encapsulated into an "Echo Mailbox" application.

[0215] After logging into the product, users will enter the "Echo Mailbox" function area. When faced with a blank email editing page, a friendly prompt will pop up (such as "Don't rush, take your time, take a breath first").

[0216] Users can click "OK" to close the prompt and start writing a letter; if no input is made for a long time, the prompt will automatically refresh, guiding users to recall warm details.

[0217] Users enter their message in the writing box. For example, I remember in fifth grade, I got a 78 on a math test. When my mother saw the report card, she tore it up in front of the whole family, saying, "How could I have given birth to such a stupid daughter?" That night, I hid under the covers and cried, feeling like I was really bad at everything.

[0218] After receiving the text input from the user, the scheduling agent (process scheduling agent) is activated, sending the text to the behavior analysis agent (basic task agent). This agent segments the text into sentences and identifies the factual part ("Fifth grade...score 78...mom tore up the test paper...") and the emotional part ("feeling like I can't do anything right"). The factual part is sent to the scenario analysis agent, which extracts the key elements: {Age: 10-11 years old, Scenario: family, Person: mother, Event: being publicly criticized for grades}. The emotional part, combined with the scenario analysis results, is sent to the intention analysis agent, which identifies the problem type as: "Childhood trauma to self-worth caused by criticism from significant others".

[0219] The scheduling agent combines problem types and scenario elements ("trauma to self-worth", "childhood", "mother", "public denial") into a joint query vector and retrieves it from a professional knowledge base built on RAG technology. A knowledge entry from the database, "Intervention Strategies for Childhood Trauma in East Asian Cultural Contexts," was matched with high similarity: "For childhood self-worth trauma caused by parental criticism, initial intervention should avoid directly challenging internalized criticism and instead adopt an 'emotional validation-situational attribution-self-dissociation' strategy. This can guide users to describe event details from a third-person perspective, separating the label 'I'm stupid' from their past selves." The knowledge related to this intervention strategy is acquired by the scheduling agent.

[0220] The scheduling agent analyzes user input and discovers that it contains both negative core beliefs that need to be corrected ("I can't do anything right") and specific events that can be used to develop the narrative. Therefore, it decides to trigger operations A and B in parallel.

[0221] Operation A: Semantic Correction Guidance: The scheduling agent sends the aforementioned intervention strategy knowledge, along with a mandatory structured output instruction (requiring the generation of a JSON containing the fields "emotional confirmation" and "cognitive reconstruction"), to the first processing agent.

[0222] Based on the "emotional verification-self separation" orientation in the strategy, the first processing agent matches positive expression templates from the standardized script library of psychological counselors and performs semantic reconstruction on the negative segment "I feel like I really can't do anything right".

[0223] In the user interface, the system displays positive guidance text in a gentle visual form (such as temporarily crossing out the sentence and having green text appear below it): "(Cross out) You felt like you couldn't do anything right (cross out) — You felt very hurt and desperate because of your mother's strong reaction, and you felt like a failure. But this does not mean that you 'can't do anything right,' but that painful experience led you to this heavy conclusion." Users can press the Tab key to accept this correction suggestion with one click and replace the original negative sentence.

[0224] Operation B: Continue writing guidance: At the same time, the scheduling agent distributes intervention strategy knowledge (especially "guiding the description of event details from a third-person perspective") to the second processing agent.

[0225] The second processing agent analyzes the user's narrative and finds that it remains stuck on "crying under the covers," deciding to guide the user to elaborate on the sensory and emotional details of "crying." It combines descriptive frameworks about "moments of loneliness" retrieved from an expressive writing example database and uses mind chain prompting technology to generate suggestions for continuing the story.

[0226] A pop-up window with "AI continuation suggestion" appears below the main text, displaying continuation content that fits the narrative; The system intelligently prompts you with a blue guide box below the writing box: "If you want to write more deeply, you can continue from here: Does that little girl huddled under the covers remember what the covers smelled like, besides her tears? Is it quiet around her, or can she hear the TV coming from the living room? What is the sentence that keeps repeating in her mind?" If a user is unsure how to proceed, they can press the Tab key to accept the question and use it as the starting point for their next sentence.

[0227] Users can press the Tab key to accept suggestions (the content will be automatically completed into the main text), or continue to manually enter suggestions, which will be updated and continued by AI in real time.

[0228] When a user finishes editing a letter or needs to save it temporarily, the top of the editing page provides "Save Draft", "Send to Past" and "Clear" buttons; When a user clicks "Save Draft," the message content is stored in the cloud (login required) for later editing. Users click "Send to the Past": submit a letter and complete a "dialogue" with their childhood self; Users can click "Clear" to reset the message and start writing again.

[0229] Users can click "Delete All Personal Data with One Click" at any time to completely erase email content and personal profiles; after logging in, users can choose whether to authorize anonymized data for product optimization; the top of the editing page provides a "Hide AI Guidance" button, allowing users to turn off all AI pop-up prompts and write purely manually; the bottom of the editing page displays the writing progress (number of characters, number of lines, number of words) in real time, helping users to control the writing pace.

[0230] Throughout the process, input and output text are continuously monitored. If no high-risk keywords are triggered, the risk warning is not activated; if high-risk keywords are triggered, an alert is issued.

[0231] After the user finishes writing and gives their consent, the long-term memory system records a summary of the interaction (e.g., "processed self-worth trauma related to her mother and grades, and showed high receptiveness to sensory detail guidance"). The next time the user uses the system, it can understand her context more quickly and provide more coherent support.

[0232] Throughout the process, the short-term processing agents (the first processing agent and the second processing agent) can see the analysis results of the basic task agents (such as "trauma of self-worth") and accept the instructions of the process scheduling agents. However, they cannot know how the scheduling agents select the final strategy from multiple pieces of knowledge, which reflects hierarchical access control.

[0233] Through the system's guidance, the user initially found herself stuck in painful memories and negative conclusions, but was able to revisit the event from a more detached and nuanced perspective. She adopted some of the suggestions and wrote richer, more therapeutic text. This process was not done by AI, but rather through safe, professional, and structured guidance provided by multi-agent collaboration, helping the user complete the key steps of expressive writing herself, achieving initial cognitive and emotional desensitization and integration.

[0234] Based on and Figure 1 The method shown follows the same principle. Figure 9 This illustration shows a structural diagram of a mental health intervention system based on multi-agent collaboration provided in an embodiment of the present disclosure, as shown below. Figure 9 As shown, the mental health intervention system 90 based on multi-agent collaboration may include: The input receiving module 910 is used to receive natural language input text from the user. The scheduling agent module 920 is used to classify the input text into emotional and factual content using a scheduling agent, perform scene analysis and intent recognition based on the classification results, and query a professional knowledge base in the field of mental health intervention based on the recognition results to obtain relevant knowledge of intervention strategies. The first processing module 930 is used to semantically correct the segments in the input text that are identified as containing negative emotional expressions based on the acquired knowledge of intervention strategies and using the first processing agent, thereby generating positive guidance text. The second processing module 940 is used to generate continuation suggestion text to promote expressive writing based on the acquired intervention strategy-related knowledge and the second processing agent, according to the narrative clues of the input text. The scheduling agent, the first processing agent, and the second processing agent constitute a hierarchical architecture with hierarchical context access permissions. The scheduling agent is configured to access the output context of the first and second processing agents, while the first and second processing agents are restricted from accessing the internal decision context of the scheduling agent.

[0235] In the multi-agent collaborative mental health intervention system provided in this disclosure, by scheduling agents to perform fine-grained emotion / fact classification, scenario analysis, and intent recognition on user input, and dynamically retrieving a structured professional knowledge base, the agents' guidance can be tailored to specific needs. This upgrades the system from generalized empathetic responses to highly customized intervention strategies based on psychological evidence and specific cultural contexts, significantly improving the scientific rigor and effectiveness of the intervention. The agents are also repositioned from "speakers" to "guides" or "collaborators," helping users overcome expression barriers through two proactive and structured guidance operations: "semantic correction" and "narrative continuation." In particular, by simulating facilitation techniques in expressive writing therapy through "continuation suggestions" and conducting real-time cognitive reconstruction through "positive guidance," a novel, low-stress, and highly participatory digital psychological intervention experience is provided.

[0236] In some possible implementations, the scheduling agent module is used to: invoke the behavior analysis agent to classify the input text to distinguish between the text portion containing emotional content and the text portion containing factual content; if the classification result is the text portion containing factual content, then invoke the scene analysis agent to analyze the time, location, and environmental elements of the factual content to obtain the scene analysis result; if the classification result is the text portion containing emotional content, then invoke the intent analysis agent and, in conjunction with the scene analysis result, determine the type of mental health intervention problem corresponding to the emotional content.

[0237] In some possible implementations, the scheduling agent module is used to: take the determined problem type and key elements in the scenario analysis results as a joint query vector; input the joint query vector into a pre-built professional knowledge base in the field of mental health intervention for retrieval, and obtain knowledge entries that match the joint query vector as knowledge related to intervention strategies; wherein, the professional knowledge base in the field of mental health intervention includes at least a knowledge base of childhood trauma cases and intervention strategies based on specific cultural backgrounds.

[0238] In some possible implementations, the scheduling agent module is used to: segment the input text to obtain multiple text sentences; identify entity keywords and sentiment keywords from the multiple text sentences; classify the multiple text sentences and the identified keywords using a behavior analysis agent to distinguish between text sentences containing sentiment content and text sentences containing factual content; and use the identified keywords as a query basis to search in a pre-built professional knowledge base in the field of mental health intervention to obtain background knowledge entries associated with the keywords as knowledge related to intervention strategies.

[0239] In some possible implementations, the intent analysis agent, behavior analysis agent, and scene analysis agent are all configured to only access the context relevant to their own tasks; the scheduling agent, the first processing agent, and the second processing agent are configured to be able to read the output context of the intent analysis agent, behavior analysis agent, and scene analysis agent.

[0240] In some possible implementations, the first processing module is used for: receiving knowledge related to intervention strategies; determining a strategy orientation for semantically correcting negative emotion expression fragments based on the knowledge related to intervention strategies; and semantically reconstructing negative emotion expression fragments according to the strategy orientation to generate positive guidance text that conforms to the orientation of positive psychology.

[0241] In some possible implementations, the first processing module is used to: retrieve positive expression templates that match the current negative emotion expression from a pre-built standardized script library for psychological counselors, based on a strategy orientation; and based on the positive expression templates, semantically replace and refine the negative emotion expression fragments to generate positive guidance text.

[0242] In some possible implementations, the second processing module is used for: receiving knowledge related to the intervention strategy; based on the knowledge related to the intervention strategy, parsing the narrative structure and emotional context of the input text to form a continuation guidance strategy; and generating continuation suggestion text to guide the user to continue the narrative and deepen emotional expression based on the continuation guidance strategy.

[0243] In some possible implementations, the second processing module is used to: retrieve a suitable narrative framework from a pre-built library of expressive writing examples based on a continuation guidance strategy; and generate continuation suggestion text based on the context of the narrative framework and the input text using mind chain hints technology.

[0244] In some possible implementations, in the step of generating positive guidance text or continuing suggestion text, a mandatory structured output language is used to constrain the format and content of the text generation process of the first or second processing agent to ensure that the output text conforms to the predetermined mental health intervention guidance specifications.

[0245] In some possible implementations, a hierarchical architecture with layered context access permissions includes: a basic task agent whose context access permissions are limited to the context related to its own task; a short-term processing agent whose context access permissions include the output context of the basic task agent; a process scheduling agent whose context access permissions include the output context of both the basic task agent and the short-term processing agent; and a global policy agent whose context access permissions include the context of the basic task agent, the short-term processing agent, and the process scheduling agent; wherein the scheduling agent corresponds to the process scheduling agent or the global policy agent, and the first and second processing agents correspond to the short-term processing agents.

[0246] In some possible implementations, the hierarchical architecture also includes multiple independent middleware service agents: a context compression agent, configured to compress and summarize the historical context in the basic task agent, short-term processing agent, process scheduling agent, or global policy agent; and a long-term memory agent, configured to store, manage, and retrieve permanent knowledge, and inject historical conclusions or user preference information related to the current task into the process scheduling agent or global policy agent.

[0247] In some possible implementations, the knowledge base is constructed using retrieval-enhanced generation techniques, with knowledge sources including clinical psychology literature, verified healing dialogue records, and culturally adapted emotional expression materials.

[0248] It is understood that the above-mentioned modules of the multi-agent collaborative mental health intervention system in the embodiments of this disclosure have the ability to implement... Figure 1 The embodiments shown illustrate the functions of corresponding steps in the multi-agent collaborative mental health intervention method. These functions can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions. These modules can be software and / or hardware, and each module can be implemented individually or integrated from multiple modules. For a detailed description of the functions of each module in the multi-agent collaborative mental health intervention system, please refer to [link to relevant documentation]. Figure 1 The corresponding descriptions of the mental health intervention methods based on multi-agent collaboration in the embodiments shown are not repeated here.

[0249] In the technical solution disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of users' personal information comply with the provisions of relevant laws and regulations, necessary measures have been taken, and there is no violation of public order and good morals.

[0250] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.

[0251] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0252] The electronic device 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, the instructions being executed by the at least one processor to enable the at least one processor to perform a mental health intervention method based on multi-agent collaboration as provided in the embodiments of this disclosure.

[0253] Compared to existing technologies, this electronic device, by scheduling an intelligent agent to perform fine-grained emotion / fact classification, scenario analysis, and intent recognition on user input, and dynamically retrieving a structured professional knowledge base, enables the agent's guidance to be more targeted. It upgrades from generalized empathetic responses to highly customized intervention strategies based on psychological evidence and specific cultural contexts, significantly improving the scientific rigor and effectiveness of the intervention. It also repositions the intelligent agent from a "speaker" to a "guide" or "collaborator," helping users overcome expression barriers through two proactive and structured guidance operations: "semantic correction" and "narrative continuation." In particular, by simulating facilitation techniques in expressive writing therapy through "continuation suggestions" and conducting real-time cognitive reconstruction through "positive guidance," it provides a novel, low-stress, and highly participatory digital psychological intervention experience.

[0254] The readable storage medium is a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to perform a mental health intervention method based on multi-agent collaboration as provided in the embodiments of this disclosure.

[0255] Compared to existing technologies, this readable storage medium, by scheduling intelligent agents to perform fine-grained emotion / fact classification, scenario analysis, and intent recognition on user input, and dynamically retrieving a structured professional knowledge base, enables the agent's guidance to be more targeted. It upgrades from generalized empathetic responses to highly customized intervention strategies based on psychological evidence and specific cultural contexts, significantly improving the scientific rigor and effectiveness of the intervention. It also repositions the agent from a "speaker" to a "facilitator" or "collaborator," helping users overcome expression barriers through two proactive and structured guidance operations: "semantic correction" and "narrative continuation." In particular, by simulating facilitation techniques in expressive writing therapy through "continuation suggestions" and conducting real-time cognitive reconstruction through "positive guidance," it provides a novel, low-stress, and highly participatory digital psychological intervention experience.

[0256] The computer program product includes a computer program that, when executed by a processor, implements a mental health intervention method based on multi-agent collaboration as provided in the embodiments of this disclosure.

[0257] Compared to existing technologies, this computer program product, by scheduling an intelligent agent to perform fine-grained emotion / fact classification, scenario analysis, and intent recognition on user input, and dynamically retrieving a structured professional knowledge base, enables the agent's guidance to be more targeted. It upgrades from generalized empathetic responses to highly customized intervention strategies based on psychological evidence and specific cultural contexts, significantly improving the scientific rigor and effectiveness of the intervention. It also repositions the intelligent agent from a "speaker" to a "facilitator" or "collaborator," helping users overcome expression barriers through two proactive and structured guidance operations: "semantic correction" and "narrative continuation." In particular, by simulating facilitation techniques in expressive writing therapy through "continuation suggestions" and conducting real-time cognitive reconstruction through "positive guidance," it provides a novel, low-stress, and highly participatory digital psychological intervention experience.

[0258] Figure 10 A schematic block diagram of an example electronic device 1000 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0259] like Figure 10 As shown, device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1002 or a computer program loaded into random access memory (RAM) 1003 from storage unit 1008. The RAM 1003 may also store various programs and data required for the operation of device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. Input / output (I / O) interface 1005 is also connected to bus 1004.

[0260] Multiple components in device 1000 are connected to I / O interface 1005, including: input unit 1006, such as keyboard, mouse, etc.; output unit 1007, such as various types of monitors, speakers, etc.; storage unit 1008, such as disk, optical disk, etc.; and communication unit 1009, such as network card, modem, wireless transceiver, etc. Communication unit 1009 allows device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0261] The computing unit 1001 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as a multi-agent collaborative mental health intervention method. For example, in some embodiments, the multi-agent collaborative mental health intervention method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program can be loaded and / or installed on device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the multi-agent collaborative mental health intervention method described above can be performed. Alternatively, in other embodiments, computing unit 1001 may be configured by any other suitable means (e.g., by means of firmware) to perform a mental health intervention method based on multi-agent collaboration.

[0262] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0263] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0264] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on 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 of the foregoing.

[0265] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0266] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0267] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0268] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0269] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A text processing method based on multi-agent collaboration, applied to mental health intervention scenarios, the method comprising: Receive natural language input text from the user; The input text is analyzed and processed using a scheduling agent. The analysis and processing includes: classifying the input text into emotional content and factual content; performing scene analysis and intent recognition based on the classification results; and querying a professional knowledge base in the field of mental health intervention based on the recognition results to obtain relevant knowledge on intervention strategies. Based on the acquired knowledge related to the intervention strategy, perform at least one guiding operation: Operation A: Using the first processing agent, semantically correct the segments in the input text identified as containing negative emotional expressions, and generate positive guidance text; Operation B: Using a second processing agent, generate continuation suggestion text to promote expressive writing based on the narrative clues of the input text; The scheduling agent, the first processing agent, and the second processing agent constitute a hierarchical architecture with hierarchical context access permissions. The scheduling agent is configured to access the output context of the first and second processing agents, while the first and second processing agents are restricted from accessing the internal decision context of the scheduling agent.

2. The method according to claim 1, wherein, The process of classifying the input text into sentiment and factual content, and then performing scene analysis and intent recognition based on the classification results, includes: The behavioral analysis agent is invoked to classify the input text to distinguish between the text portion containing emotional content and the text portion containing factual content; If the classification result is the text portion of factual content, then the scene analysis agent is invoked to parse the time, location, and environmental elements of the occurrence of the factual content to obtain the scene analysis result; If the classification result is the text portion of emotional content, then the intent analysis agent is invoked, and the type of mental health intervention problem corresponding to the emotional content is determined by combining the scenario analysis results.

3. The method according to claim 2, wherein, The process involves querying a professional knowledge base in the field of mental health intervention based on the identification results to obtain knowledge related to intervention strategies, including: The identified problem type and key elements from the scenario analysis results are used as a joint query vector; The joint query vector is input into a pre-built professional knowledge base in the field of mental health intervention for retrieval, and knowledge entries that match the joint query vector are obtained as knowledge related to the intervention strategy. The professional knowledge base in the field of mental health intervention includes at least a knowledge base of childhood trauma cases and intervention strategies based on specific cultural backgrounds.

4. The method according to claim 2, wherein, The invocation behavior analysis agent classifies the input text to distinguish between the text portion containing emotional content and the text portion containing factual content, including: The input text is segmented into sentences to obtain multiple text sentences; Identify entity keywords and sentiment keywords from the multiple text sentences; Based on the multiple text sentences and the identified keywords, the behavior analysis agent is used for classification to distinguish between text sentences containing emotional content and text sentences containing factual content. The method further includes: using the identified keywords as the basis for querying, searching in a pre-built professional knowledge base in the field of mental health intervention, and obtaining background knowledge entries associated with the keywords as knowledge related to the intervention strategy.

5. The method according to claim 2, wherein, The intent analysis agent, the behavior analysis agent, and the scene analysis agent are all configured to only access the context related to their own tasks. The scheduling agent, the first processing agent, and the second processing agent are configured to read the output context of the intent analysis agent, the behavior analysis agent, and the scene analysis agent.

6. The method according to claim 1, wherein, The step of using a first processing agent to semantically correct segments of the input text identified as containing negative emotional expressions and generate positive guidance text includes: The first processing agent receives knowledge related to the intervention strategy; Based on the knowledge related to the intervention strategy, a strategy for semantic modification of the negative emotion expression fragments is determined; Based on the strategy, the negative emotion expression fragments are semantically reconstructed to generate positive guidance text that conforms to the guidance of positive psychology.

7. The method according to claim 6, wherein, The step of semantically reconstructing the negative emotion expression fragments according to the strategy guidance to generate positive guidance text that conforms to the guidance of positive psychology includes: Based on the aforementioned strategy, positive expression templates that match the current expression of negative emotions are retrieved from a pre-built standardized script library for psychological counselors. Based on the positive expression template, the negative emotional expression fragments are semantically replaced and refined to generate the positive guidance text.

8. The method according to claim 1, wherein, The process of using a second processing agent to generate continuation suggestion text to promote expressive writing, based on the narrative clues of the input text, includes: The second processing agent receives the knowledge related to the intervention strategy; Based on the knowledge related to the intervention strategy, the narrative structure and emotional context of the input text are analyzed to form a continuation writing guidance strategy; Based on the aforementioned continuation guidance strategy, a continuation suggestion text is generated to guide users to continue the narrative and deepen emotional expression.

9. The method according to claim 8, wherein, The process of generating continuation suggestion text based on the continuation guidance strategy to guide users in continuing the narrative and deepening emotional expression includes: Based on the continuation writing guidance strategy, a suitable narrative framework is retrieved from a pre-built library of expressive writing examples; Using mind chain prompting technology, the suggested continuation text is generated based on the narrative framework and the context of the input text.

10. The method according to any one of claims 6 to 9, wherein, In the step of generating the positive guidance text or the continuation suggestion text, a forced structured output language is used to constrain the format and content of the text generation process of the first processing agent or the second processing agent to ensure that the output text conforms to the predetermined mental health intervention guidance specifications.

11. The method according to claim 1, wherein, The hierarchical architecture with hierarchical context access permissions includes: Basic task agents have their context access permissions limited to contexts related to their own tasks. The short-term processing agent has context access permissions including the output context of the basic task agent; The process scheduling agent has context access permissions including the output context of the basic task agent and the short-term processing agent. The global policy agent has context access permissions including the context of the basic task agent, the short-term processing agent, and the process scheduling agent. Wherein, the scheduling agent corresponds to the process scheduling agent or the global policy agent, and the first processing agent and the second processing agent correspond to the short-term processing agent.

12. The method according to claim 11, wherein, The hierarchical architecture also includes multiple independent middleware service agents: The context compression agent is configured to compress and summarize the historical context in the basic task agent, the short-term processing agent, the process scheduling agent, or the global policy agent. The long-term memory agent is configured to store, manage, and retrieve permanent knowledge, and to inject historical conclusions or user preference information related to the current task into the process scheduling agent or the global policy agent.

13. The method according to claim 1, wherein, The professional knowledge base is constructed using retrieval-enhanced generation technology, and its knowledge sources include clinical psychology literature, verified healing dialogue records, and a culturally adapted database of emotional expression materials.

14. A mental health intervention system based on multi-agent collaboration, wherein, include: The input receiving module is used to receive natural language input text from users; The scheduling agent module is used to classify the input text into emotional and factual content using a scheduling agent, perform scene analysis and intent recognition based on the classification results, and query a professional knowledge base in the field of mental health intervention based on the recognition results to obtain relevant knowledge of intervention strategies. The first processing module is used to perform semantic correction on the segments of the input text identified as containing negative emotional expressions based on the acquired knowledge related to the intervention strategy, using the first processing agent, and generate positive guidance text. The second processing module is used to generate continuation suggestion text to promote expressive writing based on the acquired knowledge related to the intervention strategy and using the second processing agent according to the narrative clues of the input text. The scheduling agent, the first processing agent, and the second processing agent constitute a hierarchical architecture with hierarchical context access permissions. The scheduling agent is configured to access the output context of the first and second processing agents, while the first and second processing agents are restricted from accessing the internal decision context of the scheduling agent.

15. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-13.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-13.

17. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-13.