Continuous cognitive construction method and system for mental health agents

By employing a continuous cognitive construction method for mental health agents, and utilizing progressive updates and risk-level management of semantic fragment data, the shortcomings of user profiles and historical memory are addressed, enabling continuous representation of user states and safe and efficient cognitive construction.

CN122004864BActive Publication Date: 2026-06-19深圳市健成星云科技有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
深圳市健成星云科技有限公司
Filing Date
2026-04-16
Publication Date
2026-06-19

Smart Images

  • Figure CN122004864B_ABST
    Figure CN122004864B_ABST
Patent Text Reader

Abstract

This application relates to the field of mental health technology and discloses a method and system for constructing continuous cognition of a mental health intelligent agent. The method includes: extracting profile features from current-period dialogue data according to a preset trigger frequency and merging them into mental profile data of a preset dimension for progressive updating; classifying and storing new semantic fragment data by risk and distributing them to generate historical memory data; determining the scope of recallable semantic fragments by performing recall permission judgment on semantic fragments with limited recall based on preset recall rules; obtaining candidate semantic fragments under a hot storage priority and cold storage rollback retrieval mechanism, and performing multi-dimensional scoring and maximum marginal relevance reordering through configurable weight parameters to obtain target semantic fragments; and constructing continuous cognitive results of the mental health intelligent agent towards the target user based on the updated mental profile data and the target semantic fragments. This method improves the accuracy, security, and coherence of continuous cognition by the mental health intelligent agent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of mental health technology, and in particular to a method and system for constructing continuous cognition of a mental health intelligent agent. Background Technology

[0002] Current mental health intelligent agent technologies still have shortcomings in user profiling and historical memory processing. On the one hand, user profiling has limited representational capabilities, making it difficult to continuously reflect changes in users' emotional states, problem progression, and cognitive characteristics across multiple rounds of interaction. Furthermore, it doesn't adequately reflect deeper psychological characteristics, easily leading to an understanding of the user's state remaining at an early stage or superficial level. For example, a user's state may have shifted from persistent anxiety to relative calm, but the profile still retains early characteristics. On the other hand, historical memory processing lacks sufficient differentiation between different types of content. Some sensitive content may be reintroduced in subsequent interactions; for example, early negative experiences may be revisited in casual conversation, thus affecting the relevance and security of subsequent interactive content. Summary of the Invention

[0003] The main technical problem addressed by the embodiments of this application is the insufficient ability of existing mental health intelligent agents to construct continuous cognition of users.

[0004] To address the aforementioned technical problems, the first technical solution adopted in this application is: providing a continuous cognitive construction method for a mental health agent, comprising: extracting profile feature data in parallel from the current periodic dialogue data of a target user according to a preset trigger frequency; merging the extraction results into mental profile data of a preset dimension according to a preset merging strategy to progressively update the mental profile data; classifying the new semantic fragment data extracted from the current periodic dialogue data according to a preset risk classification rule, and storing the new semantic fragment data of different risk levels according to a preset writing rule to generate historical memory data; and performing a recall permission determination on the semantic fragment data in the historical memory data that is subject to restricted recall based on a preset recall rule. The system determines the range of semantic fragment data that can be recalled based on the permission determination result. The preset recall rules include keyword hit determination and semantic similarity determination based on a preset semantic similarity threshold. Based on the range of recallable semantic fragment data, memory retrieval is performed from the historical memory data to obtain candidate semantic fragment data. The memory retrieval is first performed based on the hot storage path, and if the hot storage path is not hit, it falls back to the cold storage path. The candidate semantic fragment data is re-ranked by multi-dimensional scoring and maximum marginal relevance through configurable weight parameters to filter out target semantic fragment data. Based on the updated psychological profile data and the target semantic fragment data, a continuous cognitive result of the mental health agent on the target user is constructed.

[0005] To address the aforementioned technical problems, the second technical solution adopted in this application is: providing a continuous cognitive construction system for a mental health intelligent agent, comprising: a portrait progressive update module, used to extract portrait feature data in parallel from the current periodic dialogue data of a target user according to a preset trigger frequency, and to merge the extraction results into mental portrait data of a preset dimension according to a preset merging strategy, so as to progressively update the mental portrait data; a semantic fragment splitting and storage module, used to classify the risk of new semantic fragment data extracted from the current periodic dialogue data according to a preset risk classification rule, and to split and store the new semantic fragment data of different risk levels according to a preset writing rule, so as to generate historical memory data; and a recall permission determination module, used to execute recall rights for semantic fragment data with restricted recall in the historical memory data based on a preset recall rule. The system includes a limit determination and a range of retrievable semantic fragment data determined based on the permission determination result. The preset recall rules include keyword hit determination and semantic similarity determination based on a preset semantic similarity threshold. A memory retrieval module is used to perform memory retrieval from the historical memory data according to the range of retrievable semantic fragment data to obtain candidate semantic fragment data. The memory retrieval is first performed based on the hot storage path, and if the hot storage path is not hit, it falls back to the cold storage path. A sorting and filtering module is used to perform multi-dimensional scoring and maximum marginal relevance reordering on the candidate semantic fragment data through configurable weight parameters to filter out target semantic fragment data. A continuous cognition construction module is used to construct the continuous cognition results of the mental health agent on the target user based on the updated psychological profile data and the target semantic fragment data.

[0006] To solve the above-mentioned technical problems, the third technical solution adopted in the embodiments of this application is: to provide an electronic device, including: at least one processor; and 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, and the instructions are executed by the at least one processor to enable the at least one processor to execute the continuous cognitive construction method of the mental health agent as described above.

[0007] To solve the above-mentioned technical problems, the fourth technical solution adopted in the embodiments of this application is: to provide a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device executes the continuous cognitive construction method of the mental health intelligent agent as described above.

[0008] Unlike related technologies, this application incorporates psychological profile updating, semantic fragment memory management, restricted recall access control, and hot / cold tiered retrieval into a unified continuous cognitive construction framework. This enables the mental health agent to continuously represent changes in user state throughout the interaction process and to manage high-risk memory content in a differentiated manner. Through this approach, it improves the continuous cognitive ability to recognize recent, periodic, and stable user changes, while reducing the likelihood of inappropriate recall of high-risk content in ordinary interaction scenarios. Simultaneously, it balances memory retrieval efficiency and the quality of recalled content, thereby enhancing the accuracy, stability, and interactive coherence of continuous cognitive construction in mental health scenarios. Attached Figure Description

[0009] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0010] Figure 1 This is a schematic diagram of the operating environment of the continuous cognition construction method for mental health intelligent agents provided in the embodiments of this application.

[0011] Figure 2 This is a schematic diagram of the execution flow of the continuous cognition construction method for a mental health intelligent agent provided in the embodiments of this application.

[0012] Figure 3 This is a schematic diagram of the information of the four-dimensional structured psychological profile in the continuous cognitive construction method of the mental health intelligent agent provided in the embodiments of this application.

[0013] Figure 4 This is a timing diagram of the three-frequency triggered progressive profile update in the continuous cognitive construction method for mental health intelligent agents provided in the embodiments of this application.

[0014] Figure 5 This is a schematic diagram of event-level information in the three-frequency triggered progressive profile update in the continuous cognitive construction method of the mental health intelligent agent provided in the embodiments of this application.

[0015] Figure 6 This is a schematic diagram of information in the three-level risk-graded memory in the continuous cognition construction method of the mental health intelligent agent provided in the embodiments of this application.

[0016] Figure 7 This is a schematic diagram of the risk memory diversion and storage process in the continuous cognition construction method of the mental health intelligent agent provided in the embodiments of this application.

[0017] Figure 8 This is a schematic diagram of the memory recall process in the continuous cognition construction method for a mental health intelligent agent provided in the embodiments of this application.

[0018] Figure 9 This is a flowchart illustrating the intent determination process in the continuous cognition construction method for a mental health intelligent agent provided in this application embodiment.

[0019] Figure 10 This is a flowchart illustrating the session window stickiness judgment process in the continuous cognition construction method for a mental health intelligent agent provided in this application embodiment.

[0020] Figure 11 This is a schematic diagram of the two-level hot and cold storage process in the continuous cognition construction method for mental health intelligent agents provided in the embodiments of this application.

[0021] Figure 12 This is a schematic diagram of the system structure of the continuous cognition construction system for mental health intelligent agents provided in the embodiments of this application.

[0022] Figure 13 This is a schematic diagram of the hardware structure of an electronic device that performs a continuous cognitive construction method for a mental health agent, as provided in an embodiment of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. The software tools, components, or servers mentioned in the embodiments of this application are merely illustrative examples and do not constitute a limitation on actual usage.

[0024] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, and all are within the protection scope of this application. Furthermore, although functional modules are divided in the system diagram and a logical order is shown in the flowchart, in some cases, a different module division than that shown in the system diagram, or a different order of execution of the shown or described steps, may be used.

[0025] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.

