A conversation memory retrieval method, system, device and medium

CN122946524APending Publication Date: 2026-10-20BEIJING PROINSIGHT TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611433520.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-15
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0003]本申请的目的是提供一种会话记忆检索方法、系统、设备及介质,以解决召回精度低、误召回率高以及用户确认和复用过往经验的成本高的问题

Benefits of technology

本申请通过接收碎片化提示信息并进行碎片度评估以确定碎片度类别和查询补全策略,同时采集开发者工作流的情境信息得到当前项目标识,进而结合多语义维度多样性约束生成N个候选完整查询,有效避免了同质化查询的生成,充分利用了开发者当前工作流情境缩小检索空间,提升了碎片化输入下的召回精度并降低了误召回率;进一步地,通过在会话块级向量索引中分别执行检索,结合当前项目标识计算融合分数进行排序,最终回查原始会话日志文件得到对话原文片段并输出,使得长会话中的关键讨论不被首尾压缩稀释而漏检,且保证展示阶段直接呈现来自原始日志的对话原文,避免了摘要式方法导致的关键语句丢失,使用户能够直接看到具体的原始表达,从而快速、准确地定位和确认真实的历史记忆,大幅降低了用户确认和复用过往经验的成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This application discloses a conversation memory retrieval method, system, device, and medium, relating to the fields of artificial intelligence-assisted software development and information retrieval technology. The method includes: receiving fragmented prompts from user input and evaluating the fragmentation level to obtain fragmentation categories and query completion strategies; collecting contextual information from the developer's workflow to obtain the current project identifier, generating N candidate complete queries that satisfy multi-semantic dimension diversity constraints, and performing searches in the conversation block-level vector index to obtain N sets of candidate search results deduplicated by the conversation identifier; combining the current project identifier to calculate a fusion score and sorting them to obtain a final conversation ranking list; and retrieving the original conversation log file based on the final conversation ranking list to determine the original dialogue fragments. This application improves recall accuracy under fragmented input and reduces false recall rate, significantly reducing the cost for user confirmation and reuse of past experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence-assisted software development and information retrieval technology, and in particular to a conversation memory retrieval method, system, device and medium, which is especially suitable for scenarios where developers can quickly recall and reuse past experiences from their historical artificial intelligence programming assistant conversations. Background Technology

[0002] In recent years, AI programming assistants have been widely used in software development practices, generating a large number of conversation records over long-term use. However, when developers try to recall and reuse specific solutions from past conversations, they often only receive fragmented prompts or vague descriptions of phenomena. Existing technologies, general retrieval enhancement generation systems, when faced with fragmented and suggestive input, lack targeted fragmentation assessment and multi-dimensional query expansion mechanisms. The generated candidate queries often exhibit severe semantic homogeneity and fail to effectively integrate with the developer's current workflow context, resulting in low recall accuracy and high false recall rates. Furthermore, existing long-text retrieval solutions typically rely on summary compression or full-text matching during the recall stage, losing specific expressions and key details from the original conversation. This prevents users from directly obtaining the original dialogue text sufficient to uniquely locate historical memories, increasing the cost for users to confirm and reuse past experiences. Summary of the Invention

[0003] The purpose of this application is to provide a session memory retrieval method, system, device, and medium to solve the problems of low recall accuracy, high false recall rate, and high cost of user confirmation and reuse of past experience.

[0004] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a session memory retrieval method, including: Receive fragmented prompt information input by the user; the fragmented prompt information is a natural language fragment with a character count less than a preset threshold, a combination of keywords, or a sentence containing referential markers; Based on the fragmentation prompts, fragmentation level is evaluated to obtain fragmentation category and query completion strategy; Collect contextual information about the developer's workflow to obtain the current project identifier; Based on the fragmentation prompt information, the fragmentation level category, the query completion strategy, and the current project identifier, generate N candidate complete queries that satisfy the multi-semantic dimension diversity constraints; Based on N candidate complete queries, perform retrieval in the session block-level vector index respectively to obtain N sets of candidate retrieval results deduplicated by session identifier; Based on the N sets of candidate search results and the current item identifier, calculate the fusion score and sort them to obtain the final session ranking list; Based on the final session sorting list, the original session log file is retrieved to determine the original dialogue fragments.

[0005] Secondly, this application provides a session memory retrieval system, comprising: The input receiving module is used to receive fragmented prompt information input by the user; the fragmented prompt information is a natural language segment with a character count less than a preset threshold, a combination of keywords, or a statement containing referential markers; The fragmentation assessment module is used to assess the fragmentation level based on the fragmentation prompt information, and obtain the fragmentation category and query completion strategy. The workflow context collection module is used to collect context information of the developer's workflow and obtain the current project identifier; The diversity candidate generation module is used to generate N candidate complete queries that satisfy the multi-semantic dimension diversity constraints based on the fragmentation prompt information, the fragmentation level category, the query completion strategy, and the current project identifier. The block-level parallel retrieval module is used to perform retrieval in the session block-level vector index according to N candidate complete queries, and obtain N sets of candidate retrieval results deduplicated by session identifier; The voting and project preference fusion module is used to calculate and sort the fusion score based on N sets of candidate search results and the current project identifier to obtain the final session ranking list; The original text retrieval module is used to retrieve the original session log file based on the final session sorting list to determine the original dialogue fragments.

[0006] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described session memory retrieval method.

[0007] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described session memory retrieval method.

[0008] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described session memory retrieval method.

[0009] According to the specific embodiments provided in this application, this application has the following technical effects: This application determines the fragmentation category and query completion strategy by receiving fragmented prompts and evaluating fragmentation levels. Simultaneously, it collects contextual information from the developer's workflow to obtain the current project identifier. Then, it generates N candidate complete queries by combining multi-semantic dimension diversity constraints. This effectively avoids the generation of homogeneous queries, fully utilizes the developer's current workflow context to narrow the retrieval space, improves recall accuracy under fragmented input, and reduces false recall. Furthermore, by performing searches separately in the session block-level vector index, calculating a fusion score based on the current project identifier, and sorting the results, the application finally retrieves and outputs the original dialogue fragments from the original session log file. This ensures that key discussions in long sessions are not compressed or diluted at the beginning and end, preventing missed detections. It also guarantees that the original dialogue text from the original log is directly presented during the display stage, avoiding the loss of key statements caused by summary methods. This allows users to directly see the specific original expressions, thus quickly and accurately locating and confirming authentic historical memories, significantly reducing the cost for users to confirm and reuse past experiences. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 A flowchart illustrating a conversation memory retrieval method provided in an embodiment of this application; Figure 2 A schematic diagram of the architecture of a session memory retrieval method provided in an embodiment of this application; Figure 3 A decision flowchart of a fragmentation evaluator provided in one embodiment of this application; Figure 4 A prompt template and post-processing flowchart for generating multi-semantic dimension candidates are provided in one embodiment of this application; Figure 5 This is a schematic diagram of long session adaptive fragmentation and block-to-session mapping provided in an embodiment of this application; Figure 6 A data flow and calculation example diagram of vote-weighted fusion and item preference weighting provided in an embodiment of this application; Figure 7 A diagram illustrating a two-tier architecture for index retrieval and original text lookup provided in one embodiment of this application; Figure 8 This is a schematic diagram of a pluggable embedding and generative model abstraction layer access provided in an embodiment of this application; Figure 9 A comparison diagram of three deployment configurations provided in one embodiment of this application. Detailed Implementation

