Historical conversation compression method and device in text interaction process, equipment, medium and product

By separating, replacing, and identifying target data objects in historical dialogues in text interaction driven by a large language model, the problem of information loss is solved, and the continuity of interaction between the agent and the user and the reliability of the response results are achieved.

CN122197818APending Publication Date: 2026-06-12中国移动通信集团云南有限公司 +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
中国移动通信集团云南有限公司
Filing Date
2026-04-30
Publication Date
2026-06-12

Smart Images

  • Figure CN122197818A_ABST
    Figure CN122197818A_ABST
Patent Text Reader

Abstract

The application discloses a history dialogue compression method, device and equipment in a text interaction process, a medium and a product. The method comprises the following steps: obtaining a history dialogue between an intelligent agent and a target user; if it is determined that a compression condition is met according to the history dialogue, extracting a target data object in the history dialogue, and identifying the target data object according to a preset identification mode; storing the target data object based on a lossless compression mode, replacing the target data object in the history dialogue with an identification of the target data object, and storing the history dialogue based on a lossy compression mode. The scheme solves the information loss problem in the history dialogue compression process, effectively avoids the information loss in the history dialogue compression process, is beneficial to the backtracking of the target data object in the future dialogue process, guarantees the coherence of the interaction between the intelligent agent and the user, and improves the reliability of the output reply result of the intelligent agent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a method, apparatus, device, medium, and product for compressing historical dialogues during text interaction. Background Technology

[0002] In the field of text interaction driven by Large Language Model (LLM), as the number of interaction rounds between the user and the agent increases, the amount of dialogue data grows rapidly. Due to the context window limitation of the large language model and the cost of token billing, the agent usually needs to compress the historical dialogue.

[0003] Currently, the widely used methods for compressing historical dialogues mainly include two categories: (1) Truncation, which directly discards the earlier rounds of dialogue in the historical dialogue and retains the later rounds; (2) Summarization, which uses LLM to summarize long historical dialogues into shorter natural language summaries to reduce word usage, for example, summarizing "sales amount of 5,321,000 yuan" into "sales amount of more than 5 million yuan".

[0004] However, truncation methods are prone to information loss, and this loss is irreversible. While summarization methods retain key information from historical dialogues, they are susceptible to losing high-precision data objects. This can prevent the agent from retrieving these data objects in subsequent dialogues, leading to inaccurate analytical conclusions. For example, if a user requests a calculation of the month-on-month growth rate of sales revenue in a later dialogue, the agent may not be able to obtain accurate sales figures from historical dialogues, resulting in distorted feedback. Summary of the Invention

[0005] This invention provides a method, apparatus, device, medium, and product for compressing historical dialogues during text interaction to solve the problem of information loss during historical dialogue compression. By separating and replacing the target data objects in the historical dialogue and then compressing the historical dialogue, information loss during the historical dialogue compression process is effectively avoided. This facilitates the retrieval of target data objects in future dialogues, ensures the continuity of interaction between the agent and the user, and improves the reliability of the agent's output response.

[0006] According to one aspect of the present invention, a method for compressing historical dialogues during text interaction is provided, the method comprising: Acquire the historical dialogue between the intelligent agent and the target user; If the pre-set compression conditions are met based on the historical dialogue, the target data object in the historical dialogue is extracted and identified according to the preset identification method; the compression conditions include at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first quantity threshold; the number of words processed by the agent in the historical dialogue reaches a second quantity threshold. The target data object is stored using lossless compression, the target data object in the historical dialogue is replaced with the target data object's identifier, and the historical dialogue is stored using lossy compression.

[0007] According to another aspect of the present invention, a historical dialogue compression device is provided during text interaction, the device comprising: The historical dialogue acquisition module is used to acquire the historical dialogues between the intelligent agent and the target user; The data object identification module is used to extract target data objects from historical dialogues and identify them according to a preset identification method if the pre-set compression conditions are met based on historical dialogues. The compression conditions include at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first quantity threshold; the number of lexical units processed by the agent in the historical dialogue reaches a second quantity threshold. The separate storage module is used to store target data objects based on lossless compression, replace the target data objects in historical dialogues with the identifiers of the target data objects, and store historical dialogues based on lossy compression.

[0008] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the historical dialogue compression method in a text interaction process according to any embodiment of the present invention.

[0009] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the historical dialogue compression method in a text interaction process as described in any embodiment of the present invention.

