A flow response fragment order-preserving proxy forwarding method

CN122802582APending Publication Date: 2026-09-22NANOMAGNETIC TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611134671.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-29
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

若缓存控制过于宽松,可能导致证据尚未闭合的正文内容提前输出;若缓存控制过于保守,又可能造成流式响应停顿时间过长,影响客户端交互体验

Benefits of technology

本发明通过在客户端与上游服务之间设置代理服务器,并在接收流式响应请求时建立流式会话标识及流式响应上下文,将流式响应分片的缓存状态、分片转发顺序状态、搜索轮次状态、策略快照状态和释放序审计状态纳入同一会话维度下维护,有利于对多来源、异步到达的流式响应分片进行统一管理,提升分片缓存、顺序控制和转发记录的一致性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122802582A_ABST
    Figure CN122802582A_ABST
Patent Text Reader

Abstract

This invention relates to the field of network communication and streaming data forwarding technology, specifically to a method for order-preserving proxy forwarding of streaming response fragments. After receiving a streaming response request, the method establishes a streaming session identifier and streaming response context, determines service indication information and a current valid policy snapshot, acquires and describes streaming response fragments, caches and evaluates them according to an evidence admission control rule set, and executes order-preserving forwarding control based on the evidence admission assessment results. This invention improves the consistency, controllability, and auditability of multi-source asynchronous fragment processing by establishing a streaming session identifier and streaming response context, combined with routing policy status, a current valid policy snapshot, and an evidence admission control rule set, to cache, evaluate, and forward streaming response fragments in an order-preserving manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network communication and streaming data forwarding technology, and more specifically, to a streaming response fragmentation and order-preserving proxy forwarding method. Background Technology

[0002] With the development of online interactive services, real-time question-and-answer services, online search services, and content generation services, clients are increasingly adopting streaming responses to receive content returned by the server. Compared to returning the complete result at once, streaming responses can continuously output fragmented data to the client during content generation, reducing user waiting time and improving the continuity and immediacy of the interaction process. Especially in scenarios such as long text generation, online question-and-answer retrieval, real-time data aggregation, policy information querying, and market information querying, streaming responses have become a common data transmission method.

[0003] In some application scenarios, the upstream service requested by the client is not a single content generation source, but involves both upstream generation services and network search services. The upstream generation service is primarily responsible for generating the main text content, while the network search service is mainly responsible for providing search evidence, citation sources, real-time data, or search round information. Because the response speed, network connectivity, retrieval time, and fragment generation rhythm of different upstream services are not entirely consistent, streaming response fragments such as main text fragments, search evidence fragments, citation binding fragments, and search round fragments often arrive asynchronously.

[0004] Existing streaming forwarding methods typically focus on reducing response latency and maintaining connection stability, meeting basic forwarding needs in general text generation or low-risk interaction scenarios. However, in scenarios requiring networked evidence or citation binding, if the proxy forwards directly according to the order of fragment arrival, issues may arise such as: text fragments arriving at the client before corresponding search evidence fragments; text content not yet being bound to the citation source; evidence relationships from different search rounds being mixed; and fragments before and after policy adjustments using different access criteria. While these issues may not necessarily affect the display of ordinary content, they can reduce the consistency between streaming response content and evidence sources in businesses with high real-time requirements, high factual accuracy requirements, or those requiring audit traceability.

[0005] Furthermore, streaming responses typically exhibit continuous output during transmission. Proxy servers need to ensure a good response experience for clients while also appropriately caching, validating, and releasing fragments involving evidence dependencies. If caching is too lenient, it may lead to premature output of content before the evidence is closed; if caching is too conservative, it may cause excessively long streaming response pauses, impacting the client's interactive experience. Therefore, a processing mechanism needs to be established on the proxy server side that balances streaming output efficiency, fragment order control, evidence admission assessment, and auditing of the release process.

[0006] Based on this, the present invention proposes a streaming response fragmentation order-preserving proxy forwarding method. Summary of the Invention

[0007] To address the shortcomings of existing technologies, the present invention aims to provide a streaming response fragmentation and order-preserving proxy forwarding method.

[0008] To achieve the above objectives, the present invention provides the following technical solution: A streaming response fragmentation and order-preserving proxy forwarding method is applied to a proxy server located between a client and an upstream service, where the upstream services include an upstream generation service and a network search service. The method includes: S1 receives the streaming response request sent by the client, establishes a streaming session identifier for the streaming response request, and configures a streaming response context including an evidence ordering cache window under the streaming session identifier; the streaming response context is used to maintain the cache state, fragment forwarding order state, search round state, policy snapshot state, and release order audit state of the streaming response fragments. S2, determine the routing policy state based on the streaming response request; the routing policy state includes service indication information for indicating upstream generation services and network search services, as well as a current valid policy snapshot, which includes a set of evidence admission control rules for controlling evidence admission and fragment forwarding; S3 obtains multiple streaming response fragments from the upstream generation service and network search service indicated by the routing policy status, and configures response fragment description information for each streaming response fragment; S4. Based on the response fragment description information and the evidence admission control rule set in the current effective policy snapshot, cache and evaluate the evidence admission of the streaming response fragment to obtain the evidence admission evaluation result. S5, based on the evidence access assessment results, performs forwarding control on streaming response fragments.