[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0013] To make the objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0014] The terms used in this application are explained as follows: Fragmented prompts: limited character count, incomplete context, and reliance on natural language input with implicit background.

[0015] Workflow context information: A set of observable signals related to the development task currently being performed by the user, including but not limited to version control status, recent files, terminal history, and current project identifier.

[0016] Semantic dimension: The same information can be described from multiple independent perspectives, each perspective being a semantic dimension.

[0017] Voting-weighted fusion: A fusion strategy that uses weighted ranking based on the overlap of multi-source results.

[0018] Project preference weighting: A strategy that adds extra weight to the fusion score based on whether the project to which the session belongs is the same as the user's current project.

[0019] Block-level vector index: An index structure that generates multiple text fragments for a session and vectorizes each one, but retains the mapping from fragment to session.

[0020] Session-level deduplication: The process of aggregating block-level search results by session identifier and taking the highest score.

[0021] Original text retrieval: The process of directly reading the original session log file and extracting the original dialogue fragments during the presentation phase is separated from index retrieval.

[0022] Injected messages: Non-user intent messages that appear under the user role field but are actually automatically generated by the tool system.

[0023] Pluggable Model Layer: An architecture layer that connects to various embedded and generative models through a unified abstract interface.

[0024] like Figure 1 As shown, this application provides a session memory retrieval method, including: S1: Receive fragmented prompt information input by the user; the fragmented prompt information is a natural language fragment with a character count less than a preset threshold, a combination of keywords, or a statement containing referential markers.

[0025] S2: Based on the fragmentation prompt information, perform fragmentation assessment to obtain the fragmentation category and query completion strategy.

[0026] S3: Collect contextual information about the developer's workflow to obtain the current project identifier.

[0027] S4: Based on the fragmentation prompt information, the fragmentation level category, the query completion strategy, and the current project identifier, generate N candidate complete queries that satisfy the multi-semantic dimension diversity constraints.

[0028] S5: Perform retrieval in the session block-level vector index based on N candidate complete queries to obtain N sets of candidate retrieval results deduplicated by session identifier.

[0029] S6: Calculate and sort the fusion scores based on the N sets of candidate search results and the current item identifier to obtain the final session ranking list.

[0030] S7: Based on the final session sorting list, retrieve the original session log file to determine the original dialogue fragments.

[0031] like Figure 2 As shown, after receiving fragmented prompts from user input, this application first classifies the input through a fragmentation assessment module and selects an appropriate completion strategy. Simultaneously, a workflow context acquisition module independently collects a snapshot of the developer's current context (each sub-source acquisition uses independent anomaly isolation). Both inputs are shared into a diversity candidate generation module, which calls a large language model to generate N candidate complete queries under multiple preset semantic dimension constraints. Each candidate query is retrieved from a pre-built session block-level vector index through a block-level parallel retrieval module, and deduplication is performed at the session level. A voting and item preference fusion module weights and sorts the results based on the overlap of each candidate's hits and the relevance of the item. Finally, a text retrieval module directly locates and extracts the original dialogue text containing keywords from the original log file path of the top-ranked sessions, returning it along with the retrieval results.

[0032] In one exemplary embodiment, S2 includes: S21: Count the number of valid lexical units in the fragmented prompt information to obtain the lexical unit statistics result.

[0033] S22: Detect the referential markers and question markers in the fragmented prompt information to obtain the marker detection results.

[0034] S23: Calculate the character scrambling degree of the fragmented prompt information to obtain the scrambling degree result.

[0035] S24: Classify the fragmentation categories based on the lexical statistics results, the marker detection results, and the noise results; the fragmentation categories include at least complete question categories, keyword categories, pronoun phrase categories, and noisy input categories.

[0036] S25: Match the corresponding query completion strategy according to the fragmentation category.

[0037] Unlike existing large language model query expansion schemes that generate expanded queries across all inputs in a "one-size-fits-all" manner, this application incorporates a fragmentation evaluator at the pipeline inlet, such as... Figure 3 As shown, this evaluator classifies inputs into four mutually exclusive categories using multi-dimensional features such as effective word count statistics, pronoun detection, question marker detection, and character noise calculation: complete question type (direct pass-through, skipping completion), pronoun phrase type (using pronoun parsing expansion), noisy input type (using error correction expansion), and keyword type (using associative expansion).

[0038] The technical effect of this mechanism is to avoid unnecessary expansion of already clear queries (expansion introduces noise), while selecting the most appropriate completion method for truly ambiguous inputs.

[0039] In one exemplary embodiment, S3 includes: S31: Obtain the context information of the developer workflow to obtain context sub-source data; the context information of the developer workflow includes at least two of the following: version control system status information, current working directory path, list of recently modified files, and terminal command history.

[0040] S32: Perform independent anomaly isolation processing on the aforementioned context sub-source data to obtain structured workflow context snapshot data.

[0041] S33: Extract the project identifier from the current working directory path in the workflow context snapshot data to obtain the current project identifier.

[0042] Unlike existing context-aware retrieval enhancement generation systems that collect general contexts (location, profile, browsing history), this application collects a set of contextual information specific to software development scenarios and highly related to conversational memory, as shown in Table 1.

[0043] Table 1

[0044] All of this contextual information is read through local commands, which protects privacy and significantly reduces the search space.

[0045] More importantly, this application extracts project identifiers from the working directory path and introduces project preference weighting during the fusion sorting stage: for sessions belonging to the same project as the current project, their fusion scores are amplified by a configurable multiplicative coefficient β (default value greater than 1). This mechanism ensures that when a user asks a question with ambiguous references under a certain project directory, the system will prioritize returning relevant historical sessions under that project, rather than being overwhelmed by sessions with similar superficial vocabulary under other projects.

[0046] To address robustness issues in real-world development environments, this application introduces two engineering improvements in scenario acquisition: independent exception isolation and cross-platform encoding compatibility. Each sub-scenario source handles exceptions independently, and failure of one does not affect the others. When calling external commands, they are read in binary format and then decoded using a multi-level encoding strategy to ensure compatibility with version control system commit messages containing non-Western characters.

[0047] In one exemplary embodiment, S4 includes: S41: Based on the fragmentation category, the query completion strategy, and the current project identifier, call the large language model to generate an initial candidate query set.

[0048] S42: Perform dimension identification on each initial candidate query in the initial candidate query set to obtain the semantic dimension to which it belongs.

[0049] S43: Based on the semantic dimension, discard initial candidate queries with duplicate dimensions, and generate N candidate complete queries that satisfy the multi-semantic dimension diversity constraint; the multi-semantic dimension diversity constraint includes: pre-defining a semantic dimension set that includes at least technical detail dimension, phenomenon description dimension, and system architecture dimension; when calling the large language model, prompting the project to explicitly require each generated candidate query to belong to a different dimension in the semantic dimension set; post-processing the candidate queries returned by the large language model, identifying the dimension declared by the returned candidate queries, and discarding candidate queries with duplicate dimensions; ensuring that the final output N candidates cover at least N / 2 There are several different semantic dimensions; among them... This is for rounding up.

