A front-end display method and system combining fixed text and streaming output

By receiving a hybrid structure array combining fixed text returned by the server with streaming output, initializing the state object, temporary result array, and streaming output ID array, and sending streaming output requests in parallel, the problem of chaotic mixed display of front-end pages in AI systems is solved, achieving a coherent information flow experience and highly smooth rendering.

CN120804453BActive Publication Date: 2025-12-23SUZHOU RUIYUN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511277627.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-09
Publication Date
2025-12-23
Estimated Expiration
2045-09-09

AI Technical Summary

Technical Problem

In existing technologies, AI systems only support single-stream output, which cannot effectively support the information display needs in complex scenarios, resulting in chaotic mixed display of front-end pages.

Method used

By receiving a hybrid structure array combining fixed text and streaming output returned by the server, we initialize a state object, a temporary result array, and an ID array for streaming output. We then send streaming output requests in parallel and render the result combining fixed text and streaming output using a sequential typewriter.

Benefits of technology

It achieves zero-sequence-biased hybrid rendering, eliminates semantic confusion, provides a coherent information flow experience, maintains a high and smooth frame rate, reduces the cognitive burden on users, and enhances user trust.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804453B_ABST
    Figure CN120804453B_ABST
Patent Text Reader

Abstract

The application discloses a front-end display method and system combining fixed text and streaming output, and the method comprises the following steps: sending a service parameter request, receiving a hybrid structure array combining fixed text and streaming output in response to the server; determining a state object, a temporary result array and an Id array of streaming output in the hybrid structure array; based on the Id array of streaming output, sending all streaming output requests in parallel, and receiving streaming output results returned by the server; based on the streaming output results and the initialized hybrid structure array, rendering and displaying the service parameter request results combining fixed text and streaming output through a sequential typewriter; and through the interaction between the front end and the AI server, the return and analysis of a structured array are realized, the array mixes fixed text and streaming output elements, and the state object, the temporary result array and the Id array of streaming output are used to coordinate the display sequence and state of the two, so that the sequential and smooth display is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a front-end display method and system combining fixed text and streaming output. BACKGROUND

[0002] With the popularization of AI question and answer technology, streaming output has become a core technology for improving interactive immersion. However, the current mainstream AI system generally adopts a character-by-character streaming generation method for answers, and its output logic is still mainly in a single streaming channel. Specifically, the rendering process of fixed text (such as system prompts and operation instructions) and streaming content is independent of each other. This mode is difficult to meet the user's demand for information coherence and interactive flexibility in complex scenarios such as multi-turn dialogue and multi-modal content display.

[0003] In the prior art, the AI system only supports single streaming output, and only operates on the current single streaming output, which cannot effectively support the information display demand in complex scenarios. Further, if multiple fixed texts and multiple streaming outputs are mixed and displayed, since the fixed text is returned between AI servers, the front end can directly know the content to be displayed, but the streaming output still needs the front end to send a streaming output request again, wait for the return result of the streaming output, and there may be more than one streaming output request, possibly multiple streaming outputs. This causes confusion in the front-end page display.

[0004] Therefore, the prior art has obvious deficiencies in mixed display of the front-end page, and more advanced methods are needed to improve the coherence, real-time performance and accuracy of mixed display of the front-end page. It is necessary to provide a front-end display method combining fixed text and streaming output to solve the above problems. SUMMARY

[0005] The present application provides a front-end display method and system combining fixed text and streaming output to solve the problem of confusion in mixed display of the front-end page in the prior art.

[0006] In a first aspect, the embodiments of the present application provide a front-end display method combining fixed text and streaming output, comprising:

[0007] sending a business parameter request and receiving a mixed structure array combining fixed text and streaming output in response to the server, wherein the mixed structure array contains fixed text corresponding to the business parameter request;

[0008] determining the core data in the mixed structure array and initializing, wherein the core data includes a state object, a temporary result array and an Id array of streaming output;

[0009] Parallelly sending all streaming output requests based on the Id array of the streaming output, receiving the returned streaming output result of the server;

[0010] Based on the streaming output result and the initialized mixed structure array, rendering and displaying the business parameter request result combined with the fixed text and the streaming output by a sequential typewriter.

[0011] Optionally, the determining the core data in the mixed structure array and the initialization include:

[0012] Traversing each element in the mixed structure array and determining the element type;

[0013] If the element type is fixed text, setting the state of the state object of the element as completed, pushing the fixed text corresponding to the business parameter request into the temporary result array, and pushing null into the Id array of the streaming output;

[0014] If the element type is streaming output, setting the state of the state object of the element as waiting, pushing an empty array into the temporary result array, and pushing the id of the element into the Id array of the streaming output.

[0015] Optionally, the parallelly sending all streaming output requests based on the Id array of the streaming output, receiving the returned streaming output result of the server include:

[0016] Determining the non-null elements in the Id array of the streaming output;

[0017] Parallelly sending the streaming output request of the non-null elements;

[0018] Receiving the returned streaming output result of the server and pushing the streaming output result into the temporary result array.

[0019] Optionally, the rendering and displaying the business parameter request result combined with the fixed text and the streaming output based on the streaming output result and the initialized mixed structure array by a sequential typewriter include:

[0020] Traversing the streaming output result and the fixed text in the temporary result array to generate a display result array;

[0021] Based on the display result array, rendering and displaying the business parameter request result combined with the fixed text and the streaming output by a typewriter in the data structure order of the mixed structure array.

[0022] Optionally, the traversing the streaming output result and the fixed text in the temporary result array to generate a display result array include:

[0023] repeatedly traversing the temporary result array in the order of data structure in the mixed structure array through the first time interval timer;

[0024] until the state of the state object corresponding to the fixed text in the temporary result array and the streaming output result is complete, the traversal is stopped.

[0025] Optionally, the repeatedly traversing the temporary result array in the order of data structure in the mixed structure array through the first time interval timer comprises:

[0026] if the element type is fixed text and the state of the state object is complete, the fixed text content corresponding to the business parameter request is pushed into the display result array word by word at the first time of traversal, and is skipped in subsequent traversals;

[0027] if the element type is streaming output and the state of the state object is complete, the result of the streaming output is pushed into the display result array word by word, and in the next traversal, it is judged whether there is new content in the temporary result array, if yes, the new content is synchronized to the display result array word by word;

[0028] if the element type is streaming output and the state of the state object is processing, the result of the streaming output already existing in the temporary result array is pushed into the display result array word by word, and the traversal is stopped, the next traversal is repeated based on the first time interval timer, it is repeatedly judged whether there is new content in the temporary result array, if yes, the new content is synchronized to the display result array word by word.

[0029] Optionally, the rendering and displaying the business parameter request result combined with the fixed text and the streaming output based on the display result array through the sequential typewriter comprises:

[0030] the rendering and displaying the business parameter request result combined with the fixed text and the streaming output in the display result array through the sequential typewriter based on the second time interval timer;

[0031] if the display result array is displayed completely, it is judged whether the state in the state object is complete;

[0032] if not, the new content in the display result array is continuously rendered based on the second time interval timer;

[0033] if yes, the display is ended.

[0034] In a second aspect, the embodiments of the present application provide a front-end display system for fixed text and streaming output mixed display, which is used to execute the method for fixed text and streaming output mixed display, and comprises:

[0035] A first processing module is configured to send a service parameter request and receive a mixed structure array with fixed text and streaming output combined as a response of a server, wherein the mixed structure array contains fixed text corresponding to the service parameter request.

[0036] An initialization module is configured to determine core data in the mixed structure array and perform initialization, wherein the core data comprises a state object, a temporary result array and an Id array of streaming output.

[0037] A second processing module is configured to send all streaming output requests in parallel based on the Id array of streaming output and receive streaming output results returned by the server.

[0038] A display module is configured to render and display the service parameter request results of the fixed text and the streaming output combined based on the streaming output results and the initialized mixed structure array through a sequential typewriter.

[0039] (1) The present application synchronously constructs three core data structures of a state object, a temporary result array and a streaming ID array through receiving a mixed structure array (containing sequential arrangement of fixed text and streaming output) predefined by a server; the fixed text (marked as "completed" in the state) can immediately enter the rendering process, and the streaming output (marked as "waiting / processing" in the state) is accurately positioned and triggered by an ID to make parallel requests; compared with the interleaving misplacement problem caused by independent rendering of fixed text and streaming content in the prior art, the present application realizes mixed rendering with zero sequence deviation, strictly follows the business logic sequence set by the server (such as [fixed→streaming→fixed]), and completely eliminates semantic confusion; and the user can obtain a coherent information flow experience.

[0040] (2) The present application adopts two independent timers: a first timer (50 ms interval) polls state object changes, and synchronizes the newly added content in the temporary result array to the display result array according to the original sequence; a second timer (20 ms interval) renders the content of the display result array to the page word by word; through the double-timer mechanism, data synchronization and content display are decoupled; compared with the traditional scheme of single-threaded processing of data reception and rendering, the present application can maintain a high smooth frame rate even when facing a million-level character stream; and the user can perceive the "thinking-output" rhythm without stuttering.

[0041] (3) When the streaming output state is "processing", the arrived segment content is synchronized to the display result array in real time, and is rendered to the current position by 20ms timer; meanwhile, the context position of the unfinished streaming element is reserved, and the subsequent data is inserted incrementally when it arrives. Compared with the mode that the prior art needs to wait for the streaming content to be completely loaded before displaying, the present application realizes the progressive experience of "partially visible + dynamic growth", the user can observe the AI generation process in real time, reduces the user's cognitive burden, and enhances the user's trust in AI capability.

[0042] (4) The present application filters non-empty elements based on the streaming ID array, concurrently processes all streaming requests at one time, eliminates serial waiting delay; at the same time, the streaming result is anchored to the preset position of the temporary result array through sequential index (index), even if multiple streaming responses arrive out of order (such as stream_4 returns earlier than stream_2), it can also be returned to the original order. Compared with the network redundancy and position disorder caused by independent request in the traditional scheme, the present application effectively reduces invalid requests, maintains content sequence consistency in asynchronous scenarios, maintains response speed in complex business scenarios, and has strong expansibility.

[0043] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0045] Figure 1 A flow chart of a front-end display method combining fixed text and streaming output provided for the first embodiment of the present application;

[0046] Figure 2 A flow chart of a front-end display method combining fixed text and streaming output provided for the second embodiment of the present application;

[0047] Figure 3 A full flow chart of front-end and server interaction provided for the second embodiment of the present application;

[0048] Figure 4 A framework diagram of a front-end display system combining fixed text and streaming output provided for the third embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the person skilled in the art better understand the technical scheme of the present application, the technical scheme in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor should belong to the scope of protection of the present application.

[0050] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0051] Embodiment 1:

[0052] Figure 1 A flowchart of a front-end display method combining fixed text and streaming output is provided for Embodiment One of the present application. This embodiment can be applied to the mixed display of fixed text and streaming output. The method is applied to a front-end display system combining fixed text and streaming output. As shown in the figure, the method comprises: Figure 1

[0053] S110, sending a service parameter request and receiving a mixed structure array combining fixed text and streaming output in response to the server, wherein the mixed structure array contains fixed text corresponding to the service parameter request.

[0054] The service parameter request can refer to a structured data request containing specific service information sent by the front-end to the server. The service parameters include but are not limited to: user intent identification: semantic classification identification of user query, such as FAQ query, data analysis request, content generation instruction, etc. The fixed text can refer to the static text content generated or preset by the server. The fixed text has completed content generation before the arrival of the service request, and the content does not change with the number of requests, and does not need to be displayed twice. Streaming output can refer to the progressive content output generated dynamically by the server. The content can be continuously generated during the response process, and the final content length is unknown at the initial response. The server can refer to an AI server.​