[0009] In one embodiment, the streaming response context includes at least an evidence ordering cache window for caching streaming response fragments, a next fragment number to be forwarded for determining the fragment forwarding order, a forwarded fragment record table for recording forwarded streaming response fragments, a current valid search round identifier for recording search rounds, a current policy snapshot identifier for recording current valid policy snapshots, and a release order audit record table for recording release order audit information.

[0010] In one embodiment, the streaming response context further includes a search round status table and a streaming response status; the search round status table includes the currently valid search round identifier and the search round status corresponding to each search round identifier.

[0011] In one embodiment, determining the routing policy state in S2 includes: performing intelligent routing on the streaming response request to obtain the target upstream generation service, the target network search service, and the intelligent routing policy snapshot; identifying the target upstream generation service and the target network search service as the upstream generation service and network search service indicated by the service indication information; binding the intelligent routing policy snapshot with the streaming session identifier, using the intelligent routing policy snapshot as the currently valid policy snapshot, and determining the current policy snapshot identifier based on the intelligent routing policy snapshot.

[0012] In one embodiment, the response fragment description information includes basic fragment information, evidence association information, and admission verification information. The basic fragment information is used to record the fragment number, fragment type, and fragment content of the streaming response fragment. The fragment type includes text fragments, search evidence fragments, reference binding fragments, search round fragments, correction fragments, and end fragments. The evidence association information is used to represent the evidence dependency relationship and reference binding relationship between the text fragments, search evidence fragments, and reference binding fragments. The admission verification information is used to represent the source validity status corresponding to the streaming response fragment, the search round consistency status corresponding to the current valid search round identifier, and the policy snapshot consistency status corresponding to the current policy snapshot identifier.

[0013] In one embodiment, S4, caching and evidence admission assessment of streaming response fragments includes: storing the streaming response fragments to be assessed for evidence admission into the evidence ordering cache window; establishing evidence dependencies among text fragments, search evidence fragments, and reference binding fragments according to the evidence admission control rule set in the current effective policy snapshot, and determining the text fragments to be assessed; and generating evidence admission assessment results including the evidence lag distance, text commitment strength, and evidence lag admission threshold corresponding to the text fragments to be assessed.

[0014] In one embodiment, generating the evidence lag distance corresponding to the text segment to be evaluated includes: for any text segment in the evidence order-preserving cache window, determining the text segment to be evaluated, and generating the evidence lag feature vector corresponding to the text segment to be evaluated; the evidence lag feature vector includes an ordinal lag component, a time lag component, an evidence closure gap component, and an admission verification gap component; normalizing each component in the evidence lag feature vector, and fusing them according to the component weights configured in the evidence admission control rule set to obtain the evidence lag distance of the text segment to be evaluated.

[0015] In one embodiment, generating the text commitment strength corresponding to the text segment to be evaluated includes: performing semantic risk identification on the content of the text segment to be evaluated according to the evidence access control rule set, and generating a text commitment feature vector corresponding to the text segment to be evaluated; the text commitment feature vector includes a factual certainty component, a numerical time-sensitive component, a domain risk component, and a decision impact component; and performing risk-weighted aggregation on the text commitment feature vector according to the risk weights configured in the evidence access control rule set to obtain the text commitment strength of the text segment to be evaluated.

[0016] In one embodiment, generating the evidence lag admission threshold corresponding to the text segment to be evaluated includes: generating the evidence lag admission threshold corresponding to the text segment to be evaluated based on the evidence admission control rule set, the text commitment strength, and the admission verification information.

[0017] In one embodiment, S5 performs forwarding control on streaming response fragments, which includes: determining the forwarding status of streaming response fragments in the evidence ordering cache window based on the streaming response context, response fragment description information, and evidence admission assessment results; the forwarding status includes an allowed forwarding status, a paused forwarding status, and an ended forwarding status. When a streaming response fragment is in the forwarding allowed state, the corresponding streaming response fragment is forwarded to the client, and the next fragment to be forwarded sequence number, the forwarded fragment record table, and the release sequence audit record table are updated. When a streaming response fragment is in a paused forwarding state, the forwarding of the corresponding streaming response fragment is paused, and dynamic control operations are performed. The dynamic control operations include at least one of the following: waiting to search for evidence fragments, triggering supplementary network search, adjusting the evidence ordering cache window, or recording release order audit information. When the end fragment arrives and there are no streaming response fragments in the evidence ordering cache window that have not completed the evidence admission assessment, the end fragment is determined to be in the end forwarding state and forwarded to the client.