[0010] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the historical dialogue compression method in a text interaction process as described in any embodiment of the present invention.

[0011] The technical solution of this invention involves acquiring the historical dialogue between an agent and a target user. If a pre-set compression condition is met based on the historical dialogue, the target data object in the historical dialogue is extracted and identified according to a preset identification method. The compression condition includes at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first threshold; the number of lexical units processed by the agent in the historical dialogue reaches a second threshold; the target data object is stored using a lossless compression method, replacing the target data object in the historical dialogue with its identifier, and then storing the historical dialogue using a lossy compression method. This technical solution solves the problem of information loss during the compression of historical dialogues. By separating and replacing the target data object in the historical dialogue before compressing the historical dialogue, information loss during the compression process is effectively avoided. This facilitates the backtracking of target data objects in future dialogues, ensuring the continuity of interaction between the agent and the user, and improving the reliability of the agent's output response.

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

[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a flowchart of a method for compressing historical dialogues during a text interaction process according to Embodiment 1 of the present invention; Figure 2 This is a flowchart of a method for compressing historical dialogues during a text interaction process according to Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of a historical dialogue compression device in a text interaction process according to Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the historical dialogue compression method in the text interaction process of this invention. Detailed Implementation

[0015] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0016] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be used interchangeably where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices. The acquisition, storage, use, and processing of data in the technical solutions of this application all comply with the relevant provisions of national laws and regulations.

[0017] Example 1 Figure 1 This document provides a flowchart of a method for compressing historical dialogues during text interaction, as described in Embodiment 1 of the present invention. This embodiment is applicable to text interaction scenarios driven by large language models, particularly for compressing historical dialogues during multi-turn interactions. The method can be executed by a historical dialogue compression device during text interaction. This device can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes: S110, Obtain the historical dialogue between the agent and the target user.

[0018] This solution can be executed by electronic devices such as computers and servers, specifically by an agent deployed with a large language model. The agent can acquire the target user's historical dialogues with the target user. The historical dialogues can be the dialogues completed by the agent up to the current moment, and can include the target user's instructions in each historical round, the prompt words input to the large language model in each historical round, and the agent's response results in each historical round.

[0019] S120. If the pre-set compression conditions are met based on the historical dialogue, the target data object in the historical dialogue is extracted and identified according to the preset identification method. The compression conditions include at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first quantity threshold; the number of lexical units processed by the agent in the historical dialogue reaches a second quantity threshold.

[0020] The agent can determine whether the amount of dialogue in the past has reached the upper limit of the context window of the large language model. If the amount of dialogue in the past has reached the upper limit of the context window of the large language model, then the past dialogue needs to be compressed to provide storage space for subsequent dialogues.

[0021] Specifically, the agent can compare the number of dialogue turns in the historical dialogue with a first threshold. If the number of dialogue turns reaches the first threshold, it indicates that the amount of dialogue in the historical dialogue has reached the upper limit of the context window of the large language model, thus confirming that the compression condition is met. The agent can also compare the number of lexical units processed in the historical dialogue with a second threshold. If the number of lexical units processed by the agent in the historical dialogue reaches the second threshold, it indicates that the amount of dialogue in the historical dialogue has reached the upper limit of the context window of the large language model, thus confirming that the compression condition is met. Furthermore, the agent can simultaneously compare the number of dialogue turns in the historical dialogue with the first threshold and the number of lexical units processed by the agent in the historical dialogue with the second threshold. If both the number of dialogue turns in the historical dialogue reaches the first threshold and the number of lexical units processed by the agent in the historical dialogue reaches the second threshold, the compression condition is confirmed to be met.

[0022] If the compression conditions are not met, the agent can continue to receive the target user's instructions for the current round and output the response based on the historical dialogue and the instructions for the current round. If the compression conditions are met, the agent can extract the target data objects from the historical dialogue and identify them according to a preset identification method. The target data objects can be data objects of high importance pre-defined based on the text interaction scenario, such as numerical values ​​in a financial scenario, locations in a geographical scenario, and equipment numbers in an industrial production scenario.

[0023] Specifically, the agent can traverse the dialogue content of each round in the historical conversation and extract the target data object. The target data object can include one or more types of data objects, and the agent can set different identification methods for different types of target data objects. In a specific example, the target data object includes numerical values ​​and addresses. Numerical values ​​can be identified by starting with "num", such as num1, num2, etc., and addresses can be identified by starting with "loc", such as loc_1, loc_2, etc.

