Text branch-based ai conversation structure graph and context dynamic assembly method

By using a text-branch-based AI dialogue structure graph and a dynamic context assembly method, the problem of AI struggling to handle multi-topic conversations in linear dialogues is solved, enabling AI to achieve efficient understanding and response in complex dialogues, and improving user interaction efficiency and information organization capabilities.

CN122633864APending Publication Date: 2026-08-25李仲毅
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510757017.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-08
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

In existing technologies, user interaction with large language models (LLM) relies on linear dialogue, which makes it difficult for AI to systematically process multi-topic conversation content, accurately identify deep logical connections, and result in low interaction efficiency. Users also find it difficult to explore and delve into specific concepts in complex topics.

Method used

We employ a text-branch-based AI dialogue structure graph and context dynamic assembly method. By establishing branch connections through contextual anchors and combining them with a structured context dynamic assembly algorithm, we construct a context load with optimal information density, thereby improving AI's understanding and response capabilities.

Benefits of technology

It enhances AI's understanding and responsiveness to user intent in complex multi-threaded dialogues, provides dynamic fidelity contextual load, and allows users to start new discussion branches from any text fragment, thereby improving interaction efficiency and clarity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633864A_ABST
    Figure CN122633864A_ABST
Patent Text Reader

Abstract

The application provides a text branch-based AI conversation structure graph and a context dynamic assembly method. The method allows the user to open a new conversation unit as a text branch by designating the selected content as a context anchor from any conversation unit, thereby dynamically organizing the conversation into a visual structure graph with each unit as a node. The context dynamic assembly algorithm is based on the context anchor and the graph, intelligently evaluating the relevance of each historical conversation and the current input from the dimensions of semantic association, structural proximity, logical context, etc., and calculating the comprehensive weight and sorting for the most relevant content. Finally, the algorithm intelligently balances the fidelity and abstractness of the information at each level according to the sorting and the budget of the smallest semantic unit (Token), constructs a context load with optimal information density and dynamic fidelity, and provides it to the AI, significantly improving its understanding and response ability to the user's real intention in complex multi-threaded conversations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence applications and human-computer interaction technology, specifically to an AI dialogue structure graph and context dynamic assembly method based on text branching. Background Technology

[0002] Currently, user interaction with Large Language Models (LLMs) primarily relies on linear dialogues. Users typically interact with the AI ​​(artificial intelligence) through successive rounds of new input at the end of existing linear dialogues, while the AI ​​mainly responds to the current input based solely on a linearly arranged historical context. This interaction method suffers from the following technical drawbacks:

[0003] The linear chat approach makes it difficult for AI to systematically process the entire conversation content involving multiple topics. When users explore complex topics, AI struggles to sort out the inherent logical thread of accumulated conversation content and cannot accurately identify and locate key information with global relevance. When responding to new user interactions, it often fails to effectively identify and utilize the deep logical connections between the current interaction and the scattered information in the historical conversation. At the same time, if users want to delve deeper into a specific concept in the conversation content that AI is outputting, they often interrupt the main conversation flow or are forced to manually start a new conversation. The interaction process is unsystematic, disjointed, and inefficient.

[0004] In light of the aforementioned technical issues, there is an urgent need in the existing technology for a technical solution for AI dialogue that allows users to start from any precise text fragment in the dialogue stream they are interacting with the AI ​​and instantly open up new focused discussion branches closely related to the context, and enables the AI ​​to fully understand the user's intent in this dialogue that continuously generates discussion branches, taking into account the context. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention proposes an AI dialogue structure graph and context dynamic assembly method based on text branches, in order to solve the deficiencies in existing technologies.

[0006] The technical solution adopted in this invention is as follows:

[0007] Firstly, a text-branch-based AI dialogue structure graph and context dynamic assembly method is provided, comprising: using any user-specified content in a dialogue unit as a context anchor, wherein the context anchor is used to establish branch connections between dialogue units to construct a structure graph; combining the context anchor with a relevance-based structured context dynamic assembly algorithm to assemble context loads after path backtracking of the multiple dialogues, and providing the context loads to the AI. The beneficial technical effect is that it can construct a context load with optimal information density and dynamic fidelity from the already structured historical context and provide it to the AI, significantly improving the AI's understanding and response capabilities to the user's true intentions in complex multi-threaded dialogues.

[0008] Furthermore, the relevance-based structured context dynamic assembly algorithm includes: performing path backtracking based on the structure graph to obtain path depth and context anchor vectors; generating enhanced query vectors representing the user's thought process based on the path depth and context anchor vectors; calculating the semantic relevance factor of each node based on the enhanced query vectors; calculating the structural proximity factor based on the structure graph; calculating the semantic distance adjustment factor based on the context anchor vectors combined with the structure graph; calculating the comprehensive weight of each node based on the structural proximity factor, semantic distance adjustment factor, and semantic relevance factor; and ranking the nodes according to their comprehensive weights to construct a context load with dynamic fidelity and gradient summarization. The beneficial technical effect is that by employing a sophisticated multi-dimensional, contextualized weighting system, the most efficient and relevant context is dynamically filtered and constructed for each AI call from the almost infinitely growing structured chat history that users actively construct based on their thoughts in natural chat. The comprehensive weighting calculation method can reflect that not all past chat records are equally important to the current interaction. It provides a multi-dimensional dynamic context evaluation system for the relevance-based structured context dynamic assembly algorithm, taking into account the influence of multiple factors and enabling a comprehensive evaluation of the context.

[0009] Furthermore, the structure graph is generated based on multiple dialogue units between AI and the user, and the historical dialogue records in the dialogue units are structured into a graph. Each dialogue unit is a node, and the node corresponds to a vertex in the graph structure. Other dialog boxes connected to the node in the structure graph are branches in the structure graph. The beneficial technical effects are: to achieve branching shifts in dialogue focus as a whole, and to provide a structured and expanded interaction method.

[0010] Furthermore, an enhanced query vector representing the user's thought process is generated based on path depth and contextual anchor vectors. The semantic relevance factor of each node is then calculated based on this enhanced query vector, including: vectorizing the user's new input and fusing it with the original text vector of the currently active node to generate a new question vector; generating an enhanced query vector based on the contextual anchor vector, the new question vector, and path depth; performing vector similarity search on all original text vectors based on the enhanced query vector; and obtaining the cosine similarity of all remaining nodes (excluding the currently active node) based on the vector similarity search results to derive the semantic relevance factor of each node. The beneficial technical effects are: the obtained enhanced query vector can represent the user's complete thought process in the current dialogue state, and the derived semantic relevance factor can characterize which content in multiple dialog boxes is more relevant to the user-specified content.

[0011] Furthermore, the semantic distance adjustment factor is calculated based on the contextual anchor vector combined with the structural graph. This includes: if two nodes are child nodes derived from the same parent node, the cosine similarity of the contextual anchor vectors of the two child nodes is calculated to obtain the semantic distance adjustment factor; if two nodes are a node and a child node derived from that node, the original text vector of the child node and the anchor text vector from which the child node originated are weighted and fused, and then the cosine similarity between the fused vector and the original text vector of the parent node is calculated to obtain the semantic distance adjustment factor. The beneficial technical effect is that the calculation of the semantic distance adjustment factor uses the "contextual anchor vector" to quantify the "ideological affinity" between nodes, so that the calculation of structural weights encompasses semantic perception.

[0012] Furthermore, the semantic distance adjustment factor is calculated based on the contextual anchor vectors combined with the structural graph. This includes: locating the nearest common ancestor node of the current active node and any non-current active node in the structural graph using a graph traversal method; collecting and fusing the contextual anchor vectors on the path from the common ancestor node to the current active node to obtain a first overall semantic vector, and fusing the contextual anchor vectors on the path from the common ancestor node to the candidate node to obtain a second overall semantic vector; and comparing the cosine similarity of the first and second overall semantic vectors to obtain the semantic distance adjustment factor. The beneficial technical effect is that it can more accurately quantify the "ideological affinity" between any two nodes.

