A large model assistant dynamic output rectification method and system in a network shooting range
By adding custom labels to the output content of the big model, rectifying and rendering specific content in real time, the problem of large model being too high cache and poor user experience in the network shooting range is solved, and the output efficiency and user experience are improved.
Patent Information
- Application Number
- CN202510081390.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-01-20
AI Technical Summary
It is difficult for large models to identify and render specific content in real time in network shooting ranges, such as html links, resulting in excessive browser cache, slow traversal speed and poor user experience.
By adding custom tags to the original content, rectify the output content of the big model in real time, find user-defined tags, and dynamically render them based on the tag results, reducing browser cache and improving output efficiency.
Real-time rendering of specific content is achieved, reducing browser cache usage, and improving user experience and output speed.
Smart Images

Figure CN119557526B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a large model assistant dynamic output rectification method and system in a network target range, belonging to the technical fields of information processing and network security. Background Art
[0002] Large models offer significant advantages in natural language understanding and text generation, making them highly effective intelligent assistants for human-computer interaction. However, the model's knowledge base is limited to its training data, meaning its ability to answer questions is limited by the training data. This data often encompasses domain knowledge specific to a particular industry (such as programming or mathematics). Consequently, large models often struggle to provide targeted responses to specialized questions in specialized fields (e.g., cybersecurity training).
[0003] To address this issue, an external knowledge base combined with Retrieval-Augmented Generation (RAG) is often used to inject additional domain knowledge into the large model. When a user asks a question, the large model first matches relevant information with the external knowledge base. It then uses its own text generation capabilities to process and output this information. This process involves streaming text generation, where the model predicts the most likely next output based on the current context and preceding and following content. The model outputs one or several characters at a time.
[0004] The streaming output process allows users to dynamically perceive the model generation process, but it also brings the following problems:
[0005] 1. It is impossible to dynamically identify and render specific content (such as HTML links) in real time, resulting in the inability to effectively display specific content such as network link addresses. Figure 1 As shown, the large model outputs a string list, and the client cannot determine the beginning and end of the link address based on the dynamic string list, resulting in an unfriendly display style.
[0006] 2. Using a global cache large model to output content and traversing the output content to find specific tags will cause the browser cache to be too high and the traversal speed to be very slow in the case of large data volumes. In addition, this method will cause the page to refresh when traversing to specific content, affecting the user experience. Summary of the Invention
[0007] Purpose of the invention: In response to the problems existing in the above-mentioned prior art, the purpose of the present invention is to provide a method and system for dynamic output rectification of a large model assistant in a network target range. By adding custom tags to the original content, the output content of the large model is rectified in real time to improve the user experience.
[0008] Technical solution: To achieve the above-mentioned purpose, the present invention adopts the following technical solution:
[0009] In a first aspect, the present invention provides a method for dynamic output rectification of a large model assistant in a network range, comprising the following steps:
[0010] Set the hit start tag state to the initial value false;
[0011] Receive the character string output by the large model and add the character string to the cache list;
[0012] Determine whether the length of the string in the current cache list reaches the preset threshold. If not, continue to receive and cache new strings; otherwise, execute the next step;
[0013] Searching for a custom tag in the current cache list according to the hit start tag status, and when the hit start tag status is true, searching for an end tag; when the hit start tag status is false, searching for a start tag;
[0014] Based on the tag hit result, generate the tag search return value and update the cache list at the same time;
[0015] Set the browser's rendering state according to the current hit start tag state; if the tag hit result is true, flip the hit start tag state;
[0016] For each input string, a tuple containing the value to be displayed and the corresponding rendering status is finally returned; the output content of the large model is continuously received and displayed dynamically.
[0017] Preferably, the step of finding a start tag or an end tag includes:
[0018] Concatenate all the strings in the cache list into a complete string and split it by the tag to be found;
[0019] Determine whether the concatenated set of split strings is equal to the original string. If they are equal, it means that the tag is not found and the tag hit result is set to false; otherwise, the tag hit result is set to true.
[0020] Preferably, the steps of generating a tag, finding the returned value, and updating the cache list include:
[0021] If the tag hit result is false, the returned value is the first value popped up in the cache list; otherwise, it is the first value in the segmented string set, and the current cache list is cleared at the same time, and the remaining values in the segmented string set are added to the cache list in sequence.
[0022] In a second aspect, the present invention provides a large model assistant dynamic output rectification system in a network range, comprising a cache module, a tag search module, and a rendering module;
[0023] The cache module is used to receive the character string output by the large model and add the character string to the cache list; and determine whether the length of the character string in the current cache list reaches a preset threshold. If not, continue to receive and cache new character strings; otherwise, call the tag search module;
[0024] The tag search module is used to set the hit start tag state to an initial value of false. When the length of the string cached in the cache module reaches a preset threshold, the custom tag is searched in the current cache list according to the hit start tag state. When the hit start tag state is true, the end tag is searched; when the state is false, the start tag is searched; and, based on the tag hit result, the tag search return value is generated and the cache list is updated at the same time; the rendering state of the browser is set according to the current hit start tag state; if the tag hit result is true, the hit start tag state is flipped; for each input string, a tuple containing the value to be displayed and the corresponding rendering state is finally returned;
[0025] The rendering module is used to dynamically display the value to be displayed according to the rendering state in the tuple.
[0026] In a third aspect, the present invention provides a computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein the computer program / instruction, when executed by the processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.
[0027] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.
[0028] In a fifth aspect, the present invention provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.
[0029] Beneficial effects: Compared with the existing technology, the present invention has the following advantages: the present invention adds custom tags to the original content, rectifies the output content of the large model in real time, searches for the user's custom tags, and outputs the rectified content and rendering rules in real time according to the search results; the browser only needs to cache a small amount of output content of the large model, and does not need to globally cache the output of the model, thereby reducing the hardware resource usage of the browser and speeding up the traversal performance of specific content; using dynamic rectification, the page can output specific style content in real time without refreshing the page after hitting a specific tag, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 Example graph of address linking issues output for a large model.
[0031] Figure 2 This is a dynamic rectification flow chart of an embodiment of the present invention.
[0032] Figure 3 This is an example diagram of labeling of original documents in the knowledge base used as an example in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings and specific embodiments.
[0034] like Figure 2 As shown, the embodiment of the present invention discloses a large model assistant dynamic output rectification method in a network range, which mainly includes the following steps:
[0035] Step S101: Set the hit start tag status to an initial value of false.
[0036] Step S102: Receive the character string output by the large model and add the character string to the cache list.
[0037] Step S103: Determine whether the length of the character string in the current cache list reaches a preset threshold. If not, continue receiving and caching new character strings; otherwise, proceed to the next step.
[0038] Step S104: Search for a custom tag in the current cache list according to the hit start tag status. When the hit start tag status is true, search for the end tag; when the status is false, search for the start tag.
[0039] Step S105: Generate the tag search return value based on the tag hit result and update the cache list at the same time;
[0040] Step S106: setting the browser rendering state according to the current hit start tag state; if the tag hit result is true, flipping the hit start tag state;
[0041] Step S107: For each input string, a tuple containing the value to be displayed and the corresponding rendering status is finally returned; the output content of the large model is continuously received and dynamically displayed.
[0042] In some embodiments, the step of searching for a start tag or an end tag in step S104 may be:
[0043] Step S1041: concatenate all character strings in the cache list into a complete character string, and segment it using the tag to be found;
[0044] Step S1042: Determine whether the segmented string set is equal to the original string after concatenation. If they are equal, it means that the tag is not found, and the tag hit result is set to false; otherwise, the tag hit result is set to true.
[0045] In step S105, the steps of generating a tag to find the returned value and updating the cache list may be: if the tag hit result is false, the returned value is the first value popped up in the cache list; otherwise, it is the first value in the segmented string set, and the current cache list is cleared at the same time, and the remaining values in the segmented string set are added to the cache list in sequence.
[0046] The following is an example of dynamic identification and rendering of HTML links.
[0047] Before the method of the embodiment of the present invention is implemented, custom tags are added to the original documents corresponding to the knowledge base where special rendering is required. The custom tags are divided into start tags and corresponding end tags. Figure 3 It is a new tag for HTML links, where the start tag is [[snlink]] and the end tag is [[ / snlink]].
[0048] Specifically, the detailed execution steps of the large model assistant dynamic output rectification method in the network range include:
[0049] Step S201: Set the hit start tag status hitStartStatus to false, indicating that no custom tag is found currently.
[0050] Step S202: Receive the character string X output by the large model, and add the received character string X to the cache list C.
[0051] Step S203: Determine whether the length of the character string currently cached in C has reached a threshold (for example, 15, as long as the length is sufficient to cover the label. For the [[snlink]] label, assuming that the model outputs one character each time, 10 times can output the complete label). If the threshold is not reached, this rectification does not output anything and jumps to step S202; otherwise, jumps to step S204.
[0052] Step S204: Search for the custom tag in the current cache list C based on the hitStartStatus. If hitStartStatus is true, search for the end tag; otherwise, search for the start tag. The tag to be searched is denoted as T. Searching for tag T is described in steps S205 through S208.
[0053] Step S205: Concatenate all the strings in the cache list to form a complete string. Assume that the values in cache list C are {"hello","a","c", [[","sn","link","]", "]http", ": / / ", "www"}, and the concatenated string S = "hello ac [[snlink]]http: / / www".
[0054] Step S206: Split the string S using T, and record the resulting string set as S1. For the example of step S205, S1 = {"hello ac", "http: / / www"}.
[0055] Step S207: Determine whether the concatenated string of set S1 is equal to S. If they are equal, it means that tag T is not found, and the tag hit result hitTag is false; otherwise, hitTag is true.
[0056] Step S208: Generate the tag and search for the value V to be returned. If hitTag is false, V is the first value popped out of cache list C. Otherwise, the popped value V is the first value in S1. The current cache list C is cleared, and the remaining values in S1 are added to C in sequence. For the example shown in step S206, if V = "hello ac", the value in cache list C is {"http: / / www"}.
[0057] Step S209: Determine the browser's rendering status (renderStatus) based on the current hitStartStatus. If hitStartStatus is true, set the renderStatus of this stream to true; otherwise, set renderStatus to false.
[0058] Step S210: If hitTag is true, flip the state of hitStartStatus. That is, if the current value of hitStartStatus is true, it becomes false, and if it is false, it becomes true.
[0059] Step S211: The final return value of the rectified input string X is (V, renderStatus). If renderStatus is true, the browser needs to perform special rendering on the returned V value (such as displaying it as an HTML link). Otherwise, the V value is output normally.
[0060] Step S212: Repeat steps S202 to S211 to continuously receive the output content of the large model and dynamically display it.
[0061] The embodiment of the present invention also discloses a large model assistant dynamic output rectification system in a network shooting range, which mainly includes a cache module, a label search module, and a rendering module; the cache module is used to receive the string output by the large model and add the string to the cache list; and determine whether the length of the string in the current cache list reaches a preset threshold. If not, continue to receive and cache new strings; otherwise, call the label search module; the label search module is used to set the hit start label state to the initial value false. When the length of the string cached in the cache module reaches the preset threshold, search for a custom tag in the current cache list according to the hit start label state. When the hit start label state is true, search for the end tag; when the state is false, search for the start tag; and, based on the label hit result, generate the value returned by the label search and update the cache list at the same time; determine the rendering state of the browser according to the current hit start label state; if the label hit result is true, flip the hit start label state; for each input string, finally return a tuple containing the value to be displayed and the corresponding rendering state; the rendering module is used to dynamically display the value to be displayed according to the rendering state in the tuple.
[0062] An embodiment of the present invention also discloses a computer system, including a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor. When the computer program / instruction is executed by the processor, the steps of dynamic output rectification of a large model assistant in a network target range are implemented.
[0063] An embodiment of the present invention also discloses a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of dynamic output rectification of a large model assistant in a network shooting range.
[0064] An embodiment of the present invention also discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of dynamic output rectification of a large model assistant in a network target range.
Claims
1. A large model assistant dynamic output rectification method in a network range, characterized in that: The following steps are involved: (1) Set the hit start tag state to the initial value false; (2) Receive the string output by the large model and add the string to the cache list; (3) Determine whether the length of the character string in the current cache list reaches the preset threshold. If not, continue to receive and cache new character strings; otherwise, execute the next step; (4) searching for a custom tag in the current cache list according to the hit start tag status, and searching for an end tag when the hit start tag status is true; When the state is false, look for the start tag; The step of finding the start tag or the end tag includes: concatenating all the strings in the cache list into a complete string, and segmenting the string using the tag to be found; determining whether the concatenated set of segmented strings is equal to the original string; if they are equal, indicating that the tag is not found, setting the tag hit result to false; otherwise, setting the tag hit result to true; (5) Generate a tag search return value based on the tag hit result and update the cache list at the same time; including: if the tag hit result is false, the tag search return value is the first value popped out of the cache list; otherwise, it is the first value in the segmented string set, and the current cache list is cleared at the same time, and the remaining values in the segmented string set are added to the cache list in sequence; (6) Set the browser's rendering state according to the current hit start tag state; if the tag hit result is true, flip the hit start tag state; (7) For each input string, a tuple containing the tag to be displayed, the return value, and the corresponding rendering status is finally returned; repeat steps (2) to (7) to continuously receive the output content of the large model and display it dynamically.
2. The method for dynamic output rectification of a large model assistant in a network range according to claim 1, characterized in that: The preset threshold is set to a minimum length sufficient to cover the custom label.
3. The large model assistant dynamic output rectification method in a network range according to claim 1 is characterized in that: When the rendering state is true, the browser renders the returned value according to preset rules.
4. The large model assistant dynamic output rectification method in a network range according to claim 1 is characterized in that: The custom tag is used to mark an HTML link. When the rendering state is true, the returned value is displayed as an HTML link.
5. A large model assistant dynamic output rectification system in a network shooting range, characterized in that: Includes cache module, tag search module, and rendering module; The cache module is used to receive the character string output by the large model and add the character string to the cache list; And determine whether the length of the string in the current cache list reaches the preset threshold. If not, continue to receive and cache new strings; otherwise, call the tag search module; The tag search module is configured to set the hit start tag state to an initial value of false, and when the length of the character string cached in the cache module reaches a preset threshold, search for a custom tag in the current cache list according to the hit start tag state, and search for an end tag when the hit start tag state is true; When the state is false, look for the start tag; The step of finding the start tag or the end tag includes: concatenating all the strings in the cache list into a complete string, and segmenting the string using the tag to be found; determining whether the concatenated set of segmented strings is equal to the original string; if they are equal, indicating that the tag is not found, setting the tag hit result to false; otherwise, setting the tag hit result to true; And, it is used to generate a tag search return value based on the tag hit result and update the cache list at the same time; including: if the tag hit result is false, the tag search return value is the first value popped out of the cache list; otherwise, it is the first value in the segmented string set, and the current cache list is cleared at the same time, and the remaining values in the segmented string set are added to the cache list in sequence; And, it is used to set the browser's rendering state according to the current hit start tag state; if the tag hit result is true, the hit start tag state is flipped; for each input string, a tuple containing the tag search return value to be displayed and the corresponding rendering state is finally returned; The rendering module is used to dynamically display the value to be displayed according to the rendering state in the tuple; By cyclically calling the cache module, label search module, and rendering module, the output content of the large model is continuously received and dynamically displayed.
6. A computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein: When the computer program / instructions are executed by a processor, the steps of dynamic output rectification of a large model assistant in a network range according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the step of dynamic output rectification of a large model assistant in a network range according to any one of claims 1 to 4 is implemented.
8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of dynamic output rectification of a large model assistant in a network range according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Front-end rendering optimization method based on streaming output
CN118869803A
Semantic-based large model assistant optimization method and system in target range
CN119025666A