[0055] Specifically, the front-end can send a request containing business parameters to the AI ​​server. The server responds with a structured array, which is a hybrid array containing both fixed text and streaming output. This response array includes the fixed text corresponding to the business parameter request. For example: [

[0057] {type:“text”,content:“Fixed text 1”,id:“text_1”},

[0058] {type: "stream", id: "stream_2"},

[0059] {type:“text”,content:“Fixed text 3”,id:“text_3”},

[0060] {type: "stream", id: "stream_4"}, ]

[0062] Here, "text" can refer to fixed text, "stream" can refer to streaming output, and "fixed text 1" and "fixed text 3" can refer to the fixed text content corresponding to the business parameter request contained in the mixed structure array.

[0063] In this embodiment, a business parameter request is sent, and a hybrid structure array combining fixed text and streaming output is received from the server. The hybrid structure array contains the fixed text corresponding to the business parameter request. A global display framework can be obtained through a single request, enabling sequential collaborative control of multiple content types. The structured array returned by the server predefines the arrangement order of the fixed text and streaming output. The front end can initialize the display framework in sequence without additional logic, thus avoiding misalignment and confusion of multiple content segments from the source.

[0064] S120. Determine the core data in the hybrid structure array and initialize it, wherein the core data includes a state object, a temporary result array, and an Id array of streaming output.

[0065] The status object (statusMap) can refer to a record of the processing status of each element of the server return array, completed / pending. The temporary result array (tempResults) can refer to storage of the processing result of each element of the server return array (i.e., the hybrid structure array). The streaming output Id array (streamIds) can refer to storage of all streaming output Ids of the server return array. Initialization can refer to a process of creating and initializing the three core data structures simultaneously according to the element type in the hybrid structure array when parsing the hybrid structure array returned by the server.

[0066] Specifically, the three core data structures are initialized by traversing the server return array (i.e., the hybrid structure array). If the traversed element is a fixed text, a completed status value is set in the status object statusMap, i.e., statusMap[id]=completed, the content of the element is pushed into the temporary result array tempResults, and a null is pushed into the streaming output Id array streamIds. If the traversed element is a streaming output stream, a pending status value is set in the status object statusMap, i.e., statusMap[id]=pending, an empty array [] is pushed into the temporary result array tempResults, and the id of the element is pushed into the streaming output Id array streamIds.

[0067] In this embodiment, the core data in the hybrid structure array is determined and initialized, wherein the core data includes a status object, a temporary result array, and a streaming output Id array. The status object (statusMap) is used to track the processing progress (completed / pending) of each element in real time, providing a basis for subsequent sequential synchronization. The temporary result array (tempResults) is used to store fixed texts (strings) and streaming contents (data block queues) uniformly, eliminating rendering gaps caused by data type differences. The streaming output Id array (streamIds) is used to mark the position of elements that need to be requested asynchronously, realizing one-to-one binding between concurrent requests and temporary result array indexes, and avoiding content misplacement. This initialization mechanism enables the subsequent process to strictly process the hybrid content according to the server-defined order, solving the order confusion problem caused by independent rendering in traditional solutions from the root, and effectively reducing the misplacement rate of displayed content.

[0068] S130, based on the streaming output Id array, all streaming output requests are sent in parallel, and the streaming output result returned by the server is received.

[0069] The stream output request can refer to an asynchronous data acquisition operation initiated by the front end based on the non-null elements in the stream output Id array (streamIds), and the target of the request is the server-side stream content generation interface. The stream output result can refer to the data segments returned by the server in batches.

[0070] Specifically, all non-null elements corresponding to the stream output request can be sent in parallel according to the non-null elements in the stream output Id array streamIds, i.e., the non-null elements in streamIds, so as to improve the data transmission efficiency. The result returned by the stream output is pushed into the temporary result array tempResults each time, and if the stream output ends, the corresponding state in the state object statusMap is modified, i.e., the state is modified from processing to completion.

[0071] Exemplarily, the stream output result can be accumulated segment by segment: tempResults[index] gradually changes from [] to ["He", "llo", "World"]; that is, the text stream arriving in blocks is finally spliced into complete content in the temporary result array. After the stream output ends, the monitoring triggers the statusMap state update (pending→completed).

[0072] In this embodiment, based on the stream output Id array, all stream output requests are sent in parallel, the stream output result returned by the server is received, the non-null elements in streamIds are screened, invalid requests for fixed text bits are avoided, network redundancy is reduced, all stream requests are concurrently sent at one time, serial waiting delay is eliminated, and data transmission efficiency is improved.

[0073] S140, based on the stream output result and the initialized mixed structure array, the business parameter request result combined with the fixed text and the stream output is rendered and displayed by a sequential typewriter.

[0074] The sequential typewriter rendering can refer to character-level progressive rendering display. The business parameter request result can refer to the heterogeneous structured data returned by the server in response to the business parameter request.

[0075] Specifically, each element position index in the temporary result array tempResults can be determined according to the data structure of the mixed structure array, and the streaming output result and the fixed text content returned in the initialization stage are pushed into the temporary result array tempResults according to the element position index. That is, the fixed text is pushed into the corresponding position in the temporary result array in the initialization stage, and after the streaming output result is obtained in real time, the streaming output result is pushed into the corresponding position in the temporary result array in real time. Through the sequential typewriter rendering technology, each element in the temporary result array is pushed into the display result array (displayResults) word by word in strict accordance with the data structure order of the mixed structure array, and based on each character-level element in the display result array, rendering and display are performed on the front-end display page.