[0013] Furthermore, when calculating the semantic distance adjustment factor based on contextual anchor vectors and the structural graph, a hierarchical hybrid strategy is adopted. This strategy includes a conventional mode and a deep analysis mode. In the conventional mode, the semantic distance adjustment factor is set to a specified value for all distant relatives. In the deep analysis mode, the semantic distance adjustment factor is calculated for all distant relatives in the following way: a graph traversal method is used to locate the nearest common ancestor node of the current active node and any non-current active node in the structural graph; contextual anchor vectors on the path from the common ancestor node to the current active node are collected and fused to obtain a first overall semantic vector; contextual anchor vectors on the path from the common ancestor node to the candidate node are fused to obtain a second overall semantic vector; the cosine similarity of the first and second overall semantic vectors is compared to obtain the semantic distance adjustment factor. The beneficial technical effect is that it allows users to make a trade-off between the smoothness of conventional operations and the ultimate association mining in specific situations when calculating the semantic distance adjustment factor.

[0014] Furthermore, when calculating the comprehensive weight of each node based on the structural proximity factor, semantic distance adjustment factor, and semantic relevance factor, a basic weight is introduced for the structural proximity factor. The beneficial technical effect is that introducing a basic weight ensures that the node most structurally directly related to the current dialogue receives a higher initial weight.

[0015] Furthermore, when calculating the comprehensive weight of each node based on the structural proximity factor, semantic distance adjustment factor, and semantic relevance factor, explicit reference bonus, interaction-based logical time bonus, absolute depth weight coefficient, and absolute depth factor are also introduced to calculate the comprehensive weight. The explicit reference bonus is configured to be an additional score obtained when the user explicitly specifies the node to be referenced through interface operation. The beneficial technical effects are as follows: introducing explicit reference bonus can ensure absolute respect for the user's direct intent; introducing interaction-based logical time bonus can capture the user's short-term memory and operational focus, making recently processed nodes easier to associate; introducing absolute depth weight coefficient and absolute depth factor can give a slight but continuous weight tilt to nodes that are closer to the initial core of the dialogue, which helps to maintain topic coherence.

[0016] Furthermore, based on the comprehensive weight ranking of each node, a context load with dynamic fidelity and gradient summarization is constructed. This includes: sorting nodes according to their comprehensive weight to obtain a node priority list; setting the budget for the smallest semantic unit of the large language model and placing the entire original text of the currently active node into the initial context load; iteratively filling the context load according to the node priority list and a gradient summarization strategy; and ending the iteration when the budget for the smallest semantic unit is exhausted or the priority list is processed, resulting in a context load with dynamic fidelity and gradient summarization. The beneficial technical effects are: the algorithm can intelligently select between the "complete original text" and "refined summary" of a node based on the budget to maximize information value; the final context load is a mixture that has undergone intelligent trade-offs, containing high-fidelity original text and summaries of varying degrees, to maximize the overall information value density.

[0017] Furthermore, the gradient summarization strategy includes: for high-weight nodes that require summarization, instead of directly abandoning them or using only a single shortest summary, the most detailed and accommodating version is selected from pre-generated summary versions of different levels of detail based on the node's overall weight, the remaining minimum semantic unit budget, and the estimated importance of subsequent nodes to be processed. The beneficial technical effect is that it avoids the complete loss of information from a large number of subsequent nodes, even those with slightly lower weights but still important, due to the excessive length of the original text for a few nodes.

[0018] Furthermore, the relevance-based structured context dynamic assembly algorithm is also configured to introduce an explicit exclusion method. This explicit exclusion method includes: if the user explicitly specifies through interface operations that they want to block or exclude certain nodes, or certain nodes and their child nodes, then these blocked or excluded nodes will be removed from the weighted sorting, and the original chat history of the deleted nodes will not be included in the context load. The beneficial technical effect is: to achieve a "one-vote veto" of irrelevant information as determined by the user.

[0019] Furthermore, historical information with the highest overall weight, as determined by the algorithm, is placed in positions easily accessible to the large language model; supplementary information with low overall weight but still valuable is filled in the remaining space according to its overall weight. The beneficial effect of this technique is that it assists LLM in understanding the derivative relationships between different discussion focuses, thereby generating more contextually coherent and in-depth responses.

[0020] Furthermore, the dialogue unit is a card-based dialog box. Users interact with the AI ​​through these dialog boxes, which can be one or more. Users can switch freely between multiple dialog boxes. When switching, the dialogue content in the current dialog box is saved for later use by the user. The beneficial technical effects are: It visually displays the originally lengthy, single-timeline chat logs in different card-based dialog boxes, which serve as the basic dialogue units of the structural graph. This helps users quickly locate, review, and organize the logical flow of complex topics; it also provides a visual representation of the dialogue structure, helping users avoid getting lost in complex conversations.

[0021] Furthermore, the card dialog box is configured with different states, including a chat card state, a browse card state, and a summary / title state. The beneficial technical effect is that by defining different interaction states, users can clearly manage their attention focus and interaction mode; thereby greatly improving the interaction efficiency and clarity in complex dialogues and avoiding information overload.

[0022] Furthermore, the chat card state is configured as follows: users can manually create new root cards; when a new child card is created from a selected text branch of the parent card, the child card automatically enters the chat card state and is placed in the user's visual center; the parent card switches to a condensed / title state and moves to a position off-center from the user's visual center. The beneficial technical effect is that it helps users focus.

[0023] Furthermore, the browsing card state is configured as follows: when a user clicks on a card in a condensed / titled state, the card expands in its original position or a designated area, displaying the complete, read-only conversation history stored on the card, thus entering the browsing card state; the user can scroll through the conversation history and select text from it to create new branches. The beneficial technical effects are: users can scroll through the history and select text to create new branches; users can safely and conveniently review historical content without interfering with the current main chat flow, and find new inspiration or evidence to open up new exploration branches.

[0024] Furthermore, the condensed / title state is configured such that when a card in chat card state is closed, the card reverts to the condensed / title state. The beneficial technical effect is that it ensures that after a user ends a focused conversation, they can smoothly return to the macroscopic structure view, maintaining a clean workspace, avoiding visual clutter, and preserving the conversation completely in the structure graph for later review or reactivation, thus achieving orderly management of conversation focus.

[0025] Furthermore, when switching between card dialog boxes, users can also hide or unhide cards; after a user hides a card, the dialogue content of that card will not be included in the subsequent output context load. The beneficial effect of this technique is that it allows users to select dialogue records related to specific content, thereby generating a context load that more closely matches the user's intent.

[0026] Furthermore, when users switch between multiple card dialog boxes, a dynamic directory view is provided for reference. This directory view renders each card dialog box as a cover of varying size or thickness, depending on the amount of content or hierarchical depth within it. Users can browse the directory view by horizontal dragging or scrolling, and can also select any cover to expand the corresponding card dialog box. The beneficial technical effects are: providing users with a linear global navigation method independent of spatial layout, helping them quickly locate and switch to any dialog branch; and allowing users to intuitively perceive the volume and depth of each dialog branch through visually varying sizes or thicknesses.

[0027] Secondly, a text-branch-based AI dialogue structure graph and context dynamic assembly system is provided to implement the text-branch-based AI dialogue structure graph and context dynamic assembly method described in the first aspect, including:

[0028] An interactive structure graph generation module provides a dialogue interface for user interaction and generates a structure graph based on the dialogue content. This structure graph is then transmitted to a structured context-aware assembly module for processing. The structured context-aware assembly module uses a relevance-based dynamic structured context assembly algorithm to analyze the structured graph's structural, semantic, user intent, and temporal dimensions, combining this with new user input to construct the most relevant context for each AI call. The beneficial technical effects are:

[0029] The interactive structure graph generation module can "structure historical chat logs." With annotations, it helps users quickly locate, review, and organize the logical flow of complex topics within lengthy, single-timeline chat logs. It also provides a visual representation of the dialogue structure, helping users avoid getting lost in complex conversations. The structured context-aware assembly module enables AI to fully understand user intent within the context of dialogues that continuously generate discussion branches. Furthermore, the generated dialogue graph contains the logical evolution path of topics and the focus and intent reflected in user interactions such as branch creation, explicit referencing, and filtering. This provides high-quality training data unmatched by traditional linear dialogue for the continuous iteration and alignment of AI models (e.g., through supervised fine-tuning, reinforcement learning, etc.).

[0030] Furthermore, the structural dimension represents logical affinity, the semantic dimension represents semantic association, the user intent dimension represents explicit citations, contextual anchors, and explicit exclusions generated by the user through dialogue and interaction with AI, and the time dimension represents the user's focus of attention within a certain period. The beneficial technical effect is that it provides a multi-dimensional dynamic context evaluation system for relevance-based structured context dynamic assembly algorithms, considering the influence of multiple factors and enabling a comprehensive evaluation of the context.