[0050] Unlike existing multi-query retrieval methods that rely solely on the large language model (often resulting in multiple candidates that are simply alternative expressions of the same meaning), this application introduces the concept of "semantic dimension," which mandates that the N candidates generated in the large language model call prompts belong to predefined and distinct sets of semantic dimensions.

[0051] The standard dimension set defined in this application includes technical detail dimension, phenomenon description dimension, system architecture dimension, etc. For example... Figure 4 As shown, the output of the large language model is post-processed and validated by the system: parsing the dimension to which each candidate statement belongs and discarding those with duplicate dimensions. Fault-tolerant structured data parsing is used for the text returned by the large language model to handle situations where the model output often contains natural language prefixes and suffixes or code block wrapping tags in real-world scenarios. When the large language model is unavailable, the system automatically downgrades to deterministic generation based on dimension templates.

[0052] In an exemplary embodiment, the session block-level vector index in S5 is pre-built through the following steps: S51: Perform structured parsing on the session log file and skip injected messages to obtain clean messages.

[0053] S52: Construct a balanced fixed-length digest text based on the clean message to obtain the digest text.

[0054] S53: Based on the cumulative total character length of the session log file and the summary text, perform overlapping fragmentation to obtain session-level additional blocks.

[0055] S54: Vectorize the summary text and the session-level appended block to obtain the session block-level vector index and the block-to-session mapping relationship, such as... Figure 5 As shown.

[0056] In one exemplary embodiment, S6 includes: S61: Based on the N sets of candidate retrieval results, calculate the sum of the hit count and similarity score for each session identifier to obtain the vote count v(d) and the original score s(d).

[0057] S62: Based on the number of votes v(d), the original score s(d), and the maximum number of hits v_max, obtain the vote fusion score vote_score(d); vote_score(d) = s(d) × α (v_max-v(d)) α is the preset voting consensus weighting coefficient.

[0058] S63: Based on the voting fusion score vote_score(d), the project preference weighting coefficient β, and the current project identifier, obtain the fusion score fused_score(d); fused_score(d) = vote_score(d) × β same_project(d) Same_project(d) is a binary indicator function; Same_project(d) is 1 if the project identifier of the candidate session identifier d is the same as the current project identifier, otherwise it is 0; The project preference weighting coefficient β is configurable, and project preference weighting is disabled when β=1.

[0059] S64: Sort the sessions in descending order according to the fused_score(d) to obtain the final session sorting list.

[0060] like Figure 6 As shown, unlike general search enhancement generation systems that use a uniform chunking strategy for all documents, this application employs differentiated processing for bimodal data such as session logs, which are characterized by "extremely short shorts and extremely long longs": (a) Balanced fixed-length summary construction: Summarize the message text by sampling messages from the beginning, middle and end of the conversation in proportion. The middle messages are included first according to the preset keyword regular expression to avoid the loss of key discussions in the middle section due to truncation of the beginning. (b) Long session overlapping fragmentation: When the cumulative characters of a session exceed the threshold, multiple additional blocks with limited length and preset overlap are generated so that keywords can still be retrieved when they are cut to the block boundary; (c) Block-to-session mapping plus session-level deduplication: All additional blocks in the index are vectorized independently, but the integer mapping from each block to its respective session is retained; similarity is calculated by block during retrieval, but it is aggregated upwards to the session level, that is, when multiple blocks of a session are hit, only the highest score is taken, so that each result in the output list corresponds to a unique session. (d) Strong consistency protection during index switching: When a user switches the embedded model, the changes in model identifier and dimension recorded in the index metadata will be detected, and the system will actively require a full reconstruction to avoid retrieval failures caused by dimension mismatch.

[0061] For each candidate session d, its vote count v(d) is defined as the number of candidate queries that hit it, and its original score s(d) is defined as the sum of the similarities among the candidates. The formula for calculating the fusion score is: vote_score(d) = s(d) × α (v_max-v(d)) fused_score(d)=vote_score(d)×β same_project(d) Where α∈(0,1] is the preset voting consistency weight coefficient, v_max is the maximum number of hits, i.e. the maximum number of votes in this search; β≥1 is the project preference weighting coefficient; same_project(d) takes 1 when the project to which the session belongs is the same as the current project identifier, otherwise it takes 0.

[0062] The core idea of ​​this formula is that when a session is simultaneously hit by multiple candidate queries with different semantic dimensions, the probability that it is the user's true target increases exponentially; and when the session also belongs to the project the user is currently working on, this probability increases further. The combination of these two mechanisms enables the cognitive mechanism of "unanimous jury verdict plus priority of the party concerned" to be implemented in a calculable form.

[0063] In one exemplary embodiment, S7 includes: S71: Obtain the path of the original session log file based on the final session sorting list.

[0064] S72: Extract a set of keywords from N candidate complete queries, filter out common words, and obtain the target keyword set.

[0065] S73: Perform a regular expression search on the file corresponding to the original session log file path based on the target keyword set to obtain the hit location.

[0066] S74: Extract context fragments based on the hit location to obtain the original dialogue text fragments.

[0067] To simultaneously satisfy the seemingly contradictory goals of "efficient retrieval" and "realistic display," such as Figure 7 As shown, this application adopts a two-tier architecture: (a) Retrieval layer: Based on block-level vector index, relevant sessions are quickly located (coarse screening) using fragmented, compressed, and embedded derived data.

[0068] (b) Presentation layer: For the small number of sessions obtained from the coarse screening, backtrack from their original log file paths and directly locate the real user / assistant dialogue fragments containing candidate query keywords using regular expressions (detailed reading).

[0069] The key effect of this design is that users ultimately see not the noise at the beginning of the chunks, nor the condensed expression after summarizing from a large language model, but the original words they uttered back then. This is crucial for the "conversation recall" task—the user's judgment of "whether it was this time" is based on that specific original sentence.

[0070] To support this two-tier architecture, this application stores the original path of each session log file in the index and implements intelligent construction of keyword sets: automatically extracting multi-word command phrases as overall matching words; using identifiers with structural symbols as precise words; and filtering out overly generic high-frequency words to avoid false hits.

[0071] In one exemplary embodiment, step S41 further includes: S44: Define the embedded model abstraction interface and the generated model abstraction interface.

[0072] S45: Based on the embedded model abstract interface and the generative model abstract interface, switch between the embedded model implementation and the generative model implementation according to the runtime configuration parameters.

[0073] S46: When the large language model fails to load, output the reason for the failure and instructions for falling back.

[0074] (1) Addressing real pain points for developers: S1 receives fragmented prompts and S3 automatically collects developer workflow scenarios. Users do not need to construct precise search queries, and can systematically recall and reuse experience from historical AI programming sessions.

