A response output processing method, device and equipment for a streaming question and answer scenario and a medium

By using a pre-set finite state machine to identify and process content in real time in streaming question-answering scenarios, the problems of incomplete tag recognition and time-consuming processing in traditional streaming question-answering scenarios are solved, thereby improving processing efficiency and user experience.

CN122633285APending Publication Date: 2026-08-25SANGFOR TECH INC
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In traditional streaming question answering scenarios, the post-processing of model answers leads to incomplete tag recognition and replacement, high logical complexity, and increased time consumption when processing long texts, which affects user experience.

Method used

Using a pre-set finite state machine, nodes identify and process the content to be processed in the streaming question-and-answer scenario in real time according to the pre-set recognition logic, processing it segment by segment or character by character until all nodes are completed.

Benefits of technology

It effectively avoids the logical complexity and incomplete label recognition issues caused by centralized and unified processing of multiple labels, shortens processing time, and improves response speed and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633285A_ABST
    Figure CN122633285A_ABST
Patent Text Reader

Abstract

The application discloses a kind of response output processing method, device and equipment of streaming question and answer scene and medium, involve computer technical field, including: the current response fragment generated by streaming question and answer scene is input to preset finite state machine, so that current node in preset finite state machine is based on corresponding preset identification logic Identification whether there is content to be handled in current response fragment;Wherein, preset finite state machine includes multiple nodes based on streaming question and answer processing demand Construction, and each node is pre-configured corresponding preset identification logic and preset processing rule;If there is content to be handled in current response fragment, then the current node is according to corresponding the preset processing rule The content to be handled in the current response fragment is handled, and current processing result is obtained;Current processing result is sent to next node, until all nodes are processed, and output final response fragment.The application reduces processing complexity and processing time-consuming.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and medium for processing response output in a streaming question-and-answer scenario. Background Technology

[0002] Traditional dialogue systems typically perform post-processing on model responses, such as replacing citation tags like "[citation:x]" or "reference x", as well as [image] and [link] tags with corresponding rich text blocks for citations, images, and hyperlinks, respectively. This usually involves processing the entire text uniformly after the model outputs. This approach has significant drawbacks: when the number of tags to be converted within the text is large, uniform processing across the entire text significantly increases logical complexity and makes it difficult to guarantee that all tags are correctly identified and replaced. Furthermore, with longer texts, uniform processing across the entire text increases processing time, impacting the user experience. Summary of the Invention

[0003] The purpose of this application is to provide a method, apparatus, device, and medium for processing response output in a streaming question-and-answer scenario, so as to reduce processing complexity and processing time.

[0004] To address the aforementioned issues, this application provides a method for processing response output in a streaming question-and-answer scenario, comprising: The current response fragment generated in the streaming question-and-answer scenario is input into a preset finite state machine, so that the current node in the preset finite state machine can identify whether there is content to be processed in the current response fragment based on the corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on the streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; If the pending content exists in the current response segment, the pending content in the current response segment is processed by the current node according to the corresponding preset processing rules to obtain the current processing result; The current processing result is sent to the next node until all nodes have finished processing, and the final response fragment is output.

[0005] Optionally, the preset identification logic includes common logic corresponding to different content to be processed and proprietary logic corresponding to a single content to be processed.

[0006] Optionally, the node includes a public node and at least one dedicated node; wherein the public node is used to perform the identification processing of the public logic, and the dedicated node is used to perform the identification processing corresponding to the proprietary logic.

[0007] Optionally, the node includes a synthesis node for performing the identification processing of the common logic and the proprietary logic.

[0008] Optionally, the response output processing method for the streaming question-answering scenario further includes: Determine whether the current response segment meets the abnormal segment determination criteria; If the current response segment meets the abnormal segment determination condition, the process will proceed to the processing of the next response segment.

[0009] Optionally, the response output processing method for the streaming question-answering scenario further includes: After the corresponding response segment is processed, a node cleanup operation is performed on the corresponding node; wherein, the node cleanup operation includes one or a combination of resetting state variables, clearing temporary data, and releasing computing resources.