[0024] S130. Store the target data object based on lossless compression, replace the target data object in the historical dialogue with the identifier of the target data object, and store the historical dialogue based on lossy compression.

[0025] An intelligent agent can replace target data objects in historical dialogues with their identifiers, and then store the target data objects and the historical dialogues after replacement using different compression methods. Understandably, data stored using lossless compression will be identical to the original data after decompression, while data stored using lossy compression will discard some less important information.

[0026] Specifically, for the target data object, the agent can use lossless compression for storage to ensure accurate restoration of the target data object. For historical dialogues after the target data object has been replaced, the agent can use lossy compression for storage to reduce the storage space of historical dialogues and free up storage space for subsequent dialogues.

[0027] The technical solution of this invention involves acquiring the historical dialogue between an agent and a target user. If a pre-set compression condition is met based on the historical dialogue, the target data object in the historical dialogue is extracted and identified according to a preset identification method. The compression condition includes at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first threshold; the number of lexical units processed by the agent in the historical dialogue reaches a second threshold; the target data object is stored using a lossless compression method, replacing the target data object in the historical dialogue with its identifier, and then storing the historical dialogue using a lossy compression method. This technical solution solves the problem of information loss during the compression of historical dialogues. By separating and replacing the target data object in the historical dialogue before compressing the historical dialogue, information loss during the compression process is effectively avoided. This facilitates the backtracking of target data objects in future dialogues, ensuring the continuity of interaction between the agent and the user, and improving the reliability of the agent's output response.

[0028] Example 2 Figure 2 This is a flowchart of a method for compressing historical dialogues during text interaction, provided in Embodiment 2 of the present invention. This embodiment is a refinement based on the above embodiment. Figure 2 As shown, the method includes: S210, Obtain the historical dialogue between the agent and the target user.

[0029] S220. If the pre-set compression conditions are met based on the historical dialogue, the target data objects in the historical dialogue are extracted based on the pre-set regular expressions, and the target data objects are identified according to the preset identification method. The compression conditions include at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first quantity threshold; the number of lexical units processed by the agent in the historical dialogue reaches a second quantity threshold.

[0030] Regular expressions are logical formulas for string manipulation. They use predefined specific characters or combinations of characters to form "rule strings," expressing the filtering logic for strings. An intelligent agent can identify strings with specific formats based on pre-defined regular expressions, quickly finding content matching specific patterns in historical dialogue text, such as email addresses and phone numbers. Furthermore, an intelligent agent can use regular expressions to identify target data objects in historical dialogues and replace them using the target data object's identifier, thereby improving the efficiency of text processing in historical dialogues.

[0031] S230. Store the target data object based on lossless compression.

[0032] Optionally, storing the target data object based on lossless compression includes: Convert the target data object into JSON format for storage.

[0033] In simple terms, JSON (JavaScript Object Notation) is an open, standard, lightweight data-interchange format that is easy to read and write, and also easy for electronic devices to parse and generate. JSON is language-independent, and most common programming languages ​​support JSON for data exchange. Intelligent agents convert target data objects into JSON format for lossless, structured storage, facilitating the management of these data objects.

[0034] This technical solution identifies and stores target data objects independently through lossless compression, achieving lossy compression at the text level and significantly saving lexical units.

[0035] S240. Generate target prompt words, which are used to instruct the large language model to retain the identifier of the target data object during the process of summarizing historical dialogues.

[0036] After replacing the target data objects in the historical dialogue with their identifiers, the agent can generate target prompts to instruct the large language model to retain the identifiers of the target data objects during the summarization of the historical dialogue. For example, the target prompt could be, "Please summarize the content of the historical dialogue, but if the summary involves identifiers starting with 'num,' such as num1, num2, etc., these identifiers must be explicitly retained in the sentence and cannot be summarized or omitted."

[0037] The above scheme establishes a deterministic and immutable logical link between text memory and data entities by forcibly retaining the identifier of the target data object in the summary text of historical dialogues, thus ensuring the accuracy of the reference to the target data object.

[0038] S250. Input the target prompt words into the large language model to obtain the summary text of the historical dialogue, and store the summary text of the historical dialogue.

[0039] The agent can input target prompts into a large language model, and then use the large language model to summarize historical dialogues, outputting a summary text of the historical dialogues, thereby achieving lossy compression of historical dialogues.

[0040] It should be noted that the target data object is not present in the summary text of historical dialogues, but its identifier is. The agent can store the summary text of historical dialogues. Compared to the actual historical dialogue, the summary text reduces the amount of information while retaining key semantic logic, thus improving information utilization.