[0031] Furthermore, when a user enters / creates a new dialogue, the interactive structure graph generation module generates a card-based dialog box as the root node. The user interacts with the AI ​​within this root node, and the structured context-aware assembly module stores the generated dialogue text history in this node. Multiple dialogues between the user and the AI ​​result in multiple card-based dialog boxes, each corresponding to a node. The interactive structure graph generation module generates a structure graph based on the dialogue content of all nodes. The user selects a specific text or segment from the currently active node as a contextual anchor point. The structured context-aware assembly module, based on the contextual anchor point and the structure graph, performs path backtracking on the dialogue content of multiple nodes, assembles the contextual load, and provides the contextual load to the AI. The beneficial technical effects are as follows: By solving the challenges of information organization and in-depth exploration in AI dialogue through an innovative graphical user interaction paradigm, it not only allows users to instantly open new, focused discussion branches around any selected text fragment from their dialogue flow with AI, thus allowing users to actively construct a structured representation that can dynamically grow and clearly reflect the internal logic and hierarchy of the entire dialogue history; it also reconstructs the form of dialogue organization between humans and AI from the user interaction level, and allows this new interaction form to directly drive an intelligent algorithm that can not only manage the length of the context, but also deeply understand the relevance of the context and the user's two-way control intentions. This algorithm has a core mechanism that intelligently filters out "extremely relevant" information from a vast history, and can extract the most relevant contextual information from historical dialogue records, thereby achieving a smooth, in-depth AI dialogue experience that is not limited by physical windows.

[0032] Thirdly, a computer program product is provided, including a computer program / instruction that, when executed by a processor, implements the steps of the text-branch-based AI dialogue structure graph and context dynamic assembly method described in the first aspect of claim.

[0033] Fourthly, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs; and when the one or more programs are executed by the one or more processors, causing the one or more processors to implement the text-branch-based AI dialogue structure graph and context dynamic assembly method according to any one of claims 1-20.

[0034] Fifthly, a storage medium is provided on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the text-branch-based AI dialogue structure graph and context dynamic assembly method according to any one of claims 1-20. Attached Figure Description

[0035] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.

[0036] Figure 1 This is a schematic diagram illustrating the user's interaction with AI according to an embodiment of the present invention;

[0037] Figure 2 This is a schematic diagram illustrating the front-end and back-end operations when a branch is generated based on user-specified content, according to an embodiment of the present invention.

[0038] Figure 3 This is a schematic diagram illustrating the process of the backend algorithm performing operations when a user inputs and sends new content in a dialog unit, according to an embodiment of the present invention. Detailed Implementation

[0039] The embodiments of the technical solution of the present invention will now be described in detail with reference to the accompanying drawings. These embodiments are merely illustrative of the technical solution of the present invention and are therefore intended to limit the scope of protection of the present invention.

[0040] It should be noted that, unless otherwise stated, the technical or scientific terms used in this application should have the ordinary meaning as understood by those skilled in the art to which this invention pertains.

[0041] Example

[0042] Regarding the technical problems mentioned in the background, the inventors of this application have discovered through research that existing LLMs suffer from a physical context window length limitation (Token limitation). This directly leads to the inevitable forgetting of key information from earlier conversations when processing lengthy, chronologically accumulated dialogue history provided by currently prevalent linear front-end interfaces. Furthermore, even with a sufficiently large context window, providing all historical records indiscriminately to the AI ​​is inefficient and harmful; it causes the AI's attention to be distracted by a large amount of noise unrelated to the current new input, thus affecting the accuracy and relevance of its responses. In the presence of noise, existing technologies not only make it difficult for users to form a clear overall understanding of the dialogue process, but also make it difficult for users to precisely guide the AI ​​to focus on a specific information point in past conversations. They also lack effective means to actively eliminate irrelevant information interference, thus failing to fully convey the user's "precise intent" (including "what to focus on" and "what to ignore") to the AI. In this context, a mechanism is needed to further assist and deepen the shared understanding of this structured representation between users and AI, and to enable AI to dynamically and selectively acquire and organize the most relevant historical context information when responding to interactions at any node, by referring to this structure dominated by user interaction behavior, rather than simply relying on a broad linear dialogue history.

[0043] Based on the above research results, this embodiment provides a method for dynamic assembly of AI dialogue structure graph and context based on text branching. This method is implemented based on an AI dialogue structure graph and dynamic context generation system, which includes an interactive structure graph generation module and a structured context-aware assembly module.

[0044] The interactive structure graph generation module, as the system front-end, provides a dialogue interface for user interaction. In a specific implementation, the basic unit of the dialogue interface (i.e., the dialogue unit) is a card-based dialog box. During the dialogue with the user, the interactive structure graph generation module guides the originally disordered dialogue flow through card-based and branching interaction methods. Driven by the user's natural interactions (e.g., creating branches from selected text), the flow evolves organically in real time and is presented as a structured and visual structure graph. This structure graph is then transmitted to the structured context-aware assembly module for processing. In a specific implementation, the interactive structure graph generation module uses "card dialog boxes" as the basic unit of interaction, allowing users to create new related cards based on specific text selected within the card as contextual anchors. This achieves branching shifts in dialogue focus and structured expansion of the interaction method.

[0045] For a structure graph that includes all content from multiple card dialog boxes, any card dialog box is considered a "node," and the node serves as a vertex in the graph structure. Other card dialog boxes connected to this node in the structure graph are considered "branches." The interactive structure graph generation module is also configured to support users in "masking" or "excluding" any card dialog box or all branches of that card dialog box, thereby conveying user intent to the structured context-aware assembly module.

[0046] The interactive structure map generation module works as follows:

[0047] Users log in to the system and access the interactive structure map generation module, for example, by accessing the system through a web browser.

[0048] The user then creates a new conversation topic, and the interactive structure graph generation module generates a root card dialog box in the center of the mind map canvas, in a "chat card state." This card contains a standard chat interface, where the user can submit content (hereinafter referred to as "new input") in the input box. This content is then connected to the large language model via the backend structured context-aware assembly module for interaction. The chat history is displayed in real-time in the chat area. The interactive structure graph generation module can provide users with "chat card state," "browse card state," and "condensed / title state." By defining different interaction states, users can clearly manage their focus and interaction patterns. For example, in the "chat state," users can engage in deep interaction; in the "browse state," they can review and search for information; and in the "condensed / title state," they can obtain an overall structural overview. This greatly improves the efficiency and clarity of interaction in complex conversations and avoids information overload.

[0049] For the "Chat Card State," users can manually create new root cards. When a new child card is created from a selected text branch of the parent card, that child card automatically enters the "Chat Card State" and becomes the currently active node (Na). At this time, the original parent card (if it was previously in Chat State) switches to the "Condensed / Title State," the canvas may pan to place the new chat card in the visual center, and other cards on non-direct paths enter a semi-transparent or faded state to help the user focus.

[0050] For "Browse Card Status," when a user clicks on a card in "Condensed / Title Status" on the canvas, the card expands in its original position or a designated area, displaying its complete, read-only chat history, thus entering "Browse Card Status." Users can scroll through the card and select text to create new branches; this allows users to safely and conveniently review historical content without interfering with the current main chat flow, and to find new inspiration or evidence to open up new branches of exploration.

[0051] For the "Condensed / Title State": When a "Chat Card" is closed (e.g., by clicking the close button or clicking in a blank area of ​​the canvas), it reverts to the "Condensed / Title State." When no cards are in "Chat Card State" or "Browse Card State," all cards on the canvas are in this state, presenting a complete overview of the mind map. Using the "Condensed / Title State" ensures that users can smoothly return to the macroscopic structural view after ending a focused conversation, maintaining a clean workspace, avoiding visual clutter, and preserving the conversation completely in the structural map for later review or reactivation, thus achieving orderly management of conversation focus.

[0052] Card blocking and unblocking: Within the UI elements of each card dialog box (e.g., the toolbar in its condensed / title state or browsing state), provide an interactive button for "Block this card" or "Ignore this card." When clicked, the card may appear grayed out, semi-transparent, or marked with a specific blocking indicator, indicating that its content will not be included in the subsequent AI context. Clicking the button again unblocks the card, restoring it to its normal state. For a parent node, an option to "Block this entire branch" can also be provided, adding all its descendant nodes to the block list. Blocking and unblocking cards allows users to select dialogue records related to specific content, generating a contextual load more closely aligned with the user's intent.