[0026] To facilitate understanding of this embodiment, a detailed description of the continuous cognition construction method for a mental health intelligent agent disclosed in this application embodiment will be provided first. Please refer to [link to relevant documentation]. Figure 1 , Figure 1This is a schematic diagram of the operating environment of the continuous cognition construction method for a mental health intelligent agent provided in the embodiments of this application, such as... Figure 1 As shown, the execution subject of the continuous cognition construction method for a mental health intelligent agent provided in this application embodiment is generally an electronic device with a certain computing power, such as a computer device. In some possible implementations, this continuous cognition construction method for a mental health intelligent agent can be implemented by a processor calling computer-readable instructions stored in memory. Figure 1 The computer equipment mentioned can be a server. A server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. This can be understood as... Figure 1 The number of computer devices shown is merely illustrative and can be expanded in any number according to actual needs.

[0027] Please continue reading. Figure 2 , Figure 2 This is a schematic diagram of the execution flow of the continuous cognition construction method for a mental health intelligent agent provided in the embodiments of this application, such as... Figure 2 As shown, it includes the following steps:

[0028] S1. Extract profile feature data in parallel from the target user's current periodic dialogue data according to the preset trigger frequency, and merge the extracted results into the psychological profile data of the preset dimension according to the preset merging strategy, so as to gradually update the psychological profile data.

[0029] As an alternative implementation method, please continue reading. Figure 3 , Figure 3 This is a schematic diagram of the four-dimensional structured psychological profile in the continuous cognitive construction method for a mental health intelligent agent provided in this application embodiment. For example... Figure 3As shown, user profiles can be divided into four orthogonal dimensions: basic profile dimension, identity dimension, internal psychological dimension, and agent configuration dimension. Data for each dimension is uniformly organized and persistently stored based on a pre-defined structured template. Specifically, the basic profile dimension represents the user's basic attribute information, including user ID, nickname, age group, gender, city, membership status, diagnosed diseases, and medication status. The identity dimension represents the user's social roles, life stages, problem list, current topics and needs, relationship list, and core beliefs, reflecting the user's identity characteristics and problem background in real-life scenarios. The internal psychological dimension represents the user's personality type, social tendencies, coping styles, emotion scores, periodic emotional trends, protective factors, and long-term goals, enhancing the ability to represent the user's psychological state and behavioral tendencies. The agent configuration dimension represents configuration content related to the human-computer interaction process, including agent preference settings, needs characteristics, acceptance levels, and feedback patterns, supporting the generation of subsequent personalized interaction strategies. In this implementation, the four dimensions are set independently, allowing basic information, real-world context, internal psychological state, and interaction configuration to be stored and updated along their respective field paths. This avoids mixing and coupling different types of information within the same data structure, improving the maintainability and scalability of the profile data. Simultaneously, during user registration, initial access, or initial profile creation, an empty profile object can be generated based on a unified structured template and written to the database, pre-establishing the field paths for each dimension. In subsequent multi-round dialogues, incremental backfilling and targeted updates of target fields in the corresponding dimensions can be performed using newly added dialogue data, without needing to repeatedly rebuild the overall structure. This improves the stability, consistency, and processing efficiency of the psychological profile update process. The four-dimensional structured psychological profile constructed in this way can, on the one hand, provide hierarchical representation of the user's basic attributes, identity positioning, psychological state, and interaction preferences; and on the other hand, provide a unified data foundation for subsequent feature extraction according to a preset trigger frequency, progressive updates of profile data, and the construction of continuous cognitive results by combining semantic fragment data.

[0030] As another optional implementation, the process of progressively updating the psychological profile data in step S1 above may also include steps S11 to S14.

[0031] S11. When the dialogue round corresponding to the current cycle dialogue data reaches the first preset trigger round, extract event-level profile feature data from the current cycle dialogue data.

[0032] In step S11, high-frequency change features are extracted under a shorter triggering period so that the psychological profile can reflect the user's recent state changes in a timely manner, avoid the lag in profile content, and thus provide a more real-time profile basis for subsequent cognitive judgment.

[0033] S12. When the dialogue round corresponding to the current cycle dialogue data reaches the second preset trigger round, extract event-level profile feature data and dynamic-level profile feature data from the current cycle dialogue data.

[0034] Step S12 extracts dynamic features that reflect phased changes to enhance the ability to continuously represent user emotional changes, problem evolution, and current state, so that the psychological profile can reflect the periodic change features in the process of multi-round dialogue.

[0035] S13. When the dialogue round corresponding to the current cycle dialogue data reaches the third preset trigger round, extract event-level profile feature data, dynamic-level profile feature data and stable-level profile feature data from the current cycle dialogue data.

[0036] In step S13, low-frequency and relatively stable deep features are extracted to enhance the ability to model users’ long-term psychological characteristics and behavioral tendencies, so that psychological profiles can not only reflect short-term changes, but also represent relatively stable long-term features.

[0037] S14. According to the preset merging strategy, merge the event-level profile feature data, dynamic profile feature data, and stable profile feature data into the psychological profile data.

[0038] In step S14, the profile features extracted from different levels are uniformly fused to form a continuously updated psychological profile result. This step avoids repeatedly constructing the overall profile structure, improves profile update efficiency, and ensures the consistency and continuity of features from different levels within the same profile data.

[0039] As a concrete example, please continue reading. Figure 4 and Figure 5 , Figure 4 This is a timing diagram of the three-frequency triggered progressive profile update in the continuous cognitive construction method for a mental health intelligent agent provided in this application embodiment. Figure 5 This is a schematic diagram of event-level information in the three-frequency triggered progressive profile update in the continuous cognitive construction method for a mental health intelligent agent provided in this application embodiment. For example... Figure 4As shown, a dialogue message queue and dialogue round counter for the current period can be maintained for each user in Redis, and profile updates can be performed according to three different trigger frequencies. Event-level profile updates correspond to S1-S2 (subtask numbers), triggered once every 10 rounds, thus event-level profile feature extraction can be performed in rounds 10, 20, 30, 40, 50, 60, 70, 80, and 90. Dynamic-level profile updates correspond to S3-S5, triggered once every 30 rounds, thus dynamic-level profile feature extraction can be performed in rounds 30, 60, and 90. Stable-level profile updates correspond to S6-S7, triggered once every 60 rounds, thus stable-level profile feature extraction can be performed in round 60. Therefore, event-level, dynamic-level, and stable-level features are not extracted simultaneously in the same round, but are triggered in layers according to three frequency levels of 10, 30, and 60 rounds. Round 60 is both the event-level trigger point and the common trigger point for dynamic and stable-level features. By using progressive triggering methods of 10, 30, and 60 rounds, high-frequency lightweight information and low-frequency deep features can be introduced into the psychological profile at different rhythms, rather than updating all fields at the same frequency. Furthermore, by using parallel extraction, result merging, and periodic cache switching, the dynamic perception capability of the profile can be guaranteed while reducing inference overhead and update latency.

[0040] like Figure 5 As shown, psychological profile data can be extracted hierarchically according to different trigger frequencies. Event-level profile features are triggered once every 10 rounds, mainly extracting information such as diagnosed diseases, medication status, counseling experience, social roles, major events, and trauma history. Dynamic-level profile features are triggered once every 30 rounds and are extracted in combination with event-level profile features, mainly extracting information such as emotion score, emotion baseline, emotion volatility, seven-day trend, problem list, core complaints, current theme and needs, dialogue pace and stage, and counseling progress. Stable-level profile features are triggered once every 60 rounds and are extracted in combination with event-level and dynamic-level profile features, mainly extracting information such as personality type, social tendency, coping style, long-term goals, protective factors, relationship list, core beliefs, self-perception, and identified strengths. Event-level profile features mainly correspond to information that changes rapidly and has a direct impact on the current interaction, so they are extracted using a higher trigger frequency; dynamic-level profile features mainly correspond to information about phased changes, and user emotional states and problem evolution are summarized using a lower trigger frequency than event-level features; stable-level profile features mainly correspond to deep and relatively stable long-term features, and are extracted using a longer trigger cycle to improve the stability of profile content.

[0041] Through steps S11 to S14, the psychological profile data can be updated hierarchically according to the frequency of change of different information types. This allows high-frequency change information, periodic change information, and relatively stable deep information to enter the profile data at appropriate rhythms, thereby improving the psychological profile's comprehensive representation of users' recent state changes and long-term psychological characteristics. At the same time, by unifying and merging the extraction results from different levels, the continuous evolution of the profile data can be achieved without repeatedly constructing the overall profile. This balances the timeliness, stability, and processing efficiency of profile updates, providing a more accurate data foundation for subsequent semantic fragment retrieval and continuous cognitive result construction.

[0042] S2. Based on the preset risk classification rules, the new semantic fragment data extracted from the current cycle dialogue data is classified into risk levels, and the new semantic fragment data of different risk levels are distributed and stored according to the preset writing rules to generate historical memory data.

[0043] As an optional implementation, memory extraction and vectorized storage can be performed before step S2 is executed, specifically including steps S201 to S204.

[0044] S201. When the dialogue round corresponding to the current cycle dialogue data reaches the preset milestone round, extract new semantic fragment data from the current cycle dialogue data.

[0045] Step S201 sets a clear triggering time for semantic fragment extraction, establishing a stable correspondence between the memory writing process and the dialogue progression process. By performing semantic fragment extraction when the current cycle of dialogue data reaches a preset milestone round, memory compression processing for each round of dialogue can be avoided, thereby reducing unnecessary extraction frequency and inference overhead. Simultaneously, milestone-based triggering facilitates the formation of relatively complete semantic units within a certain dialogue span, enabling the extraction results to cover stage-specific topics, key events, and contextual information, thus improving the effectiveness of subsequent memory storage and retrieval.