[0010] Optionally, the content to be processed includes one or a combination of image intro markers, link intro markers, and sensitive content markers; wherein, the image intro marker is used to indicate content that needs to be converted into an image, the link intro marker is used to indicate content that needs to be converted into a link, and the sensitive content marker is used to indicate content that needs to be subject to risk control processing, and the risk control processing includes one or more of filtering, replacement, blocking, or marking.

[0011] This application also provides a response output processing device for a streaming question-and-answer scenario, including: The content recognition module is used to input the current response fragment generated in the streaming question-and-answer scenario into a preset finite state machine, so that the current node in the preset finite state machine can identify whether there is content to be processed in the current response fragment based on the corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on the streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; The content processing module is used to process the content to be processed in the current response segment according to the corresponding preset processing rules through the current node if the content to be processed exists in the current response segment, so as to obtain the current processing result; The node transfer module is used to send the current processing result to the next node until all nodes have finished processing and output the final response fragment.

[0012] Optionally, the response output processing device for the streaming question-and-answer scenario further includes: Anomaly detection module is used to determine whether the current response segment meets the anomaly segment detection conditions; The segment jump module is used to jump to the processing of the next response segment if the current response segment meets the abnormal segment determination conditions.

[0013] This application also provides a response output processing device for a streaming question-and-answer scenario, including: Memory, used to store computer programs; A processor is configured to implement the response output processing method for the streaming question-and-answer scenario as described above when executing the computer program.

[0014] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the response output processing method for the streaming question-and-answer scenario as described above.

[0015] This application provides a response output processing method for a streaming question-and-answer scenario, comprising: inputting a current response fragment generated by the streaming question-and-answer scenario into a preset finite state machine, so that the current node in the preset finite state machine identifies whether there is content to be processed in the current response fragment based on a corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; if there is content to be processed in the current response fragment, the current node processes the content to be processed in the current response fragment according to the corresponding preset processing rules to obtain a current processing result; the current processing result is sent to the next node until all nodes have finished processing, and the final response fragment is output.

[0016] In summary, this application inputs the current response fragment generated in a streaming question-answering scenario into a preset finite state machine. Nodes within this finite state machine then identify the content to be processed in real time according to their corresponding preset recognition logic. If content to be processed is identified, it is processed immediately according to the corresponding preset processing rules, and the current processing result is sent to the next node until all nodes have completed processing and the final response fragment is output. This approach avoids the problems of logical complexity and incomplete tag recognition and replacement caused by centralized processing of multiple tags. Furthermore, processing can begin without waiting for full text generation, effectively shortening the processing time for long texts, improving response speed and user experience, and thus specifically addressing the shortcomings of traditional solutions.

[0017] This application also provides a response output processing device, a response output processing equipment, and a computer-readable storage medium for a streaming question-and-answer scenario, which have the above-mentioned beneficial effects, and will not be elaborated here. Attached Figure Description

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

[0019] Figure 1 A flowchart illustrating a response output processing method for a streaming question-and-answer scenario provided in this application embodiment; Figure 2 A flowchart illustrating a specific response output processing method for a streaming question-and-answer scenario provided in this application embodiment; Figure 3 A schematic diagram of a response output processing device for a streaming question-and-answer scenario provided in an embodiment of this application; Figure 4 This is a schematic diagram of a response output processing device for a streaming question-and-answer scenario provided in an embodiment of this application. Detailed Implementation

[0020] The core of this application is to provide a method, apparatus, device, and medium for processing response output in a streaming question-and-answer scenario, so as to reduce processing complexity and processing time.