[0075] (2) Significantly improved accuracy: This is precisely because S4 imposes multi-semantic dimension diversity constraints (ensuring that N candidates cover at least...). N / 2 (Multiple dimensions), S6 uses the sum of hit count and similarity score for voting weighted fusion, S7 applies preference weighting to sessions consistent with the current project, "multi-angle common hit" and "project relevance" are used as strong precision signals, thereby significantly reducing false recall and improving recall accuracy under fragmented input; at the same time, due to the overlapping sharding of ultra-long sessions in the index building stage and S5 taking the maximum value at the session level for deduplication, key discussions in the middle of long sessions can be recalled independently, and its recall rate is improved from an extremely low level to a level comparable to the first and last messages.

[0076] (3) Presents concrete and credible content: Since it does not rely on block-level vectors and block-level summaries, but directly extracts the original dialogue fragments containing keywords from the original conversation log file line by line, users see the original words from that year in the presentation stage rather than the "translation" after the summary is rewritten, which minimizes the cost for users to judge "whether it is this time".

[0077] (4) Privacy friendly: S3’s context signals are all read through local commands, and all indexing and retrieval are completed locally. Only the candidate generation stage of S4 can optionally call the large language model interface and only transmit fragment prompts and context snapshots, without transmitting the conversation content.

[0078] (5) Pluggable model layers: such as Figure 8 As shown, the embedded model and the generated model are accessed through the abstraction layer. They can be switched between local and remote implementations through runtime configuration without modifying the main method body, and are not bound to any specific model vendor.

[0079] (6) Multi-form deployment: It supports three deployment forms: as a programming assistant plugin, plugin plus remote generation model, and independent command line tool, to adapt to different user scenarios.

[0080] (7) Degradable: When the large language model candidate generation fails, it is downgraded to a template-based candidate; when the embedded model fails to load, it will explicitly report an error instead of silently rolling back, avoiding hidden failures caused by the mismatch between the index vector and the query vector dimensions.

[0081] The technical solution of this application will be further illustrated below with a practical application scenario.

[0082] This embodiment describes the end-to-end workflow of this application in a typical deployment environment. A set of hypothetical examples are used throughout the steps to aid the reader's understanding, but should not be construed as limiting the scope of the claims of this application.

[0083] Example Scenario: A developer has used an AI programming assistant to solve multiple software development problems over the past few months. These sessions are stored locally in structured log files. The developer is currently working in the code directory of a software project (hereinafter referred to as Project P). He vaguely recalls solving a problem related to configuration loading order several weeks ago, but can only remember a vague description, such as "the service still used the old values ​​after the configuration was changed last time." The developer cannot construct a precise query; the goal is for the system to find that specific session from the historical session logs.

[0084] This application provides a session memory retrieval method, which is based on fragmented input and developer workflow context, and includes the following steps: Step 1: Receive fragmented prompt information input by the user. The fragmented prompt information is a natural language fragment, keyword combination, or statement containing referential markers with a character count less than a preset threshold. The preset threshold ranges from 5 to 30 characters.

[0085] Step 2: Evaluate the fragmentation of the fragmented prompt information, determine its fragmentation category and corresponding query completion strategy. The fragmentation category includes at least: complete question category, keyword category, pronoun phrase category and noisy input category.

[0086] Step 3: Automatically collect contextual information related to the user's current developer workflow. The contextual information includes at least two of the following: version control system status information, current working directory path, list of recently modified files, and terminal command history. The contextual information is further used to extract the current project identifier from the current working directory path.

[0087] Step 4: Based on the fragmented prompt information, the contextual information, and the fragmentation category and its corresponding query completion strategy determined in Step S2, generate N candidate complete queries (N≥2) through the large language model. These N candidate complete queries satisfy a multi-semantic dimension diversity constraint, which includes: (i) a predefined set of semantic dimensions including at least technical detail dimension, phenomenon description dimension, and system architecture dimension; (ii) when calling the large language model, explicitly requiring each candidate generated to belong to a different dimension in the semantic dimension set through prompts; (iii) post-processing the candidates returned by the large language model to identify their declared dimensions and discard candidates with duplicate dimensions; (iv) ensuring that the final output of the N candidates covers at least... N / 2 Different dimensions.

[0088] Step 5: Perform retrieval on each of the N candidate complete queries in the pre-built session block-level vector index to obtain N sets of candidate retrieval results. Each set of candidate retrieval results returns the session identifier and the corresponding highest similarity score at the session level. The session level granularity is obtained by taking the maximum similarity of multiple blocks within a session and deduplicating them using the session identifier.

[0089] Step 6: Perform voting weighted fusion on the N groups of candidate search results. The voting weighted fusion uses the number of times each session identifier is hit by different candidate queries and its similarity score to make the session identifier that is hit by multiple candidate queries obtain a relatively higher fusion score, so as to suppress sessions that are only accidentally hit by a single candidate and obtain a fused candidate session ranking list.

[0090] Step 7: Based on the current project identifier mentioned in Step 3, apply project preference weighting to sessions in the fusion candidate session ranking list whose projects match the current project identifier, so that sessions related to the user's current project receive a relatively higher fusion score; compare the fusion scores of each session identifier after weighting, sort them from high to low according to the fusion score, and obtain the final session ranking list for Step 8 to select the top K sessions.

[0091] Step 8: For the top K sessions (K≥1) in the final session sorting list, backtrack their original session log files. The backtracking does not rely on the block-level vector and block-level summary used in Step 5, but directly parses and extracts the original user message or assistant message fragments containing the keywords generated by the candidate query in Step 4 from the original session log file line by line, and outputs them as original evidence of the search results.

[0092] Example of constructing a session block-level vector index: The pre-built session block-level vector index is generated through the following steps: (a) Scan the preset local session storage directory and identify all session log files therein. The session log files store user messages, assistant messages, tool calls and tool results in a format where each line contains a structured data record.

[0093] (b) Perform structured parsing on each session log file, identify and skip injected messages that do not reflect the user's actual intent. The injected messages include at least the following three categories: slash command wrapping text, extended capability loading template text, and task tracking automatic status messages. Scan the first preset number of user messages and select the first non-injected message as a candidate session title.

[0094] (c) Construct a balanced fixed-length summary text for the session log file. The summary text is composed of header messages, information-dense messages in the middle section, and tail messages spliced ​​together according to a preset budget ratio. Among them, the middle section messages are selected and included first according to preset keyword regular expressions to avoid the key discussions in the middle section being discarded due to header truncation in long sessions.

[0095] (d) When the total length of the cumulative characters in the session log file exceeds a preset threshold, it is overlapped and fragmented to generate one or more session-level append blocks. The length of each append block is within a preset range, and adjacent append blocks maintain a preset overlap to avoid cutting off boundary keywords. The final vectorizable text corresponding to the session log file is composed of the summary text obtained in (c) and the append blocks obtained in (d).

[0096] (e) Each text fragment obtained in (c) and (d) is independently vectorized using an embedding model to obtain a vector representation and its mapping relationship with the session identifier to which it belongs. The mapping relationship is used for session-level deduplication in step 5.

[0097] (f) The vector representation, session-level mapping relationship, original path of the session log file and structured fields are written into the local index storage, supporting incremental construction mode and full reconstruction mode; when switching the embedded model, the system detects changes in vector dimension or model identifier and forces full reconstruction to avoid dimension mismatch.

[0098] (g) The structured field contains the original path of the session log file, which serves as the input for the original text lookup in step 8.