[0046] S202. New semantic fragment data includes title information, content information, summary information, context information, risk level information, and information level information.

[0047] In step S202, the new semantic fragment data is structured and organized so that the memorized content not only retains the original semantic information but also has auxiliary fields required for subsequent retrieval, classification, and understanding. Specifically, title and summary information facilitates the compressed expression of semantic fragments, content and context information help preserve the original semantics and dialogue background, and risk level and information level information provide the foundation for subsequent risk-based storage, recall access control, and multi-dimensional scoring.

[0048] S203. Make a retention determination on the new semantic fragment data. When the determination result is to skip and the current cycle dialogue data contains a first-person preference expression, trigger the preference memory special path to write the new semantic fragment data into the preference memory.

[0049] Step S203 involves filtering and controlling the writing of semantic fragments to prevent low-value content from entering memory storage, while retaining preference information that is important for long-term personalized interaction. Specifically, under normal circumstances, semantic fragments that are determined not to be retained can be skipped; however, when first-person preference expressions appear in the dialogue content, even if the overall judgment result is skipped, writing can still be performed through the special path of preference memory.

[0050] S204. Generate semantic feature vectors for semantic similarity retrieval based on the summary information, and store the new semantic fragment data and semantic feature vectors in the vector database.

[0051] Specifically, the summary information in semantic fragments is converted into semantic feature representations that can be used for vector retrieval, and these representations are stored together with the corresponding semantic fragment data in a vector database, thereby establishing a correspondence between structured memory data and vectorized retrieval indexes. Vectorizing the summary information not only compresses the representation length while preserving the core semantics, but also helps improve the efficiency and stability of subsequent semantic similarity retrieval.

[0052] As an example, in steps S201 to S204, memory extraction can be triggered when the dialogue rounds corresponding to the current periodic dialogue data reach a configurable milestone sequence. For example, by default, episode-style memory extraction is performed once in rounds 10, 20, 40, and 60. After triggering, the dialogue content of this stage can be compressed into new semantic fragment data, i.e., episode data, forming a structured field containing title, content, summary, context, risk_level, and info_level. The title summarizes the semantic fragment's theme, content retains the fragment's main content, summary extracts the core semantics, context represents contextual information, and risk_level and info_level represent the risk level and information level, respectively. Subsequently, based on LLM (Large Language Management), memory extraction can be performed... The LLM (Large Language Model) performs a retention decision on the new semantic fragment data. When the LLM decision result is skip=true, if a first-person preference expression is detected in the corresponding user text, such as "I prefer", "I usually", "I don't like", etc., the preference memory special path is triggered, and the new semantic fragment data is forcibly written to avoid the user preference information being missed in the regular filtering process. After completing the retention decision, a semantic feature vector for semantic similarity retrieval can also be generated for the summary field, that is, a high-dimensional embedding vector is generated for the summary, and the new semantic fragment data and the corresponding semantic feature vector are stored together in the PostgreSQL vector database, thereby providing basic data support for subsequent semantic retrieval, risk classification and recall control based on vector similarity.

[0053] Through steps S201 to S204, structured semantic fragments can be extracted from the current periodic dialogue data at preset milestone rounds, forming memory data units containing title information, content information, summary information, context information, risk level information, and information level information. Simultaneously, combined with retention determination and preference memory special paths, key semantic content and user preference information that need to be retained are written in a targeted manner. Furthermore, by generating semantic feature vectors for semantic similarity retrieval based on summary information, and storing the semantic fragment data and semantic feature vectors together in a vector database, a unified data foundation can be provided for subsequent risk classification, restricted recall determination, and vector retrieval.

[0054] As an optional implementation, the specific process of generating historical memory data in step S2 above may include the following steps S21 to S24.

[0055] S21. Based on the preset risk classification rules, determine the risk level of the new semantic fragment data to divide the new semantic fragment data into first-risk-level semantic fragment data, second-risk-level semantic fragment data, and third-risk-level semantic fragment data.

[0056] In step S21, before semantic fragments enter the memory management process, a risk hierarchy is established to provide a clear basis for subsequent storage path selection and retrieval permission control. By determining the risk level of new semantic fragment data, general information, information requiring attention, and high-risk information that may trigger secondary stimuli can be distinguished, preventing content of different sensitivities from being treated equally. This provides the prerequisite for subsequent differentiated storage and differentiated retrieval, and is also the foundation for secondary harm prevention.

[0057] S22. According to the preset writing rules, the first risk level semantic fragment data and the second risk level semantic fragment data are written into the hot memory list, wherein the hot memory list participates in memory retrieval by default.

[0058] This includes routine memory writing processing for low-risk and medium-risk semantic fragments. By writing these semantic fragments into a hot memory list and setting them as the default for memory retrieval, information that is frequently used in the dialogue, has low risk, and is highly relevant to subsequent interactions can be prioritized for fast access. This not only helps to shorten the latency of subsequent memory retrieval but also helps to ensure the continuity of context and memory availability in ordinary interaction scenarios.

[0059] S23. Write the semantic fragment data of the third risk level into the independent secondary damage list according to the preset writing rules. The independent secondary damage list does not participate in memory recall by default.

[0060] Step S23 focuses on the isolated storage processing of high-risk semantic fragments. By writing third-risk level semantic fragments into an independent secondary trauma list and setting them to not participate in memory retrieval by default, sensitive content such as traumatic experiences and other expressions related to high-risk psychological crises can be separated from the regular memory retrieval path, preventing them from being directly brought back during ordinary conversations. This reduces the risk of secondary stimulation caused by the misrecall of high-risk content, giving the memory management process stronger safety constraints.

[0061] S24. Generate historical memory data based on the hot memory list and the independent secondary damage list.

[0062] Step S24 integrates the different categories of memories after hierarchical processing into the historical memory data system, enabling regular and restricted memories to be organized and maintained within the same memory framework. This step preserves both the regular recall capability of low-risk and medium-risk semantic fragments and the restricted management status of high-risk semantic fragments, thus forming a historical memory structure that balances usability and security. This provides foundational data support for subsequent recall permission determination, hot and cold path retrieval, and continuous cognitive construction.

[0063] As an example, please continue reading Figure 6 , Figure 6 This is a schematic diagram of the three-level risk-graded memory information in the continuous cognitive construction method for a mental health intelligent agent provided in this application embodiment. For example... Figure 6 As shown, semantic fragment data can be divided into three risk levels, and different storage and recall strategies can be configured for each risk level. The first risk level (L1) corresponds to ordinary information, such as daily emotions and life events; this type of information can be written to the hot memory list and participates in recall by default. The second risk level (L2) corresponds to moderately sensitive information, such as family conflicts and workplace difficulties; this type of information can also be written to the hot memory list and participates in recall by default. The third risk level (L3) corresponds to high-risk content related to psychological crises, such as trauma; this type of information is written to a separate secondary harm list and does not participate in recall by default to avoid being directly retrieved during normal interactions.

[0064] Furthermore, for semantic fragment data at risk level 3 (L3), a three-tiered progressive recall permission determination mechanism can be set up. Specifically, the first layer is keyword hit determination, which determines whether the current memory recall request hits the preset trauma inquiry keywords; the second layer is semantic vector similarity determination, which compares the similarity between the request vector corresponding to the current memory recall request and the predefined trauma inquiry template vector, and makes a judgment based on the preset semantic similarity threshold; the third layer is large language model intent determination, which is an optional determination layer that is triggered when the first two layers fail to hit, and is used to further determine whether the current memory recall request contains trauma inquiry intent. Recall permission for semantic fragment data at risk level 3 is only allowed when any of the above determinations hits, thereby ensuring restricted management of high-risk content while providing technical support for controlled recall in necessary scenarios.

[0065] In addition, a session continuity maintenance mechanism can be set within the same session window. Specifically, if the third-risk level semantic fragment data has already been recalled in the previous round of memory recall, and the current round of memory recall request occurs within a session window of a preset duration, and the current round request meets the short follow-up question condition, such as the current round text length not exceeding a preset word count threshold, the third-risk level semantic fragment data can be automatically allowed to continue participating in the recall, so as to maintain the continuity of the dialogue context and avoid repeatedly performing high-risk recall permission determination in continuous follow-up question scenarios.

[0066] Furthermore, for semantic fragment data at the third risk level, the merging process can be restricted to allow only append-only merging, without rewriting existing traumatic content. During subsequent dialogues, if new semantic fragment data related to existing high-risk memories is generated, it can be added supplementarily while ensuring the original traumatic memory content is not overwritten or altered. This approach maintains the integrity of the traumatic memory history while enabling the continuous accumulation and controlled management of high-risk content. Overall, through the aforementioned three-tiered risk classification, differentiated storage, restricted recall, and append-only merging mechanism, the safety and continuity of high-risk psychological content management can be improved while ensuring memory availability.