[0041] S260. If the current round instruction from the target user is received, the target data object is obtained based on the identifier of the target data object in the summary text of the historical dialogue.

[0042] After completing the bimodal storage of the target data object and the summary text of the historical dialogue, the agent can continue to receive the target user's current round instruction. Understandably, during the process of identifying the target data object according to a preset identification method, the agent stores a mapping relationship between the target data object and its identifier. Upon receiving the target user's current round instruction, the agent can query and retrieve the target data object based on its identifier in the summary text of the historical dialogue and the mapping relationship between the target data objects and their identifiers.

[0043] S270. Based on the summary text of the historical dialogue and the target data object, output the response result of the instruction matching in the current round.

[0044] After obtaining the target data object, the agent can replace the target data object's identifier in the summary text of the historical dialogue with the target data object, thereby achieving target data object backfilling. Based on the target user's current turn command and the summary text of the historical dialogue after target data object backfilling, the agent can output the response corresponding to the current turn command using a large language model.

[0045] In this scheme, the step of outputting the response result matching the current round's instruction based on the summary text of the historical dialogue and the target data object includes: The target data object is then populated into the summary text of the historical dialogue to obtain the populated text. Concatenate the backfill text with the current round instruction to obtain the prompt word for the current round; Based on the large language model, the system outputs the response result matching the current round's instruction according to the prompt word in the current round.

[0046] The agent can backfill the target data object into the summary text of the historical dialogue to remove the target data object's identifier from the summary text, thus obtaining the backfilled text. By concatenating the backfilled text with the target user's current turn command, the agent can generate a prompt for the current turn. This prompt is then input into a large language model, and the agent can output the response corresponding to the current turn command based on the model's output.

[0047] This solution limits the role of the large language model to "logical orchestration" by backfilling the target data object, and returns the task of processing the target data object to the deterministic code execution engine, thus completely eliminating the "illusion" risk of the large language model in the task of processing the target data object.

[0048] Existing technologies, in order to preserve information, require storing large amounts of text fragments or abstract insights, or over-generalize historical dialogues to save storage space, creating a contradiction between "storage cost" and "information integrity." This solution, based on a dual-modal separation storage strategy for target data objects in the summary text domain, significantly compresses the number of lexical units in historical dialogues, greatly reducing the inference cost of large language models and partially eliminating the need for context windows. Furthermore, due to the mapping relationship between target data objects and their identifiers, it ensures that target data objects are backfilled into the summary text. This achieves a dual optimization of resource efficiency and information integrity without sacrificing the accessibility of target data objects.

[0049] Example 3 Figure 3 This is a schematic diagram of a historical dialogue compression device for a text interaction process provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: The historical dialogue acquisition module 310 is used to acquire the historical dialogue between the intelligent agent and the target user. The data object identification module 320 is used to extract target data objects from historical dialogues and identify them according to a preset identification method if the pre-set compression conditions are met based on historical dialogues. The compression conditions include at least one of the following: the number of dialogue rounds in the historical dialogues reaches a first quantity threshold; the number of lexical units processed by the agent in the historical dialogues reaches a second quantity threshold. The separate storage module 330 is used to store the target data object based on lossless compression, replace the target data object in the historical dialogue with the identifier of the target data object, and store the historical dialogue based on lossy compression.

[0050] In this solution, the data object identification module 320 is specifically used for: Extract target data objects from historical dialogues based on pre-defined regular expressions.

[0051] In one feasible embodiment, the separate storage module 330 includes a summary text storage unit, which is specifically used for: Generate target prompt words, which are used to instruct the large language model to retain the identifier of the target data object during the process of summarizing historical dialogues; Input the target prompt words into the large language model to obtain the summary text of the historical dialogue, and store the summary text of the historical dialogue.

[0052] Based on the above solution, the device further includes: The data object acquisition module is used to acquire the target data object based on the identifier of the target data object in the summary text of the historical dialogue after storing the historical dialogue based on lossy compression. The response output module is used to output the response result matching the current round's instruction based on the summary text of the historical dialogue and the target data object.

[0053] Based on the above solution, the response result output module is specifically used for: The target data object is then populated into the summary text of the historical dialogue to obtain the populated text. Concatenate the backfill text with the current round instruction to obtain the prompt word for the current round; Based on the large language model, the system outputs the response result matching the current round's instruction according to the prompt word in the current round.