[0053] Implementation of Selected Text Branch: Regardless of whether the card is in "Chat Card State" or "Browse Card State," the user can use the mouse to select any text fragment in the chat history. Upon selection, a trigger button appears (e.g., "Create Branch Based on This Text"). Clicking this button: The system creates a new sub-card dialog box on the canvas, initially in "Chat Card State." A visual connection line extends from the selected text fragment in the parent card to this new sub-card. The default title of the new sub-card can be automatically generated based on the selected text (e.g., truncating the first N characters).

[0054] When a user performs the 'Select Text to Create Branch' operation, the system frontend establishes the selected text fragment as the 'contextual anchor' of the new dialogue branch and records its key information (such as anchor content). This anchor information, captured and transmitted (or marked for later retrieval) by the frontend, lays the core foundation for the backend algorithm to construct an initial context highly relevant to the branch's starting point when the user submits their first new input in that new branch. This ensures that the new dialogue branch is accurately opened and focused on a specific issue. The canvas view dynamically adjusts, such as by panning, to make the newly created sub-cards of the 'Chat Card Status' the visual focus.

[0055] The interactive structure map generation module also features a dynamic directory view: users can switch from the "Mind Map Canvas View" to an "Album-Style Directory View" by clicking a specific toggle button on the interface. In this view, each card dialog box (at least the root node and main branches) is rendered as a rectangle resembling an album cover. These "covers" can visually vary in size or thickness depending on the amount of content or hierarchical depth of their internal dialogues. Users can browse these "albums" by dragging horizontally or scrolling. Clicking on any "album cover" triggers a switch back to the "Mind Map Canvas View," placing the clicked card in "Chat Card State" (or "Browse Card State"). The dynamic directory view provides users with a linear, global navigation method independent of spatial layout. When the structure map becomes very large and complex, this directory view helps users quickly locate and switch to any dialogue branch, as clear and intuitive as a book's table of contents; and through visually varying sizes or thicknesses, users can intuitively perceive the volume and depth of each dialogue branch.

[0056] The interactive structure map generation module also supports document import and branching: users can import files of various formats via the file upload function. The file content is parsed and displayed in a scrollable view. Users can also select any text fragment in this document view and trigger a dialog box to create a new card in a similar manner. This card will be associated with the selected text in the document, allowing users to interact with the AI ​​around the selected content.

[0057] The interactive structure graph generation module in this embodiment allows users to switch freely between multiple card dialog boxes. When switching, the dialogue content in the current card dialog box is saved for later use by the user. This setup visually presents the originally lengthy, single-timeline chat logs in different card dialog boxes, which serve as the basic dialogue units of the structure graph. This helps users quickly locate, review, and organize the logical flow of complex topics. It also provides a visual representation of the dialogue structure, helping users avoid getting lost in complex conversations. After completing a conversation, users can easily return to review it, and this structured result is fully preserved after the conversation ends, forming a well-structured, reusable, and iterative personalized knowledge base. Users can easily return to this self-constructed 'dialogue graph' at any time in the future, quickly reviewing the complete context and logical flow of any discussion, reactivating old ideas, or embarking on new explorations based on existing knowledge. This greatly enhances the value of AI as a long-term thinking partner and knowledge management tool. Furthermore, the generated dialogue graph contains the logical evolution path of topics and the focus and intent reflected by user-created branches, explicit references, and blocking behaviors. It can provide high-quality training data that traditional linear dialogue cannot match for the continuous iteration and alignment of AI models (such as through supervised fine-tuning, reinforcement learning, etc.).

[0058] The structured context-aware assembly module, serving as the system backend, is configured to dynamically calculate and construct the most relevant context for each AI call by comprehensively analyzing the structural, semantic, user intent, and temporal dimensions of the structure graph through a multi-dimensional dynamic evaluation mechanism. Specifically, the structural dimension represents logical affinity, the semantic dimension represents semantic association, the user intent dimension represents explicit references, contextual anchors, and explicit exclusions generated by the user's interaction with the AI, and the temporal dimension represents the user's focus of attention within a specific timeframe.

[0059] The structured context-aware assembly module is equipped with a custom, relevance-based, dynamic structured context assembly algorithm, hereinafter referred to as the algorithm. In the structured dialogue graph constructed through user interaction with a large model, when a user inputs and sends new content (i.e., new input) at any node, the core principle of the algorithm in determining context relevance is that not all past chat records are equally important to the current interaction. The algorithm's core objective is to use a sophisticated, multi-dimensional, contextualized weighting system to dynamically filter and construct the most efficient and relevant context for each AI call from the almost infinitely growing structured chat records (i.e., the structured graph) that users actively build in natural conversations. This intelligent context management calculates the weight of each chat record by dynamically evaluating the node position of the user's current new input content and the structural and content relationships between that node and all historical nodes, and then makes the calls accordingly. This mechanism not only ensures the extreme relevance of the context, but also, when faced with the constraints of the token budget, the algorithm's unique "gradient summarization" function intelligently prioritizes the retention of the original text of high-weight core dialogues, applying summarization processing commensurate with the importance of content with lower relevance only. This dynamic fidelity mechanism effectively controls the amount of information while ensuring the accuracy of key contexts, significantly outperforming the practice of uniformly compressing or truncating historical information. Furthermore, it breaks through the limitations of the physical context window of traditional AI models, elevating the dialogue experience to an infinitely expandable structured knowledge dome, thereby achieving truly long-term, in-depth dialogue.

[0060] To facilitate understanding of the custom, correlation-based, structured context dynamic assembly algorithm, some custom concepts that will be used later are briefly described:

[0061] Activity Node The card dialog box in which the user is currently entering content.

[0062] Node content : Refers to the complete dialogue text record contained within any node 'n'.

[0063] Node Summary : A refined summary generated by the system for the dialogue content of node 'n', which is mainly used as a fallback option when the original text cannot be provided.

[0064] Original vector : Using a text embedding model, the complete original text content of each node is represented. Generated and pre-stored mathematical vectors. The implementation of the text embedding model is not limited and can be implemented in any feasible manner existing in the art.

[0065] Context Anchor Vector Sequence: A special vector that is computed and stored once when a branch is created; a contextual anchor corresponds to a specific text, but it does not simply represent the anchor text itself, but rather represents the specific semantics of "the anchor text in the complete context of its parent node".

[0066] Enhanced query vector A core dimension generated in real time when a user submits new input, used for global semantic matching, which can highly accurately represent the user's multi-layered contextual intent.

[0067] Structural distance A quantitative metric used to represent the shortest path length between an active node and any other node in the graph structure; for example, the number of edges on the path.

[0068] Absolute depth : refers to the structural distance between any node 'n' and the root node of the entire structure graph; preferably, the depth of the root node is 0.

[0069] Explicit reference A list of nodes that contains other nodes that the user actively selects or points to when submitting the current new input.

[0070] Context load : Structured text blocks assembled by the algorithm; context load is provided to the AI ​​large language model.

[0071] Time decay bonus : Represents the extra points a node 'n' receives due to its position in the user's recent interaction sequence. This bonus is based on "logical time" (i.e., the order and frequency of interactions), rather than physical time. The earlier the node ranks (the more recent or more important the interaction), the higher the bonus, and it diminishes as the interaction becomes less frequent.

[0072] The custom correlation-based structured context dynamic assembly algorithm in this embodiment includes the following steps:

[0073] S1. Perform path backtracking based on the structural graph to obtain the path depth and contextual anchor vector.

[0074] When the user is in the activity node When submitting new input, the Structured Context-Aware Assembly module first starts from the active node. The process traces back up along the unique anchor path to the root node. During this process, the structured context-aware assembly module collects pre-computed context anchor vectors stored on the parent-child node connection edges at each level. The sequence, contextual anchor vector, is obtained by fusing the original text vector of the parent node. and the vector of the anchor text itself And generated.

[0075] S2. Generate an enhanced query vector that represents the user's thought process based on the path depth and contextual anchor vector, and calculate the semantic relevance factor of each node based on the enhanced query vector.

[0076] S21. Vectorize the user's new input and merge it with the original text vector of the current active node to generate a new question vector.

[0077] The user's current input text is used to generate its corresponding vector through a text embedding model, and then compared with the original text vector of the current active node. Fusion generates new problem vectors .