[0067] As another example, please continue reading Figure 7 , Figure 7 This is a schematic diagram of the risk memory diversion and storage process in the continuous cognition construction method for a mental health intelligent agent provided in this application embodiment. For example... Figure 7 As shown, after the new semantic fragment data is extracted, a risk level determination can be performed on the new semantic fragment data to determine the corresponding risk level. If the risk determination result is the first risk level (L1) or the second risk level (L2), the new semantic fragment data is written to the hot memory list; if the risk determination result is the third risk level (L3), the new semantic fragment data is written to the independent secondary injury list. Figure 7 The diagram illustrates the process of splitting and writing new semantic fragment data based on risk levels. A hot memory list stores semantic fragment data at the first and second risk levels, while an independent secondary injury list stores semantic fragment data at the third risk level. In this embodiment, the hot memory list can be maintained using an ordered set structure and participates in subsequent memory retrieval by default; the independent secondary injury list can also be maintained using an ordered set structure, but does not participate in subsequent memory retrieval by default. After risk level determination, semantic fragment data at different risk levels not only enter different storage lists but also correspond to different default retrieval states. In this way, risk classification and storage splitting can be completed during the semantic fragment writing stage, enabling subsequent memory retrieval to directly perform differentiated processing based on different lists.

[0068] Through the above steps S21 to S24, risk classification and distributed storage can be completed during the semantic fragment writing stage, so that memory content of different risk levels corresponds to different default recall states, thereby forming a historical memory data structure that separates ordinary memory and high-risk memory, and providing basic data support for subsequent restricted recall permission determination, hot and cold path retrieval and continuous cognitive construction.

[0069] S3. Based on the preset recall rules, perform recall permission determination on the semantic fragment data in the historical memory data that are restricted from recall, and determine the range of semantic fragment data that can be recalled based on the permission determination results. The preset recall rules include keyword hit determination and semantic similarity determination based on preset semantic similarity threshold.

[0070] As an optional implementation, the process of determining the range of semantic fragment data that can be recalled in step S3 above may also specifically include the following steps S31 to S34.

[0071] S31. Based on the current memory recall request, perform keyword hit determination on the semantic fragment data of the limited recall to obtain the first semantic fragment data with keyword hit.

[0072] Step S31 involves a first-level rapid screening of the semantic fragment data in the restricted recall process. By first performing keyword hit determination, it is possible to prioritize identifying whether explicit semantic clues related to trauma questioning, high-risk content revisiting, etc., have already appeared in the current memory recall request. Since keyword determination has the characteristics of low processing overhead and fast response speed, it can be used as a pre-layer for restricted recall permission determination to complete the preliminary identification of obvious hit scenarios in a short period of time.

[0073] S32. Perform semantic similarity determination on the semantic fragment data of the restricted recall that did not hit the keyword, and generate the memory recall request vector corresponding to the current memory recall request.

[0074] In step S32, if no keyword match is found, the current memory retrieval request is further characterized semantically. Compared to keyword matching, semantic similarity determination does not depend on whether fixed words appear directly. Instead, it converts the current memory retrieval request into a vector representation and extracts its implicit semantic features, thereby providing an input basis for subsequent semantic similarity comparison with predefined templates.

[0075] S33. Compare the similarity between the memory recall request vector and the predefined trauma questioning template vector to obtain the second semantic segment data with a semantic similarity not less than the preset semantic similarity threshold.

[0076] In step S33, the semantic features of the current memory retrieval request are aligned with the semantic features of the predefined trauma questioning template. By comparing the similarity between the memory retrieval request vector and the predefined trauma questioning template vector, and filtering based on a preset semantic similarity threshold, request content that is close to the trauma questioning semantic pattern but is not directly hit at the keyword level can be identified.

[0077] S34. Determine the range of semantic fragment data that can be recalled based on the first semantic fragment data and the second semantic fragment data.

[0078] In step S34, the aforementioned multi-layered judgment results are uniformly summarized to form the final range of semantic fragment data that can participate in the recall. By integrating the first semantic fragment data obtained from keyword matching with the second semantic fragment data obtained from semantic similarity judgment, explicit matching results and implicit semantic matching results can be included in the same recall permission range. This allows the open judgment of restricted recall semantic fragments to take into account both rule-based recognition and semantic recognition, providing clear candidate boundaries for subsequent memory retrieval.

[0079] As an example, please continue reading Figure 8 , Figure 8 This is a schematic diagram of the memory recall process in the continuous cognitive construction method for a mental health intelligent agent provided in this application embodiment. For example... Figure 8 As shown, upon receiving a recall request, the memory retrieval function (e.g., the predefined search_memory()) is called. It first determines whether the current memory recall request includes a recall requirement for semantic fragment data at the third risk level (e.g., whether include_l3 is true). If the determination result is no, recall can be performed only for semantic fragment data corresponding to the first and second risk levels; if the determination result is yes, the recall permission determination process for semantic fragment data at the third risk level is initiated.

[0080] Furthermore, a progressive, multi-layered decision-making approach can be adopted for determining the recall permission of semantic fragment data at the third risk level. First, a keyword hit determination can be performed, checking whether the current memory recall request matches a preset trauma inquiry keyword. If the keyword matches, the recall permission for the third risk level semantic fragment data is enabled (e.g., directly setting allow_l3 to true). If the keyword does not match, a semantic similarity determination is further performed, comparing the request vector corresponding to the current memory recall request with the predefined trauma inquiry template vector and determining whether the semantic similarity is not lower than a preset semantic similarity threshold. If the semantic similarity determination matches, allow_l3 can also be set to true. As an optional approach, if neither the keyword hit determination nor the semantic similarity determination matches, a large language model intent determination can be performed to determine whether the current memory recall request contains a preset trauma inquiry intent. If the intent determination matches, the recall permission for the third risk level semantic fragment data can also be enabled. In this implementation, the third-risk level semantic fragment data only participates in subsequent memory recall if at least one of the above-mentioned keyword hit determination, semantic similarity determination, and optional intent determination is hit; otherwise, the third-risk level semantic fragment data remains in a default state of not participating in recall. Through the above process, permission determination can be performed on the third-risk level semantic fragment data in the memory recall stage, and then a decision can be made on whether to include it in the scope of recallable semantic fragment data based on the determination result.

[0081] As another optional implementation, after the similarity comparison step in step S33 above, intent determination can also be performed, which may specifically include the following steps S351 to S352.

[0082] S351. When there are semantic fragment data with limited recall that have not been matched by similarity comparison, the current memory recall request is input into the large language model for intent determination to obtain the intent determination result.

[0083] In step S351, when neither keyword matching nor semantic similarity determination yields a valid result, a higher level of semantic understanding is introduced to further analyze the current memory retrieval request. Compared to the first two layers of determination, which mainly rely on explicit keywords and template vector similarity, this step uses a large language model to identify the semantic intent of the request content. It can supplement the judgment of implicit expressions, variant expressions, and follow-up questions with strong contextual dependencies, thereby providing a fallback judgment basis for the access control of restricted retrieval semantic fragments.

[0084] S352. When the intent determination result indicates that the current memory recall request contains a preset trauma inquiry intent, the semantic fragment data of the limited recall that failed the similarity comparison is added to the range of semantic fragment data that can be recalled.

[0085] In step S352, the result of the intent determination by the large language model is transformed into a recall permission control result. When the determination result indicates that the current memory recall request contains a preset traumatic questioning intent, the restricted recall semantic fragments that were not previously hit in the semantic similarity determination can be included in the scope of recallable semantic fragment data. This enables the restricted recall permission determination to cover not only explicit hits and template similarity scenarios, but also implicit questioning scenarios that require overall semantic understanding to identify, thereby improving the completeness of identifying high-risk questioning intents.

[0086] As an example, please continue reading Figure 9 , Figure 9 This is a flowchart illustrating the intent determination process in the continuous cognitive construction method for a mental health intelligent agent provided in this application embodiment. For example... Figure 9 As shown, the intent determination corresponds to the third optional determination layer, used to further semantically understand the current memory recall request when neither keyword hit determination nor semantic vector similarity determination yields a valid hit. Compared to the first two determination layers, which mainly rely on similarity matching between explicit keywords and predefined template vectors, this layer focuses more on identifying implicit expressions, variant expressions, and context-dependent follow-up intents. For example, even if trauma keywords do not appear directly and the similarity with the predefined trauma follow-up template does not reach the preset semantic similarity threshold, the current memory recall request may still demonstrate further concern for high-risk content through semantic restatement, euphemisms, or continuous follow-up questions. In this case, the intent recognition capability of the large language model can be introduced to supplement the overall semantics of the current memory recall request, thus providing a fallback basis for whether the restricted recall semantic fragments enter the recallable range. By setting this layer as an optional decision layer and limiting its triggering to when the first two layers fail, we can avoid performing high-cost intent analysis on all recall requests. On the other hand, we can improve the completeness of identifying implicit traumatic questioning intent in scenarios where explicit rules and template matching are insufficient.

[0087] As another optional implementation, after obtaining the intent determination result in step S351, a session window stickiness determination can also be performed, which may specifically include the following steps S361 to S362.

[0088] S361. When the intent determination result is not hit, there are limited recall semantic fragment data that have been added to the scope of recallable semantic fragment data in the previous round of memory recall, and the time interval between the current memory recall request and the previous round of memory recall request is not greater than the preset session window duration, a short follow-up question determination is performed on the current memory recall request.