[0099] In practical applications, after a user first enables the session memory retrieval method provided in this application, a session block-level vector index is pre-constructed: The first step is to scan all structured log files in the root directory of the local session log storage.

[0100] The second step is to parse the structured data records line by line in each file to identify four types of events: user messages, assistant messages, tool calls, and tool results.

[0101] The third step is to identify and skip injected messages that do not reflect the user's actual intent—typically including the following three categories: slash command wrapper text (a wrapper segment automatically generated by the programming assistant host when the user invokes extended capabilities), extended capability loading template text (descriptive text inserted by the host when an extended capability is loaded), and task tracking automatic status messages (status change messages automatically generated by the task tracking tool); scan through the first preset number of user messages and select the first non-injected message as the title of the session.

[0102] The fourth step is to extract file paths and command strings from all user and assistant text blocks and all tool call records, and extract thematic keywords through frequency statistics.

[0103] Step 5: Construct a balanced fixed-length summary: Sample messages from the head, middle, and tail according to the budget ratio (e.g., 25% for the head, 60% for the middle, and 15% for the tail). Middle messages are preferentially included according to a preset keyword regular expression. The keyword regular expression matches at least one of the following signals: strings in the form of environment variable assignments, error keywords, decision verbs, and common expressions in debugging scenarios.

[0104] Step 6: When the cumulative number of characters in the session exceeds a preset threshold (e.g., 4000 characters), an additional block is generated outside the header and footer summaries with a preset target block length (e.g., 2000 characters) and a preset overlap length (e.g., 200 characters).

[0105] The seventh step involves calling the embedding model on each of the summary text and all additional blocks to obtain a vector matrix, while simultaneously recording the mapping of each block to its respective session identifier.

[0106] The eighth step is to persist the vector matrix, block-to-session mapping, session structured fields (including the original log path), and index metadata (including the currently used embedded model identifier and vector dimension) for subsequent retrieval and original text lookup.

[0107] Fragmentation assessment example: The fragmentation assessment in step 2 includes: (a) Count the number of valid tokens in the fragmented prompt information.

[0108] (b) detecting whether the fragmented prompt information contains a reference marker word, where the reference marker word includes at least any one of the following: pronouns or adverbs in Chinese that indicate a known historical reference, such as "last time", "that", "just now", "previously"; and pronouns or adverbs in English with the same semantic function, such as "that", "the previous", "last time".

[0109] (c) detecting whether the fragmented prompt information contains a question mark.

[0110] (d) calculating the character mixing degree of the fragmented prompt information.

[0111] (e) based on the detection results of step (a) to step (d), classifying the fragmented prompt information into one of the fragmentation degree categories according to a preset rule, and selecting a corresponding query completion strategy, wherein: when the number of tokens is greater than a first threshold, a question marker is contained, and no reference marker is contained, the fragmented prompt information is classified as a complete question category, and the completion strategy is transparent transmission; when a reference marker is contained, the fragmented prompt information is classified as a reference phrase category, and the completion strategy is reference parsing extension; when the character mixing degree is greater than a second threshold, the fragmented prompt information is classified as a noisy input category, and the completion strategy is error-correcting extension; when the number of tokens is not greater than a third threshold, the fragmented prompt information is classified as a keyword category, and the completion strategy is associative extension.

[0112] In this embodiment, the first threshold is greater than the third threshold; the first threshold and the third threshold are used to control the input length, both measure the number of tokens contained in the input, have the same unit, and are comparable.

[0113] For example: the first threshold is set to 7; when the number of tokens is greater than 7, that is, the number of tokens is at least 8, it is determined as a complete question.

[0114] The third threshold is set to 6; when the number of tokens is less than or equal to 6, it is determined as a keyword.

[0115] The second threshold is used to judge the character mixing degree or the degree of spelling abnormality. As a normalized noise evaluation value, in this embodiment, the second threshold is set to 0.2, which is understood as the judgment boundary where the noise degree reaches 20%.

[0116] (f) calculating a continuous fragmentation degree score according to the detection result, and using the score as a weight parameter for subsequent steps.

[0117] In practical applications, the input is: the fragmented prompt typed by the developer "the issue that the service still uses the old value after modifying that configuration last time".

[0118] In the first step, tokenization is performed to obtain a word segmentation result, and the number of valid tokens is counted.

[0119] In the second step, detection finds that the two words "last time" and "that" hit the Chinese reference marker word list.

[0120] Third, no typical question markers were found.

[0121] The fourth step is to minimize character mixing (all characters are in the same language).

[0122] Fifth, according to the classification rules, if it falls into the pronoun phrase category, select the pronoun analytic expansion strategy; at the same time, calculate the continuous fragmentation score.

[0123] Workflow Context Acquisition Example: Step 3, which involves automatically collecting contextual information, includes the following steps: (a) Call the version control system command to get the current branch name, the list of uncommitted modified files, and the most recent M commit records (M is a positive integer).

[0124] (b) Scan the current working directory, filter the files that have been modified in the most recent preset time window, and sort them in reverse order of modification time.

[0125] (c) Read the user terminal command history file and extract the most recent P executed commands (P is a positive integer).

[0126] (d) Collect data independently for each sub-step (a) to (c). The failure of any sub-step does not affect the output of the remaining sub-steps. Fields that fail to be collected are filled with null values.

[0127] (e) For the external commands called during the acquisition process of (a) to (c), read their standard output in binary mode and decode them according to a multi-level encoding strategy. The multi-level encoding strategy includes at least three levels: decoding with priority to general encoding, falling back to local encoding when decoding fails, and using replacement characters for error tolerance when local encoding also fails, so as to be compatible with version control system submission information containing non-Western characters.

[0128] (f) Integrate the above information into structured workflow context snapshot data, and extract the project identifier from the current working directory path as input for steps 4 and 7.

[0129] In practical applications, three independent acquisition subtasks are executed in parallel: (a) Invoke version control system commands to obtain the current branch name, list of modified files, and summaries of the most recent commits.

[0130] (b) Scan the current working directory, enumerate the files that have been modified in the most recent preset time window, and sort them in reverse order of modification time.

[0131] (c) Read several command records at the end of the terminal history file.

[0132] (d) Extract the project identifier (e.g., the string "P") from the end of the current working directory path, and use it as the basis for subsequent project preference weighting.

[0133] When any subtask fails, only the corresponding field is missing, without affecting the overall process. The output of external commands is processed using a multi-level strategy of prioritizing decoding with general encoding, rolling back to local encoding, and handling character replacement errors to ensure compatibility with submission messages containing non-Western characters.

[0134] Example of diversity candidate generation: Step 4 includes the following multi-semantic dimension diversity constraints: (a) A set of dimensions is predefined, including at least the following three semantic dimensions: technical details dimension, focusing on implementation technology, components used, code-level mechanisms and root cause patterns; phenomenon description dimension, focusing on observable symptoms, error messages and user-visible behaviors; system architecture dimension, focusing on system-level components, services, modules and data flows.

[0135] (b) When calling the large language model, the prompting process explicitly requires each candidate complete query generated to belong to a different dimension in the above-mentioned dimension set, and requires it to use the same language as the fragmented prompting information.