[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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, 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.

[0022] Traditional dialogue systems typically perform post-processing on model responses, such as replacing citation tags like "[citation:x]" or "reference x", as well as [image] and [link] tags with corresponding rich text blocks for citations, images, and hyperlinks, respectively. This usually involves processing the entire text uniformly after the model outputs. This approach has significant drawbacks: when the number of tags to be converted within the text is large, uniform processing across the entire text significantly increases logical complexity and makes it difficult to guarantee that all tags are correctly identified and replaced. Furthermore, with longer texts, uniform processing across the entire text increases processing time, impacting the user experience.

[0023] In summary, this application inputs the current response fragment generated in a streaming question-answering scenario into a preset finite state machine. Nodes within this finite state machine then identify the content to be processed in real time according to their corresponding preset recognition logic. If content to be processed is identified, it is processed immediately according to the corresponding preset processing rules, and the current processing result is sent to the next node until all nodes have completed processing and the final response fragment is output. This approach avoids the problems of logical complexity and incomplete tag recognition and replacement caused by centralized processing of multiple tags. Furthermore, processing can begin without waiting for full text generation, effectively shortening the processing time for long texts, improving response speed and user experience, and thus specifically addressing the shortcomings of traditional solutions.

[0024] The following examples illustrate a method for processing response output in a streaming question-and-answer scenario provided in this application.

[0025] refer to Figure 1 , Figure 1 This is a flowchart illustrating a response output processing method for a streaming question-and-answer scenario, as provided in an embodiment of this application.

[0026] In this embodiment, the method may include: S101: Input the current response fragment generated in the streaming question-and-answer scenario into a preset finite state machine, so that the current node in the preset finite state machine can identify whether there is content to be processed in the current response fragment based on the corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on the streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules.

[0027] In this embodiment, the current response fragment generated in the streaming question-and-answer scenario is input into a preset finite state machine, so that the preset finite state machine calls the consumption function of its current node. The consumption function takes the current session flow context state and the current response fragment as input parameters, and performs segment-by-segment / character-by-character recognition on the current response fragment based on the corresponding preset recognition logic, thereby determining whether there is content to be processed in the current response fragment. The preset finite state machine includes multiple nodes built based on the requirements of streaming question-and-answer processing. Each node is pre-configured with corresponding preset recognition logic and preset processing rules. Each node includes a consumption function, state variables, and auxiliary functions. The state variables are used to record the processing status and flow information of the current node, and the auxiliary functions are used to support state transitions, data parsing, and content processing.

[0028] The preset identification logic includes common logic for different content to be processed and proprietary logic for individual content to be processed. The common logic is used to uniformly identify the start and end characters of various tags, while the proprietary logic is used to identify specific content to be processed, such as image intro tags, link intro tags, and sensitive content tags. Image intro tags indicate content that needs to be converted into images, link intro tags indicate content that needs to be converted into links, and sensitive content tags indicate content that needs risk control processing. This risk control processing includes one or more of filtering, replacement, blocking, or marking. For example, when an image intro tag in the format [image:xxx] is identified, the proprietary logic can locate it as content to be processed; when a link intro tag in the format [link:xxx] is identified, the proprietary logic can determine it as content to be processed; and when preset sensitive words are identified, the proprietary logic can mark them as sensitive content to be processed.

[0029] In this embodiment, the node is built based on the requirements of streaming question and answer processing. Streaming question and answer processing requirements refer to the business requirements for real-time detection, filtering, correction, conversion, risk control, and other processing of answer content in the context of streaming output of the model.

[0030] The system is divided into four parts according to the processing flow: entry node, pre-processing node, processing node, and post-processing node. The functions of each part are as follows: The entry node receives the current response fragment and imports it into the subsequent processing flow; the pre-processing node performs preliminary identification, status preparation, and format verification of the received response fragment before formal processing; the processing node performs core processing such as identification, conversion, filtering, and risk control on the content to be processed in the response fragment according to preset identification logic and preset processing rules; and the post-processing node performs final verification and status organization of the processed content and outputs the processing result. Public nodes, dedicated nodes, and integrated nodes all belong to the above-mentioned processing nodes.

[0031] In one implementation of a processing node, the node includes a common node and at least one dedicated node. The common node performs identification processing for common logic, while the dedicated node performs identification processing for corresponding proprietary logic. For example, the common node uniformly identifies boundary symbols for various tags, while dedicated nodes for images, links, and sensitive content respectively identify image entry markers, link entry markers, and sensitive content markers, facilitating the separate maintenance of common and proprietary logic. In another implementation, the node includes a comprehensive node, which simultaneously performs identification processing for both common and proprietary logic. For example, the same comprehensive node, while identifying tag boundaries, simultaneously identifies and determines multiple types of content to be processed, such as images, links, and sensitive content, simplifying the workflow and improving execution efficiency.

[0032] S102: If the content to be processed exists in the current response segment, the content to be processed in the current response segment is processed by the current node according to the corresponding preset processing rule to obtain the current processing result.

[0033] In this embodiment, if there is content to be processed in the current response segment, the current node processes the content to be processed in the current response segment according to the corresponding preset processing rules to obtain the current processing result.

[0034] In one specific implementation, a processing method combining public nodes and dedicated nodes is adopted: if the current response fragment simultaneously contains an image entry identifier for [Image: Vehicle Start-up Process], a link entry identifier for [Link: Driving Safety Standards], and sensitive text corresponding to a preset sensitive content identifier, then the response fragment will be processed sequentially by different dedicated nodes; the current dedicated node converts the image entry identifier into a rich text block according to the corresponding preset processing rules, obtains the current processing result, and sends it to the next dedicated node; the next dedicated node converts the link entry identifier into a clickable hyperlink text, obtains the current processing result, and sends it to subsequent dedicated nodes; subsequent dedicated nodes perform risk control processing such as desensitization and replacement on the sensitive content, and obtain the current processing result; until all nodes have completed processing, the final response fragment after all processing is output.

[0035] In another specific implementation, a comprehensive node processing method is adopted: if the current response fragment contains image introduction identifiers, link introduction identifiers, and sensitive content identifiers at the same time, the comprehensive node can identify various types of content to be processed based on common logic and proprietary logic, and according to the corresponding preset processing rules, simultaneously complete the image rich text block conversion, hyperlink text conversion, and sensitive content desensitization and replacement within the current node, and send the current processing result to the next node.

[0036] S103: Send the current processing result to the next node, and continue until all nodes have finished processing and output the final response fragment.

[0037] It is understandable that if the content to be processed does not exist in the current response fragment, the current response fragment is directly sent to the next node as the current processing result until all nodes have finished processing and the final response fragment is output.

[0038] Furthermore, to avoid contextual remnants affecting the accuracy of subsequent segment recognition and processing, a node cleanup operation is performed on the corresponding node after the corresponding response segment processing is completed. This node cleanup operation includes one or a combination of resetting state variables, clearing temporary data, and releasing computing resources. Specifically, the node also includes a `flush` function, which is typically called after the entire input processing is complete. This function is used to perform tasks such as clearing temporary data, resetting state variables, and shutting down computing resources. The specific implementation of this function is adaptively adjusted according to the node's business requirements.

[0039] This application provides a response output processing method for a streaming question-and-answer scenario, comprising: inputting a current response fragment generated by the streaming question-and-answer scenario into a preset finite state machine, so that the current node in the preset finite state machine identifies whether there is content to be processed in the current response fragment based on a corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; if there is content to be processed in the current response fragment, the current node processes the content to be processed in the current response fragment according to the corresponding preset processing rules to obtain a current processing result; the current processing result is sent to the next node until all nodes have finished processing, and the final response fragment is output.

[0040] In summary, this application inputs the current response fragment generated in a streaming question-answering scenario into a preset finite state machine. Nodes within this finite state machine then identify the content to be processed in real time according to their corresponding preset recognition logic. If content to be processed is identified, it is processed immediately according to the corresponding preset processing rules, and the current processing result is sent to the next node until all nodes have completed processing and the final response fragment is output. This approach avoids the problems of logical complexity and incomplete tag recognition and replacement caused by centralized processing of multiple tags. Furthermore, processing can begin without waiting for full text generation, effectively shortening the processing time for long texts, improving response speed and user experience, and thus specifically addressing the shortcomings of traditional solutions.

[0041] This application also provides a response output processing device, a response output processing equipment, and a computer-readable storage medium for a streaming question-and-answer scenario, which have the above-mentioned beneficial effects, and will not be elaborated here.

[0042] For further details, please refer to... Figure 2 , Figure 2 To further extend the above embodiments, this is used to achieve rapid fallback and stable transfer of abnormal response segments during streaming identification and conversion, ensuring that the entire processing flow is uninterrupted and unblocked.

[0043] S201: Determine whether the current response segment meets the abnormal segment determination condition.

[0044] In this embodiment, while performing character-by-character and segment-by-segment identification on the current response segment, a consumption function determines whether the current response segment meets the abnormal segment determination criteria. These abnormal segment determination criteria include, but are not limited to: the response segment being empty, the tag format being unclosed, the content containing garbled characters, or unresolvable special character strings. In other words, when the consumption function identifies any of the above situations, it immediately determines that the current response segment meets the abnormal segment determination criteria.

[0045] S202: If the current response segment meets the abnormal segment determination condition, then proceed to the identification and processing of the next response segment.

[0046] In this embodiment, if the current response segment meets the abnormal segment determination conditions, the conventional processing procedures such as tag recognition, content conversion, and sensitive word filtering are not executed. Instead, the node state is reset from the abnormal processing state to the normal state, and the process directly jumps to the recognition and processing of the next response segment, ensuring that the next response segment is not affected by residual information.

[0047] In summary, this embodiment provides a fast fallback mechanism for streaming response anomalies. It can identify, skip, and reset the status of abnormal segments without interrupting the processing flow or blocking the parsing of subsequent segments. This effectively avoids problems such as the entire streaming question and answer processing freezing or parsing errors caused by a single abnormal response segment, and significantly improves the fault tolerance of the system.

[0048] The following explanation uses the question-and-answer dialogue service for assisted driving as an example.

[0049] I. Scene Setting

[0050] In the context of assisted driving Q&A dialogue, users can initiate inquiries related to vehicle operation, safety regulations, troubleshooting, and driving guidelines. The large model generates response text in real time based on the user's inquiry content in a streaming output manner. The response content can carry image introduction markers, link introduction markers, and sensitive content waiting to be processed. To ensure the accuracy, standardization, and security of the output content, each response segment output by the model is input into a preset finite state machine in real time. Multiple nodes in the state machine perform real-time detection, recognition, conversion, filtering, and risk control processing on the segment character by character and segment by segment according to common logic and proprietary logic. Finally, compliant, usable, rich text format response content is output and presented to the user interface.

[0051] II. Processing Flow

[0052] After a user initiates an inquiry about "Vehicle Start-up Procedure and Safety Precautions," the large model streams the corresponding response fragment. An example of the content is: "[Image: Vehicle Start-up Procedure] Please start the vehicle according to the specifications. For specific instructions, please refer to [Link: Driving Safety Specifications]. Improper operation may lead to [Sensitive Content] risks." This response fragment enters the preset finite state machine. First, the entry node receives the fragment and completes the initial state setting, importing the fragment into the subsequent processing flow. Then, the pre-processing node performs format verification and state preparation on the fragment. Afterward, the processing node identifies the content to be processed according to common and proprietary logic. When using a processing method that combines common and proprietary nodes, the fragment will be processed sequentially by each proprietary node. The image proprietary node then outputs the response fragment: "[Image: Vehicle Start-up Procedure]..." The process involves converting [link: Driving Safety Regulations] into a rich text image block, then using a dedicated link node to convert it into a clickable hyperlink. A dedicated sensitive content node performs desensitization and replacement of sensitive text. After each node completes its processing, the current result is sent to the next node. Finally, the processed node verifies and organizes the data, outputting the final response fragment after all nodes have finished processing. Alternatively, if a combined node is used, it simultaneously identifies tag boundaries, image intro markers, link intro markers, and sensitive content markers within the same node, synchronously completing conversion, replacement, and risk control processing before sending the result to the next node until the process ends. Furthermore, if the response fragment does not contain any content to be processed, it is directly sent to the next node until all nodes have finished processing.

[0053] III. Exception Handling and Backup Plan

[0054] During the above streaming process, if the consumption function detects an anomaly in the current response segment, it immediately triggers a fallback mechanism to stop the subsequent processing of the current response segment, reset the node state to the normal state, and directly jump to the identification and processing flow of the next response segment, thereby ensuring that the overall streaming process is uninterrupted, unblocked, and error-free.

[0055] IV. Node Cleanup

[0056] After the response fragment is processed, the node performs node cleanup operations by calling the flush function, which includes resetting state variables, clearing temporary data, and releasing computing resources to prevent the context state from affecting the parsing accuracy of subsequent fragments.

[0057] The response output processing device for a streaming question-and-answer scenario provided in the embodiments of this application is described below: Please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of a response output processing device for a streaming question-and-answer scenario provided in an embodiment of this application.

[0058] In this embodiment, the device may include: The content recognition module 100 is used to input the current response fragment generated in the streaming question-and-answer scenario into a preset finite state machine, so that the current node in the preset finite state machine can identify whether there is content to be processed in the current response fragment based on the corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on the streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; The content processing module 200 is used to process the content to be processed in the current response segment according to the corresponding preset processing rules through the current node if the content to be processed exists in the current response segment, so as to obtain the current processing result; The node transfer module 300 is used to send the current processing result to the next node until all nodes have finished processing and output the final response fragment.

[0059] In some specific embodiments, the response output processing device for the streaming question-and-answer scenario further includes: Anomaly detection module is used to determine whether the current response segment meets the anomaly segment detection conditions; The segment jump module is used to jump to the processing of the next response segment if the current response segment meets the abnormal segment determination conditions.

[0060] It should be noted that the anomaly detection module is specifically used to determine whether the current response segment meets the anomaly detection criteria through a consumption function while performing character-by-character and segment-by-segment identification of the current response segment. The anomaly detection criteria include, but are not limited to: the response segment being empty, the tag format being unclosed, the content containing garbled characters, or unparseable special character strings. In other words, when the consumption function detects any of the above situations, it immediately determines that the current response segment meets the anomaly detection criteria.

[0061] It should be noted that the segment jump module is specifically used to, if the current response segment meets the abnormal segment judgment conditions, not to perform the conventional processing procedures such as tag recognition, content conversion, and sensitive word filtering, but to reset the node state from the abnormal processing state to the normal state and directly jump to the recognition and processing of the next response segment, so as to ensure that the next response segment will not be affected by residual information.

[0062] In summary, this embodiment provides a rapid fallback mechanism for streaming response anomalies through the anomaly detection module and the segment jump module. This mechanism can identify, skip, and reset abnormal segments without interrupting the processing flow or blocking subsequent segment parsing, effectively avoiding problems such as the entire streaming question and answer processing freezing or parsing errors caused by a single abnormal response segment, and significantly improving the system's fault tolerance.

[0063] Figure 4 This is a schematic diagram of the structure of a response output processing device for a streaming question-and-answer scenario provided in an embodiment of this application.

[0064] This application embodiment also provides a response output processing device for a streaming question-and-answer scenario, which may include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the steps of the response output processing method for the streaming question-and-answer scenario as described in the above embodiments.

[0065] like Figure 4 The diagram shows the structural composition of a response output processing device in a streaming question-and-answer scenario. This device may include a processor 10, a memory 11, a communication interface 12, and a communication bus 13. The processor 10, memory 11, and communication interface 12 all communicate with each other via the communication bus 13.

[0066] In this embodiment, the processor 10 may be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic devices.

[0067] The processor 10 can call the program stored in the memory 11. Specifically, the processor 10 can execute the operations in the embodiment of the response output processing method for the streaming question-and-answer scenario.

[0068] The memory 11 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the memory 11 stores at least a program for implementing the following functions: The current response fragment generated in the streaming question-and-answer scenario is input into a preset finite state machine, so that the current node in the preset finite state machine can identify whether there is content to be processed in the current response fragment based on the corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on the streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; If the pending content exists in the current response segment, the pending content in the current response segment is processed by the current node according to the corresponding preset processing rules to obtain the current processing result; The current processing result is sent to the next node until all nodes have finished processing, and the final response fragment is output.

[0069] In one possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.

[0070] In addition, memory 11 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.

[0071] Communication interface 12 can be an interface for the communication module, used to connect with other devices or systems.

[0072] Of course, it should be noted that, Figure 4 The structure shown does not constitute a limitation on the response output processing device for the streaming question-and-answer scenario in this application embodiment. In practical applications, the response output processing device for the streaming question-and-answer scenario may include devices such as... Figure 4 More or fewer components as shown, or combinations of certain components.

[0073] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the response output processing method for the streaming question-and-answer scenario as described in the above embodiments.

[0074] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0075] For a description of the computer-readable storage medium provided in this application, please refer to the above method embodiments; further details will not be repeated here.

