Intelligent Customer Service Dialogue Methods and Systems Based on Proactive Context Management and Memory Enhancement
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-31
- Publication Date
- 2026-08-14
AI Technical Summary
但目前基于LLM的智能客服系统,上下文管理方案存在明显局限,主要包括三种类型:全量上下文拼接,(FullContextConcatenation),将所有历史对话与当前查询线性拼接,受LLMToken长度限制严重,无法适配长对话;滑动窗口(SlidingWindow),仅保留最近N轮对话,易丢弃早期重要信息导致逻辑断层和记忆丢失,是“前摄干扰”的主要诱因;简单规则下的分层/摘要,通过预设规则或固定间隔摘要压缩上下文,缺乏灵活性,无法适应动态对话状态,且可能丢失关键细节
1、本方案通过引入动态感知与决策机制、跨会话长期记忆模块以及上下文塑形工具集,并结合宏观策略与微观工具的协同作用,有效克服了现有客服系统在上下文管理、个性化延续、信息利用及稳定性方面的不足,带来多方面显著有益效果,具体如下:
Smart Images

Figure CN122570697A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to an intelligent customer service dialogue method and system with proactive context management and memory enhancement. Background Technology
[0002] With the rapid popularization of artificial intelligence applications, intelligent customer service has been widely used in e-commerce, finance, healthcare, government affairs, and other scenarios. Especially in scenarios requiring multi-round, complex, and lengthy human-computer dialogues, such as online intelligent customer service, virtual assistants, and enterprise-level business processing robots, intelligent customer service has become a core support for improving service efficiency and user experience. To this end, related intelligent customer service systems are constantly iterating and optimizing. However, in actual use, due to factors such as the complexity and variability of user questions, long dialogue times, and overlapping tasks, existing customer service systems generally suffer from problems such as context breaks, inconsistent responses, and a lack of personalized service.
[0003] In practical applications, existing intelligent customer service systems demonstrate several positive effects: First, they alleviate "memory interruptions" and "proactive interference," maintaining continuous focus on key information during long, multi-turn conversations, proactively filtering out irrelevant information, and improving task accuracy and logical coherence. Second, they improve task success rates and efficiency, enhancing processing smoothness and reducing the burden of repetitive user interactions in scenarios with multi-task concurrency and frequent switching. Third, they support personalized services, identifying returning users through cross-session long-term memory modules and providing customized services by invoking their historical preferences and past questions. Fourth, they optimize resource utilization, focusing on key information within a limited context window through tools such as context segmentation, folding, and summarization, reducing redundant interference, and improving model stability and response quality in long conversations.
[0004] Taking e-commerce platforms as an example, when users consult customer service during multiple shopping trips, the system can recall their historical purchasing behavior and preferences, proactively providing personalized recommendations and after-sales assistance. Such applications help improve customer satisfaction and long-term customer loyalty. However, current intelligent customer service systems based on LLM have significant limitations in their context management solutions, mainly including three types: Full Context Concatenation, which linearly concatenates all historical dialogues with the current query, is severely limited by the length of the LLMToken and cannot adapt to long dialogues; Sliding Window, which only retains the most recent N rounds of dialogue, easily discarding important early information, leading to logical gaps and memory loss, and is a major cause of "proactive interference"; and Layered / Summary under Simple Rules, which compresses the context through preset rules or fixed-interval summaries, lacks flexibility, cannot adapt to dynamic dialogue states, and may lose key details.
[0005] While the aforementioned technical solutions offer certain advantages in specific scenarios, four core issues remain to be addressed when facing the complex demands of real-world customer service scenarios: First, the strategies are rigid and lack real-time adaptability, failing to dynamically adjust and optimize based on conversation progress, changes in user intent, and emotional fluctuations. Second, there is a lack of cross-session memory and proactive interaction capabilities, limiting them to single-session context management and hindering the transfer of historical memory across sessions and the continuation of personalized services. LLM passively generates text and lacks a mechanism for proactively managing and utilizing long-term memory. Third, the token-based processing method is simple and inefficient, often employing crude strategies such as discarding or truncating historical information, lacking the ability to intelligently "shape" and efficiently "compress" contextual information. Fourth, it is difficult to overcome the inherent defects of LLM, failing to effectively mitigate the performance degradation caused by proactive interference and sequence position deviations. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies by proposing an intelligent customer service dialogue method and system with proactive context management and memory enhancement. To achieve the above objectives, the present invention adopts the following technical solution: A proactive context management and memory-enhanced intelligent customer service dialogue approach includes the following steps: S1: Preliminary context construction. When a user initiates a new round of audio and video dialogue query, the current query is combined with the historical audio and video interactions and corresponding text conversion data stored in the session layer to form a preliminary dialogue context. S2: System state awareness. Based on the initial dialogue context, the dynamic perception and decision-making module is activated. Real-time analysis is performed from the dimensions of intent recognition, emotion analysis (including voice and facial emotions), and task state evaluation. Multi-source information is integrated to complete the global state awareness of the system. S3: Structured policy instruction generation. Based on state-aware results, the policy generation function comprehensively analyzes the core elements and outputs a set of structured executable policy instructions that specify the system's actions. S4: Context optimization construction, based on the policy instruction set, executes long memory retrieval and writing, session history optimization operations in parallel, and then intelligently extracts core content from multiple levels according to information layer priority and resource budget, and automatically splices them to form the final context; S5: Response generation and memory persistence. The final context is input into the large language model to generate response text, and the data of the session layer and task layer are updated synchronously. When the session ends, the session summary is extracted through the long-term memory module and persistently stored in the database.
[0007] Preferably, the system processing actions specified by the structured executable policy instruction set output by S3 include: setting resource allocation for dialogue token budget, determining mode selection between stable priority workflow mode and flexible priority autonomous mode, deciding on memory management for long-term memory retrieval, planning context shaping for optimizing conversation layer history records, and setting information priority to clarify the information extraction priority of each layer.
[0008] Preferably, the optimization and construction of the S4 context includes: the long-term memory module encodes the query text into a vector to retrieve historical memories and writes it into the corresponding storage layer according to instructions; the context shaping toolset optimizes the conversation layer dialogue fragments according to instructions; after the above operations are completed, driven by the policy instruction set, the core content is extracted from multiple levels according to the information layer priority and the token budget and spliced to form the final Prompt. This process does not require an independent "assembler" module.
[0009] This invention also provides a dynamic context management system for large language models, comprising five core components: a hierarchical context storage, a dynamic perception and decision-making module, a long-term memory module, a context shaping toolset, and a large language model. The dynamic perception and decision-making module, as the central hub of the system, is responsible for perceiving the dialogue status in real time and generating the optimal context construction strategy. The hierarchical context storage is responsible for the structured hierarchical management and collaborative supply of multi-source interactive information, providing data support for strategy formulation and context construction; The long-term memory module is responsible for the closed-loop management and dynamic adaptation of users' historical memories, realizing the persistent storage, semantic retrieval and injection of cross-session memories; The context shaping toolset is responsible for the dynamic compression, recombination, and precise positioning of context fragments, improving the efficiency of information utilization; The large language model is responsible for generating responses based on the optimized and efficient prompt. Each module exchanges data and transmits control commands through a unified bus architecture or message queue, ensuring efficient and reliable collaboration.
[0010] Preferably, the hierarchical context storage adopts a multi-level storage pool architecture of session layer, task layer, system layer, and user / history layer to realize structured hierarchical management and collaborative supply of multi-source interactive information. Through close coupling with the dynamic perception and decision-making module and the context shaping toolset, it completes information differentiation management and on-demand calling. Each storage layer stores information differently, and the session layer, task layer, user / history layer and dynamic perception and decision-making module form a collaborative mechanism, while the system layer is continuously activated as a basic configuration.
[0011] Preferably, the dynamic perception and decision-making module is actively activated before each round of response generation, integrates multi-source information to complete intent recognition, sentiment analysis and task status assessment, formulates the optimal context construction strategy and outputs a structured strategy instruction set including Token budget, hierarchical priority, autonomous / workflow / hybrid mode, etc., so as to dynamically control the context management mode and drive the invocation of the context shaping toolset.
[0012] Preferably, the long-term memory module adopts a "write-store-retrieve-inject" mechanism, combining the Transformer summary model and vector database to realize closed-loop management, persistent storage, semantic retrieval, and dynamic injection of user historical memory into the current dialogue context; its implementation mechanism includes generating a semantic summary and storing it as a vector when the session ends, and retrieving relevant memory fragments by vector when a new session begins or a retrieval command is received.
[0013] Preferably, the context shaping toolset integrates chunking, folding / expanding, summarizing / restoring, and semantic search tools to achieve dynamic compression, recombination, and precise positioning of context fragments. Tool calls are driven by policy instructions or directly invoked by the large language model in autonomous mode.
[0014] The present invention has the following beneficial effects: 1. This solution, by introducing dynamic perception and decision-making mechanisms, a cross-session long-term memory module, and a context shaping toolset, and combining the synergistic effect of macro strategies and micro tools, effectively overcomes the shortcomings of existing customer service systems in context management, personalization continuity, information utilization, and stability, bringing significant benefits in many aspects, as follows: 2. Through dynamic perception and decision-making mechanisms, the context management strategy can be adaptively adjusted in real time according to the progress of the dialogue, changes in user intent, and emotional fluctuations. This completely overcomes the shortcomings of the rigid strategy in existing solutions, allowing the system to better adapt to complex and ever-changing customer service dialogue scenarios, reducing response deviations caused by rigid strategies, thereby achieving flexible and adaptive context management and improving scenario adaptability.
[0015] 3. This invention, by leveraging a cross-session long-term memory module, enables the cross-session transfer and retrieval of user historical memories. This effectively overcomes the limitation of existing solutions lacking cross-session memory, accurately identifying returning users and matching their historical preferences and past questions. This provides users with customized services, significantly improving the continuity and intelligence of the interactive experience, thereby extending the personalized service experience and enhancing the continuity and intelligence of the interaction.
[0016] 4. This invention integrates a context shaping toolset to intelligently "shape" and efficiently "compress" context information, replacing the crude strategy of simply "discarding" or "truncating" existing solutions. While controlling token usage, it maximizes the retention of key information, improves information utilization efficiency, and thus efficiently overcomes token restrictions and reduces the loss of key information. Attached Figure Description
[0017] Figure 1 Flowchart of the intelligent customer service dialogue method provided by the present invention; Figure 2 The architecture diagram of the intelligent customer service dialogue system provided by this invention; Figure 3 The LLM context structure diagram provided by this invention; Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] Reference Figure 1-3 The system architecture of this invention mainly consists of a computing server, a storage database, and network devices in terms of hardware. Its core architecture mainly consists of five core components: a hierarchical context memory, a dynamic perception and decision-making module (ACM policy engine), a long-term memory module, a context shaping toolset, and a large language model (LLM). Each module exchanges data and transmits control commands through a unified bus architecture or message queue, and communicates and collaborates through predefined interfaces and data protocols, forming an organic whole.
[0020] The system architecture centers on the Dynamic Perception and Decision Module (ACM), and its overall workflow is as follows: User queries first arrive at the system and are sent to the ACM module along with the context from the hierarchical memory for state perception and policy generation. Subsequently, policy instructions issued by the ACM drive the long-term memory module for retrieval and the context shaping toolset for compression and optimization. Finally, context construction automatically extracts information from each layer according to the policy. Ultimately, the assembled, high-efficiency prompt is sent to the LLM to generate a response, completing one round of interaction. The entire system exchanges data and transmits control commands through a unified bus architecture or message queue, ensuring efficient and reliable collaboration.
[0021] The hierarchical context storage is configured to implement structured hierarchical management and collaborative supply of multi-source interactive information. It employs a four-layer storage structure—session layer, task layer, system layer, and user / history layer—and is tightly coupled with the dynamic decision-making module and shaping toolset. This enables differentiated management and on-demand retrieval of multi-layered information, ensuring rapid access to high-frequency information and deep retrieval of long-term memory, effectively improving the flexibility and accuracy of context construction. Simultaneously, the multi-layered storage architecture categorizes and organizes different types of information, providing accurate and comprehensive data support for context construction and the collaborative work of various modules. Its specific implementation details can be divided into three core parts: architecture design, hierarchical storage function, and multi-layered collaborative mechanism. The specific implementation of each part is as follows.
[0022] Firstly, at the architectural design level, this hierarchical context storage adopts a multi-level storage pool architecture, clearly defining four layers: SessionLayer, TaskLayer, SystemLayer, and User / Long-termLayer. Each layer is responsible for storing and managing specific types of information, collectively forming a structured context storage pool. Based on this architectural design, each storage layer further implements differentiated hierarchical storage functions according to information type, with the following specific division of labor: The SessionLayer is responsible for storing the original dialogue records of the most N rounds in the current session (including user input and system responses). This layer also serves as the main operation object of the context shaping toolset, and its data includes metadata such as round ID, timestamp, sentiment tag, and intent tag, providing real-time session status information for the dynamic perception and decision-making module; The TaskLayer stores the status information of currently active tasks, including task ID, type, status, key parameters, process pointers, etc., to achieve... For precise management and rapid retrieval of task information, this layer uses a structured data format to store relevant information. The System Layer stores system-level instructions and configurations, specifically covering global information such as AI role settings, response styles, and compliance terms. This information ensures the consistency and compliance of the content generated by the system. The User / Long-term Layer serves as the output interface of the long-term memory module, dynamically storing user history memory summaries retrieved from the vector database, including user preferences, historical questions, and key information from past conversations. This layer's information is the core foundation for achieving personalized services across conversational scenarios.
[0023] Finally, there is a multi-layered collaboration mechanism. Each storage layer achieves efficient collaboration based on system strategies. The specific collaboration methods revolve around the dynamic perception and decision-making module: the session layer provides the dynamic perception and decision-making module (ACM) with the latest dialogue state data, and the task layer synchronously provides the dynamic perception and decision-making module with structured task context information; the user layer / history layer receives memory information dynamically injected by the long-term memory module under the guidance of the dynamic perception and decision-making module's strategy; the system layer, as the underlying basic configuration, is continuously activated throughout the entire interaction process to ensure the collaboration and stability of data supply from each module.
[0024] The core advantage of this hierarchical structure lies in its ability to flexibly combine, compress, or expand information from different sources based on the strategies output by the dynamic perception and decision-making modules, thereby constructing a concise and relevant context that fits the current needs, laying the foundation for subsequent optimization operations and response generation.
[0025] The Dynamic Perception and Decision-Making Module (ACM Policy Engine), as the core controller of the system, is configured to be actively activated before each round of dialogue response generation. Its core responsibility is to analyze the current state and formulate the optimal context construction strategy. Through real-time intent recognition, sentiment analysis, and task state evaluation, it outputs a structured policy instruction set to dynamically control the context management mode (autonomous / workflow / hybrid mode) and drive the invocation of context shaping tools, ultimately achieving real-time adaptive and multi-mode scheduling of context management. This mechanism enables the system to proactively build and optimize the context for the LLM based on the dialogue state, thereby significantly improving dialogue coherence, task success rate, and resource utilization efficiency. At the same time, it transforms the LLM from a passive information processor into an intelligent agent that is driven by system policies and efficiently utilizes context. Its specific working mechanism mainly includes two core links: multi-source information input and multi-dimensional state analysis and decision-making.
[0026] In the multi-source information input stage, the module receives and integrates the latest user queries, session layer metadata (including rounds, sentiment tags, intent tags, etc.), task layer status information, and system layer configuration information. This integrated information provides comprehensive data input support for subsequent status analysis and strategy generation. Based on this data input, the module enters the multi-dimensional status analysis and decision-making stage, specifically performing real-time intent recognition (I), sentiment analysis (S), and task status evaluation (T) on the input information. This process can be abstracted as a policy function based on multi-feature input, and its core decision-making process can be represented by the following function: ; Where F is the policy generation function, I represents the user intent vector, S represents the sentiment label and its intensity, and T represents the current task state. and These represent metadata for the session layer and the task layer, respectively. This function evaluates a weighted combination of these features to output a structured decision instruction set P, and innovatively introduces tool invocation mode selection. A typical decision instruction set P is shown below: { "token_budget": 3500, "layer_priority": ["task", "long_term", "session", "system"], "acm_mode": "hybrid", / / Enumeration values: autonomous, workflow, hybrid "session_retain_rounds": 5, "focus_task_id": "task_7781", "sculptor_operations": [ / / Command to enable the Sculptor toolset {"operation": "fold_fragment", "fragment_id": "seg_001"}, {"operation": "summary_fragment", "fragment_id": "seg_002"} ], "long_term_retrieval_query": "User's most recent complaint history" } It should be noted that in the current dialogue system, context construction and dynamic management rely on the configurable parameters and policy instructions in the aforementioned decision instruction set P. The specific functions of each core parameter are as follows: ① token_budget: Sets the maximum number of tokens that can be used in this dialogue. This budget directly affects the context construction process. When assembling the context, the system extracts information from different levels and splices it into the final prompt, and must strictly adhere to this budget limit. ② layer_priority: Defines the priority order of information extraction, in the following order: task information > long-term memory > current session > system settings. This order ensures that the most critical information (such as the current task status and user history) is included first during the context construction process. ③ acm_mode (Active Context Management Mode): Used for macro-level control of context management strategies, supporting three modes: Autonomous mode grants the LLM high autonomy, allowing it to determine when to invoke context management tools; Workflow mode adopts a fixed process, forcibly cleaning up or compressing irrelevant information before processing the current query, offering the highest stability; Hybrid mode combines the advantages of both, such as forcibly compressing historical sessions (e.g., workflow) while allowing the LLM to autonomously retrieve long-term memory (e.g., autonomous). ④ session_retain_rounds: Controls the session layer to retain only the most recent 5 rounds of dialogue, limiting the context length from the source. ⑤ focus_task_id: Specifies the task ID to be focused on (e.g., "task_7781"), guiding the task layer to provide the corresponding task status and prioritizing the extraction of relevant content during context assembly. ⑥ sculptor_operations: Defines a list of specific optimization operations to be performed on context fragments, such as folding fragment "seg_001" or generating a summary for fragment "seg_002". ⑦ long_term_retrieval_query: Instructs the long-term memory module to perform a retrieval, such as finding information related to "the user's most recent complaint records", and injects a summary of the retrieval results into the user layer or history layer for use in subsequent context building.
[0027] Furthermore, the decision instruction set P is dynamically generated, and its strategy is formulated by the built-in decision logic function F based on real-time input. Typical strategies include: ① If the detected user intent I is "complaint" and the emotional state S is "anger", it tends to trigger long_term_retrieval_query to retrieve the user's historical complaint records to show importance, set a clear focus_task_id to focus on solving the current task, and select a more stable acm_mode (such as workflow) to ensure the correct execution of the process. ② If the task status T shows that a complex task is currently in progress, it sets "task" in layer_priority to the highest priority and allocates sufficient token_budget to ensure that the task information is presented completely. ③ If the current session has many rounds (based on the metadata Msession), it lowers session_retain_rounds and adds compression operations (such as folding and summarizing) in sculptor_operations to simplify the historical content.
[0028] The long-term memory module is configured to achieve closed-loop management and dynamic adaptation of user history memory. Its core is to adopt a "write-store-retrieve-inject" mechanism, combined with the Transformer summary model and vector database, to achieve persistent storage and semantic retrieval of user history memory. At the same time, the retrieved memory is dynamically injected into the current dialogue context, thereby supporting continuous identification of user identity and continuation of personalized services, significantly improving the consistency of cross-conversation dialogue and user experience. Its specific implementation mechanism can be divided into four parts: memory writing process, memory reading and retrieval process, memory injection mechanism and closed-loop collaboration mechanism. The specific implementation of each part is as follows.
[0029] The first step is the memory writing process. At the end of a session, the module uses a Transformer-based summarization model (such as BART or T5) to generate a semantic summary of the current session, encodes it into a high-dimensional vector, and stores it in a vector database (such as FAISS or Milvus). Each memory entry includes metadata such as user ID, timestamp, and session type. Next is the memory reading and retrieval process. When a new session begins or the decision module issues a retrieval command, the query text is transformed into a high-dimensional vector using a semantic encoding model. Then, an approximate nearest neighbor search is performed in the vector database to find relevant memory fragments. The mathematical expression for this is as follows:
[0030] ; in, It is a query vector. Function return and Most similar A memory vector.
[0031] After retrieving relevant memory fragments, subsequent processing is completed through a memory injection mechanism. Specifically, the retrieved memory fragments are structured and injected into the user / history layer and input into the LLM as part of the context. The injection timing can be dynamically controlled by the ACM strategy, such as being automatically triggered after user identification, during task switching, or when a historically relevant question is detected. Finally, there is a closed-loop collaboration mechanism. The long-term memory module transforms historical session knowledge into a sustainably usable resource through a closed-loop mechanism of "write-store-retrieve-injection." When combined with the decision-making module, it can be triggered at key nodes, such as when a user logs in again or asks a similar question in the past, automatically retrieving and injecting historical fragments to ensure the coherence of the conversation and the continuity of the service.
[0032] The Context Shaping Toolset, as the core execution unit for context micro-optimization, integrates various tools such as chunking, folding / unfolding, summarizing / restoring, and semantic search. Its core objective is to achieve dynamic compression, recombination, and precise positioning of context fragments, thereby supporting LLM to efficiently utilize information within a limited token window, effectively alleviating the problems of "proactive interference" and "lost in the middle," improving the stability and response quality of the model in long dialogues, and ultimately realizing the intelligent reconstruction and efficient utilization of context information. Its specific implementation mechanism mainly includes two parts: the role of core tools and the dynamic invocation mechanism. The specific implementation of each part is as follows.
[0033] Regarding the core tools, each tool has complementary functions and a clear division of labor, as follows: ① Segmentation tool (fragment_context): Based on sliding window or semantic boundary detection algorithms (such as TextTiling), it segments long dialogues into fragments with unique IDs, laying the foundation for subsequent fine-grained management; ② Fold / Expand tool (fold_fragment / expand_fragment): It "folds" non-focused fragments into placeholder markers to save tokens, and can dynamically "expand" them to restore details when needed. This operation can directly alleviate "proactive interference"; ③ Summary / Restore tool (summary_fragment / revert_summary): It summarizes specific fragments ( This method employs an attention-based sequence-to-sequence model to generate summaries to compress information. Its core objective is to maximize conditional probabilities. ; Where (m) is the length of the summary sequence. The model is typically trained using a strategy of maximizing likelihood estimation or minimizing risk.
[0034] ④ Search Tool (search_context): Performs semantic search based on word embeddings or attention weights within the current context to quickly locate key information and effectively solve the "lost in the middle" problem. There is a clear complementary relationship between the tools: the chunking tool is responsible for building the basic structure, the folding and summarizing tool is responsible for dynamic compression, and the search tool is responsible for precise location; the three work together. Simultaneously, this toolset collaborates with the Dynamic Perception and Decision Module (ACM) to achieve dynamic compression and reorganization of information, ensuring that the context maintains the integrity and relevance of information even with limited length.
[0035] Regarding the dynamic invocation mechanism, the invocation of each tool is driven by the policy instructions output by the dynamic perception and decision-making module, or directly invoked by the Large Language Model (LLM) in autonomous mode, ensuring that the optimization operation is precisely matched with the current context construction strategy. Specifically, based on the strategy output by the ACM module, the system extracts content from each layer of storage, compresses, reorganizes, and optimizes it through the context shaping toolset, and finally splices it into a Prompt that meets the token length limit, has a clear structure, and high information density, which is then input into the LLM to generate a response.
[0036] With the collaborative work of the aforementioned modules, the system can intelligently extract and organize information from multi-level memory based on dynamically generated strategies and predetermined priorities, constructing the optimal context input for LLM use. This process is not a simple information splicing, but a deep "reconstruction" based on strategy guidance and tool invocation; the system not only responds to the user's current needs in real time, but also organically integrates long-term historical memory, and improves information density and focus through proactive shaping operations. The final generated Prompt has high integrity, high relevance, and high robustness, significantly improving the logic and personalization level of LLM output.
[0037] This invention has many applications, including but not limited to the following described scenarios: This system and method can be widely applied to various scenarios such as intelligent customer service, online education, psychological counseling, and virtual companionship. The resulting improvements in user experience, reductions in labor costs, and leaps in business processing efficiency will generate significant commercial value. Furthermore, its core modules can be encapsulated as cloud service APIs or middleware, providing downstream AI application developers with powerful long-context management capabilities and opening up new business models and markets.
[0038] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An intelligent customer service dialogue method based on proactive context management and memory enhancement, characterized in that: Includes the following steps: S1: Preliminary context construction. When a user initiates a new round of audio and video dialogue query, the current query is combined with the historical audio and video interactions and corresponding text conversion data stored in the session layer to form a preliminary dialogue context. S2: System state awareness. Based on the initial dialogue context, the dynamic perception and decision-making module is activated. Real-time analysis is performed from the dimensions of intent recognition, sentiment analysis, and task state assessment. Multi-source information is integrated to complete the global state awareness of the system. S3: Structured policy instruction generation. Based on state-aware results, the policy generation function comprehensively analyzes the core elements and outputs a set of structured executable policy instructions that specify the system's actions. S4: Context optimization construction, based on the policy instruction set, executes long memory retrieval and writing, session history optimization operations in parallel, and then intelligently extracts core content from multiple levels according to information layer priority and resource budget, and automatically splices them to form the final context; S5: Response generation and memory persistence. The final context is input into the large language model to generate response text, and the data of the session layer and task layer are updated synchronously. When the session ends, the session summary is extracted through the long-term memory module and persistently stored in the database.
2. The method according to claim 1, characterized in that, The system processing actions specified by the structured executable policy instruction set output by S3 include: setting resource allocation for dialogue token budget, determining mode selection between stable priority workflow mode and flexible priority autonomous mode, deciding on memory management for long-term memory retrieval, planning context shaping for optimizing conversation layer history records, and setting information priority to clarify the information extraction priority of each layer.
3. The method according to claim 1, characterized in that, The optimization and construction of the S4 context includes: the long-term memory module encodes the query text into vectors according to instructions to retrieve historical memories and writes them into the corresponding storage layer; the context shaping toolset optimizes the conversation layer dialogue fragments according to instructions; after the above operations are completed, driven by the policy instruction set, core content is extracted from multiple levels according to information layer priority and token budget to form the final Prompt.
4. A dynamic context-managed large language model interactive system, characterized in that, It includes five core components: hierarchical context storage, dynamic perception and decision-making module, long-term memory module, context shaping toolset, and large language model; The dynamic perception and decision-making module, as the central hub of the system, is responsible for perceiving the dialogue status in real time and generating the optimal context construction strategy. The hierarchical context storage is responsible for the structured hierarchical management and collaborative supply of multi-source interactive information, providing data support for strategy formulation and context construction; The long-term memory module is responsible for the closed-loop management and dynamic adaptation of users' historical memories, realizing the persistent storage, semantic retrieval and injection of cross-session memories; The context shaping toolset is responsible for the dynamic compression, recombination, and precise positioning of context fragments, improving the efficiency of information utilization; The large language model is responsible for generating responses based on the optimized and efficient prompt. Each module exchanges data and transmits control commands through a unified bus architecture or message queue, ensuring efficient and reliable collaboration.
5. The system according to claim 4, characterized in that, The hierarchical context storage adopts a multi-level storage pool architecture consisting of a session layer, a task layer, a system layer, and a user / history layer. This architecture enables structured hierarchical management and collaborative supply of multi-source interactive information. Through close coupling with the dynamic perception and decision-making module and the context shaping toolset, it achieves differentiated information management and on-demand retrieval. Each storage layer stores information differently, and the session layer, task layer, user / history layer, and dynamic perception and decision-making module form a collaborative mechanism. The system layer is continuously activated as a basic configuration.
6. The system according to claim 4, characterized in that, The dynamic perception and decision-making module is actively activated before each round of response generation. It integrates multi-source information to complete intent recognition, sentiment analysis and task status assessment, formulates the optimal context construction strategy and outputs a structured strategy instruction set including Token budget, hierarchical priority, autonomous / workflow / hybrid mode, etc., to dynamically control the context management mode and drive the invocation of the context shaping toolset.
7. The system according to claim 4, characterized in that, The long-term memory module adopts a "write-store-retrieve-inject" mechanism, combining the Transformer summary model and vector database to achieve closed-loop management, persistent storage, semantic retrieval, and dynamic injection of the user's historical memory into the current dialogue context. Its implementation mechanism includes generating a semantic summary and storing it as a vector at the end of the session, and retrieving relevant memory fragments via vector when a new session begins or a retrieval command is received.
8. The system according to claim 4, characterized in that, The context shaping toolset integrates chunking, folding / expanding, summarizing / restoring, and semantic search tools to achieve dynamic compression, recombination, and precise positioning of context fragments. Tool calls are driven by policy instructions or directly invoked by the large language model in autonomous mode.