[0136] (c) Post-process the candidate complete queries returned by the large language model, identify the declared dimensions, discard candidates with duplicate dimensions, and ensure that the final output of N candidates covers at least N / 2 Different dimensions.

[0137] (d) The text returned by the large language model is parsed using fault-tolerant structured data parsing, which includes at least: stripping the tags used to wrap code blocks; locating the longest valid structured data substring when the text contains natural language prefixes and suffixes; and returning explicit error messages to degrade the parsing process when it fails.

[0138] (e) When the large language model is unavailable, the N candidate complete queries are deterministically generated using preset dimension-based template rules as a degradation scheme.

[0139] In practical applications, constructing system prompt templates requires the large language model to generate exactly N candidate complete queries, each belonging to a predefined different semantic dimension, and requires them to use the same natural language as the user input.

[0140] Examples of structured data actually returned by the large language model (using three candidates as examples): [ { "axis": "Technical details", "expanded_query": "Configuration item loading priority and overriding relationship cause the service to still use the old configuration at runtime", "rationale": "..."}, { "axis": "Phenomenon description", "expanded_query": "After modifying the configuration file and restarting the service, the old configuration value is still displayed", "rationale": "..."}, { "axis": "System architecture", "expanded_query": "The parsing and merging mechanism of multi-level configuration sources at service startup", "rationale": "..."}] Post-processing: Remove any code block wrapping tags, locate the longest valid structured data substring, parse the semantic dimension fields of each candidate declaration, and discard duplicate dimensions. When the large language model output contains natural language prefixes and suffixes (such as "Okay, here are the query candidates generated for you: [...] Hope this helps"), fault-tolerant parsing can correctly extract the structured data.

[0141] Long-session adaptive fragmentation example: Suppose a historical session has accumulated approximately 600KB of characters (approximately 1200 lines of structured data records). After processing according to the fragmentation strategy of this application: A balanced summary text, with a length limited to a preset upper limit (e.g., 8000 characters), is spliced ​​together from the header, middle section (sampled first by keywords), and footer according to the budget ratio.

[0142] Several additional blocks (about 30 in this example), each block has a target length of 2000 characters, and adjacent blocks overlap by 200 characters.

[0143] The total number of vectors is approximately 31, and all 31 rows of vectors are mapped to the same session identifier in the block-to-session mapping array.

[0144] During retrieval, the query vector is compared with all 31 lines sequentially, but only the maximum similarity across all blocks in the session is used as the representative score for that session. This allows key discussions occurring in the middle of the session (in this case, the specific diagnostic conclusion regarding configuration item coverage is located near line 700 of the session) to be retrieved as independent blocks, even if the topic is not fully covered in the initial and final summaries.

[0145] Example of voting-weighted fusion and project preference-weighted fusion: The specific calculations for step 6 (vote-weighted fusion) and step 7 (project preference-weighted fusion) include: (a) For each session identifier d, count the number of times it is hit in the N sets of candidate search results, v(d).

[0146] (b) For each session identifier d, sum the similarity scores obtained from the N candidate search results, s(d) = Σ i s i (d)

[0147] (c) Record the maximum number of hits v_max = max_d v(d).

[0148] (d) Calculate the voting fusion score according to the following formula: vote_score(d) = s(d) × α^(v_max - v(d)), where α is the preset voting consistency weight coefficient, 0<α ≤ 1.

[0149] (e) For each session identifier d, calculate the final fusion score according to whether its session's item identifier is equal to the current item identifier: fused_score(d) = vote_score(d) × β same_project(d) Where β ≥ 1 is the project preference weighting coefficient, and same_project(d) takes the value of 1 when the two are the same, otherwise it takes the value of 0; the coefficient β is configurable, and project preference weighting is disabled when β=1; (f) Sort by fused_score in descending order and take the first K as the output.

[0150] In practical applications, after parallel retrieval of candidates, each candidate returns a session-level Top-N list. Table 2 illustrates the fusion process using hypothetical numerical values.

[0151] Table 2

[0152] The user's current project is identified as P. The final output shows session d1 ranked first. Even though session d2 is close in vector score, it is effectively distinguished due to a 1.5x weighting for project preference.

[0153] Original text review example: Step 8, the original text lookup, includes: (a) Read the original path of the session log file, parse each event line by line, and identify events of type user message or assistant message.

[0154] (b) Apply the same injection message identification rules to the identified event text, and skip events that are identified as injection messages.

[0155] (c) Collect the set of keywords contained in the candidate complete query in step 4. The set of keywords includes at least the following three categories: multi-word command phrases guided by predefined command runner names; identifiers containing structural symbols, which include at least one of underscore, hyphen, colon, period, and slash; non-stop words with a length greater than a preset threshold; and filter high-frequency words that are too general according to the stop word list to ensure that the filtered words will not trigger a hit on their own.

[0156] (d) Use regular expressions to find the occurrence position of any keyword in the keyword set obtained in step (c) for the event text that has not been skipped, prioritizing the longest keyword.

[0157] (e) For a hit event, extract a context fragment centered on the hit location with a preset character width, and output its role and message sequence number together.

[0158] (f) For the final output of several sessions, steps (d) to (e) are executed directly based on the original path of the session log file, without relying on the block-level vector and block-level digest used in step 5, thereby ensuring that the content presented to the user is the original dialogue text from the original log file.

[0159] In practical applications, for the final output of several sessions, the system performs the following callback process: The first step is to retrieve the original log path of the session from the index store.

[0160] The second step is to construct a keyword set, which includes at least: multi-word command phrases identified in candidate queries, identifiers containing structural symbols, and non-stop words with a length greater than a preset threshold; at the same time, high-frequency words that are too general are filtered according to the stop word list to avoid triggering a hit on their own.

[0161] The third step is to re-parse the original log file line by line, skipping events identified as injection messages.

[0162] The fourth step is to scan the remaining real user and assistant messages using the longest keyword priority method.

[0163] The fifth step is to extract a context fragment centered on the hit location with a preset character width for each hit, and then display it along with its role and message number.

[0164] The final content is presented in the form of "dialogue fragments separated by boxes," with each fragment labeled with the role (USER or ASSISTANT), message number, and original text. This lookup process does not rely on block-level summarization, does not call the large language model again, and does not introduce information loss.

[0165] Pluggable model layer example: This application supports pluggable integration of embedded models and generative models, specifically including: (a) Define an abstract interface for an embedding model, wherein the interface includes at least a model name, vector dimensions and the ability to batch embed a set of texts, and the specific implementation of the interface includes at least two or more of the following five: local sentence embedding model implementation; zero-dependency fallback embedding implementation based on word frequency statistics; remote cloud embedding service implementation; local area network or local containerized embedding service implementation; and general compatible protocol embedding endpoint implementation.

[0166] (b) Define an abstract interface for generating models, wherein the interface includes at least a model name and the ability to return text based on system prompts and user prompts, and the specific implementation of the interface includes at least two of the following three: remote cloud generation service implementation; local area network or local containerized generation service implementation; and general compatible protocol generation endpoint implementation.

[0167] (c) Users can switch the specific model implementation they use by configuring parameters at runtime without modifying the main code of the method.

[0168] (d) When the embedded model fails to load, output a clear reason for the failure and instructions on how to fall back to the user, instead of silently falling back to the non-equivalent default implementation.