[0076] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0077] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0078] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0079] The foregoing has provided a detailed description of the response output processing method, apparatus, device, and medium for a streaming question-and-answer scenario provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method for processing response output in a streaming question-and-answer scenario, characterized in that, include: The current response fragment generated in the streaming question-and-answer scenario is input into a preset finite state machine, so that the current node in the preset finite state machine can identify whether there is content to be processed in the current response fragment based on the corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on the streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; If the pending content exists in the current response segment, the pending content in the current response segment is processed by the current node according to the corresponding preset processing rules to obtain the current processing result; The current processing result is sent to the next node until all nodes have finished processing, and the final response fragment is output.

2. The response output processing method for a streaming question-and-answer scenario according to claim 1, characterized in that, The preset identification logic includes common logic corresponding to different content to be processed and proprietary logic corresponding to a single content to be processed.

3. The response output processing method for a streaming question-and-answer scenario according to claim 2, characterized in that, The node includes a public node and at least one dedicated node; wherein the public node is used to perform the identification processing of the public logic, and the dedicated node is used to perform the identification processing corresponding to the proprietary logic.

4. The response output processing method for a streaming question-and-answer scenario according to claim 2, characterized in that, The node includes a comprehensive node, which is used to perform the identification processing of the common logic and the proprietary logic.