[0078] S22. Generate an enhanced query vector based on the context anchor vector, the new question vector, and the path depth.

[0079] Fusion generation of enhanced query vectors : Collected contextual anchor vectors Vector sequences and The data is then fused to generate the final query vector. In some embodiments, the fusion strategy can employ a weighted average with time / distance decay to ensure that anchor information closer to the current node and the new input itself dominate, as calculated below:

[0080]

[0081] in, These are the weights of the new problem vector. These are the weights of the anchor vectors for each context. It is the path depth.

[0082] The enhanced query vector obtained in this step can represent the complete thought process of the user in the current dialogue state.

[0083] S23. Perform vector similarity search on all original text vectors based on the enhanced query vector.

[0084] The pre-computation basis for this step is that the system's background tasks have pre-computed and stored the original text vectors for all inactive, historical nodes. .

[0085] Based on the enhanced query vector The original vectors of all historical nodes stored in the database Perform a high-speed vector similarity search on the set.

[0086] S24. Based on the vector similarity search results, obtain the cosine similarity of all other nodes that are not currently active nodes, and obtain the semantic relevance factor of each node based on the cosine similarity.

[0087] After performing a vector similarity search, all nodes except the currently active node are quickly returned, along with the cosine similarity between each node and the enhanced query vector. These cosine similarities represent the semantic relevance factors for all inactive nodes. The resulting semantic relevance factor can characterize which of the contents of multiple dialog boxes are more relevant to the user-specified content.

[0088] S3. Calculate the structural proximity factor based on the structural map.

[0089] In this embodiment, the structural proximity factor Defined as a quantitative regulating factor, it answers the question of "how far do we need to go on the structural map to reach this node". Based on node 'n' and the currently active node The actual structural distance between To adjust subsequent calculations and The basic weights of multiplication The influence of this, in specific implementation methods. It is an inverse proportional function, for example:

[0090]

[0091] in, It is node 'n' and the active node The structural distance between them; It is an exponent greater than 0 (preferably 1 or 2) that can control the decay rate.

[0092] S4. Calculate the semantic distance adjustment factor based on contextual anchor vectors and structural graphs.

[0093] In this embodiment, the semantic distance adjustment factor Defined as a multiplier factor (typically between 0 and 1) used to dynamically fine-tune the "structural distance base weights". By utilizing "contextual anchor vectors" to quantify the "ideological affinity" between nodes, the calculation of structural weights incorporates semantic perception. In a specific implementation, The value depends on node n and the active node. The relation type is dynamically calculated, including the following two cases:

[0094] The first case: If the two nodes are child nodes derived from the same parent node:

[0095] Since the context anchor vector is formed by a weighted fusion of the "original text vector of the parent node" and the "text vector of the context anchor," calculating the cosine similarity of the context anchor vectors of two child nodes allows us to determine the degree of similarity between the "topics" of these two child nodes and their parent node. .

[0096] The second scenario: If the two nodes are a node and its derived child node, respectively.

[0097] The weighted vectors of the child node and the anchor text vector from which the child node originated are fused together. Then, the cosine similarity between the fused vector and the parent node's vector is calculated. The anchor text here refers to the specific text corresponding to the context anchor; the weighting fusion method can be a weighted average.

[0098] The Asem calculation rules described above for "parent-child nodes" and "sibling nodes" form the basis for quantifying the semantic distance relationship between any two nodes in the graph. For nodes that are not directly related, their Asem values ​​can be determined recursively or by combining these two basic rules.

[0099] In some embodiments, The value can also be calculated using a second method, which can more accurately quantify any two nodes, i.e., the currently active node. The "ideological affinity" between n (any non-current active node, regardless of distance) is as follows:

[0100] First, locate the nearest common ancestor (ACCA) node of the currently active node and any non-active node in the structural graph. Then, using a graph traversal algorithm, find the ACCA node from each node. And n trace back up to its anchor parent node until the first common ancestor node is found, and then determine. The most recent common ancestor of n .

[0101] Secondly, contextual anchor vectors along the paths from common ancestor nodes to the current active node are collected and fused to obtain the first overall semantic vector; contextual anchor vectors along the paths from common ancestor nodes to non-current active nodes are fused to obtain the second overall semantic vector. This process involves collecting contextual anchor vectors from... arrive On this anchor path A, the context anchor vectors stored on each connecting "edge" construct the first vector sequence. :

[0102] .

[0103] Using a weighted average method (considering distance decay or hierarchical importance), They are merged into a single first overall semantic vector that represents the overall semantics of path A. .

[0104] Similarly, collecting from Construct a second vector sequence from the contextual anchor vectors along the path to anchor n. Using a weighted average method to This is merged into a single second overall semantic vector that represents the overall semantics of path B. .

[0105] Then, the semantic distance adjustment factor is derived by comparing the cosine similarity of the first and second overall semantic vectors. The semantic similarity of these two "paths of thought development" is compared by calculating the cosine similarity of the first and second overall semantic vectors. The method of calculating values ​​quantifies the shared source of thought. After the fork, it leads to The semantic similarity between the two development paths of n in terms of overall direction and core theme.

[0106] Because of the second calculation The value-based method has high computational complexity (involving multiple path traversals and vector fusion), and if executed in real time for all nodes, it may affect system performance; therefore, in some embodiments, The value can also be calculated using a third method. The values ​​are calculated using a hierarchical hybrid strategy, including a conventional mode and a deep analysis mode, as detailed below:

[0107] In normal mode, for close relatives (such as direct ancestors and siblings): the relatively efficient method defined in the current document is used. The calculation method, for example, involves directly comparing the context anchor vectors at the time of "birth" between sibling nodes; and comparing the context anchor vectors at the time of branching between direct ancestors. For all other distant relatives, to ensure system response speed, a temporary setting is used. At this point, the discovery and weight evaluation of these nodes rely more on global semantic relevance factors. .

[0108] In deep analysis mode, the algorithm will enable the aforementioned method for all distant relative nodes (or nodes within a specific range specified by the user). The second method of calculation.

[0109] The system can provide a user-selectable switch between a normal mode and a deep analysis mode, allowing users to balance the smoothness of normal operation with the ultimate correlation mining in specific situations.

[0110] In specific implementations, the order in which steps S2, S3, and S4 are performed is not limited and they can be processed in parallel.

[0111] S5. Calculate the comprehensive weight of each node based on the structural proximity factor, semantic distance adjustment factor, and semantic relevance factor.

[0112] In a specific implementation, the comprehensive weighting Calculate using the following formula:

[0113]

[0114] In the above formula:

[0115] The base weight represents the inherent importance of node 'n' due to its "role" or "relationship category" relative to the currently active node in the structural graph. For example, the base weight of a parent node might be set to 1.0, the base weight of a child node might be 0.7, and the base weight of a sibling node might be 0.5. These values ​​reflect the general importance of different relationship types in the context based on their structural roles, ensuring that the node most structurally relevant to the current conversation receives a higher initial weight.

[0116] Structural proximity factor This is obtained through step S3. and The synergistic effects are as follows: The inherent importance of "relationship categories" is defined, and This quantifies the "distance cost of accessing the relationship". Its main value lies in handling "same name, different reality": when multiple nodes have the same basic weight. (For example, both are "ancestor nodes"), but their actual structural distances are different (such as ancestor and great-ancestor). Their weights can be distinguished by distance differences. A unified attenuation model is provided: a universal distance-based attenuation is offered for all structural relationships, making... Values ​​can focus more purely on defining the inherent importance of relation types without coupling distance factors. Adapting to complex structural graphs: providing a robust distance metric for potentially more flexible, non-strictly tree-like graph connections in the future (such as a node with multiple "parent anchors" or cross-branch references). Introduction This results in nodes that are structurally "closer" having an advantage over nodes that are "farther" in the structural weighting, reflecting the logic of "a close neighbor is worse than a distant relative," and also affecting the basic weights. Quantitative adjustments were made to the distance.

[0117] Semantic distance adjustment factor It is obtained through step S4.

[0118] Semantic relevance factor This is obtained through step S2. This is the semantic weight coefficient, with a value ranging from 0 to 1, preferably 0.8.

[0119] In some embodiments, to more accurately analyze user intent, a comprehensive weighting is applied. A second calculation method can also be used, as follows:

[0120]