[0076] For example, if the data structure order of the mixed structure array is {“text_1”, “stream_1”, “text_2”, “stream_2”}, the result of the temporary result array after initialization is [[“fixed text 1 content”], [], [“fixed text 3 content”], [],], that is, the order of each element position in the temporary result array is the same as the data structure order of the mixed structure array. If the fixed text 1 content is “please call:”, and the fixed text 3 content is “please call:”, the temporary result array after initialization is [[“please call:”], [], [“please call:”], [],], and if the streaming output result obtained in segments is “He”, “llo”, “Wor”, the temporary result array at this time is [[“please call:”], [“He”, “llo”, “Wor”], [“please call:”], [],]. Each element in the temporary result array is pushed into the display result array word by word, and the display result array is [“please”, “call”, “:”, “He”, “llo”, “Wor”], and the front-end display page displays “please”→“call”→“:”→“H”→“e”→“l”→“l”→“o”→“W”→“o”→“r”. At this time, the state in the corresponding state object of the streaming output stream_1 is pending, and therefore, even if the fixed text 3 (text_2) content “please call:” exists, it will not be pushed into the display result array until the streaming output result of the streaming output stream_1 is completely output, and the state in the corresponding state object is updated from pending to completed; then the fixed text 3 (text_2) content is pushed into the display result array for rendering and display.

[0077] In this embodiment, a mixed structure array of fixed text combined with streaming output is received by sending a service parameter request and a server response, wherein the mixed structure array includes the fixed text corresponding to the service parameter request; core data in the mixed structure array is determined and initialized, wherein the core data includes a state object, a temporary result array, and an Id array of streaming output; based on the Id array of streaming output, all streaming output requests are sent in parallel, and streaming output results returned by the server are received; based on the streaming output results and the initialized mixed structure array, the service parameter request result of the fixed text combined with the streaming output is rendered and displayed by a sequential typewriter; the problem of mixed display confusion in the prior art is solved, multiple fixed texts and multiple segments of streaming output can be mixed together and displayed in a fixed arrangement order, the user experience when receiving a message generated by an AI server is significantly improved; no matter how complex and large the message content is, the user can feel a smooth and non-stuttering display effect, thereby enhancing the satisfaction and trust of the AI service; further, the diversified needs of users in AI custom professional skills are met, the organic combination of fixed scripts and AI replies is realized; the AI service is more flexible and diverse, and can better adapt to the needs and scenarios of different users.

[0078] Optionally, the determining the core data in the mixed structure array and initializing includes:

[0079] traversing each element in the mixed structure array and determining an element type;

[0080] if the element type is a fixed text, setting the state of the state object of the element to complete, pushing the fixed text corresponding to the service parameter request into the temporary result array, and pushing null into the Id array of streaming output;

[0081] if the element type is a streaming output, setting the state of the state object of the element to waiting, pushing an empty array into the temporary result array, and pushing the id of the element into the Id array of streaming output.

[0082] The traversal can refer to the front end performing sequential access, type identification, and real-time updating of the three core structures (state object, temporary result array, and streaming ID array) according to the element type in the original order of the mixed structure array (results) returned by the server. Sequential access means starting from the first element of the array and processing each element (index from 0 to n-1) in turn, strictly following the order defined by the server, that is, the traversal order must be completely consistent with the array order returned by the server. The element can refer to each independent unit in the mixed structure array results returned by the server, which is essentially a heterogeneous data object organized in display order; the type of the element is determined according to the type field of the element, and the element type can specifically include fixed text and streaming output.

[0083] Specifically, each element in the mixed structure array returned by the server (results) is traversed, and the element type is determined. If the element type of the traversed element is fixed text text, a state value completed is set in the state object statusMap, statusMap[id]=completed, the content of the element, i.e., the fixed text content corresponding to the business parameter request, is pushed into the temporary result array tempResults, and a null is pushed into the Id array streamIds of streaming output. If the element type of the traversed element is streaming output stream, a state value pending is set in the state object statusMap, i.e., statusMap[id]=pending, an empty array [] is pushed into the temporary result array tempResults, and the id of the element is pushed into the Id array streamIds of streaming output. The specific initialization operation logic is shown in Table 1:

[0084] Table 1

[0085]

[0086] For example, the three core data after initialization can be as follows:

[0087] statusMap:

[0088] {

[0089] text_1: "completed",

[0090] stream_2: "pending",

[0091] text_3: "completed",

[0092] stream_4: "pending",

[0093] }

[0094] tempResults:

[0095] [[“fixed text 1”], [], [“fixed text 3”], [],]

[0096] streamIds:

[0097] [null, stream_2, null, stream_4]

[0098] In this embodiment, by traversing each element in the mixed structure array and determining the element type; if the element type is fixed text, set the state of the element's state object to complete, and push the fixed text corresponding to the service parameter request into the temporary result array, and push null into the Id array of stream output; if the element type is stream output, set the state of the element's state object to pending, and push an empty array into the temporary result array, and push the id of the element into the Id array of stream output, clearly distinguish between completed fixed text (completed) and pending stream output (pending), and provide a basis for judging for the subsequent state polling mechanism; by sequential traversal, the order of the content defined by the server is converted into the order of the front-end data structure (such as the index position of tempResults), ensuring that the subsequent display is not disordered; through the streamIds array, the stream output ID (filtering null values) that needs to be requested concurrently is accurately positioned, avoiding invalid requests.

[0099] Optionally, based on the Id array of stream output, all stream output requests are sent in parallel, and the stream output results returned by the server are received, including:

[0100] determining the non-null elements in the Id array of stream output;

[0101] sending the stream output requests of the non-null elements in parallel;

[0102] receiving the stream output results returned by the server, and pushing the stream output results into the temporary result array.

[0103] Specifically, non-null elements are determined from the stream output Id array streamIds, and all non-null elements are sent to the server in parallel. The server returns the data fragments in batches, and each returned data fragment is pushed into the corresponding element of the temporary result array tempResults. The elements in the temporary result array can refer to the content storage of the corresponding mixed array position, and the index can ensure that the results are written to the correct position. Further, the reserved empty array in tempResults can be located by the sequential index index, and each request corresponds to a separate stream output position, where the sequential index index can refer to the sequential index of the elements in the mixed structure array (results) returned by the server, which is an integer starting from 0, with the first element index = 0 and the subsequent elements increasing by 1, 2, 3, etc. The main fixed text and stream output are unified coordinates, and each element occupies an index position regardless of the element type.