[0018] Compared with the prior art, the present invention has the following beneficial effects: This invention sets up a proxy server between the client and the upstream service, and establishes a streaming session identifier and streaming response context when receiving streaming response requests. It integrates the cache status, forwarding order status, search round status, policy snapshot status, and release order audit status of streaming response fragments into the same session dimension for maintenance. This is beneficial for unified management of streaming response fragments arriving from multiple sources and asynchronously, and improves the consistency of fragment caching, order control, and forwarding records. By determining the routing policy state based on the streaming response request and configuring service indication information and the current effective policy snapshot in the routing policy state, the proxy server can apply unified admission constraints to streaming response fragments from different sources based on the participation of upstream generation services and network search services, as well as the evidence admission control rule set in the current effective policy snapshot, thereby reducing mismatches between text fragments, search evidence fragments, and policy states. By configuring response fragment description information for multiple obtained streaming response fragments, and performing caching and evidence admission assessment based on the response fragment description information and evidence admission control rule set, and then executing forwarding control based on the evidence admission assessment results, it is beneficial to ensure the continuity of streaming responses while controlling the processing of fragments whose evidence does not meet the admission conditions, thereby improving the accuracy, controllability, and auditability of streaming response fragment order-preserving proxy forwarding. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating a streaming response fragmentation and order-preserving proxy forwarding method according to the present invention. Figure 2 This is a schematic diagram illustrating the structure between the client, proxy server, upstream service, upstream generation service, and network search service in this invention; Figure 3 This is a schematic diagram illustrating the mapping relationship between streaming response fragments, response fragment description information, evidence dependencies, and reference binding relationships in this invention. Detailed Implementation

[0020] Reference Figures 1 to 3 A streaming response fragmentation and order-preserving proxy forwarding method is applied to a proxy server located between a client and an upstream service, where the upstream services include an upstream generation service and a network search service. The method includes: S1 receives the streaming response request sent by the client, establishes a streaming session identifier for the streaming response request, and configures a streaming response context including an evidence ordering cache window under the streaming session identifier; the streaming response context is used to maintain the cache state, fragment forwarding order state, search round state, policy snapshot state, and release order audit state of the streaming response fragments. After receiving a streaming response request from a client, the proxy server reads the request time, client session information, request content summary, and request source information from the streaming response request. It then generates a streaming session identifier based on the request timestamp, client session information, and a random salt value, and establishes a streaming response context under this identifier. The streaming response context is written into the evidence ordering cache window, the next fragment to be forwarded sequence number, the forwarded fragment record table, the current valid search round identifier, the current policy snapshot identifier, the release order audit record table, the search round status table, and the streaming response status. Specifically, the evidence ordering cache window stores streaming response fragments that have not yet been released; the next fragment to be forwarded sequence number records the minimum fragment number currently allowed for release; the forwarded fragment record table records the fragment number, forwarding time, and corresponding release basis of the streaming response fragments already forwarded to the client; and the release order audit record table records the streaming session identifier, fragment number, release time, cache status before release, and cache status after release for each release action. For example, when a client initiates a question-and-answer request with a network search requirement, the proxy server generates a streaming session identifier for the request, initializes the next fragment sequence number to be forwarded to one, initializes the streaming response status to receiving, and initializes the current valid search round identifier to the first search round identifier. The proxy server establishes a search round status table within the streaming response context and writes the currently valid search round identifier into the search round status table. The search round status table stores the search round status corresponding to each search round identifier. The search round status includes one or more of the following: waiting for search evidence, receiving search evidence, search evidence completed, and search round expired. When the network search service returns the first batch of search evidence fragments, the proxy server records the search round status corresponding to the first search round identifier as "receiving search evidence" and puts the corresponding streaming response fragment into the evidence ordering cache window. When the upstream... If a service returns a text fragment ahead of schedule but the search evidence fragment that the text fragment depends on has not yet arrived, the evidence ordering cache window maintains the cached state of the text fragment, the sequence number of the next fragment to be forwarded is not moved forward, and the release record of the text fragment is not written to the already forwarded fragment record table; when the search evidence fragment corresponding to the text fragment arrives and completes the matching, the streaming response context updates the cache state, fragment forwarding order state, search round state, policy snapshot state, and release order audit state, so that streaming response fragments under the same streaming session identifier are managed in an orderly manner according to evidence constraints and fragment sequence number constraints.

[0021] S2, determine the routing policy state based on the streaming response request; the routing policy state includes service indication information for indicating upstream generation services and network search services, as well as a current valid policy snapshot, which includes a set of evidence admission control rules for controlling evidence admission and fragment forwarding; Under the condition that the streaming session identifier has been established, the proxy server reads the request content, network search requirements, risk level, timeliness requirements, client identity information, and call constraint information from the streaming response request, and performs intelligent routing based on the above information to obtain the target upstream generation service, the target network search service, and a snapshot of the intelligent routing policy. The intelligent routing policy snapshot records the service selection basis, evidence admission control rule set, fragment forwarding control parameters, search round constraints, reference binding constraints, and policy effective time corresponding to this streaming response request. For example, when a streaming response request involves real-time policy interpretation, the proxy server combines the upstream generation service with long text generation capabilities with the target network search service with real-time network retrieval capabilities into the service combination for this request, and writes a higher-level evidence access control rule set into the intelligent routing policy snapshot. The proxy server writes the target upstream generation service and the target network search service into the service indication information, making the service indication information point to the upstream generation service and network search service actually called by this streaming response request. The proxy server binds the smart routing policy snapshot with the streaming session identifier, registers the smart routing policy snapshot as the currently valid policy snapshot, and generates the current policy snapshot identifier based on the version number, generation time, rule set summary, and streaming session identifier of the smart routing policy snapshot. Streaming response fragments obtained under the same streaming session identifier are all associated with this current policy snapshot identifier. When making evidence admission and fragment forwarding judgments, the proxy server processes the evidence admission control rule set in the currently valid policy snapshot to avoid inconsistencies in policy interpretation between different streaming response fragments for the same streaming response request.