5. The response output processing method for a streaming question-and-answer scenario according to claim 1, characterized in that, Also includes: Determine whether the current response segment meets the abnormal segment determination criteria; If the current response segment meets the abnormal segment determination condition, the process will proceed to the processing of the next response segment.

6. The response output processing method for a streaming question-and-answer scenario according to claim 1, characterized in that, Also includes: After the corresponding response fragment is processed, a node cleanup operation is performed on the corresponding node; wherein, the node cleanup operation includes one or a combination of resetting state variables, clearing temporary data, and releasing computing resources.

7. The response output processing method for a streaming question-and-answer scenario according to any one of claims 1 to 6, characterized in that, The content to be processed includes one or a combination of image intro markers, link intro markers, and sensitive content markers; wherein, the image intro marker is used to indicate content that needs to be converted into an image, the link intro marker is used to indicate content that needs to be converted into a link, and the sensitive content marker is used to indicate content that needs to be subject to risk control processing, and the risk control processing includes one or more of filtering, replacement, blocking, or marking.

8. A response output processing device for a streaming question-and-answer scenario, characterized in that, include: The content recognition module is used to input the current response fragment generated in the streaming question-and-answer scenario into a preset finite state machine, so that the current node in the preset finite state machine can identify whether there is content to be processed in the current response fragment based on the corresponding preset recognition logic; wherein, the preset finite state machine includes multiple nodes constructed based on the streaming question-and-answer processing requirements, and each node is pre-configured with the corresponding preset recognition logic and preset processing rules; The content processing module is used to process the content to be processed in the current response segment according to the corresponding preset processing rules through the current node if the content to be processed exists in the current response segment, so as to obtain the current processing result; The node transfer module is used to send the current processing result to the next node until all nodes have finished processing and output the final response fragment.

9. The response output processing device for a streaming question-and-answer scenario according to claim 8, characterized in that, Also includes: Anomaly detection module is used to determine whether the current response segment meets the anomaly segment detection conditions; The segment jump module is used to jump to the processing of the next response segment if the current response segment meets the abnormal segment determination conditions.

10. A response output processing device for a streaming question-and-answer scenario, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the response output processing method for a streaming question-and-answer scenario as described in any one of claims 1 to 7 when executing the computer program.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of response output processing in a streaming question-and-answer scenario as described in any one of claims 1 to 7.