[0104] For example, the correspondence between the element positions in the temporary result array and the sequential index index is shown in Table 2:

[0105] Table 2

[0106]

[0107] The index can ensure that the results are written to the correct position, even if the stream request response order is random (e.g., stream_4 is returned before stream_2), stream_4 can be fixed to tempResults[3] and stream_2 can be fixed to tempResults[1] according to the index, avoiding the page disorder caused by multiple stream output results returned by the server, maintaining the original order defined by the server in asynchronous scenarios, and making the two types of elements share the same index system, allowing fixed text and asynchronous stream output to work together in the same framework, making fixed text the cornerstone of smooth experience, stream output becoming progressive enhancement, and finally achieving an immersive effect of "static content immediately visible and dynamic content seamlessly inserted". For example, concurrent stream requests can be as follows:

[0108] Promise.all(streamIds.map((id,index)=>fetchStreamData(id,index)));

[0109] fetchStreamData(id,index){

[0110] const evtSource = new EventSource(res);

[0111] evtSource.onmessage = (e) =>{

[0112] tempResults[index].push(e);

[0113] if(done){

[0114] statusMap[id] = “completed”;

[0115] }

[0116] }

[0117] }。

[0118] In the embodiment, non-null elements in the Id array of the stream output are determined, the stream output request of the non-null elements is sent in parallel, the stream output result returned by the server is received, and the stream output result is pushed into the temporary result array, the non-null elements in the streamIds are screened through the ID-driven precise concurrency mechanism, invalid requests are avoided to be initiated to the fixed text bit, network redundancy is reduced, all stream requests are concurrently initiated at one time, and serial waiting delay is eliminated, the stream result is pushed into the corresponding empty array of tempResults according to the preset index (index) in real time, the content is always anchored to the original position, and the original order defined by the server can be maintained in the asynchronous scene.

[0119] Embodiment 2

[0120] Figure 2 A flowchart of a front-end display method combining fixed text and stream output provided by the second embodiment of the application, and the technical scheme of the embodiment is further refined on the basis of the above-mentioned embodiment. As shown in the figure, the method comprises the following steps. Figure 2

[0121] S210, a service parameter request is sent, and a mixed structure array combining fixed text and stream output returned by the server in response is received, wherein the mixed structure array contains fixed text corresponding to the service parameter request.

[0122] S220, core data in the mixed structure array is determined and initialized, wherein the core data comprises a state object, a temporary result array and an Id array of stream output.

[0123] S230, based on the Id array of the stream output, all stream output requests are sent in parallel, and stream output results returned by the server are received.

[0124] ​S240, traversing the streaming output results in the temporary result array and the fixed text to generate a display result array.

[0125] The display result array can refer to an ordered sequence array of characters generated for front-end page display. Each element of the display result array is a single character (such as a Chinese character, a letter, or a punctuation mark), and strictly follows the element order of the original mixed structure array. The display result array can directly drive the typewriter effect display when the streaming content (i.e., the streaming output result) arrives in real-time expansion. For example, the display result array can be ["You", "good", "!", "when", "front", "day", "weather", ":"].

[0126] Specifically, the temporary result array is traversed to determine the element type. If the element type is fixed text, the fixed text content is pushed into the display result array (displayResults) character by character. If the element type is streaming output, the state of the streaming output is queried in the state object statusMap. If the state of the streaming output is completed, the entire result of the streaming output is pushed into the display result array (displayResults) character by character. If the state of the streaming output is pending, the existing result of the streaming output is pushed into the display result array (displayResults) character by character, and the traversal of the temporary result array is stopped. The newly added streaming output result in the temporary result array is pushed into the display result array character by character until all states are completed.

[0127] In this embodiment, the display result array is dynamically generated by sequentially traversing the streaming output buffer and fixed text content in the temporary result array, and the unified time sequence arrangement of multi-source heterogeneous data is achieved.

[0128] S250, based on the display result array, the fixed text and the streaming output combined business parameter request result are rendered and displayed by a typewriter according to the data structure order of the mixed structure array.

[0129] The data structure order of the mixed structure array can refer to the topological order of the element arrangement in the response array returned by the server. This order determines the absolute order of content display. The data structure order of the mixed structure array is the same as the element position order in the temporary result array and the display order of the display result array. For details, refer to Table 2, which is corresponding through the sequential index index.

[0130] Specifically, according to the display order of the display result array, the fixed text content and the stream output result are extracted from the display result array by a typewriter rendering technology, and are rendered onto the front-end display page. The rendering end condition is that all characters in the display result array have been rendered, and all states in the state object are complete.

[0131] In this embodiment, based on the display result array, the business parameter request result combined with the fixed text and the stream output is displayed by a typewriter rendering according to the data structure order of the mixed structure array; by sequentially traversing the stream output buffer and the fixed text content in the temporary result array, the display result array is dynamically generated, the unified time sequence arrangement of multi-source heterogeneous data is realized, the content in the display result array is outputted by a typewriter rendering in a word-by-word manner according to the original order of the mixed structure array, and the seamless fusion display of the fixed text and the stream output is realized.

[0132] Optionally, the traversing the stream output result and the fixed text in the temporary result array to generate the display result array comprises:

[0133] repeatedly traversing the temporary result array according to the data structure order in the mixed structure array by a first time interval timer;

[0134] until the state of the state object corresponding to the stream output result and the fixed text in the temporary result array is complete, the traversal is stopped.

[0135] The first time interval timer can be a state polling timer, which is used to periodically check the state object (statusMap) and the temporary result array (tempResults), and synchronize the new content in the temporary result array to the display result array (displayResults) according to the state; the first time interval can be 50 ms.

[0136] Specifically, a timer A is set, and the state of the status object statusMap is queried every 50 ms. The state is queried in the order of the temporary result array tempResults (i.e., the order of the data structure in the mixed structure array). If the state is completed, the temporary result array is compared to see if there is a new part, and if so, the new part is synchronized to the display result array (displayResults). If the state is pending, the new content in the temporary result array tempResults corresponding to the element is synchronized to the display result array (displayResults), and then the query is ended, 50 ms is waited, the next query is performed, and the process is repeated until the state of all the streaming output results and fixed texts in the temporary result array and the status object is completed. The timer A is ended, and the traversal is stopped. The algorithm based on the first time interval timer for state polling can be as follows:

[0137] setInterval(()=>{

[0138] let allCompleted = true;

[0139] for(key in statusMap){

[0140] if(statusMap[key] ===“completed”){

[0141] Synchronize tempResults to displayResults;

[0142] }

[0143] if(statusMap[key] ===“pending”){

[0144] Synchronize tempResults to displayResults;

[0145] allCompleted = false;

[0146] break;

[0147] }

[0148] }

[0149] if(allCompleted){

[0150] clearInterval();

[0151] }

[0152] },50)。

[0153] In this embodiment, the temporary result array is repeatedly traversed in the data structure order in the mixed structure array by a first time interval timer until the state of the state object corresponding to the stream output result and the fixed text in the temporary result array is complete, and then the traversal is stopped. By using an accurate 50ms polling period, strict data structure order maintenance and an intelligent state interruption mechanism, seamless connection between the fixed text and the stream content is achieved, cognitive burden caused by content jumping is avoided, and a "zero perception waiting" effect of mixed content rendering is achieved.

[0154] Optionally, the repeatedly traversing the temporary result array in the data structure order in the mixed structure array by the first time interval timer comprises:

[0155] If the element type is fixed text and the state of the state object is complete, the fixed text content corresponding to the business parameter request is pushed into the display result array word by word when the first traversal is performed, and the subsequent traversals are skipped.

[0156] If the element type is stream output and the state of the state object is complete, the result of the stream output is pushed into the display result array word by word, and whether there is new content in the temporary result array is judged in the next traversal. If there is new content, the new content is synchronized to the display result array word by word.

[0157] If the element type is stream output and the state of the state object is processing, the result of the stream output already existing in the temporary result array is pushed into the display result array word by word, and the traversal is stopped. The next traversal is repeatedly performed based on the first time interval timer, and whether there is new content in the temporary result array is repeatedly judged. If there is new content, the new content is synchronized to the display result array word by word.

[0158] Specifically, a timer A is set to query the state of the state object statusMap every 50ms, and the query is performed in the order of the temporary result array tempResults (i.e., the data structure order in the mixed structure array). If the element type is fixed text and the state of the state object is complete, the fixed text content corresponding to the business parameter request in the temporary result array is pushed into the display result array word by word when the first traversal is performed, and the subsequent traversals are skipped.

[0159] If the element type is stream output, the state of the state object is completed, then the results of the stream output are pushed into the display result array character by character, and in the next iteration, it is determined whether there is new content in the temporary result array, if yes, the new content is synchronized to the display result array character by character; if not, skip in the subsequent iteration; the new content can refer to the newly returned stream output result of the server. If the element type is stream output, the state of the state object is processing, then in the first iteration, the results of the stream output already existing in the temporary result array are pushed into the display result array character by character, and the iteration is stopped, based on the first time interval timer, every 50 ms, the iteration is performed once, and it is determined whether there is new content in the temporary result array, if yes, the new content is synchronized to the display result array character by character. Until all states in the state objects corresponding to the stream output results and fixed texts in the temporary result array are completed (completed), the timer A is ended, and the iteration is stopped.

[0160] In this embodiment, based on the first time interval timer, the iteration is performed once every 50 ms; strictly follow the original element order returned by the server (for example, fixed text→stream→fixed text→stream), ensure that the business logic and visual presentation are completely consistent, solve the interleaving misplacement problem caused by asynchronous stream return in the traditional scheme; the stream content is inserted into the display queue character by character in the order of data block arrival, and the user can perceive part of the result in real time; only when there is new content in the stream buffer or the fixed text is not synchronized, the display array is updated, avoiding invalid iteration; when an unfinished stream element is encountered, the generation is immediately paused, the position context of the arrived content is preserved, and a precise anchor point is provided for subsequent incremental synchronization, ensuring that the content is coherent and there is no jump when the rendering is resumed after interruption.

[0161] Optionally, the business parameter request result combined with the fixed text and the stream output is rendered and displayed based on the display result array by a sequential typewriter, including:

[0162] The business parameter request result combined with the fixed text and the stream output in the display result array is rendered and displayed based on the second time interval timer by a sequential typewriter;

[0163] If the display result array is displayed, it is determined whether the states in the state objects are all completed;

[0164] If not, the new content in the display result array is continuously rendered based on the second time interval timer;

[0165] If yes, the display is ended.

[0166] The second time interval can refer to 20 ms, and the newly added content in the display result array can refer to the streaming output result character newly synchronized from the temporary result array to the display result array.

[0167] Specifically, a timer B is set, and the renderer adopts a typewriter technique, which is executed once every 20 ms, to render and display the fixed text in the display result array and the business parameter request result combined with the streaming output to the front-end display page according to the display order in the display result array. It can be simply understood that the renderer outputs a character in the display result array every 20 ms. Exemplarily, it can be "please" -> "back" -> "H" -> "e" -> "hello".

[0168] If the display result array (displayResults) is completely displayed, it is necessary to determine whether all the completed (allCompleted) in the status object statusMap, if not all completed, continue to execute the timer B, and the renderer queries whether there is a newly added character in the display result array every 20 ms, and when it is determined that there is a newly added character, the rendering operation is executed again, until all the newly added content in the display result array is completely displayed, and it is determined again whether all the completed (allCompleted) in the status object statusMap, repeat the above steps until the status in the status object is all completed, then end the display and stop the timer B.