[0022] The evidence access control rule set is denoted as: in, For fragmentation type admission rules, For evidence-dependent closure rules, To reference the complete binding rule, The rules for determining the validity of the source are as follows: The rules for determining the consistency of search rounds are as follows: Rules for determining the consistency of policy snapshots; As the component weight of the evidence lag distance, Risk weight for the strength of commitment in the main text; This is the upper limit of the ordinal normalization. The upper limit of time normalization, To compensate for the network search trigger time, Maximum waiting time To minimize the waiting increment, The maximum cache size for the evidence-preserving cache window. To compensate for the limit on the number of online searches, As the baseline admission threshold, The lower limit of the threshold. The upper limit of the threshold, The penalty coefficient for the commitment in the main text. The penalty coefficient for admission verification. To prevent constants with a denominator of zero.

[0023] The parameter source sequence is denoted as: in, The calling constraint parameters carried by the streaming response request. Fragment forwarding control parameters recorded in the snapshot of the intelligent routing policy. Configure local parameters for the proxy server. The same parameters are used in... When both exist, the proxy server will proceed according to... The order of the non-null values ​​is read first.

[0024] The rule for factual statements is denoted as follows: in, For entity recognition terms or entity recognition rules, For predicate identification terms or predicate identification rules, Identify terms or rules for identifying definitive conclusions; This is a list of time-sensitive terms. For the term list of decision-making influences, This is a domain risk mapping table.

[0025] The historical audit sample set is denoted as: in, For the first Release audit sample corresponding to each historical request. For the number of historical requests, For historical request sequence numbers, . For the set of historical evidence arrival times, This is the set of historical fragmentation sequence intervals. This is a set of historical concurrent cache counts. This is a set of historical numerical time-sensitive terms. This is the set of terms that represent the impact of historical decisions.

[0026] Each release audit sample At least including: and the lag in historical evidence Historical text commitment strength Historical access verification gap components Historical release status and historical feedback status . This indicates that the corresponding historical text fragment has been released. This indicates that the corresponding historical text segment has been paused or modified; This indicates that after the corresponding historical text fragment was released, there were records of inconsistent evidence, missing citations, inconsistent search rounds, or inconsistent strategy snapshots. This indicates that the aforementioned record does not exist. For parameter adjustment period, A maximum number of historical requests must be reserved. The above parameters must satisfy: Represents a set of numbers The percentile, .set up: in, For set The number of elements, for The set sorted from smallest to largest. hour, hour, Retrieve the default value of the empty set for the corresponding parameter. The proxy server adjusts its cycle according to the parameters. Update historical audit sample set Collection of historical evidence arrival times Historical fragmentation sequence interval set Historical concurrent cache count set Historical numerical time-sensitive term count set The set of terms influenced by historical decisions . Recorded by a snapshot of the currently effective policy; When empty, Hours. The proxy server retains the most recent update each time. Data corresponding to each historical request; When empty, After the parameters are updated, a new rule set summary and a new current policy snapshot identifier are generated; the currently valid policy snapshots already registered under the same streaming session identifier remain unchanged, and the new parameters take effect under the new streaming session identifier.

[0027] The original component weights of the evidence lag distance are denoted as: The original risk weight for the strength of the commitment in the main text is denoted as: The proxy server is based on a historical audit sample set. Obtain and . No. The historical abnormal contribution value of each evidence lag component is denoted as , No. The historical anomaly contribution value of each text commitment component is denoted as: : when and hour, when or hour, After normalization, in, For the first Normalized weights of the lag components of evidence. For the first The normalized weights of each text commitment component satisfy: The set of historical evidence arrival times is denoted as: in, For the first The time elapsed from the establishment of the network search service connection to the arrival of the evidence ordering cache window in each historical request for a search evidence fragment. The set of historical fragment order intervals is denoted as: in, For the first The absolute difference between the sequence number of the main text segment in each historical request and the sequence number of the first matching search evidence segment. When not empty, When empty, When not empty, When empty, When empty, Milliseconds. The upper limit of order normalization, the upper limit of time normalization, the supplementary network search trigger time, and the maximum waiting time are obtained using the following formula: The set of historical concurrent cache counts is denoted as: in, For the first The maximum number of streaming response fragments that can simultaneously remain in the evidence ordering cache window during the evidence admission assessment phase for each historical request. When not empty, ; When empty, The maximum number of cached items and the maximum number of supplementary network searches for the evidence-preserving cache window are obtained using the following formula: in, for The 50th percentile, for The 90th percentile, for The 50th percentile, for The 90th percentile, for The 90th percentile. and The units are all milliseconds; and All are dimensionless values. and All are positive integers.