[0169] In practical applications, users only need to modify runtime configuration parameters to switch embedding models. The system specifies the name of the currently used embedding implementation (e.g., local sentence embedding implementation, remote cloud embedding service, local containerized embedding service, etc.) and its corresponding specific model identifier through predefined configuration items.

[0170] When switching to different implementations, simply change the above configuration items to the corresponding implementation name and model identifier; no source code modification is required. The system will automatically detect changes in vector dimensions (e.g., a low-dimensional vector becoming a high-dimensional vector) and prompt the user to rebuild the index to ensure consistency. Switching between generated models is similar; the corresponding configuration items allow switching between various implementations such as remote cloud generation services, local containerized generation services, and universally compatible protocol endpoints.

[0171] The configuration items can be provided in any form, such as environment variables, configuration files, or runtime parameters, and the specific form does not affect the scope of the claims of this application.

[0172] Three-form deployment example: like Figure 9 As shown, this application is provided to users in at least one of the following three deployment models: (a) In the first form, as a programming assistant plugin, it registers with the programming assistant host through the plugin manifest file and exposes at least two interaction entry points to the user: the first interaction entry point is used to trigger the construction or update of the session vector index; the second interaction entry point is used to receive the fragmented prompt information and trigger the execution of steps 1 to 8; in the first form, the generation of candidate complete queries is directly executed by the large language model already running in the programming assistant host, without the implementation unit of the method needing to call the large language model application interface additionally. (b) Second form, as a programming assistant plugin and in conjunction with remote or local containerized generation model implementation, so that the generation of candidate complete queries is completed at the generation model implementation, without relying on the host large language model; (c) The third form is an independent command-line tool that provides three sub-commands: index building, session recall, and single-session text expansion. The method can be run independently in an environment detached from the programming assistant host.

[0173] In practical applications, Form 1: Running as a programming assistant plugin Users invoke the system-provided recall entry point in the programming assistant's command line, submitting fragmented suggestions. The programming assistant's own large language model reads the system-provided suggestions and generates N candidate complete queries. Then, it calls the system-provided retrieval tools to complete block-level retrieval, fusion, and original text lookup. This approach does not consume any external large language model application programming interface quotas, and the quality of candidate generation depends on the capabilities of the host large language model.

[0174] Form 2: Plugin-based model generation from a remote source The overall process is the same as in Form 1, but the candidate generation step is implemented by the system actively calling the remote generation model specified in the configuration, rather than relying on the host large language model. This form is suitable for scenarios where it is desirable to complete candidate generation with a specific large language model, but the host large language model is too costly or its capabilities are incompatible.

[0175] Form 3: Standalone command-line tool Completely independent of the programming assistant host, it provides three core functions through command-line subcommands: index building, session retrieval, and single-session original text expansion. The "single-session original text expansion" subcommand accepts a session identifier and a list of optional keywords, and directly outputs all user-assistant dialogue fragments containing the keywords based on the original session log. It is suitable for scenarios where a specific entry is selected from the retrieval results and its original text is further examined.

[0176] Complete Implementation of System Interaction Continuing with the hypothetical example scenario, the complete process is as follows: (1) When the developer enters the fragmentation prompt in the working directory of project P, it says "The service is still using the old value after the last configuration was changed".

[0177] (2) The system evaluates the fragmentation of the input, classifies it as a pronoun phrase, and selects a pronoun parsing expansion strategy.

[0178] (3) The system collects workflow snapshots in parallel, obtaining the current project identifier P, the current version control branch, a list of recently modified files, and the terminal command history.

[0179] (4) The system calls the large language model to generate three candidate complete queries under the constraints of multi-semantic dimension diversity, which belong to the three dimensions of technical details, phenomenon description and system architecture respectively.

[0180] (5) The system performs block-level vector retrieval on the three candidates in parallel and returns three Top-N lists at the session level.

[0181] (6) The system performs voting weighted fusion on the three lists and adds project preference weighting to the session with project P based on the project identifier P.

[0182] (7) For sessions that rank highly after merging, the system directly reads their original log files and extracts fragments of user messages and assistant messages containing keywords generated by candidate queries.

[0183] (8) Output the final results to the developers. Each result includes: project, date, number of votes, fusion score, confidence level, conversation title, several original dialogue fragments, and a conversation continuation command string that can be executed directly.

[0184] The entire process, from user input to result presentation, typically takes less than a few seconds. Developers can directly read their original questions and the system's original solutions from the output, recognizing their true memories and deciding whether to continue working on the session without re-entering the conversation.

[0185] This application provides a session memory retrieval system, including: The input receiving module is used to receive fragmented prompt information input by the user; the fragmented prompt information is a natural language segment with a character count less than a preset threshold, a combination of keywords, or a statement containing referential markers.

[0186] The fragmentation assessment module is used to assess the fragmentation based on the fragmentation prompt information, and obtain the fragmentation category and query completion strategy.

[0187] The workflow context collection module is used to collect context information of the developer's workflow and obtain the current project identifier.

[0188] The diversity candidate generation module is used to generate N candidate complete queries that satisfy multi-semantic dimension diversity constraints based on the fragmentation prompt information, the fragmentation level category, the query completion strategy, and the current project identifier.

[0189] The block-level parallel retrieval module is used to perform retrieval in the session block-level vector index according to N candidate complete queries, and obtain N sets of candidate retrieval results deduplicated by session identifier.

[0190] The voting and project preference fusion module is used to calculate and sort the fusion score based on N sets of candidate search results and the current project identifier to obtain the final session ranking list.

[0191] The original text retrieval module is used to retrieve the original session log file based on the final session sorting list to determine the original dialogue fragments.

[0192] This application also includes a pluggable model layer, which is used to access several local and remote embedded model implementations and several local and remote generated model implementations through a unified abstract interface. The switching of the specific implementations is completed through runtime configuration.

[0193] This application also includes an index building module for scanning the local session storage directory, parsing session log files, constructing a balanced fixed-length digest, performing overlapping sharding on long sessions, generating block-level vector indexes, and maintaining the mapping relationship between blocks and sessions.

[0194] This application performs fragmentation classification and strategy routing on fragmented prompts from user input, automatically collects the developer's current workflow context information, generates multiple candidate complete queries based on multi-semantic dimension diversity constraints, performs block-level vector retrieval in parallel for each candidate query and deduplicates using session identifiers, merges and ranks the multiple candidate results through a voting weighted fusion algorithm, applies project preference weighting to the fusion results based on project identifiers in the workflow context, and finally extracts dialogue fragments containing keywords directly from the original log files of the top-ranked sessions as the retrieval results. This invention introduces a pluggable embedding model and generative model abstraction layer, allowing specific model implementations to be changed through runtime configuration without modifying the main method; it introduces a long-session adaptive fragmentation and session-level deduplication mechanism to prevent key discussions in the middle of long dialogues from being compressed and diluted at the beginning and end, thus avoiding missed detection; and it introduces a two-layer architecture of index retrieval and original text back-search, ensuring retrieval efficiency while ensuring that the original dialogue text from the original logs is presented during the display stage, avoiding the loss of key sentences caused by summary methods. This invention solves the problems of low recall accuracy in existing retrieval enhancement generation systems when user input is fragmented and relies on implicit context, as well as the inability to present original text details due to summary compression.