[0169] Exemplarily, if the current display result array is ["please", "back", "H", "e"], the characters in the display result array have been completely rendered and displayed, and it is determined whether the status in the status object is all completed; if not, a flashing cursor is inserted, and the display result array is queried once every 20 ms to determine whether there is a newly added character. For example, if the timer B continues to query for 3 times, i.e. after 60 ms, it is determined that there is a newly added character ["l", "l"] in the display result array, the rendering operation is executed again, until all the newly added content in the display result array is completely displayed, and it is determined again whether all the completed (allCompleted) in the status object statusMap, repeat the above steps until the status in the status object is all completed. During the continuous query stage of the timer B, the cursor in the front-end display page flashes continuously at 20 ms. The specific result display algorithm can be as follows:

[0170] let displayIndex = 0;

[0171] setInterval(()=>{

[0172] const str = displayResults[displayIndex];

[0173] render function(str);

[0174] displayIndex++;

[0175] if(displayIndex === displayResults.length-1){

[0176] if(allCompleted){

[0177] clearInterval();

[0178] }

[0179] }

[0180] },20);

[0181] In this embodiment, the second time interval timer (such as 20ms) is independently set to realize the seamless sequential mixed rendering of fixed text and streaming output content, to ensure the smoothness of the typewriter effect, and to intelligently judge the rendering termination condition. When the result array content is not completely rendered and there is incomplete streaming content, the newly added content is continuously monitored and rendered in real time. Only when all the content is synchronized and the display queue is exhausted, the rendering is ended. The word-by-word mixed rendering of fixed text and streaming content has no garbled code, strictly depends on the state object to judge the global completion degree, eliminates content truncation or premature termination, and ensures the complete display of the business parameter request result.

[0182] In one specific embodiment, Figure 3 A full flowchart of front-end and server interaction is provided for the second embodiment of the present application. As shown in Figure 3 , the specific steps of the front-end and server interaction are as follows:

[0183] 1. The front-end page sends the business parameters to the AI server;

[0184] 2. The server responds and returns a structured array (i.e., a mixed structure array);

[0185] 3. The front-end initializes the core data, parses the array to generate a state object, a temporary result array, and an Id array for streaming output;

[0186] 4. The streaming output request of the non-null element is sent in parallel;

[0187] 5. The streaming output result is received and stored in the temporary result array;

[0188] 6. Through the timer 50 ms polling, the fixed text / flow content in the temporary result array is pushed into the display result array (not shown in the figure) in the order of the data structure in the mixed structure array.

[0189] 7. Through the timer 20 ms timing, the fixed text / flow content is extracted from the display result array word by word and rendered to the front-end display page.

[0190] 8. When all states in the state object are completed, all characters in the display result array are rendered, and the front-end page display process is ended.

[0191] Embodiment 3

[0192] Figure 4 A framework diagram of a front-end display system combining fixed text and flow output is provided for the third embodiment of the present application. As shown in the figure, the system includes: Figure 4

[0193] The first processing module 310 is configured to send a service parameter request and receive a mixed structure array combining fixed text and flow output returned by the server in response to the request, wherein the mixed structure array contains fixed text corresponding to the service parameter request.

[0194] The initialization module 320 is configured to determine core data in the mixed structure array and initialize the core data, wherein the core data includes a state object, a temporary result array, and an Id array of flow output.

[0195] The second processing module 330 is configured to send all flow output requests in parallel based on the Id array of flow output and receive flow output results returned by the server.

[0196] The display module 340 is configured to render and display the service parameter request result combining the fixed text and the flow output based on the flow output result and the initialized mixed structure array through a sequential typewriter.

[0197] Optionally, the initialization module 320 is specifically configured to:

[0198] traverse each element in the mixed structure array and determine the element type;

[0199] if the element type is fixed text, set the state of the state object of the element to complete, push the fixed text corresponding to the service parameter request into the temporary result array, and push null into the Id array of flow output;

[0200] ​If the element type is streaming output, set the state of the state object of the element to be in waiting, and push an empty array into the temporary result array, and push the id of the element into the Id array of the streaming output.

[0201] Optionally, the second processing module 330 is specifically configured to:

[0202] determine the non-null elements in the Id array of the streaming output;

[0203] send the streaming output request of the non-null elements in parallel;

[0204] receive the streaming output result returned by the server, and push the streaming output result into the temporary result array.

[0205] Optionally, the display module 340 specifically includes:

[0206] a generating unit, configured to traverse the streaming output result in the temporary result array and the fixed text, and generate a display result array;

[0207] a display unit, configured to render and display the fixed text and the business parameter request result combined with the streaming output according to the data structure order of the mixed structure array based on the display result array.

[0208] Optionally, the generating unit is specifically configured to:

[0209] repeat the traversal of the temporary result array according to the data structure order in the mixed structure array through the first time interval timer;

[0210] stop the traversal until the state of the state object corresponding to the streaming output result and the fixed text in the temporary result array is complete.

[0211] Optionally, the generating unit is specifically further configured to:

[0212] if the element type is fixed text and the state of the state object is complete, push the fixed text content corresponding to the business parameter request into the display result array word by word when the first traversal is performed, and skip the subsequent traversal;

[0213] if the element type is streaming output and the state of the state object is complete, push the result of the streaming output into the display result array word by word, and when the next traversal is performed, determine whether there is new content in the temporary result array, and if yes, synchronize the new content to the display result array word by word;

[0214] If the element type is streaming output, the state of the state object is in processing, the existing result of the streaming output in the temporary result array is pushed into the display result array word by word, and the traversal is stopped, the next traversal is repeated based on the first time interval timer, and it is repeatedly judged whether the temporary result array has new content, if yes, the new content is synchronized to the display result array word by word.

[0215] Optionally, the display unit is specifically used for:

[0216] Based on the second time interval timer, the business parameter request result of the combination of the fixed text and the streaming output in the display result array is rendered and displayed by a sequential typewriter;

[0217] If the display result array is displayed, it is judged whether the state in the state object is all completed;

[0218] If not, the new content in the display result array is continuously rendered based on the second time interval timer;

[0219] If yes, the display is ended.