[0028] S3 obtains multiple streaming response fragments from the upstream generation service and network search service indicated by the routing policy status, and configures response fragment description information for each streaming response fragment; Based on the service indication information in the routing policy state, the proxy server establishes streaming connections with the upstream generation service and the network search service indicated by the routing policy state, respectively. Under the same streaming session identifier, it receives text fragments, correction fragments, and end fragments from the upstream generation service, as well as search round fragments, search evidence fragments, and reference binding fragments from the network search service. When the proxy server receives each streaming response fragment, it generates a fragment sequence number according to the arrival time, source service, streaming session identifier, and logical position of the fragment. It then writes the fragment sequence number, fragment type, and fragment content into the basic fragment information. The fragment type is determined from the text fragment, search evidence fragment, reference binding fragment, search round fragment, correction fragment, and end fragment. For example, the network search service first returns the search round fragments and several search evidence fragments corresponding to the first search round. The upstream generation service returns the text fragments formed for the search evidence content within the search round. The proxy server configures consecutive fragment numbers for the above streaming response fragments and saves the original fragment content of each streaming response fragment. The proxy server supplements each streaming response fragment with evidence association information and admission verification information. The evidence association information records the evidence dependency relationship and reference binding relationship between the text fragment, the search evidence fragment, and the reference binding fragment. The admission verification information records the source validity status corresponding to the streaming response fragment, the search round consistency status corresponding to the current valid search round identifier, and the policy snapshot consistency status corresponding to the current policy snapshot identifier. For example, when the content of a text fragment relates to a real-time data conclusion, the proxy server establishes an evidence dependency relationship between the text fragment and the corresponding search evidence fragment, and writes the reference position, evidence number, and text fragment sequence number recorded in the reference binding fragment into the evidence association information; if the search evidence fragment comes from the target network search service pointed to by the service indication information, and its search round identifier is equal to the current valid search round identifier, and its policy snapshot identifier is equal to the current policy snapshot identifier, then the admission verification information records the source validity status as valid, the search round consistency status as consistent, and the policy snapshot consistency status as consistent, forming response fragment description information that can enter the evidence admission assessment.

[0029] When the proxy server establishes a streaming connection with the target's upstream generation service and the target's network search service, it generates a connection token. and the transmission connection identifier Write to the set of valid transport connections Write the target service identifier into the target service identifier set. Streaming response fragmentation The streaming session identifier is denoted as The segment number is recorded as The fragmentation type is denoted as The normalized string of the fragmented content is denoted as The source service identifier is recorded as The transmission connection identifier is denoted as The search round identifier is denoted as The policy snapshot identifier is recorded as . It is obtained by removing transport layer line breaks from fragmented content, unifying character encoding, and preserving the original semantic order. Current effective strategy snapshot record digest algorithm. , When empty, The proxy server calculates the verification digest: in, Indicates field concatenation operator. for Corresponding connection token. Streaming response fragmentation. The carried signature digest is The set of valid signature digests is: The validity status of the source is obtained by the following formula: in, This indicates that the source is valid. This indicates that the source's validity status is abnormal. (Search round status table) The corresponding search round status is denoted as The current valid search round identifier is denoted as The current policy snapshot identifier is recorded as The search round consistency state and the policy snapshot consistency state are obtained by the following formula: in, This indicates that the search rounds are consistent, meaning the status is consistent. This indicates that the search rounds are consistent and the status is abnormal. This indicates that the policy snapshot is consistent and the state is consistent. This indicates that the policy snapshot consistency status is abnormal.

[0030] The text segments to be evaluated are denoted as , The fragment number is Arrival time is The content of the segment is . The set of matching search evidence fragments is denoted as The matching reference to the bound shard collection is denoted as The set of matched search evidence fragments is denoted as The matched reference-bound shard collection is denoted as Any reference bound to a shard. Record at least the text segment number. Evidence Number Reference location Search round identifier and policy snapshot identifier Any search evidence fragment At least record the evidence number. Search round identifier Strategy snapshot identifier Segment number Arrival time and segmented content The matching rules for referencing binding shards and searching evidence shards are as follows: in, Bind shards to references The recorded text segment number, Bind shards to references Recorded reference location, Bind shards to references The search round identifier carried. Bind shards to references The policy snapshot identifier carried, For searching evidence fragments Evidence number, For searching evidence fragments The fragment number, For searching evidence fragments Arrival time, For searching evidence fragments The content is divided into segments.

[0031] Content in segments The set of placeholder evidence markers in the data is denoted as , It is obtained by matching the evidence number, reference position, or reference binding fragment sequence number carried by the text fragment. The entity set function is denoted as... The predicate set function is denoted as The set function of deterministic conclusions is denoted as and All are based on the rule table of factual statements Perform a match. The entity set, predicate set, and deterministic conclusion set are respectively: The set of factual statements is denoted as: in, For the first A factual statement segment. It should match the set of search evidence fragments. Obtained by the following formula: in, This is a virtual evidence number to be bound. Evidence fragments for searching exist. satisfy: hour, Marked as matched. The matching references should be bound to the shard collection. Obtained by the following formula: when contain hour, in, Bind a shard to the virtual reference to be bound. Matched and referenced position cover When making factual statements, Mark as matched.