[0089] In step S361, if the intent determination fails, a session continuity dimension is introduced to supplement the judgment of the current memory recall request. Since the semantic fragment data of the restricted recall may have already been allowed to participate in the recall in the previous round of dialogue, if the current round is still within the preset session window duration, it indicates that the two rounds of requests have strong temporal continuity. In this case, re-judging based solely on the content of the current round might sever the semantic connection between the preceding and following parts. By further performing a short follow-up question judgment under this condition, it can be identified whether the current request is a continuation of the high-risk topic from the previous round, thus providing a basis for whether to continue retaining the restricted recall status.

[0090] S362. When the current memory recall request meets the preset short follow-up conditions, the semantic fragment data of the limited recall is added to the range of recallable semantic fragment data corresponding to the current memory recall request.

[0091] In step S362, when the current request is identified as belonging to a short follow-up question scenario, the recall continuity between the previous and subsequent rounds is maintained. Since short follow-up questions are typically concise and context-dependent, relying solely on the current round's text content for independent judgment can easily fail to capture the true intent of the follow-up question due to its brevity. Therefore, when the preset short follow-up question conditions are met, including the limited-recall semantic fragment data within the recallable range of the current round allows the high-risk semantic context established in the previous round to continue within a short time window, thereby avoiding recall interruptions or semantic disconnections in continuous follow-up question scenarios.

[0092] As an example, please continue reading Figure 10 , Figure 10 This is a flowchart illustrating the session window stickiness judgment process in the continuous cognition construction method for a mental health intelligent agent provided in this application embodiment. Figure 10As shown, if keyword hit determination, semantic vector similarity determination, and optional large language model intent determination all fail, the process can further proceed to the session window stickiness processing. Specifically, if third-risk level semantic fragment data already exists in the previous round of memory recall, and the time interval between the current memory recall request and the previous round of memory recall request is within the same session window (e.g., no more than 45 minutes by default), it can be further determined whether the current round request is a short follow-up question. If the current round request meets the preset short follow-up question conditions, such as the current round text length being no more than 16 characters, the recall permission for third-risk level semantic fragment data can be kept enabled, and the third-risk level semantic fragment data that was allowed to be recalled in the previous round can continue to be included in the scope of semantic fragment data that can be recalled in the current round, thereby maintaining the semantic continuity of the dialogue between the previous and subsequent rounds on high-risk topics.

[0093] Furthermore, the aforementioned session window stickiness does not directly release the recall of third-risk level semantic fragment data for all missed scenarios. Instead, the recall status of third-risk level semantic fragment data is extended only when three conditions are simultaneously met: "third-risk level semantic fragment data has been recalled in the previous round," "the current round is still within the preset session window duration," and "the current round is a short follow-up question." Therefore, in scenarios such as continuous follow-up questions, supplementary follow-up questions, or brief confirmations, even if the current round's text itself does not directly hit the keywords, does not reach the semantic similarity threshold, and the optional intent judgment does not result in a hit, the established limited recall status can still be maintained based on the continuous relationship between the previous and subsequent rounds of dialogue, avoiding the interruption of the high-risk topic context due to the current round's expression being too short.

[0094] Through steps S31 to S34, S351 to S352, and S361 to S362, a hierarchical recall permission control mechanism can be formed in restricted recall scenarios. This mechanism comprises explicit rule recognition, semantic similarity recognition, deep intent recognition, and session continuity maintenance. This expands the conditions for opening high-risk semantic fragment data from a single judgment to a multi-dimensional collaborative judgment. On the one hand, it improves the ability to identify implicit probing, variant expressions, and continuous probing scenarios, enhancing the accuracy and completeness of restricted recall permission determination. On the other hand, it maintains the coherence of the recall chain even when the current request expression is short but has strong continuity with the preceding dialogue, reducing recall interruptions caused by insufficient text information in a single round. Therefore, it reduces the probability of high-risk content being mistakenly opened while ensuring the contextual continuity of high-risk memory retrieval in necessary scenarios, thus balancing security, stability, and interactive coherence in the memory recall process.

[0095] S4. Based on the range of retrievable semantic fragment data, perform memory retrieval from historical memory data to obtain candidate semantic fragment data. Memory retrieval is first performed based on the hot storage path, and if the hot storage path is not hit, it falls back to the cold storage path for execution.

[0096] As an optional implementation, the memory retrieval process in step S4 above may further include the following steps S41 to S45.

[0097] S41. Configure the hot storage path as a hot memory list based on ordered sets. The list capacity of the hot memory list is a preset number. The hot memory list stores semantic fragment data sorted by popularity and records the corresponding recall count, most recent recall time, and popularity weight sorting information.

[0098] In step S41, a fast access path is constructed for high-frequency recall scenarios. By setting the hot storage path as a hot memory list with a preset list capacity and recording the recall number, recent recall time, and popularity weight sorting information of the semantic fragment data, the semantic fragments that are more frequently accessed, more timely, or have higher overall popularity in the historical memory data can be given priority to enter the fast retrieval range, thus providing a foundation for subsequent low-latency queries.

[0099] S42. Configure the cold storage path as a vector database, which stores the full semantic fragment data, the corresponding high-dimensional semantic feature vectors, quality score information, and risk level labeling information.

[0100] In step S42, a cold storage path for full memory retrieval is constructed. By storing full semantic fragment data and corresponding high-dimensional semantic feature vectors in the vector database, along with quality scoring information and risk level labeling information, the cold storage path can not only perform the function of full memory retention, but also provide complete data support for subsequent vector retrieval based on semantic similarity, multi-dimensional scoring, and risk constraint processing.

[0101] S43. Based on the current memory recall request, query the hot memory list and determine whether a hit has occurred based on the preset hot hit determination conditions.

[0102] In step S43, the hot storage path is used to quickly respond to the current memory retrieval request. By first performing a query in the hot memory list and making a judgment based on the preset hot hit judgment conditions, candidate content can be retrieved from the smaller, more clearly sorted high-hot memory set first, thereby reducing the frequency of vector retrieval of the full memory and allowing the memory retrieval process to undergo a fast screening first.

[0103] S44. When the preset hot hit judgment condition is met, the hit semantic fragment data is returned as candidate semantic fragment data, and the recall count, most recent recall time and popularity weight ranking information corresponding to the hit semantic fragment data are updated asynchronously.

[0104] In step S44, if the hot storage path is hit, the candidate semantic fragment is directly determined, and the popularity status of the hot memory list is maintained simultaneously. Since the hit semantic fragment data is already in the hot memory list, it indicates that it has a high correlation or high access frequency with the current memory recall request, so it can be directly used as a candidate result; at the same time, by asynchronously updating the recall count, the most recent recall time, and the popularity weight ranking information, the ranking status of the hot memory list can be continuously adjusted according to the actual access situation.

[0105] S45. When the preset hot hit judgment condition is not hit, generate the recall retrieval vector corresponding to the current memory recall request, and perform approximate nearest neighbor vector retrieval on the full set of semantic fragment data in the vector database based on the recall retrieval vector to obtain a preset number of candidate semantic fragment data.

[0106] In step S45, if the hot storage path is not found, the system switches to the cold storage path to perform a full-scale semantic retrieval. By generating a retrieval vector based on the current memory retrieval request and performing an approximate nearest neighbor vector retrieval on the full set of semantic fragment data in the vector database, candidate semantic fragment data that are semantically similar to the current request can be found from a wider range of historical memories. This ensures that memory retrieval can still be completed based on semantic similarity even when the hot memory list fails to provide effective results.

[0107] As an example, please continue reading Figure 11 , Figure 11 This is a schematic diagram illustrating the two-level hot and cold storage process in the continuous cognitive construction method for a mental health intelligent agent provided in this application embodiment. For example... Figure 11As shown, after receiving a recall request, the application layer can first access the first-level hot storage path, namely the L1 hot list. The hot list can be maintained using Redis ZSET, which stores recently active semantic fragment data and records the corresponding recall count, last_recalled_at recent recall time, and popularity weight ranking information. As an example, the hot list can maintain a preset capacity, such as no more than 20 semantic fragment data entries. If the current recall request hits the hot list, the corresponding result can be returned directly, and the recall count and popularity status of the hit semantic fragment data can be updated asynchronously, thus achieving low-latency return. When the hot list is not hit, it can fall back to the second-level cold storage path, namely the L2 vector database. The vector database can be built using PostgreSQL and pgvector extensions, which stores the full episode data, the corresponding high-dimensional embedding vectors, and information such as quality scores and risk level markers. As an example, the vector database can first return a preset number of candidate semantic fragment data entries, such as no more than 300 candidate episodes. Subsequently, based on the retrieval vector corresponding to the current recall request, an approximate nearest neighbor vector retrieval can be performed in the vector database, and combined with subsequent multidimensional scoring and re-ranking processing, the top-ranked target semantic fragment data can be returned, i.e., the top-k results can be returned.

[0108] Furthermore, after the retrieval of the target semantic fragment data is completed and returned in the cold storage path, the returned results can be asynchronously preheated to the hot list so that subsequent similar recall requests can be responded to in the hot storage path first. Figure 11 The two-tiered hot and cold storage shown is not a simple parallel dual-database structure, but rather forms a hierarchical processing chain of "hot list priority query—missed results rollback to full vector retrieval—retrieval results asynchronously written back to the hot list." The hot storage path primarily handles frequently accessed semantic fragment data, while the cold storage path primarily handles vectorized retrieval of the full semantic memory. This ensures the retrievalability of the full memory while improving access efficiency in high-frequency recall scenarios.