[0220] The embodiment of the application provides a front-end display system combining fixed text and streaming output, returns and analyzes a structured array through the interaction of the front end and the AI server, the array mixes fixed text and streaming output elements, and the state object, the temporary result array and the Id array of the streaming output are used to coordinate the display order and the state of the two, so that the display is ensured to be smooth in sequence; a double timer mechanism is adopted, one timer is responsible for regularly querying the state of the state object, and the temporary result array is synchronized to the display result array according to the state change; the other timer is responsible for displaying the content in the display result array to the page word by word, and through the cooperative working mode of the double timers, the coherence, the real-time performance and the accuracy of the display content are ensured.

[0221] Embodiment 4:

[0222] In some embodiments, a front-end display method combining fixed text and streaming output can be implemented as a computer program tangibly embodied in a computer readable storage medium, for example, when the computer program is loaded into the RAM and executed by the processor, one or more steps of the front-end display method combining fixed text and streaming output described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform the front-end display method combining fixed text and streaming output by any other appropriate manner (for example, by means of firmware).

[0223] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Parts (ASSP), a System on Chip (SOC), a Complex Programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0224] Computer programs used to implement the processes of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor of the machine, implements the functions / acts specified in the flow diagrams and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as part of a standalone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.

[0225] In the context of the present application, the computer readable storage medium stores computer instructions for causing a processor to implement the front-end presentation issuance of fixed text combined with streaming output provided by the present application when executed. The computer readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium can be a machine-readable signal medium. More specific examples of the machine readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0226] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a Cathode Ray Tube (CRT) or a Liquid Crystal Display (LCD) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0227] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0228] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and virtual private server (VPS) services.

[0229] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the present disclosure are achieved, and the present disclosure is not limited herein.

[0230] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A front-end display method combining fixed text and streaming output, characterized in that, include: Send a business parameter request and receive a mixed structure array of fixed text and streaming output from the server response, wherein the mixed structure array contains the fixed text corresponding to the business parameter request; The core data in the hybrid structure array is determined and initialized, wherein the core data includes a state object, a temporary result array, and an Id array of streaming output; Based on the Id array of the streaming output, all streaming output requests are sent in parallel, and the streaming output results returned by the server are received. Based on the streaming output results and the initialized mixed structure array, the business parameter request results combining the fixed text and the streaming output are displayed using a sequential typewriter rendering method. The step of determining and initializing the core data in the hybrid structure array includes: Iterate through each element in the mixed structure array and determine the element type; If the element type is fixed text, then set the state of the element's state object to complete, push the fixed text corresponding to the business parameter request into a temporary result array, and push null into the Id array of the streaming output; If the element type is streaming output, then set the state of the element's state object to waiting, push the empty array into the temporary result array, and push the element's id into the streaming output's Id array.

2. The method according to claim 1, characterized in that, Based on the Id array of the streaming output, all streaming output requests are sent in parallel, and the streaming output results returned by the server are received, including: Determine the non-null elements in the Id array of the streaming output; Send the streaming output requests for the non-null elements in parallel; Receive the streaming output results returned by the server and push the streaming output results into a temporary result array.

3. The method according to claim 2, characterized in that, Based on the streaming output results and the initialized mixed structure array, the business parameter request results combining the fixed text and the streaming output are rendered and displayed using a sequential typewriter, including: Iterate through the streaming output results and fixed text in the temporary result array to generate a display result array; Based on the array of display results, and in accordance with the data structure order of the hybrid structure array, the business parameter request results combining the fixed text and the streaming output are rendered and displayed using a typewriter.

4. The method according to claim 3, characterized in that, The step of traversing the streaming output results and fixed text in the temporary result array to generate a display result array includes: The temporary result array is repeatedly traversed using a first time interval timer, following the data structure order in the mixed structure array. The iteration stops when the state of the streaming output result and the state object corresponding to the fixed text in the temporary result array is complete.

5. The method according to claim 4, characterized in that, The step of repeatedly traversing the temporary result array according to the data structure order in the mixed structure array using a first time interval timer includes: If the element type is fixed text and the state object is in the completed state, then when it is encountered for the first time, the fixed text content corresponding to the business parameter request is pushed into the display result array word by word, and then skipped in subsequent traversals. If the element type is streaming output and the state object is in the state of completed, then the streaming output result is pushed into the display result array word by word. In the next traversal, it is determined whether there is any new content in the temporary result array. If so, the new content is synchronized to the display result array word by word. If the element type is streaming output and the state object is in the process state, then the existing streaming output results in the temporary result array are pushed into the display result array word by word, and the traversal is stopped. Based on the first time interval timer, the next traversal is repeated, and it is repeatedly determined whether there is any new content in the temporary result array. If so, the new content is synchronized to the display result array word by word.

6. The method according to claim 3, characterized in that, The process of rendering and displaying the business parameter request result, which combines the fixed text with the streaming output, using a sequential typewriter based on the array of displayed results, includes: Based on the second time interval timer, the business parameter request result combining the fixed text in the display result array and the streaming output is rendered and displayed by a sequential typewriter. If the array of display results has been displayed, then determine whether the state in the state object is "complete". If not, then based on the second time interval timer, continue rendering the newly added content in the display result array; If so, the presentation will end.

7. A front-end display system that combines fixed text with streaming output, characterized in that, The system is used to execute the front-end display method of mixing fixed text and streaming output as described in any one of claims 1-6, including: The first processing module is used to send a business parameter request and receive a hybrid structure array that combines fixed text and streaming output from the server response, wherein the hybrid structure array contains the fixed text corresponding to the business parameter request. An initialization module is used to determine and initialize the core data in the hybrid structure array, wherein the core data includes a state object, a temporary result array, and a streaming output ID array; The second processing module is used to send all streaming output requests in parallel based on the Id array of the streaming output, and to receive the streaming output results returned by the server. The display module is used to display the business parameter request result combining the fixed text and the streaming output through sequential typewriter rendering, based on the streaming output result and the initialized mixed structure array.

Citation Information

Patent Citations

  • Rendering processing method and device, storage medium and product

    CN118193864A

  • Front-end rendering optimization method based on streaming output

    CN118869803A