[0121] In the above formula, This is an explicit reference bonus, representing the extra points a user receives for explicitly specifying a node to reference through interface operations. Specifically, if node 'n' is explicitly referenced by the user, then... It is assigned a high fixed value (e.g., 2.0 or higher) to ensure that user-specified nodes almost always appear at the top of the priority list; if not explicitly specified as a reference node by the user, then =0. Increase This ensures absolute respect for the user's direct intent.

[0122] This is an interaction-based logical temporal bonus, representing the extra points a node 'n' receives due to its position in the user's recent interaction sequence. (Introduction) This approach can replace physical time-based decay and better reflect the user's "work focus" or "flow state." In a specific implementation, the system maintains a "sequence of recently interacted nodes" (e.g., a list of nodes with the N most recent meaningful interactions). The value is determined by the node's position in the sequence; the earlier the node appears, the newer or more frequent the interaction, and the higher the score. Nodes not in the sequence... =0. (Introduction) It can capture the user's short-term memory and operational focus, making recently processed nodes easier to associate.

[0123] This represents the absolute depth weighting coefficient, an adjustment parameter used to control the next term, "absolute depth factor". The proportion of the total weight, This can balance the influence of node seniority in the structural graph. In a specific implementation, It is usually a relatively low fixed value, such as 0.1 or 0.2.

[0124] The absolute depth factor represents the absolute depth of node 'n' within the entire knowledge graph. The weight adjustment is obtained based on the distance from the root node. Giving a slight but consistent weight tilt to nodes closer to the initial core of the conversation helps maintain topic coherence. In this embodiment, It is a function that gradually decreases with increasing depth, and its calculation formula is as follows:

[0125]

[0126] in, It is the absolute depth of the node (0 for the root node). It is a small positive number (such as 1).

[0127] The comprehensive weight calculation method in this step provides a multi-dimensional dynamic context evaluation system for the correlation-based structured context dynamic assembly algorithm. It takes into account the influence of multiple factors and can comprehensively evaluate the context.

[0128] S6. Based on the comprehensive weights of each node, construct a context load with dynamic fidelity and gradient summarization.

[0129] S61 sorts the nodes according to their overall weight to obtain a node priority list.

[0130] In this embodiment, when sorting the historical chat cards of each node by weight, the comprehensive weight of each node is calculated based on all the historical chat cards of each node, and all nodes are sorted according to the comprehensive weight to obtain the "node priority list".

[0131] Build context load Follow these steps:

[0132] S62. Set the budget for the smallest semantic unit of the large language model, and put all the original text of the current active node into the initial context load.

[0133] The total token (smallest semantic unit) budget for this AI call is determined, and the algorithm is set to include the current active node. The full original text Forced and fully placed into the final context And deducted from the budget.

[0134] S63. Iteratively populate the context load according to the node priority list and the gradient summary strategy.

[0135] The system starts with the highest score in the "node priority list" and processes each candidate node one by one to maximize the inclusion of high-value information within the token budget. This mainly includes: evaluating the remaining space (checking the remaining token budget) and prioritizing the original text. The method for prioritizing the original text is: if all the original texts of the current candidate node are included... Add to If the total number of tokens is still within a relatively lenient dynamic threshold of the budget (e.g., 80% of the budget, leaving room for subsequent higher priority nodes or more digests), then its entire original text is added.

[0136] The gradient summarization strategy is as follows: If adding the entire original text would exceed the dynamic threshold or the hard total budget, the system will activate the gradient summarization mechanism: For this high-weight node, the system will not directly discard it or use only a single shortest summary, but will instead use a summary based on its overall weight. The system considers the remaining token budget and the estimated importance of subsequent nodes to be processed, attempting to select the most detailed and accommodating version from pre-generated summary versions of varying levels of detail (e.g., long summary, medium summary, short summary / keyword list). A tiered summarization strategy is implemented to avoid the complete loss of information for a large number of subsequent, though less important, nodes due to excessively long original texts for a few nodes. The system may choose to moderately summarize a node with a very high weight to make room for several other nodes with slightly lower weights (or their summaries); the higher the weight of a node, the more likely the system is to retain its more complete description.

[0137] S64. When the total token budget is exhausted or the priority list has been processed, the iteration ends, resulting in a context payload with dynamic fidelity and gradient summary.

[0138] The algorithm will continuously optimize in step S63 until the total token budget is exhausted or the priority list is processed. The final result is... It is a hybrid of high-fidelity original text and summaries of varying levels, achieved through intelligent weighting. In step S64, the algorithm intelligently selects between the "complete original text" and "refined summary" of a node based on the Token budget to maximize information value and achieve dynamic fidelity. It prioritizes ensuring the highest fidelity (original text) of highly relevant information and intelligently selects summaries of different levels of detail under Token pressure through a gradient summarization mechanism to maximize the overall information value density.

[0139] In some embodiments, during construction During the process, the algorithm can introduce an explicit exclusion method. The specific implementation of explicit exclusion is as follows: if the user explicitly specifies through the interface that certain nodes, or certain nodes and their child nodes, should be blocked or excluded, then these blocked or excluded nodes will be removed from the weighted sorting, and their original chat history will not be included in the final context load. This allows for a "one-vote veto" of information deemed irrelevant by the user.

[0140] In some embodiments, when constructing a context load with dynamic fidelity and gradient summarization, the structured context-aware assembly module further guides the large language model to perceive the importance of information by marking up structured features and descriptive headings using a markup language (such as Markdown). Specifically, this strategy of perceiving information importance through markup language guidance (LLM) is applied to the context load selected by the core algorithm of this invention and processed through methods such as "gradient summarization". This is a presentation strategy when presenting information to an LLM. This strategy does not replace the core algorithm's decision-making, but aims to maximize the effective utilization of selected information by the LLM through structured and systematic arrangement, taking into account the attention characteristics of the LLM (such as its sensitivity to the first and last position information of the input sequence, i.e., the so-called primacy and proximity effects) and token economy, thereby improving the accuracy and consistency of the response.

[0141] In a specific implementation method The overall order of the historical context blocks within the block is still determined by their "comprehensive weight". "This allows LLM to focus more on processing these high-weight blocks. Specifically, it could be considered to strategically place the historical information that the algorithm determines to have the highest weight in..." The information should be placed at the beginning or immediately before the current user's question, in a position easily noticed by the LLM. For supplementary information with relatively low weight but still valuable (typically sections with "gradient summaries"), the remaining space should be filled in order of weight. To visually and logically distinguish different information blocks, extremely lightweight separation methods can be used, such as a single --- line break. If it is necessary to provide subtle hints about the block's origin or role, and the token allows, consider using minimal inline labels such as [Source Node X] or [Summary]. For the "thought path tracing" information mentioned in this invention, for example, it can be condensed into a single line of text consisting of core keywords and simple connectors (such as >), aiming to provide the LLM with a clear logical thread of conversational evolution, helping it understand the derivative relationships between different discussion focuses, thereby generating more contextually coherent and in-depth responses.

[0142] This invention emphasizes that the structured presentation described above provides an idea and method for optimizing information presentation, rather than a fixed format template. Those skilled in the art should be able to flexibly adjust the level of detail in the tags and the arrangement of information based on the actual performance of the target LLM and specific task requirements. The core lies in enhancing the technical effectiveness of the core algorithm through these strategies, ensuring that the LLM can more effectively understand and utilize the selected high-quality content based on the importance (i.e., "weights") assigned to different contextual information by the algorithm, thereby optimizing the accuracy, relevance, and depth of its final output.

[0143] The aforementioned relevance-based structured context dynamic assembly algorithm in this embodiment features advanced context processing and construction strategies, introducing "contextual anchors" to achieve path dependence. The algorithm can identify from which segment of the preceding node a new node is derived as a specific text, dynamically reconstructing its complete "contextual context," and using this to guide AI (e.g., by integrating this contextual information into the generation process of enhanced query vectors, or in the generation process of the final context load, or in the final context load...). The thought process is explicitly presented in the text. As a simplified solution to the "contextual context", a lightweight approach using contextual keyword chains can be adopted. Specifically, a list of "contextual keyword chains" is physically stored for each node. This list contains the text of all "contextual anchors" on the path from the root node to the current node. It can be used to enhance semantic queries together with new user input and the history of the current active node (i.e., the input text that together constitutes the enhanced query vector), or directly as the input text injected into the final context load for "thinking path review", or directly as the starting part of the final context load for "thinking path review".