[0054] Optionally, the separate storage module 330 further includes a data object storage unit, which is specifically used to convert the target data object into JSON format for storage.

[0055] The historical dialogue compression device in the text interaction process provided in the embodiments of the present invention can execute the historical dialogue compression method in the text interaction process provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0056] Example 4 Figure 4 A schematic diagram of an electronic device 410 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0057] like Figure 4 As shown, the electronic device 410 includes at least one processor 411 and a memory communicatively connected to the at least one processor 411. The memory may be a read-only memory (ROM) 412, a random access memory (RAM) 413, etc. The memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes based on the computer program stored in the ROM 412 or loaded from storage unit 418 into the RAM 413. The RAM 413 may also store various programs and data required for the operation of the electronic device 410. The processor 411, ROM 412, and RAM 413 are interconnected via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0058] Multiple components in electronic device 410 are connected to I / O interface 415, including: input unit 416, such as keyboard, mouse, etc.; output unit 417, such as various types of displays, speakers, etc.; storage unit 418, such as disk, optical disk, etc.; and communication unit 419, such as network card, modem, wireless transceiver, etc. Communication unit 419 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0059] Processor 411 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 411 performs the various methods and processes described above, such as the historical dialogue compression method in a text interaction process.

[0060] In some embodiments, the historical dialogue compression method during text interaction can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the historical dialogue compression method during text interaction described above can be performed. Alternatively, in other embodiments, processor 411 can be configured to perform the historical dialogue compression method during text interaction by any other suitable means (e.g., by means of firmware).

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

[0062] Computer programs used to implement the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable text-to-text communication history compression device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0063] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

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

[0065] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0066] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0067] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

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

Claims

1. A method for compressing historical dialogues during text interaction, characterized in that, The method includes: Acquire the historical dialogue between the intelligent agent and the target user; If the pre-set compression conditions are met based on the historical dialogue, the target data object in the historical dialogue is extracted and identified according to the preset identification method; the compression conditions include at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first quantity threshold; the number of words processed by the agent in the historical dialogue reaches a second quantity threshold. The target data object is stored using lossless compression, the target data object in the historical dialogue is replaced with the target data object's identifier, and the historical dialogue is stored using lossy compression.

2. The method according to claim 1, characterized in that, The extraction of target data objects from historical dialogues includes: Extract target data objects from historical dialogues based on pre-defined regular expressions.

3. The method according to claim 1, characterized in that, The storage of historical dialogues based on lossy compression includes: Generate target prompt words, which are used to instruct the large language model to retain the identifier of the target data object during the process of summarizing historical dialogues; Input the target prompt words into the large language model to obtain the summary text of the historical dialogue, and store the summary text of the historical dialogue.

4. The method according to claim 3, characterized in that, After storing historical dialogues using lossy compression, the method further includes: If the current round instruction from the target user is received, the target data object is obtained based on the identifier of the target data object in the summary text of the historical dialogue; Based on the summary text of the historical dialogue and the target data object, output the response result that matches the instruction in the current round.

5. The method according to claim 4, characterized in that, The step of outputting the response result matching the current round's instruction based on the summary text of the historical dialogue and the target data object includes: The target data object is then populated into the summary text of the historical dialogue to obtain the populated text. Concatenate the backfill text with the current round instruction to obtain the prompt word for the current round; Based on the large language model, the system outputs the response result matching the current round's instruction according to the prompt word in the current round.

6. The method according to claim 1, characterized in that, The storage of the target data object based on lossless compression includes: Convert the target data object into JSON format for storage.

7. A device for compressing historical dialogues during text interaction, characterized in that, The device includes: The historical dialogue acquisition module is used to acquire the historical dialogues between the intelligent agent and the target user; The data object identification module is used to extract target data objects from historical dialogues and identify them according to a preset identification method if the pre-set compression conditions are met based on historical dialogues. The compression conditions include at least one of the following: the number of dialogue rounds in the historical dialogue reaches a first quantity threshold; the number of lexical units processed by the agent in the historical dialogue reaches a second quantity threshold. The separate storage module is used to store target data objects based on lossless compression, replace the target data objects in historical dialogues with the identifiers of the target data objects, and store historical dialogues based on lossy compression.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the historical dialogue compression method in the text interaction process according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the historical dialogue compression method in any one of claims 1-6 during text interaction.

10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the historical dialogue compression method in a text interaction process according to any one of claims 1-6.