[0032] S4. Based on the response fragment description information and the evidence admission control rule set in the current effective policy snapshot, cache and evaluate the evidence admission of the streaming response fragment to obtain the evidence admission evaluation result. After obtaining the response fragment description information, the proxy server classifies and registers the streaming response fragments that enter the same streaming session identifier according to the fragment sequence number, fragment type and fragment content in the basic fragment information. It writes the streaming response fragments that need to participate in the evidence admission assessment from the text fragments, search evidence fragments and reference binding fragments into the evidence ordering cache window, and retains the arrival time, source service, current valid search round identifier, current policy snapshot identifier and cache location of each streaming response fragment. For example, when the text fragment with fragment number twelve arrives before the search evidence fragment it depends on, the text fragment is placed in the evidence ordering cache window, the cache status is recorded as pending evaluation, and the fragment forwarding order status is still controlled by the next fragment number to be forwarded. The proxy server performs association matching on the text fragments, search evidence fragments, and reference binding fragments within the evidence ordering cache window according to the evidence admission control rule set in the current effective policy snapshot. Based on the evidence dependency and reference binding relationships in the evidence association information, it determines the text fragment to be evaluated and checks whether the search evidence fragment corresponding to the text fragment to be evaluated is complete, whether the reference binding fragment covers the factual statements in the text fragment, and whether the source validity status, search round consistency status, and policy snapshot consistency status in the admission verification information meet the rule requirements. For example, when a text segment records a real-time price conclusion, the proxy server searches for search evidence segments and reference binding segments under the same currently valid search round identifier, and includes the text segment to be evaluated. Let the evaluation time be Text segmentation to be evaluated The evidence lag feature vector is: in, For the lag component, For time lag components, For evidence to close the gap component, For access verification of gap components. When When not empty, when When empty, in, The reference sequence number of the matched fragment. The reference arrival time for the matched fragments. For matched fragments The fragment number, For matched fragments The arrival time. The components of the evidence lag eigenvector are calculated using the following formula: Evidence lag distance Calculate using the following formula: in, The range of values ​​is .

[0033] Step 4, the proxy server is based on and Calculate the text fragments to be evaluated The feature vector of the commitment in the text: in, For the component of factual certainty, It is a time-sensitive component. As a measure of risk in the field, The component affecting decision-making. The component of factual certainty. Obtained by the following formula: The sets of historical numerical time-sensitive terms and the sets of historical decision-influence terms are respectively: in, For the first The history request corresponds to a specific text segment. The number of terms, For the first The history request corresponds to a specific text segment. The number of terms. The upper limit of term normalization is obtained by the following formula: for hit The number of terms, for hit The number of terms. The numerical time-sensitive component and the decision influence component are obtained by the following formula: Domain risk mapping table is denoted as in, For the first Each category for The corresponding domain risk value, Number of domain categories. Historical audit sample set. China belongs to the field category The sample set is denoted as , The number of samples is denoted as The number of abnormal samples is denoted as The domain risk value is obtained using the following formula: in, The preset risk levels are defined as follows: general information corresponds to 0, real-time policy information and market information queries correspond to 0.5, and medical, financial transactions, legal conclusions, and safe operations correspond to 1. The text segment to be evaluated is shown below. The field category is Risk weight in the field Obtained by the following formula: Commitment strength in the main text Calculate using the following formula: in, The range of values ​​is .

[0034] Text segmentation to be evaluated The request risk level is recorded as ,and Obtained from the risk level field in the streaming response request; if this field is empty, Take domain risk component The distance sets for abnormal samples and normal samples are as follows: when and When none are empty, when or When empty, in, and These are the normal sample distance sets. The 10th percentile, 50th percentile, and 90th percentile. The main text's commitment penalty benchmark is denoted as... The admission verification penalty benchmark is recorded as The two are obtained by the following formula: Risk threshold adjustment factor in accordance with and Obtained: The penalty adjustment coefficients for the main text commitment and the access verification penalty adjustment coefficients are as follows: The baseline admission threshold, the text commitment penalty coefficient, and the admission verification penalty coefficient are obtained using the following formulas: Text segmentation to be evaluated The evidence lag threshold is denoted as Obtained by the following formula: in, and All are non-negative numbers. The range of values ​​is The proxy server will and Include it in the evidence access assessment results.

[0035] For example, when a text segment contains specific dates, price values, and decision recommendations, its factual certainty component, numerical time-sensitive component, and decision impact component are all assigned higher risk values. If the reference binding segment has not yet arrived, the evidence closure gap component increases, the evidence lag distance exceeds the evidence lag admission threshold, and the text segment remains in the evidence ordering cache window waiting for further forwarding control.

[0036] S5, based on the evidence access assessment results, performs forwarding control on streaming response fragments.