[0109] Through steps S41 to S45 above, a hierarchical memory retrieval mechanism with hot storage path priority and cold storage path fallback can be formed. This allows frequently accessed semantic fragment data to be responded to quickly via the hot memory list, while requests that are not matched can be further semantically retrieved across the entire range based on the vector database. This balances response efficiency and retrieval coverage during the memory recall process. At the same time, by asynchronously updating the popularity information of matched semantic fragment data, the content of the hot memory list can be dynamically adjusted according to the actual access situation, providing a more stable and fast access foundation for subsequent high-frequency recall requests.

[0110] S5. The candidate semantic segment data is re-ranked by multi-dimensional scoring and maximum marginal relevance using configurable weight parameters to filter out the target semantic segment data.

[0111] As an optional implementation, the process of multidimensional scoring and maximum marginal relevance reordering in step S5 above may also specifically include the following steps S51 to S54.

[0112] S51. Determine the relevance score, time freshness score, quality score, risk score, and information density score for each candidate semantic fragment data.

[0113] In step S51, the evaluation criteria for candidate semantic fragment data are broken down into multiple independent scoring dimensions, thereby avoiding reliance on a single semantic similarity for ranking. By introducing dimensions such as relevance, time freshness, quality, risk, and information density, the subsequent screening process for candidate semantic fragment data can simultaneously consider semantic matching degree, time validity, content reliability, security constraints, and information carrying capacity.

[0114] S52. The relevance score, time freshness score, quality score, risk score, and information density score are weighted according to configurable weight parameters to obtain a multi-dimensional comprehensive score for each candidate semantic segment data. The formula for calculating the multi-dimensional comprehensive score is as follows:

[0115]

[0116] in, score This indicates a multi-dimensional comprehensive score. w_rel Configurable weight parameters representing relevance scores. w_ recency Configurable weight parameters representing the freshness score. w_quality Configurable weight parameters representing quality scores w_risk This represents the configurable weight parameters for risk scoring. w_info Configurable weight parameters representing information density scores. rel Relevance score recency Indicates the time freshness rating, quality Indicates quality score, wr Indicates risk score, wi This indicates the information density score.

[0117] S53. Based on the multidimensional comprehensive score corresponding to each candidate semantic segment data and the similarity between candidate semantic segment data, the candidate semantic segment data are reordered according to the maximum marginal relevance.

[0118] Step S53 further controls content redundancy among candidate semantic fragment data based on the multidimensional comprehensive score, ensuring that the final ranking results not only have high relevance but also good diversity. Since multiple candidate semantic fragment data may be highly relevant to the current memory retrieval request but also have strong semantic overlap, ranking solely based on the comprehensive score could easily result in a cluster of semantic fragments with similar content. By introducing similarity constraints between candidate semantic fragment data during the ranking process, highly relevant semantic fragments can be retained while suppressing candidates with high semantic repetition, thus achieving a balance between relevance and diversity in the ranking results. This provides richer and more comprehensive semantic fragment inputs for constructing subsequent continuous cognitive results.

[0119] S54. Determine the preset number of target semantic fragment data based on the reordering results.

[0120] Through steps S51 to S54, multidimensional comprehensive evaluation and differentiated ranking can be performed on candidate semantic fragment data, so that the screening results are no longer limited to a single semantic similarity, but simultaneously take into account relevance, timeliness, quality, security and information carrying capacity. At the same time, by introducing maximum marginal relevance reordering and determining a preset number of target semantic fragment data, content redundancy can be reduced while ensuring the overall relevance of the recall results, thereby providing more refined, balanced and representative semantic fragment inputs for the construction of subsequent continuous cognitive results.

[0121] S6. Based on the updated psychological profile data and target semantic fragment data, construct the continuous cognitive results of the psychological health intelligent agent on the target user.

[0122] In addition to the extraction, risk level determination, and splitting of new semantic fragment data, semantic conflict detection and intelligent deduplication and merging can be performed before these processes are completed. Specifically, the new semantic fragment data can be compared with recent episodes of the same risk level using cosine similarity or text similarity. When the similarity reaches a preset threshold, it indicates a high degree of content overlap between the new semantic fragment data and existing episodes, and the process can proceed to the intelligent merging process. Once in this process, rule-level semantic conflict detection can be prioritized, such as detecting antonyms and negation flips, to determine if the two are similar in expression but contradictory in meaning. When a semantic conflict is detected, the corresponding content is not merged; instead, the new semantic fragment data is split into new episodes and stored independently. For cases with extremely high similarity but where the rule layer cannot clearly determine whether a conflict exists, a large language model can be further invoked to determine whether the two constitute a semantic contradiction. If no conflict is detected, refined merging of content fields can be performed based on sentence-level Jaccard similarity to reduce redundant expressions and retain incremental information. Furthermore, when the length of an existing episode reaches a preset length threshold, merging new content into it will cease, and a new episode will be forcibly created instead to prevent the continuous expansion of a single memory. For episodes at the third risk level, it can be further restricted to allow only append-only merging, while prohibiting the rewriting of existing trauma content, thereby preserving the historical integrity of high-risk memory content while retaining newly added information.

[0123] The continuous cognitive construction method for mental health agents provided in this application, through hierarchical and progressive updates of mental profile data, risk-based classification and distributed storage of semantic fragment data, multi-level recall permission determination for restricted recall content, and combined with a memory retrieval mechanism that prioritizes hot storage paths and rolls back cold storage paths, as well as multi-dimensional scoring and maximum marginal relevance reordering processing, enables mental health agents to form continuous, dynamic, and hierarchical cognitive results for target users. On the one hand, it allows high-frequency changing information, periodic changing information, and relatively stable deep features to enter mental profile data at different rhythms, reducing the processing overhead caused by repeated extraction and full updates while ensuring the timeliness of the profile; on the other hand, it allows for differentiated management of ordinary memory content and high-risk memory content during the writing stage, so that high-risk content is in a restricted recall state by default and is only controlled to participate in recall when keyword hit, semantic similarity determination, intent determination, or conversation continuity conditions are met, thereby reducing the probability of high-risk content being improperly brought back. Furthermore, by employing hot-cold hierarchical retrieval, multidimensional comprehensive scoring, and maximum marginal relevance reordering, the relevance, representativeness, and diversity of candidate semantic fragments can be improved while ensuring recall efficiency, reducing redundant content from entering the subsequent cognitive construction process. Thus, while balancing computational efficiency, memory availability, and content security, the accuracy, stability, and interactive coherence of continuous cognitive construction in mental health scenarios can be enhanced.

[0124] Please continue reading. Figure 12 , Figure 12 This is a schematic diagram of the system structure of the continuous cognitive construction system for a mental health intelligent agent provided in the embodiments of this application, such as... Figure 12 As shown, the continuous cognition construction system 50 of the mental health intelligent agent includes: a portrait progressive update module 51, a semantic fragment splitting and storage module 52, a recall permission determination module 53, a memory retrieval module 54, a sorting and filtering module 55, and a continuous cognition construction module 56.

[0125] The progressive profile update module 51 is specifically used to extract profile feature data in parallel from the target user's current periodic dialogue data according to a preset trigger frequency, and merge the extraction results into the psychological profile data of a preset dimension according to a preset merging strategy, so as to progressively update the psychological profile data. The semantic fragment splitting and storage module 52 is specifically used to classify the new semantic fragment data extracted from the current periodic dialogue data according to a preset risk classification rule, and split and store the new semantic fragment data of different risk levels according to a preset writing rule to generate historical memory data. The recall permission determination module 53 is specifically used to perform recall permission determination on the semantic fragment data of the historical memory data that is restricted from recall based on a preset recall rule, and determine the range of semantic fragment data that can be recalled according to the permission determination result, wherein the preset recall rule includes keyword hit determination and semantic similarity determination based on a preset semantic similarity threshold. The memory retrieval module 54 is specifically used to perform memory retrieval from the historical memory data based on the range of recallable semantic fragment data to obtain candidate semantic fragment data. The memory retrieval is first performed based on the hot storage path, and if the hot storage path is not hit, it falls back to the cold storage path for execution. The sorting and filtering module 55 is used to perform multi-dimensional scoring and maximum marginal relevance reordering on the candidate semantic fragment data through configurable weight parameters to filter out target semantic fragment data. The continuous cognition construction module 56 is used to construct the continuous cognitive results of the mental health agent on the target user based on the updated psychological profile data and the target semantic fragment data.

[0126] As an optional implementation, the progressive profile update module 51 is further configured to: extract event-level profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a first preset trigger round; extract event-level profile feature data and dynamic profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a second preset trigger round; extract event-level profile feature data, dynamic profile feature data, and stable profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a third preset trigger round; and merge the event-level profile feature data, the dynamic profile feature data, and the stable profile feature data into the psychological profile data according to the preset merging strategy.