[0144] The correlation-based structured context dynamic assembly algorithm described above in this embodiment also has the function of adaptive search depth, which jointly determines the range of the search context through system adaptation and user manual adjustment.

[0145] The following example, using a real-world dialogue between a user and AI, illustrates the working process of a relevance-based structured context dynamic assembly algorithm, including three stages: initial, middle, and late-stage interaction.

[0146] 1. Initial Interaction in the First Phase:

[0147] First node creation: The user opens the first chat card (root node) and interacts with the larger model. At this point, since only a single node exists, the algorithm's structural weights (such as...) ) and time weight ( It has almost no effect. The system behaves similarly to a typical AI chat application. The original vector of this node... It will be asynchronously calculated and stored in the background after it becomes inactive.

[0148] Initial branch creation: The user selects a specific text segment ("contextual anchor") within the root node to create a new child node card. Chat focus shifts to this new card. The original root node becomes inactive, and its parent node's parent node becomes inactive. Confirmed storage received.

[0149] Interacting in a new branch: The user submits new input in a new card.

[0150] The system generates enhanced query vectors. This vector combines the new input text with the recent history of the currently active card.

[0151] System usage With the already stored root node Calculate semantic relevance .

[0152] At this point, structural weights (root node as direct predecessor), absolute depth weights (current node depth is 1), and time decay (root node has just been edited) are all included in the calculation.

[0153] "Contextual anchor" information can be used to enhance... Or in construction It serves as a path suggestion.

[0154] Due to the relatively small overall text volume, the final context load It mainly contains the original text of the currently active node and the root node.

[0155] At this stage, the user completes a single-point dialogue and initial branching with the AI.

[0156] 2. Mid-term interaction in the second phase:

[0157] Multi-level branching: Users continuously create new branches, the structure graph gradually expands, and the number of nodes and the total amount of text increase significantly.

[0158] The algorithm operates in its entirety: When a user submits new input at any active node, the algorithm comprehensively evaluates the weights of all candidate historical nodes (within the search depth), taking into account all factors such as structure, semantics, time, and absolute depth.

[0159] User manually increases weight (explicit reference) Users can specify to reference one or more historical nodes, which will significantly increase the weight of these nodes.

[0160] User-blocked nodes: Users can configure the blocking of certain nodes or all nodes under a specific branch. These blocked nodes will not participate in subsequent weight calculations and context construction, meaning they are removed from the candidate pool.

[0161] Context dynamic construction: The system constructs a context based on the calculated weight and priority list. At this point, the original text-first strategy begins to play an important role.

[0162] At this stage, as the structure graph expands, the advantages of the correlation-based structured context dynamic assembly algorithm begin to emerge.

[0163] 3. Late-stage interaction in the third phase

[0164] Token pressure becomes apparent: As the graph becomes extremely complex, even selecting only the original text from high-weight nodes may exceed the LLM's token limit. Algorithm construction. The gradient summarization strategy is activated. For high-weight nodes that cannot be fully included in the original text due to token limitations, the system will attempt to use pre-generated summaries of varying degrees of abbreviation. To replace it, ensure that the core information can still be transmitted.

[0165] In some embodiments, this stage may also include pre-calculation and pre-display, visual feedback, and user adjustments and confirmations, as detailed below:

[0166] Pre-computation and Pre-display: After a user submits new input at an active node, the system can trigger a "pre-computation" of the algorithm before it is officially sent to the API. Visual feedback: The calculated weights of each historical node (or whether they will be included). The algorithm (whether included in the original text or a summary) can provide real-time visual feedback to the user interface (e.g., node color depth, highlighting, flashing, marking, etc.). User adjustments and confirmation: Users can check which historical information will be retrieved based on this visual feedback. If some important nodes fail to be selected even after summarization due to token restrictions (e.g., displayed in gray or with specific markings), or if some less relevant nodes have excessively high weights, users can manually adjust them in real-time (e.g., temporarily increase / decrease the weight of a node, or force the inclusion / exclusion of a node). This mechanism partially makes the algorithm's decision-making process transparent, giving users ultimate control at crucial moments, further enhancing the depth and efficiency of human-computer collaboration.

[0167] Final delivery: After the user confirms the adjustment, the system constructs the final (potentially user-intervened) context selection. And send it to the LLM.

[0168] In this embodiment, the card dialog group, as a front-end interactive interface, is a data generator and structure provider that the structured context-aware module for back-end data processing can run, and is an integral part of the entire technical solution. There is an inseparable symbiotic relationship between the front-end interaction and the back-end algorithm. The specific design of the front-end UI provides the necessary conditions for the operation of the back-end algorithm, while the powerful capabilities of the back-end algorithm also endow the front-end UI design with feasibility and practical value, as detailed in the table below:

[0169] Specific design of the front-end UI (technical reasons) How to provide the necessary conditions for the backend algorithm (technical results) A visual graph interaction framework based on card-style chat boxes It directly defines the "nodes" and graph structure that the algorithm operates on, making calculations such as "structural distance" possible. Without this structure, the algorithm cannot run. Interaction that leads to branches from a user-selected exact text segment. It provides one of the most critical inputs to the algorithm—"contextual anchors"—which greatly improves the initial relevance of branch dialogues and is a prerequisite for achieving accurate context injection. The "Refer to other cards" interactive feature This directly triggered the "explicit reference" mechanism in the algorithm, giving the referenced node extremely high weight and enabling complex, cross-topic reasoning. User's clicking and switching behavior between different cards Users can return to any previously existing card-based chat box at any time to continue chatting on that topic. The algorithm also dynamically assembles the historical context based on the different chat cards the user submits each time, capturing the user's "flow" state and making recently focused nodes more active in the context. User's "block / exclude" operation on cards or branches By directly generating and updating the backend "block list", the algorithm can prioritize the execution of the user's negative guidance instructions when filtering contexts, ensuring that irrelevant information is completely excluded.

[0170] The technical solution of this embodiment addresses the challenges of information organization and in-depth exploration in AI dialogue through an innovative graphical user interaction paradigm. It not only allows users to instantly open new, focused discussion branches around any selected text fragment from their dialogue flow with AI, enabling them to proactively construct a dynamically growing, clearly structured representation that reflects the inherent logic and hierarchy of the entire dialogue history, but also reconstructs the dialogue organization between humans and AI from the user interaction level. This new interaction directly drives an intelligent algorithm that not only manages context length but also deeply understands context relevance and the user's two-way control intentions. This algorithm possesses a core mechanism for intelligently filtering "extremely relevant" information from a vast history, extracting the most relevant contextual information from historical dialogue records, thereby achieving a smooth, in-depth AI dialogue experience unrestricted by physical windows.

[0171] In some embodiments, a computer program product is also provided, including a computer program / instruction that, when executed by a processor, implements the steps of the text-branch-based AI dialogue structure graph and context dynamic assembly method described above.

[0172] In some embodiments, an electronic device is also provided, including: one or more processors; a storage device for storing one or more programs; and when one or more programs are executed by one or more processors, causing one or more processors to implement the text-branch-based AI dialogue structure graph and context dynamic assembly method described above.

[0173] In some embodiments, a storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the text-branch-based AI dialogue structure graph and context dynamic assembly method described above.

[0174] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all 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 the present invention, and they should all be covered within the scope of the claims and specification of the present invention.

Claims

1. A method for dynamically assembling an AI dialogue structure graph and context based on text branching, characterized in that, include: Use any user-specified content in the dialogue unit as a contextual anchor point; The contextual anchors are used to establish branch connections between dialogue units in order to construct a structural graph; By combining contextual anchors and using a relevance-based structured context dynamic assembly algorithm, context loads are assembled after path backtracking of multiple dialogues and then provided to AI.

2. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching as described in claim 1, characterized in that, The correlation-based structured context dynamic assembly algorithm includes: Path backtracking is performed based on the structural graph to obtain path depth and contextual anchor vectors; An enhanced query vector representing the user's thought process is generated based on the path depth and contextual anchor vector. The semantic relevance factor of each node is calculated based on the enhanced query vector. Calculate the structural proximity factor based on the structural map; The semantic distance adjustment factor is calculated based on the contextual anchor vector and the structural graph. The comprehensive weight of each node is calculated based on the structural proximity factor, semantic distance adjustment factor, and semantic relevance factor. Based on the comprehensive weights of each node, a context load with dynamic fidelity and gradient summarization is constructed.

3. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, The structural graph is generated based on multiple dialogue units between AI and users, and the historical dialogue records in the dialogue units are structurally graphed; each dialogue unit is a node, and the node corresponds to the vertex of the graph structure in the structural graph. Other dialog boxes connected to the node in the structure graph are branches in the structure graph.

4. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, An enhanced query vector representing the user's thought process is generated based on path depth and contextual anchor vectors. The semantic relevance factor for each node is calculated based on this enhanced query vector, including: The user's new input is vectorized and fused with the original text vector of the current active node to generate a new question vector; An enhanced query vector is generated based on the context anchor vector, the new question vector, and the path depth. Perform vector similarity search on all original text vectors based on the enhanced query vector; Based on the vector similarity search results, obtain the cosine similarity of all other nodes that are not currently active nodes, and derive the semantic relevance factor of each node.

5. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, The semantic distance adjustment factor is calculated based on the contextual anchor vector and the structural graph, including: If two nodes are child nodes derived from the same parent node, calculate the cosine similarity of the contextual anchor vectors of the two child nodes to obtain the semantic distance adjustment factor. If two nodes are a certain node and a child node derived from that node, respectively, the original text vector of the child node and the anchor text vector that gave birth to the child node are fused with weights, and then the cosine similarity between the fused vector and the original text vector of the parent node is calculated to obtain the semantic distance adjustment factor.

6. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, The semantic distance adjustment factor is calculated based on the contextual anchor vector and the structural graph, including: The graph traversal method is used to locate the nearest common ancestor node of the currently active node and any non-current active node in the structural graph; Collect contextual anchor vectors on the path from the common ancestor node to the current active node and fuse them to obtain the first overall semantic vector; collect contextual anchor vectors on the path from the common ancestor node to the candidate node and fuse them to obtain the second overall semantic vector. The semantic distance adjustment factor is derived by comparing the cosine similarity of the first and second overall semantic vectors.

7. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, When calculating the semantic distance adjustment factor based on contextual anchor vectors and structural graphs, a hierarchical hybrid strategy is used to calculate the semantic distance adjustment factor, which includes a conventional mode and a deep analysis mode. In normal mode, the semantic distance adjustment factor is set to a specified value for all distant relative nodes; In deep analysis mode, the semantic distance adjustment factor is calculated for all distant relative nodes in the following way: the graph traversal method is used to locate the nearest common ancestor node of the currently active node and any non-currently active node in the structural graph; Collect contextual anchor vectors on the path from the common ancestor node to the current active node and fuse them to obtain the first overall semantic vector. Collect contextual anchor vectors on the path from the common ancestor node to the candidate node and fuse them to obtain the second overall semantic vector. Compare the cosine similarity of the first and second overall semantic vectors to obtain the semantic distance adjustment factor.

8. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, When calculating the comprehensive weight of each node based on the structural proximity factor, semantic distance adjustment factor, and semantic relevance factor, a basic weight is introduced for the structural proximity factor.

9. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 8, characterized in that, When calculating the comprehensive weight of each node based on the structural proximity factor, semantic distance adjustment factor, and semantic relevance factor, explicit reference bonus, interaction-based logical time bonus, absolute depth weight coefficient, and absolute depth factor are also introduced to calculate the comprehensive weight. The explicit reference bonus is configured to be an extra point awarded to users who explicitly specify the node to reference through interface operations.

10. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, Based on the comprehensive weights of each node, a context load with dynamic fidelity and gradient summarization is constructed, including: The nodes are sorted according to their overall weight to obtain a priority list. Set the budget for the smallest semantic unit of the large language model, and put all the original text of the current active node into the initial context load; The context load is iteratively populated according to the node priority list and a gradient summary strategy; When the minimum semantic unit budget is exhausted, or the priority list is processed, the iteration ends, resulting in a context load with dynamic fidelity and gradient summary.

11. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 10, characterized in that, The gradient summarization strategy includes: For high-weight nodes that require summarization, instead of directly abandoning them or using only a single shortest summary, the most detailed and accommodating version is selected from pre-generated summary versions of different levels of detail, based on the node's overall weight, remaining minimum semantic unit budget, and the estimated importance of subsequent nodes to be processed.

12. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, The correlation-based structured context dynamic assembly algorithm is also configured to introduce an explicit exclusion method, which includes: If a user explicitly specifies through the interface that they want to block or exclude certain nodes, or certain nodes and their child nodes, then these blocked or excluded nodes will be removed from the weighted sorting, and the original chat history of the deleted nodes will not be included in the context load.

13. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 2, characterized in that, Place the historical information that the algorithm determines has the highest overall weight in a position that is easily noticed by the large language model; For supplementary information that has a low overall weight but is still valuable, fill the remaining space according to the overall weight order.

14. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 1, characterized in that, The dialogue unit is a card dialog box. Users interact with the AI ​​through card dialog boxes, and there can be one or more card dialog boxes. Users can switch between multiple card dialog boxes at will. When switching, the dialogue content in the current card dialog box will be saved so that users can specify text in subsequent operations.

15. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 14, characterized in that, The card dialog box is configured to different states, including chat card state, browse card state, and summary / title state.

16. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 15, characterized in that, The chat card status is configured as follows: Users can manually create new root cards; When a new child card is created from a selected text branch of the parent card, the child card automatically enters the chat card state and is placed in the user's visual center; the parent card switches to the condensed / title state and moves to a position away from the user's visual center.

17. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 15, characterized in that, The browsing card status is configured as follows: When a user clicks on a card in condensed / titled state, the card expands in its original position or in a designated area, displaying the complete, read-only conversation history stored in that card, thus entering the card browsing state; Users can scroll through the conversation history and select text to create new branches.

18. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 15, characterized in that, The condensed / title state is configured such that when a card in chat card state is closed, the card will revert to the condensed / title state.

19. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 14, characterized in that, When switching between card dialog boxes, users can also block or unblock cards; after a user blocks a card, the dialog content of that card will not be included in the subsequent output context load.

20. The AI ​​dialogue structure graph and context dynamic assembly method based on text branching according to claim 14, characterized in that, When a user switches between multiple card dialog boxes, a dynamic catalog view is provided for the user's reference; the catalog view renders each card dialog box as a cover of different sizes or thicknesses depending on the amount or depth of its internal dialogue content. Users can browse the catalog view by dragging horizontally or scrolling, and can also select any cover in the catalog view to expand the card dialog box corresponding to that cover.

21. A text-branch-based AI dialogue structure graph and context-based dynamic assembly system, characterized in that, The method for implementing the text-branch-based AI dialogue structure graph and context dynamic assembly method according to any one of claims 1-20 includes: The interactive structure graph generation module is used to provide a dialogue interface for users to engage in dialogue, and also to generate structure graphs based on the dialogue content, and then transmit the structure graphs to the structured context-aware assembly module for processing. The structured context-aware assembly module is used to analyze the structural, semantic, user intent, and temporal dimensions of the structure graph based on a correlation-based structured context dynamic assembly algorithm, and to construct the most relevant context for each AI call in conjunction with the user's new input.

22. The AI ​​dialogue structure graph and context dynamic assembly system based on text branching according to claim 21, characterized in that, The structural dimension represents logical affinity, the semantic dimension represents semantic association, the user intent dimension represents explicit citations, contextual anchors, and explicit exclusions generated by the user through dialogue and interaction with AI, and the time dimension represents the user's focus of attention within a certain period of time.

23. The AI ​​dialogue structure graph and context dynamic assembly system based on text branching according to claim 21, characterized in that, When a user enters / creates a new dialogue, the interactive structure graph generation module generates a card dialog box as the root node. The user interacts with the AI ​​in the root node, and the structured context-aware assembly module stores the generated dialogue text history in this node. The user and AI engage in multiple dialogues to form multiple card-based dialog boxes, with each dialog box corresponding to a node; the interactive structure graph generation module generates a structure graph based on the dialogue content of all nodes. The user selects a specific text or passage in the current active node as a contextual anchor point; The structured context-aware assembly module assembles context loads by backtracking the dialogue content of multiple nodes based on context anchors and structure graphs, and then provides the context loads to the AI.

24. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the text-branch-based AI dialogue structure graph and context dynamic assembly method as described in any one of claims 1-20.

25. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the AI ​​dialogue structure graph and context dynamic assembly method based on text branching as described in any one of claims 1-20.

26. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the text-branch-based AI dialogue structure graph and context dynamic assembly method as described in any one of claims 1-20.