[0037] The proxy server determines the forwarding status of each streaming response fragment in the evidence ordering cache window based on the streaming response context, response fragment description information, and evidence admission assessment results. The forwarding status is selected from the allowed forwarding status, paused forwarding status, and ended forwarding status. The proxy server reads the next fragment number to be forwarded and takes the streaming response fragment whose fragment number in the evidence ordering cache window is equal to the next fragment number to be forwarded as the current judgment object. It then makes a forwarding determination based on the fragment type, evidence dependency relationship, reference binding relationship, source validity status, search round consistency status, policy snapshot consistency status, evidence lag distance, text commitment strength, and evidence lag admission threshold of the streaming response fragment. The next segment number to be forwarded is denoted as Text segmentation to be evaluated The fragment number is The end of the segment is recorded as , The fragment number is .when hour, If it is not currently considered as a judgment object, its cache state remains unchanged. At the same time, The forwarding status is set to allow forwarding; the proxy server will Forwarded to the client, and Update the sequence number to the adjacent unforwarded fragment number, and simultaneously update the forwarded fragment record table and the release sequence audit record table. And if any of the following conditions are met, The forwarding status is paused. When the fragmentation ends Upon arrival, there are no streaming response fragments in the evidence ordering cache window that have not completed evidence admission assessment, and hour, The forwarding status is "Ended Forwarding". Streaming response fragments that have not completed the evidence access assessment include those with an empty forwarding status, a paused forwarding status, or lacking evidence access assessment results.

[0038] A single record in the release sequence audit record table is recorded as follows: in, For streaming session identification, This is the fragment number. It is a fragment type. In forwarding status, For evidence lag distance, For the strength of the commitment in the main text, As a threshold for evidence lag admission, For evidence to close the gap component, To verify the gap components for entry, This serves as the identifier for the current valid search round. This serves as the snapshot identifier for the current policy. In order to release the basis for judgment, To release the cache location, The location to release the cache. Release time. Release judgment criteria. Including distance access markers Evidence Closure Markers , Verification consistency mark Serial number matching mark and termination condition marker Each mark is obtained using the following formula: The cache locations before and after release are as follows: in, and This refers to the order of the streaming response fragments within the evidence ordering buffer window. and This is a cached state. The corrected shard carries the corrected field: in, The segment number of the text segment being modified. To correct the cause, To correct the previous fragment content, This is the corrected content of the fragments. The value is taken from the following: evidence not closed, incomplete reference binding, abnormal source validity status, abnormal search round consistency status, and abnormal policy snapshot consistency status. When a corrected fragment enters the evidence ordering cache window, its fragment sequence number is generated according to the fragment logical position under the current streaming session identifier; when a forwarded text fragment is corrected, the corrected fragment is treated as an independent fragment to be evaluated and undergoes evidence admission evaluation.

[0039] For example, the search evidence fragment and the reference binding fragment corresponding to the text fragment with fragment number 20 have both arrived, and although the text commitment strength is high, the evidence closure is complete. The proxy server releases the text fragment to the client and adjusts the next fragment number to be forwarded to 21. Text segmentation awaiting evaluation while forwarding is paused. The waiting time is recorded as The number of online searches is recorded as follows. The current cache size of the evidence ordering cache window is denoted as . .in, for From arrival at the evidence ordering cache window to the evaluation time Duration for The cumulative number of times supplementary online searches have been triggered. To assess the number of streaming response fragments that have not yet been released within the time-sensitive evidence-preserving buffer window, when multiple conditions are met simultaneously, the dynamic control operation is executed according to the following priority: Dynamic control operation is determined by the following formula: When adjusting the evidence ordering cache window, the proxy server removes search evidence fragments and reference-bound fragments whose search round status is expired from the evidence ordering cache window and writes them to the release order audit log table. Corrected fragments delete factual statements corresponding to unclosed evidence dependencies and include the fragment number of the corrected text fragment, the reason for the correction, the current valid search round identifier, and the current policy snapshot identifier.

[0040] When the end fragment arrives, the proxy server checks whether there are still streaming response fragments in the evidence ordering cache window that have not completed the evidence admission assessment. If there are no streaming response fragments that have not completed the evidence admission assessment, the proxy server determines the end fragment to be in the end forwarding state and forwards it to the client. At the same time, it records the arrival time, end forwarding time, window clearing status and streaming response status of the end fragment in the release order audit log table to ensure that streaming response fragments under the same streaming session identifier have completed the evidence admission assessment and ordering release before the end.

[0041] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A streaming response fragmentation and order-preserving proxy forwarding method, characterized in that, Applied to a proxy server located between the client and upstream services, including upstream generation services and network search services, the method includes: S1 receives the streaming response request sent by the client, establishes a streaming session identifier for the streaming response request, and configures a streaming response context including an evidence ordering cache window under the streaming session identifier; the streaming response context is used to maintain the cache state, fragment forwarding order state, search round state, policy snapshot state, and release order audit state of the streaming response fragments. S2, determine the routing policy state based on the streaming response request; the routing policy state includes service indication information for indicating upstream generation services and network search services, as well as a current valid policy snapshot, which includes a set of evidence admission control rules for controlling evidence admission and fragment forwarding; S3 obtains multiple streaming response fragments from the upstream generation service and network search service indicated by the routing policy status, and configures response fragment description information for each streaming response fragment; S4. Based on the response fragment description information and the evidence admission control rule set in the current effective policy snapshot, cache and evaluate the evidence admission of the streaming response fragment to obtain the evidence admission evaluation result. S5, based on the evidence access assessment results, performs forwarding control on streaming response fragments.