[0127] As an optional implementation, the semantic fragment splitting and storage module 52 is further configured to extract new semantic fragment data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a preset milestone round; the new semantic fragment data includes title information, content information, summary information, context information, risk level information, and information level information; to determine whether to retain the new semantic fragment data, and when the determination result is to skip and the current periodic dialogue data contains a first-person preference expression, to trigger a special path for preference memory to write the new semantic fragment data into preference memory; to generate a semantic feature vector for semantic similarity retrieval based on the summary information, and to store the new semantic fragment data and the semantic feature vector in a vector database.

[0128] As an optional implementation, the semantic fragment splitting and storage module 52 is further configured to: determine the risk level of the new semantic fragment data according to the preset risk classification rules, thereby dividing the new semantic fragment data into first-risk-level semantic fragment data, second-risk-level semantic fragment data, and third-risk-level semantic fragment data; write the first-risk-level semantic fragment data and the second-risk-level semantic fragment data into a hot memory list according to the preset writing rules, wherein the hot memory list participates in memory retrieval by default; write the third-risk-level semantic fragment data into an independent secondary injury list according to the preset writing rules, wherein the independent secondary injury list does not participate in memory retrieval by default; and generate the historical memory data based on the hot memory list and the independent secondary injury list.

[0129] As an optional implementation, the recall permission determination module 53 is further specifically used to: determine keyword hits on the restricted recall semantic fragment data based on the current memory recall request to obtain first semantic fragment data with keyword hits; determine semantic similarity on the restricted recall semantic fragment data without keyword hits to generate a memory recall request vector corresponding to the current memory recall request; compare the memory recall request vector with a predefined trauma inquiry template vector to obtain second semantic fragment data with a semantic similarity not less than the preset semantic similarity threshold; and determine the range of recallable semantic fragment data based on the first semantic fragment data and the second semantic fragment data.

[0130] As an optional implementation, the recall permission determination module 53 is further specifically used to input the current memory recall request into a large language model for intent determination when there are semantic fragment data of the restricted recall that have not been matched by the similarity comparison, and obtain an intent determination result; when the intent determination result indicates that the current memory recall request contains a preset trauma inquiry intent, the semantic fragment data of the restricted recall that have not been matched by the similarity comparison is added to the range of the recallable semantic fragment data.

[0131] As an optional implementation, the recall permission determination module 53 is further specifically used to perform a short follow-up question determination on the current memory recall request when the intent determination result is not hit, there are restricted recall semantic fragment data that have been added to the scope of recallable semantic fragment data in the previous round of memory recall, and the time interval between the current memory recall request and the previous round of memory recall request is not greater than the preset session window duration; when the current memory recall request meets the preset short follow-up question condition, the restricted recall semantic fragment data is added to the scope of recallable semantic fragment data corresponding to the current memory recall request.

[0132] As an optional implementation, the memory retrieval module 54 is further configured to configure the hot storage path as a hot memory list based on an ordered set, the list capacity of which is a preset number, the hot memory list stores semantic fragment data sorted by popularity, and records the corresponding recall count, most recent recall time, and popularity weight sorting information; configure the cold storage path as a vector database, the vector database stores the full semantic fragment data, the corresponding high-dimensional semantic feature vectors, quality score information, and risk level labeling information; query the hot memory list according to the current memory recall request, and determine whether a hit is achieved according to a preset hot hit determination condition; when the preset hot hit determination condition is met, return the hit semantic fragment data as the candidate semantic fragment data, and asynchronously update the recall count, most recent recall time, and popularity weight sorting information corresponding to the hit semantic fragment data; when the preset hot hit determination condition is not met, generate a recall retrieval vector corresponding to the current memory recall request, and perform an approximate nearest neighbor vector search on the full semantic fragment data in the vector database based on the recall retrieval vector to obtain a preset number of candidate semantic fragment data.

[0133] As an optional implementation, the sorting and filtering module 55 is further configured to determine the relevance score, time freshness score, quality score, risk score, and information density score corresponding to each candidate semantic segment data; and to perform a weighted calculation on the relevance score, time freshness score, quality score, risk score, and information density score according to the configurable weight parameters to obtain a multidimensional comprehensive score corresponding to each candidate semantic segment data, wherein the calculation formula for the multidimensional comprehensive score is: ,in, score This represents the multidimensional comprehensive score. w_rel The configurable weight parameters representing the relevance score w_recency This represents the configurable weighting parameter for the freshness score. w_quality This represents the configurable weight parameters for the quality score. w_risk This represents the configurable weight parameters of the risk score. w_info The configurable weight parameters represent the information density score. rel Indicates the correlation score, recency Indicates the time freshness score, quality Indicates the quality score, wr This indicates the risk score. wi The information density score is represented; based on the similarity between the multidimensional comprehensive score corresponding to each candidate semantic segment data and the candidate semantic segment data, the candidate semantic segment data is re-ranked by maximum marginal relevance; a preset number of target semantic segment data is determined according to the re-ranking result.

[0134] It should be noted that the aforementioned continuous cognition construction system for mental health agents can execute the continuous cognition construction method for mental health agents provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in the embodiments of the continuous cognition construction system for mental health agents can be found in the continuous cognition construction method for mental health agents provided in the embodiments of this application.

[0135] Figure 13 This is a schematic diagram of the hardware structure of an electronic device for implementing a continuous cognitive construction method for a mental health intelligent agent, as provided in an embodiment of this application. Figure 13 As shown, the electronic device 600 includes:

[0136] One or more processors 610 and memory 620, Figure 13 Take the 610 processor as an example.

[0137] The processor 610 and the memory 620 can be connected via a bus or other means. Figure 13 Taking the example of a connection between China and Israel via a bus.

[0138] The memory 620, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the continuous cognition construction method for a mental health intelligent agent in the embodiments of this application. The processor 610 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 620, thereby realizing the continuous cognition construction method for a mental health intelligent agent in the above-described method embodiments.

[0139] The memory 620 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the continuous cognitive construction system of the mental health agent. Furthermore, the memory 620 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 620 may optionally include memory remotely located relative to the processor 610, and these remote memories can be connected to the continuous cognitive construction system of the mental health agent via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0140] The one or more modules are stored in the memory 620. When executed by the one or more processors 610, they perform the continuous cognitive construction method of the mental health agent in any of the above method embodiments, for example, performing the above-described... Figure 2 Steps S1 to S6 in the method are implemented. Figure 12 The functions of modules 51-56 in the document.

[0141] The above-described product can perform the methods provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects for performing the methods. Technical details not described in detail in this embodiment can be found in the methods provided in the embodiments of this application.

[0142] This application provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example... Figure 13 One of the processors 610 can enable the one or more processors to execute the continuous cognitive construction method of the mental health agent in any of the above method embodiments, for example, to execute the above-described Figure 2 Steps S1 to S6 in the method are implemented. Figure 12 The functions of modules 51-56 in the document.

[0143] This application provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium. The computer program includes program instructions that, when executed by an electronic device, enable the electronic device to perform the continuous cognitive construction method for a mental health agent in any of the above method embodiments, for example, to execute the above-described method. Figure 2 Steps S1 to S6 in the method are implemented. Figure 12 The functions of modules 51-56 in the document.

[0144] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0145] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

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

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of this application as described above, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for constructing continuous cognition in a mentally healthy intelligent agent, characterized in that, include: According to a preset trigger frequency, profile feature data is extracted in parallel from the current periodic dialogue data of the target user. The extracted results are then merged into the psychological profile data of a preset dimension according to a preset merging strategy, so as to progressively update the psychological profile data. The new semantic fragment data extracted from the current periodic dialogue data is classified according to the preset risk classification rules, and the new semantic fragment data of different risk levels are split and stored according to the preset writing rules to generate historical memory data. Based on preset recall rules, the semantic fragment data in the historical memory data that are subject to limited recall are subject to recall permission determination, and the range of semantic fragment data that can be recalled is determined according to the permission determination result. The preset recall rules include keyword hit determination and semantic similarity determination based on preset semantic similarity threshold. Based on the range of retrievable semantic fragment data, memory retrieval is performed from the historical memory data to obtain candidate semantic fragment data. The memory retrieval is first performed based on the hot storage path, and if the hot storage path is not hit, it falls back to the cold storage path for execution. The candidate semantic fragment data is re-ranked by multi-dimensional scoring and maximum marginal relevance using configurable weight parameters to filter out the target semantic fragment data. Based on the updated psychological profile data and the target semantic fragment data, a continuous cognitive result of the mental health intelligent agent on the target user is constructed. The step of progressively updating the psychological profile data by simultaneously extracting profile feature data from the target user's current periodic dialogue data according to a preset trigger frequency and merging the extracted results into psychological profile data of a preset dimension according to a preset merging strategy includes: extracting event-level profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a first preset trigger round; extracting event-level profile feature data and dynamic-level profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a second preset trigger round; extracting event-level profile feature data, dynamic-level profile feature data, and stable-level profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a third preset trigger round; and merging the event-level profile feature data, the dynamic-level profile feature data, and the stable-level profile feature data into the psychological profile data according to the preset merging strategy. The process involves performing recall permission determination on the restricted semantic fragment data in the historical memory data based on a preset recall rule, and determining the range of recallable semantic fragment data based on the permission determination result. The preset recall rule includes steps of keyword hit determination and semantic similarity determination based on a preset semantic similarity threshold. Specifically, it includes: performing keyword hit determination on the restricted recall semantic fragment data based on the current memory recall request to obtain first semantic fragment data with keyword hits; performing semantic similarity determination on the restricted recall semantic fragment data without keyword hits to generate a memory recall request vector corresponding to the current memory recall request; comparing the memory recall request vector with a predefined trauma inquiry template vector to obtain second semantic fragment data with a semantic similarity not less than the preset semantic similarity threshold; and determining the range of recallable semantic fragment data based on the first semantic fragment data and the second semantic fragment data. The method further includes, after the step of comparing the memory recall request vector with the predefined trauma inquiry template vector, the following steps: when there are semantic fragment data of the restricted recall that are not matched by the similarity comparison, inputting the current memory recall request into a large language model for intent determination to obtain an intent determination result; when the intent determination result indicates that the current memory recall request contains a preset trauma inquiry intent, adding the semantic fragment data of the restricted recall that are not matched by the similarity comparison to the range of retrievable semantic fragment data. The step of inputting the current memory recall request into the large language model for intent determination and obtaining the intent determination result further includes: when the intent determination result is not hit, there are restricted recall semantic fragment data that have been added to the scope of recallable semantic fragment data in the previous round of memory recall, and the time interval between the current memory recall request and the previous round of memory recall request is not greater than the preset session window duration, performing a short follow-up question determination on the current memory recall request; when the current memory recall request meets the preset short follow-up question condition, adding the restricted recall semantic fragment data to the scope of recallable semantic fragment data corresponding to the current memory recall request.