[0195] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments. The computer device can be a server or a terminal. The computer device includes a processor, a memory, an input / output interface (I / O), and a communication interface. The processor, memory, and I / O interface are connected via a system bus, and the communication interface is connected to the system bus via the I / O interface. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device stores data to be processed. The I / O interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to connect and communicate with an external terminal via a network. When the computer program is executed by the processor, it implements the above-described methods.

[0196] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0197] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0198] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0199] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by computer program instructions and related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the above method embodiments. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0200] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0201] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0202] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for retrieving conversation memory, characterized in that, include: Receive fragmented prompts from the user; The fragmented prompt information consists of natural language segments, keyword combinations, or statements containing referential markers whose character count is less than a preset threshold. Based on the fragmentation prompts, fragmentation level is evaluated to obtain fragmentation category and query completion strategy; Collect contextual information about the developer's workflow to obtain the current project identifier; Based on the fragmentation prompt information, the fragmentation level category, the query completion strategy, and the current project identifier, generate N candidate complete queries that satisfy the multi-semantic dimension diversity constraints; Based on N candidate complete queries, perform retrieval in the session block-level vector index respectively to obtain N sets of candidate retrieval results deduplicated by session identifier; Based on the N sets of candidate search results and the current item identifier, calculate the fusion score and sort them to obtain the final session ranking list; Based on the final session sorting list, the original session log file is retrieved to determine the original dialogue fragments.

2. The session memory retrieval method according to claim 1, characterized in that, Based on the fragmentation prompts, fragmentation is evaluated to obtain fragmentation categories and query completion strategies, including: The number of valid lexical elements in the fragmented prompt information is counted to obtain the lexical element statistics results; The referential markers and question markers in the fragmented prompt information are detected to obtain the marker detection results; Calculate the character promiscibility of the fragmented prompt information to obtain the promiscibility result; The fragmentation categories are obtained by classifying the lexical statistics, the marker detection, and the noise level results; the fragmentation categories include at least complete question categories, keyword categories, pronoun phrase categories, and noisy input categories. Match the corresponding query completion strategy based on the fragmentation category.

3. The session memory retrieval method according to claim 1, characterized in that, Collect contextual information about the developer's workflow to obtain the current project identifier, including: Contextual information of the developer workflow is obtained separately to obtain contextual sub-source data; the contextual information of the developer workflow includes at least two of the following: version control system status information, current working directory path, list of recently modified files, and terminal command history; Independent anomaly isolation processing is performed on the aforementioned context sub-source data to obtain structured workflow context snapshot data; The project identifier is extracted from the current working directory path in the workflow context snapshot data to obtain the current project identifier.

4. The session memory retrieval method according to claim 1, characterized in that, Based on the fragmentation hints, the fragmentation category, the query completion strategy, and the current item identifier, N candidate complete queries that satisfy the multi-semantic dimension diversity constraints are generated, including: Based on the fragmentation category, the query completion strategy, and the current project identifier, the large language model is invoked to generate an initial candidate query set; For each initial candidate query in the initial candidate query set, dimension identification is performed to obtain its semantic dimension; Based on the semantic dimensions they belong to, initial candidate queries with duplicate dimensions are discarded, generating N candidate complete queries that satisfy the multi-semantic dimension diversity constraint. This multi-semantic dimension diversity constraint includes: a predefined set of semantic dimensions that predefines at least technical detail dimensions, phenomenon description dimensions, and system architecture dimensions; when calling the large language model, each candidate query is explicitly required by the project to belong to a different dimension in the semantic dimension set; the candidate queries returned by the large language model are post-processed to identify the dimensions declared by the returned candidate queries, discarding candidate queries with duplicate dimensions; ensuring that the final output of N candidates covers at least... N / 2 There are several different semantic dimensions; among them... This is for rounding up.

5. The session memory retrieval method according to claim 1, characterized in that, The session block-level vector index is pre-constructed through the following steps: The session log file is structured and injected messages are skipped to obtain clean messages; A balanced fixed-length digest text is constructed based on the clean message to obtain the digest text; Based on the cumulative total character length of the session log file and the digest text, overlapping fragments are performed to obtain session-level append blocks; Vectorize the summary text and the session-level appended block to obtain the session block-level vector index and the block-to-session mapping relationship.

6. The session memory retrieval method according to claim 1, characterized in that, Based on the N sets of candidate search results and the current item identifier, a fusion score is calculated and sorted to obtain the final session ranking list, including: Based on the N sets of candidate retrieval results, the number of hits and the sum of similarity scores for each session identifier are counted to obtain the number of votes v(d) and the original score s(d); Based on the number of votes v(d), the original score s(d), and the maximum number of hits v_max, the vote fusion score vote_score(d) is obtained; vote_score(d) = s(d) × α (v_max-v(d)) α is the preset voting consensus weight coefficient, 0 < α ≤ 1; The fused score fused_score(d) is obtained based on the vote fusion score vote_score(d), the project preference weighting coefficient β, and the current project identifier; fused_score(d) = vote_score(d) × β same_project(d) Same_project(d) is a binary indicator function; Same_project(d) is 1 if the project identifier of the candidate session identifier d is the same as the current project identifier, otherwise it is 0; The project preference weighting coefficient β is configurable, and project preference weighting is disabled when β=1; The final session sorting list is obtained by sorting the sessions in descending order based on the fused_score(d).

7. The session memory retrieval method according to claim 1, characterized in that, Based on the final session sorting list, the original session log file is retrieved to determine the original dialogue fragments, including: Obtain the path to the original session log file based on the final session sorting list; Extract a set of keywords from N candidate complete queries, filter out common words, and obtain the target keyword set; The target keyword set is used to perform a regular expression search in the file corresponding to the original session log file path to obtain the hit location; Based on the hit location, extract the context fragment to obtain the original dialogue fragment.

8. A conversation memory retrieval system, characterized in that, The session memory retrieval method according to any one of claims 1-7 includes: The input receiving module is used to receive fragmented prompt information input by the user; the fragmented prompt information is a natural language segment with a character count less than a preset threshold, a combination of keywords, or a statement containing referential markers; The fragmentation assessment module is used to assess the fragmentation level based on the fragmentation prompt information, and obtain the fragmentation category and query completion strategy. The workflow context collection module is used to collect context information of the developer's workflow and obtain the current project identifier; The diversity candidate generation module is used to generate N candidate complete queries that satisfy the multi-semantic dimension diversity constraints based on the fragmentation prompt information, the fragmentation level category, the query completion strategy, and the current project identifier. The block-level parallel retrieval module is used to perform retrieval in the session block-level vector index according to N candidate complete queries, and obtain N sets of candidate retrieval results deduplicated by session identifier; The voting and project preference fusion module is used to calculate and sort the fusion score based on N sets of candidate search results and the current project identifier to obtain the final session ranking list; The original text retrieval module is used to retrieve the original session log file based on the final session sorting list to determine the original dialogue fragments.

9. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the session memory retrieval method according to any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the session memory retrieval method according to any one of claims 1-7.