2. The streaming response fragmentation and order-preserving proxy forwarding method according to claim 1, characterized in that, The streaming response context includes at least an evidence ordering cache window for caching streaming response fragments, a next fragment number to be forwarded for determining the fragment forwarding order, a forwarded fragment record table for recording forwarded streaming response fragments, a current valid search round identifier for recording search rounds, a current policy snapshot identifier for recording current valid policy snapshots, and a release order audit record table for recording release order audit information.

3. The streaming response fragmentation and order-preserving proxy forwarding method according to claim 2, characterized in that, The streaming response context also includes a search round status table and a streaming response status; the search round status table includes the currently valid search round identifier and the search round status corresponding to each search round identifier.

4. The streaming response fragmentation and order-preserving proxy forwarding method according to claim 3, characterized in that, Determining the routing policy state in S2 includes: executing intelligent routing for streaming response requests to obtain the target upstream generation service, the target network search service, and intelligent routing policy snapshots; identifying the target upstream generation service and the target network search service as the upstream generation service and network search service indicated by the service indication information; binding the intelligent routing policy snapshot with the streaming session identifier, using the intelligent routing policy snapshot as the currently valid policy snapshot, and determining the current policy snapshot identifier based on the intelligent routing policy snapshot.

5. The streaming response fragmentation and order-preserving proxy forwarding method according to claim 1, characterized in that, The response fragment description information includes basic fragment information, evidence association information, and admission verification information; the basic fragment information is used to record the fragment number, fragment type, and fragment content of the streaming response fragment; Sharding types include text shards, search evidence shards, reference binding shards, search round shards, correction shards, and end shards; Evidence association information is used to represent the evidence dependency and reference binding relationships between text fragments, search evidence fragments, and reference binding fragments; The admission verification information is used to indicate the source validity status corresponding to the streaming response fragment, the search round consistency status corresponding to the current valid search round identifier, and the policy snapshot consistency status corresponding to the current policy snapshot identifier.

6. The streaming response fragmentation and order-preserving proxy forwarding method according to claim 5, characterized in that, In S4, caching and evidence admission assessment of streaming response fragments includes: storing the streaming response fragments requiring evidence admission assessment into the evidence ordering cache window; establishing evidence dependencies among text fragments, search evidence fragments, and reference binding fragments according to the evidence admission control rule set in the current effective policy snapshot, and determining the text fragments to be assessed; and generating evidence admission assessment results including the evidence lag distance, text commitment strength, and evidence lag admission threshold corresponding to the text fragments to be assessed.

7. The streaming response fragmentation and order-preserving proxy forwarding method according to claim 6, characterized in that, Generating the evidence lag distance corresponding to the text fragment to be evaluated includes: for any text fragment in the evidence order-preserving cache window, determining that text fragment as the text fragment to be evaluated, and generating the evidence lag feature vector corresponding to the text fragment to be evaluated; the evidence lag feature vector includes the ordinal lag component, the temporal lag component, the evidence closure gap component, and the admission verification gap component; normalizing each component in the evidence lag feature vector, and fusing them according to the component weights configured in the evidence admission control rule set to obtain the evidence lag distance of the text fragment to be evaluated.

8. The streaming response fragmentation and order-preserving proxy forwarding method according to claim 7, characterized in that, Generating the text commitment strength corresponding to the text segment to be evaluated includes: performing semantic risk identification on the content of the text segment to be evaluated according to the evidence access control rule set, and generating the text commitment feature vector corresponding to the text segment to be evaluated; the text commitment feature vector includes factual certainty component, numerical time-sensitive component, domain risk component and decision impact component; according to the risk weight configured in the evidence access control rule set, the text commitment feature vector is risk-weighted and aggregated to obtain the text commitment strength of the text segment to be evaluated.

9. A streaming response fragmentation and order-preserving proxy forwarding method according to claim 8, characterized in that, Generating the evidence lag admission threshold for the text segment to be evaluated includes: generating the evidence lag admission threshold for the text segment to be evaluated based on the evidence admission control rule set, the text commitment strength, and the admission verification information.

10. A streaming response fragmentation and order-preserving proxy forwarding method according to any one of claims 1-9, characterized in that, In S5, forwarding control for streaming response fragments includes: determining the forwarding status of streaming response fragments in the evidence ordering buffer window based on the streaming response context, response fragment description information, and evidence admission evaluation results; the forwarding status includes allowed forwarding, paused forwarding, and terminated forwarding. When a streaming response fragment is in the forwarding allowed state, the corresponding streaming response fragment is forwarded to the client, and the next fragment to be forwarded sequence number, the forwarded fragment record table, and the release sequence audit record table are updated. When a streaming response fragment is in a paused forwarding state, the forwarding of the corresponding streaming response fragment is paused, and dynamic control operations are performed. The dynamic control operations include at least one of the following: waiting to search for evidence fragments, triggering supplementary network search, adjusting the evidence ordering cache window, or recording release order audit information. When the end fragment arrives and there are no streaming response fragments in the evidence ordering cache window that have not completed the evidence admission assessment, the end fragment is determined to be in the end forwarding state and forwarded to the client.