2. The method for constructing continuous cognition of a mental health intelligent agent according to claim 1, characterized in that, Before the step of classifying the risk of new semantic fragment data extracted from the current periodic dialogue data according to preset risk classification rules, the method further includes: When the dialogue round corresponding to the current periodic dialogue data reaches a preset milestone round, new semantic fragment data is extracted from the current periodic dialogue data; The new semantic fragment data includes title information, content information, summary information, context information, risk level information, and information level information; The new semantic fragment data is subject to retention determination. When the determination result is to skip and the current cycle dialogue data contains a first-person preference expression, a special path for preference memory is triggered to write the new semantic fragment data into preference memory. Based on the summary information, a semantic feature vector for semantic similarity retrieval is generated, and the new semantic fragment data and the semantic feature vector are stored in a vector database.

3. The method for constructing continuous cognition of a mental health intelligent agent according to claim 1, characterized in that, The step of classifying the new semantic fragment data extracted from the current periodic dialogue data according to a preset risk classification rule, and then distributing and storing the new semantic fragment data of different risk levels according to a preset writing rule to generate historical memory data, includes: According to the preset risk classification rules, the risk level of the new semantic fragment data is determined so as to divide the new semantic fragment data into first risk level semantic fragment data, second risk level semantic fragment data and third risk level semantic fragment data. According to the preset writing rules, the first risk level semantic fragment data and the second risk level semantic fragment data are written into the hot memory list, wherein the hot memory list participates in memory retrieval by default; According to the preset writing rules, the semantic fragment data of the third risk level is written into the independent secondary injury list, wherein the independent secondary injury list does not participate in memory recall by default; The historical memory data is generated based on the hot memory list and the independent secondary injury list.

4. The method for constructing continuous cognition of a mental health intelligent agent according to claim 1, characterized in that, The step of retrieving candidate semantic fragment data from historical memory data based on the range of retrievable semantic fragment data, wherein the memory retrieval is first performed based on the hot storage path and then falls back to the cold storage path if the hot storage path is not found, includes: The hot storage path is configured as a hot memory list based on an ordered set. The list capacity of the hot memory list is a preset number. The hot memory list stores semantic fragment data sorted by popularity and records the corresponding recall count, most recent recall time, and popularity weight sorting information. The cold storage path is configured as a vector database, which stores the full set of semantic fragment data, the corresponding high-dimensional semantic feature vectors, quality score information, and risk level labeling information. Based on the current memory recall request, query the hot memory list and determine whether a hit has occurred based on the preset hot hit determination conditions; When the preset hot hit determination condition is met, the hit semantic fragment data is returned as the candidate semantic fragment data, and the recall count, most recent recall time and hot weight ranking information corresponding to the hit semantic fragment data are updated asynchronously. When the preset hot hit determination condition is not met, a recall retrieval vector corresponding to the current memory recall request is generated. Based on the recall retrieval vector, an approximate nearest neighbor vector search is performed on the full set of semantic fragment data in the vector database to obtain a preset number of candidate semantic fragment data.

5. The method for constructing continuous cognition of a mental health intelligent agent according to claim 1, characterized in that, The step of performing multidimensional scoring and maximum marginal relevance reordering on the candidate semantic segment data using configurable weight parameters to filter out the target semantic segment data includes: The relevance score, time freshness score, quality score, risk score, and information density score corresponding to each candidate semantic segment data are determined respectively. The relevance score, freshness score, quality score, risk score, and information density score are weighted according to the configurable weight parameters to obtain a multidimensional comprehensive score for each candidate semantic segment data. The formula for calculating the multidimensional comprehensive score is as follows: in, score This represents the multidimensional comprehensive score. w_rel The configurable weight parameters representing the relevance score w_ recency This represents the configurable weighting parameter for the freshness score. w_quality This represents the configurable weight parameters for the quality score. w_risk This represents the configurable weight parameters of the risk score. w_info The configurable weight parameters represent the information density score. rel Indicates the correlation score, recency Indicates the time freshness score, quality Indicates the quality score, wr This indicates the risk score. wi This represents the information density score; Based on the similarity between the multidimensional comprehensive score corresponding to each candidate semantic segment data and the candidate semantic segment data, the candidate semantic segment data is reordered according to the maximum marginal relevance. The predetermined number of target semantic fragment data is determined based on the reordering results.

6. A continuous cognitive construction system for a psychologically healthy intelligent agent, characterized in that, include: The profile progressive update module is used to extract profile feature data in parallel from the current periodic dialogue data of the target user according to a preset trigger frequency, and merge the extraction results into the psychological profile data of a preset dimension according to a preset merging strategy, so as to progressively update the psychological profile data. The semantic fragment splitting and storage module is used to classify the new semantic fragment data extracted from the current periodic dialogue data according to the preset risk classification rules, and to split and store the new semantic fragment data of different risk levels according to the preset writing rules to generate historical memory data. The recall permission determination module is used to perform recall permission determination on the semantic fragment data of the historical memory data that are restricted from recall based on the preset recall rules, and determine the range of semantic fragment data that can be recalled based on the permission determination result. The preset recall rules include keyword hit determination and semantic similarity determination based on the preset semantic similarity threshold. The memory retrieval module is used to perform memory retrieval from the historical memory data according to the range of recallable semantic fragment data to obtain candidate semantic fragment data. The memory retrieval is first performed based on the hot storage path, and when the hot storage path is not hit, it falls back to the cold storage path for execution. The sorting and filtering module is used to perform multidimensional scoring and maximum marginal relevance reordering on the candidate semantic fragment data through configurable weight parameters, so as to filter out the target semantic fragment data. The continuous cognition construction module is used to construct the continuous cognitive results of the mental health intelligent agent on the target user based on the updated psychological profile data and the target semantic fragment data; Specifically, the progressive profile update module is further configured to: extract event-level profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a first preset trigger round; extract event-level profile feature data and dynamic-level profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a second preset trigger round; extract event-level profile feature data, dynamic-level profile feature data, and stable-level profile feature data from the current periodic dialogue data when the dialogue round corresponding to the current periodic dialogue data reaches a third preset trigger round; and merge the event-level profile feature data, the dynamic-level profile feature data, and the stable-level profile feature data into the psychological profile data according to the preset merging strategy. Specifically, the recall permission determination module is further configured to: perform keyword hit determination on the restricted recall semantic fragment data based on the current memory recall request to obtain first semantic fragment data with keyword hits; perform semantic similarity determination on the restricted recall semantic fragment data without keyword hits to generate a memory recall request vector corresponding to the current memory recall request; compare the memory recall request vector with a predefined trauma inquiry template vector to obtain second semantic fragment data with a semantic similarity not less than the preset semantic similarity threshold; and determine the range of recallable semantic fragment data based on the first semantic fragment data and the second semantic fragment data. Specifically, the recall permission determination module is further used to input the current memory recall request into a large language model for intent determination when there are semantic fragment data of the restricted recall that have not been matched by the similarity comparison, and obtain an intent determination result; when the intent determination result indicates that the current memory recall request contains a preset trauma inquiry intent, the semantic fragment data of the restricted recall that have not been matched by the similarity comparison is added to the range of semantic fragment data that can be recalled. Specifically, the recall permission determination module is further used to perform a short follow-up question determination on the current memory recall request when the intent determination result is not hit, there are restricted recall semantic fragment data that have been added to the scope of recallable semantic fragment data in the previous round of memory recall, and the time interval between the current memory recall request and the previous round of memory recall request is not greater than the preset session window duration; when the current memory recall request meets the preset short follow-up question conditions, the restricted recall semantic fragment data is added to the scope of recallable semantic fragment data corresponding to the current memory recall request.