Method and device for presenting streaming input on rich text editor

By generating format difference documents supported by the rich text editor and performing incremental update rendering, the problem that the rich text editor cannot directly render streaming input in lightweight markup languages is solved, improving rendering efficiency and page rendering effect.

CN120476401APending Publication Date: 2025-08-12BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202480006869.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

Some rich text editors cannot directly render streaming input in lightweight markup language formats, resulting in poor rendering performance and jittery pages, requiring full rendering, resulting in inefficiency.

Method used

By obtaining streaming and incremental inputs, generate differential documents in formats supported by rich text editors and render them in incremental updates to avoid full rendering.

Benefits of technology

Improves the rendering efficiency and page rendering effect of rich text editors, reduces page jitter, and enhances the compatibility of input content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120476401A_ABST
    Figure CN120476401A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for presenting streaming input on a rich text editor, computing equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: acquiring a first streaming input and a second streaming input, wherein the second streaming input comprises an increment relative to the first streaming input; generating a difference document in a format supported by the rich text editor based on the first streaming input and the second streaming input; and rendering the second streaming input on the rich text editor by rendering the difference document. In this way, according to the technical scheme, the compatibility of the rich text editor for presenting the streaming input is improved, meanwhile, the streaming input is presented in an incremental updating mode, and the rendering efficiency and the page presentation effect of the rich text editor are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and more particularly, to a method, apparatus, computing device, computer-readable storage medium, and computer program product for presenting streaming input on a rich text editor. Background Art

[0002] With the development of network technology, lightweight markup languages (such as Markdown) have been widely used due to their simplicity, intuitiveness, ease of learning and use. Lightweight markup languages allow people to write documents in a plain text format that is easy to read and write, and then convert them into valid Hypertext Markup Language (HTML) or other formats for rendering or presentation.

[0003] At the same time, more and more people are using generative language models to obtain information or create content. Generative language models accept user queries and provide answers in the form of streaming output, which is often a string formatted in a lightweight markup language. The user's device receives streaming input from the generative language model and renders it in a rich text editor. However, some rich text editors may lack component support and cannot directly render some streaming input in the lightweight markup language format, or require complex processing, resulting in poor rendering performance. Summary of the Invention

[0004] In view of this, the present disclosure provides a technical solution for presenting streaming input on a rich text editor, which can improve the compatibility of the rich text editor in presenting streaming input, and at the same time enable the rich text editor to present streaming input in an incremental update manner, thereby improving the rendering efficiency and page presentation effect of the rich text editor.

[0005] According to a first aspect of the present disclosure, a method for presenting streaming input in a rich text editor is provided. The method comprises: obtaining a first streaming input and a second streaming input, the second streaming input comprising a delta relative to the first streaming input; generating a difference document in a format supported by the rich text editor based on the first streaming input and the second streaming input; and presenting the second streaming input in the rich text editor by rendering the difference document.

[0006] According to a second aspect of the present disclosure, a device for presenting streaming input on a rich text editor is provided. The device includes: a streaming input acquisition unit configured to acquire a first streaming input and a second streaming input, the second streaming input including a delta relative to the first streaming input; a difference document generation unit configured to generate a difference document in a format supported by the rich text editor based on the first streaming input and the second streaming input; and a presentation unit configured to present the second streaming input on the rich text editor by rendering the difference document.

[0007] According to a third aspect of the present disclosure, a computing device is provided, comprising: at least one processing unit; and at least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the computing device to execute the method as described in the first aspect of the present disclosure.

[0008] According to a fourth aspect of the present disclosure, a non-transitory computer storage medium is provided, comprising machine-executable instructions, which, when executed by a device, cause the device to perform the method according to the first aspect of the present disclosure.

[0009] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising machine-executable instructions, which, when executed by a device, cause the device to perform the method according to the first aspect of the present disclosure.

[0010] It should be understood that the summary of the invention is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and other objects, features and advantages of the embodiments of the present disclosure will become more readily understood through the following detailed description with reference to the accompanying drawings, in which several embodiments of the present disclosure are illustrated by way of example and not limitation, in which:

[0012] Figure 1 A schematic diagram illustrating an environment in which various embodiments of the present disclosure can be implemented is shown;

[0013] Figure 2 A schematic flowchart of a method for presenting streaming input on a rich text editor according to an embodiment of the present disclosure is shown;

[0014] Figure 3 A schematic flow chart of a method for rendering streaming input by incremental updating according to an embodiment of the present disclosure is shown;

[0015] Figure 4 A schematic block diagram showing an apparatus for presenting streaming input on a rich text editor according to an embodiment of the present disclosure is shown; and

[0016] Figure 5 A block diagram of a device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0017] The concepts of the present disclosure will now be described with reference to the various exemplary embodiments shown in the accompanying drawings. It should be understood that the description of these embodiments is merely to enable those skilled in the art to better understand and further implement the present disclosure, and is not intended to limit the scope of the present disclosure in any way. It should be noted that similar or identical reference numerals may be used in the figures where possible, and similar or identical reference numerals may represent similar or identical elements. It will be understood by those skilled in the art from the description below that alternative embodiments of the structures and / or methods described herein may be adopted without departing from the principles and concepts of the present disclosure described.

[0018] In the context of this disclosure, the term "including" and its various variations can be understood as open-ended terms, meaning "including but not limited to," the term "based on" can be understood as "based, at least in part, on," the term "one embodiment" can be understood as "at least one embodiment," and the term "another embodiment" can be understood as "at least one other embodiment." Other terms that may appear but are not mentioned here should not be interpreted or limited in a manner that is inconsistent with the concepts underlying the embodiments of this disclosure, unless explicitly stated.

[0019] As mentioned above, lightweight markup languages such as Markdown allow people to write documents in a plain text format that is easy to read and write, and then convert it into valid HTML or other formats. The syntax of lightweight markup languages is simple and intuitive, easy to learn and use, and therefore has been widely used in many fields.

[0020] A rich text editor (RTE) is a tool that allows users to create and edit formatted text, commonly used in web pages, documents, and emails. Unlike plain text editors, rich text editors support various text formats, styles, and structures, such as bold, italics, underlining, color, font variations, and paragraph alignment. These editors typically support a WYSIWYG mode, allowing users to see the formatting effects in real time while editing. In addition, they are often able to generate HTML code, making it easy to embed formatted content into web pages or applications.

[0021] However, some rich text editors cannot directly render strings in certain syntax formats (such as Markdown), and need to convert them into supported format content for rendering. In application scenarios where generative models output streaming content, the rich text editor of the user device may not support the format of certain streaming content, resulting in the content not being displayed correctly. On the other hand, since the streaming output of the model needs to be continuously displayed on the screen, and since the output of the model is strongly context-dependent, the rich text editor needs to perform full rendering, and its performance is relatively low, and may cause page jitter. Therefore, it is expected to enhance the compatibility of the rich text editor for input content and implement an incremental update rendering method to improve performance and user experience.

[0022] To solve or alleviate the above-mentioned problems and / or other potential problems, an embodiment of the present disclosure proposes a method for presenting streaming content on a rich text editor. According to this method, a user device can obtain streaming input (also referred to as existing content) and incremental input relative to the streaming input, and the incremental input may be obtained later. The streaming input and incremental input can be, for example, text that conforms to a certain markup language format, such as Markdown text, but in some implementations, the rich text editor may not support direct rendering of this markup language format. The user device can then convert the entirety formed by the streaming input and incremental input into content that conforms to the format supported by the rich text editor, and compare it with the converted streaming input to generate a difference document, which also conforms to the format supported by the rich text editor. Then, by rendering the difference document, the existing streaming content and incremental content are presented on the rich text editor. Based on this approach, the compatibility of the rich text editor in presenting streaming input can be improved, and at the same time, the rich text editor can present streaming input in an incremental update manner, thereby improving the rendering efficiency and page rendering effect of the rich text editor.

[0023] It should be noted that this article uses Markdown as an example of the format of streamed input received by the rich text editor, but it should be understood that other language formats are also possible. In addition, this article uses Delta language based on the QuillJS framework as a format supported by the rich text editor (i.e., capable of direct rendering), but it should be understood that other formats are also possible.

[0024] To facilitate understanding of the embodiments of the present disclosure, the following explanations of terms are provided:

[0025] Table 1: Explanation of relevant terms

[0026]

[0027] The following describes the basic principles and implementations of the present disclosure with reference to the accompanying drawings. It should be understood that the exemplary embodiments provided are only intended to enable those skilled in the art to better understand and implement the embodiments of the present disclosure, and are not intended to limit the scope of the present disclosure in any way.

[0028] Figure 1 1 shows a schematic diagram of an environment 100 in which various embodiments of the present disclosure can be implemented. Figure 1 As shown, environment 100 includes a user device 110 operable by a user and a server 120. Optionally, user device 110 may be any computing device with a display function, including but not limited to smartphones, tablet computers, portable computers, smart TVs, in-vehicle computers, wearable devices (e.g., smart bracelets, smart watches), etc. User device 110 may be installed with a rich text editor 130, which can receive documents or input that support various styles (fonts, sizes, colors) and elements (images, tables, links, etc.), and render and present them to the user.

[0029] Server 120 can be a standalone physical network server, a network server cluster or distributed system consisting of multiple physical network servers, or a cloud network server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. As shown in the figure, server 120 includes a generative model 140. In some implementations, generative model 140 can be a trained language model that can generate data or content based on prompt words.

[0030] The user device 110 and the server 120 may be communicatively connected via a network. The network between the user device 110 and the network server 120 may be a wired network or a wireless network, for example, a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a cellular data communication network, or other electronic network capable of exchanging information.

[0031] like Figure 1As shown, the user device 101 can transmit data, information, and services to the server 120 via the network. In this example, the user can transmit a query through the user device 110 to the server 120, and expect the server 120 to provide content based on the query. Accordingly, after receiving the query, the server 120 can use the generative model 140 to generate an answer, for example, providing the query as a prompt word to the generative model 140. In some implementations, the generative model 140 will generate the answer in a streaming manner, for example, generating the answer word by word. The server 120 can send the streaming answer to the user device 110. The user device 110 can present the answer in a streaming manner on the rich text editor. It should be noted that Figure 1 The environment 100 shown is merely exemplary, and the embodiments of the present disclosure may be implemented in different environments. For example, the streaming input is not necessarily provided by a generative model, but may be generated locally or in other ways.

[0032] In some implementations, the streamed answer input to the user device 110 may be in Markdown format, but the rich text editor 130 does not support Markdown format but supports other formats, such as Delta format. Therefore, it is necessary to implement conversion from Markdown format to Delta format.

[0033] Tables 2 and 3 below show an exemplary Markdown document and the converted Delta text.

[0034] Table 2: Example Markdown text

[0035]

[0036] Table 3: Example Delta document

[0037]

[0038]

[0039]

[0040] In some embodiments, a Delta document (deltas) may include one or more Delta objects, each of which has a key or index (zoneId), a type (zoneType), and a change operation (ops). Each change operation can be insert, retain, or delete. In this document, key and index are used interchangeably. In some embodiments, a change operation can have an attribute that indicates the type or other information of the object involved in the operation.

[0041] In the above example, for the delta object with key "0," its attribute is "Z" (i.e., ZoneDelta). The change operations are: insert:'*'; insert:'Headings h13\n'; insert:'*'; insert:'\n'. Note that the attribute "aceTable" of the second occurrence of "insert:'\n'" indicates that the inserted content is a table. The attributes also include the table's row object (key flIhB2GF7c4FWkjvr2Hw) and column object (key lUJB7OAsHUI7o39e0).

[0042] For the table row object with key flIhB2GF7c4FWkjvr2Hw, its type is "R" (i.e., RowDelta), and its change operation includes inserting three rows (with ids of 'flihb2gf7c4fwkjvr2hwr0', 'flihb2gf7c4fwkjvr2hwr1', and 'flihb2gf7c4fwkjvr2hwr2'). For the table column object with key lUJB7OAsHUI7o39e0, its type is "C" (i.e., ColDelta), and its change operation includes inserting two columns (with ids of 'lujb7oashui7o39e0c0' and 'lujb7oashui7o39e0c1').

[0043] Furthermore, the Delta document also includes table cell objects, where the key of each cell object is a combination of its row and column keys. For example, a Delta object with the key xflihb2gf7c4fwkjvr2hwr0xlujb7oashui7o39e0c0 has a type of "Z" and a change operation of inserting the string 'Syntax\n'.

[0044] Figure 2 1 is a flow chart of a method 200 for presenting streaming input on a rich text editor according to some embodiments of the present disclosure. In some embodiments, the method 200 may be performed by, for example, Figure 1 It should be understood that the method 200 may also include additional actions not shown and / or may omit the actions shown, and the scope of the present disclosure is not limited in this respect. Figure 1 Method 200 will be described.

[0045] like Figure 2As shown, in box 210, method 200 may include: obtaining a first streaming input and a second streaming input, the second streaming input including a delta relative to the first streaming input. In some embodiments, the first streaming input and the second streaming input may be strings that are stream-generated by the generative model 140 and streamed to the user device 110. For example, the user device 110 first receives the first streaming input, and then receives the delta relative to the first streaming input, and the delta and the already received first streaming input constitute the second streaming input. The user device 110 may cache the first streaming input and merge the subsequently received delta with the cached data to obtain the second streaming input.

[0046] The rich text editor 130 of the user device 110 can render and present the first streaming input before receiving the incremental input. As an example, assume that the rich text editor 130 supports direct rendering of the Delta format, but does not support the Markdown format. If the streaming input received by the user device 110 is a string in the Markdown format, it is necessary to implement the conversion from the Markdown format to the Delta format. In some embodiments, the input in the Markdown format can be converted into an abstract syntax tree (Abstract Syntax Tree) first, and then the abstract syntax tree is converted into a document in the Delta format. The conversion from the abstract syntax tree to the Delta format can include conversions for the following Markdown formats: quotes, code blocks, inline code, strikethrough, italics, bold, titles, pictures, inline formulas, paragraph formulas, hyperlinks, reference links, unordered lists, ordered lists, tables, etc. This can achieve the conversion from Table 2 to Table 3. The converted Delta format document can be rendered directly.

[0047] It should be noted that because streaming input may have strong context dependencies, it is not possible to perform separate conversion and rendering for the increments. In order to render and present the second streaming input based on the increment, the previously received first streaming input and the increment need to be rendered and presented as a whole. As mentioned above, full rendering (i.e., clearing the rendered first streaming input and re-rendering the second streaming input from scratch) has the problems of low performance and page jitter.

[0048] At block 220, a difference document in a format supported by a rich text editor is generated based on the first streaming input and the second streaming input. The format supported by the rich text editor defines a document (e.g., DeltaSet) by describing changes. The document may include at least one object (Delta), each object may include at least one change operation (ops), and each change operation may include one of insert, retain, and delete. Using this difference document, incremental update rendering can be implemented, avoiding full rendering.

[0049] In some embodiments, the user device 110 may obtain a first document (DeltaSetA) for the first streaming input and a second document (DeltaSet B) for the second streaming input, wherein the first document and the second document have the format supported by the rich text editor 130. The user device 110 may then generate a difference document (DeltaSet C) based on the first document and the second document. To this end, the user device 110 converts the first streaming input into a first abstract syntax tree, and converts the first abstract syntax tree into a first document. This action may be completed in advance. For the second streaming input, the user device 110 may merge the first streaming input and the incremental input to obtain the second streaming input, convert it into a second abstract syntax tree, and convert the second abstract syntax tree into a second document. It should be understood that the first document and the second document include respective Delta objects, each object having a corresponding index and type. Regarding the specific implementation of obtaining a difference document from the first document and the second document, reference will be made below. Figure 3 Let's explain in detail.

[0050] At block 230, the second streamed input is presented in the rich text editor by rendering the difference document. In some embodiments, the difference document is applied to the rich text editor without clearing the first streamed input already presented in the rich text editor. This advantageously avoids full Document Object Model (DOM) updates and rendering operations, reduces performance penalties, and eliminates the jittery effect of page refreshes.

[0051] Figure 3 FIG2 shows a flow chart of a method for rendering streaming input by incremental updating according to an embodiment of the present disclosure. Figure 3, the server 120 provides streaming input, namely incremental Markdown (MD) data 302 to the user device 110. The user device 110 merges the received incremental MD with the MD that has been received and cached to obtain the streaming input to be presented. Then, the user device 110 converts the merged content into an abstract syntax tree 304, and converts the abstract syntax tree 304 into a new document DeltaSet 305 that conforms to the format supported by the rich text editor. The new document DeltaSet 305 includes a set of newly generated objects Delta. Next, the difference (diff) algorithm proposed in the present disclosure will be used to generate a difference document (DeltaSetC) based on the comparison of the converted and cached MD document (DeltaSet A) and the new document DeltaSet 305 (DeltaSet B). The difference document can be initialized to an empty set.

[0052] In some embodiments, the new Delta object 306 in DeltaSet B may be traversed to determine the Delta object of DeltaSet C, and the new Delta object 306 may be compared with the Delta data of the cached MD (i.e., DeltaSet A) 307 to generate a difference Delta 308, which is added to DeltaSet C. The generated DeltaSet C may be applied to the rich text editor for rendering 308.

[0053] Specifically, for each new Delta object in DeltaSet B, if the index of the Delta object (e.g., key) does not exist in DeltaSet A or the index exists in DeltaSet A but the type (e.g., ZoneType) is different, then the DeltaS object is added to DeltaSet C. Otherwise, if the index of the Delta object exists in DeltaSet A and the type is the same, then the difference between the Delta object and another Delta object corresponding to the index in DeltaSet A is calculated and the difference is added to the difference document.

[0054] In some embodiments, the Delta objects may be serialized into two strings based on the respective change operations in the two Delta objects, and the difference between the Delta objects may be determined based on a comparison between the strings. The string comparison result may include insertion, identity, or deletion of the strings.

[0055] For example, the Delta object in DeltaSet A can be named DeltaX, and the Delta object in DeltaSet B can be named DeltaY. The two Delta objects can be serialized into corresponding strings, and the difference between the two strings can be calculated. In some embodiments, a fast-diff algorithm can be used to calculate the string difference, and the output is of type INSERT, EQUAL, or DELETE. Serialization can be implemented based on the change operations in the Delta objects, for example, by extracting the strings from the insert operation and merging them to obtain the serialized result.

[0056] Then, based on the comparison results of the two strings, the difference between DeltaX and DeltaY is determined. For INSERT type comparison results, the string index region corresponding to Delta is sliced and added to DeltaSetC[key] as an insert operation. For EQUAL type comparison results, the string index region corresponding to Delta is sliced and added to DeltaSetC[key] as a retain operation. For DELETE type comparison results, the string index region corresponding to Delta is sliced and added to DeltaSetC[key] as a delete operation.

[0057] It's important to note that when the Delta string type is EQUAL, that is, when identical strings exist, further determination is required based on attribute information to determine whether the content is truly identical or nested. This is because tables, code blocks, and the like correspond to a predefined string in the Delta object, such as an empty string or "*." Further information is stored in the corresponding attribute, which contains the index value of the actual delta content. Therefore, when encountering an EQUAL type, recursive calls to the differentiation algorithm described above are required when the string is a table, code block, or the like.

[0058] In some embodiments, if the result of the comparison includes the same string and the same string includes predefined characters, the attribute information of the change operation corresponding to the string in the two Delta objects is determined, such as whether it is a table, a code block, or other structure. If so, the sub-objects in DeltaSet A and DeltaSet B are determined based on the attribute information, the differences between the two sub-objects are further compared, and the differences are added to DeltaSet C. In some embodiments, the attribute information may include the index of the sub-object, and if the attribute information indicates that the Delta object is a table, it may also include the index of the row object (RowDelta) and the column object (ColDelta). In the process of calculating the difference between two delta sub-objects, the differences of more delta sub-objects may continue to be recursively calculated.

[0059] Taking the following diff process of mdA and mdB as an example, the recursive call process is described.

[0060] Table 4: Markdown input example

[0061]

[0062]

[0063] In the first step, the Markdown input shown in Table 4 is converted into the corresponding Delta document as follows

[0064] Table 5: Delta document example

[0065]

[0066]

[0067]

[0068]

[0069] The second step is to compare the two Delta documents. For the delta objects with key 0, which have the same type, their corresponding serialization is obtained as the corresponding string.

[0070] Table 6: Serialization result example

[0071]

[0072] The third step is to traverse the serialized string. Since '*Headings h' in strA is the same as in strB, the first 11 characters are the retain operation.

[0073] In the fourth step, strings 12 to 15 are newly added in strB, so it is an insert operation. Since the sixteenth strings of strA and strB are the same, and the attributes of their delta contain the attribute aceTable, whose value is the table row delta and column delta index connected by a space, it is necessary to split it by a space, find its corresponding Delta object in DeltaSet B, and recursively repeat the previous steps 1 to 4 to obtain the difference of the cell delta objects.

[0074] Finally, we get an incremental difference document DeltaSet C, the result of which is

[0075] Table 7: DeltaSet C Example

[0076]

[0077]

[0078]

[0079] Figure 4 A device 400 for presenting streaming input on a rich text editor according to an embodiment of the present disclosure is shown. As shown in the figure, the device 400 includes a streaming input acquisition unit 410, a difference document generation unit 420, and a presentation unit 430. The streaming input acquisition unit 410 can be configured to acquire a first streaming input and a second streaming input, the second streaming input including an increment relative to the first streaming input. The difference document generation unit 420 can be configured to generate a difference document in a format supported by the rich text editor based on the first streaming input and the second streaming input. The presentation unit 430 can be configured to present the second streaming input on the rich text editor by rendering the difference document.

[0080] It should be noted that the reference Figures 1 to 3 Further actions or steps shown can be performed by Figure 4 For example, the apparatus 400 may include more modules or units to implement the actions or steps described above, or Figure 4 Some of the units or modules shown may be further configured to implement the actions or steps described above, which will not be repeated here.

[0081] Figure 5A schematic block diagram of an example device 500 that can be used to implement an embodiment of the present disclosure is shown. As shown, the device 500 includes a computing unit 501 that can perform various appropriate actions and processes based on computer program instructions stored in a read-only memory (ROM) 502 or loaded from a storage unit 506 into a random access memory (RAM) 503. Various programs and data required for the operation of the device 500 can also be stored in the RAM 503. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0082] Various components in device 500 are connected to I / O interface 505, including: an input unit 506, such as a keyboard, mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, optical disk, etc.; and a communication unit 509, such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0083] The computing unit 501 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as method 300. For example, in some embodiments, method 300 can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the method 300 described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform method 300 in any other appropriate manner (e.g., by means of firmware).

[0084] In some embodiments, the methods and processes described above may be implemented as a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.

[0085] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.

[0086] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.

[0087] The computer program instructions for performing the disclosed operation can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data or source code or the object code written in any combination of one or more programming languages, wherein the programming languages include object-oriented programming languages, and conventional procedural programming languages.Computer-readable program instructions can be performed completely on the user's computer, partially on the user's computer, performed as an independent software package, partly on the user's computer and partly on a remote computer, or performed completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer by any type of network-including local area network (LAN) or wide area network (WAN), or can be connected to an external computer (such as utilizing an Internet service provider to connect by the Internet). In certain embodiments, by utilizing the state information of computer-readable program instructions to carry out personalized customization electronic circuits, such as programmable logic circuits, field programmable gate arrays (FPGAs) or programmable logic arrays (PLA), this electronic circuit can perform computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0088] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0089] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0090] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart, can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0091] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technical improvements to existing technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for presenting streaming input on a rich text editor, comprising: Obtaining a first streaming input and a second streaming input, wherein the second streaming input includes a delta relative to the first streaming input; generating a difference document in a format supported by the rich text editor based on the first streaming input and the second streaming input; as well as The second streaming input is presented on the rich text editor by rendering the difference document.

2. The method according to claim 1, wherein The format supported by the rich text editor defines a document by describing changes. The document includes at least one object, each object includes at least one change operation, and each change operation includes one of insertion, retention, and deletion.

3. The method according to claim 2, wherein: Generating a difference file for rendering based on the first streaming input and the second streaming input includes: Obtaining a first document for the first stream input and a second document for the second stream input, wherein the first document and the second document have the format supported by the rich text editor; and The difference document is generated based on the first document and the second document.

4. The method according to claim 3, wherein obtaining a first document for the first streaming input and a second document for the second streaming input comprises: Converting a first streaming input into a first abstract syntax tree, and converting the first abstract syntax tree into the first document; as well as The second streaming input is converted into a second abstract syntax tree, and the second abstract syntax tree is converted into the second document.

5. The method according to claim 3, wherein The objects in the first document and the second document have respective indexes and types, and generating the difference document based on the first document and the second document includes: For each object in the second document, If a reference to the object does not exist in the first document or the reference exists in the first document but is of a different type, adding the object to the difference document; and If the index of the object exists in the first document and is of the same type, a difference between the object and another object corresponding to the index in the first document is calculated and the difference is added to the difference document.

6. The method of claim 5, wherein the another object in the first document is a first object, the object in the second document is a second object, and calculating the difference between the second object and the first object comprises: Based on respective change operations in the first object and the second object, serialize the first object and the second object into a first string and a second string respectively; Based on a comparison between the first character string and the second character string, a difference between the second object and the first object is determined, wherein a result of the comparison includes insertion, identity, or deletion of a character string.

7. The method according to claim 6, further comprising: In response to the comparison result including an identical character string and the identical character string including predefined characters, determining first attribute information of a first change operation corresponding to the character string in the first object and second attribute information of a second change operation corresponding to the character string in the second object; determining a first sub-object in the first document and a second sub-object in the second document based on the first attribute information and the second attribute information respectively; as well as Differences of the second sub-object compared to the first sub-object are added to the difference document.

8. The method according to claim 7, wherein: The first attribute information and the second attribute information respectively indicate that the types of the first sub-object and the second sub-object are tables.

9. The method according to claim 8, wherein The first attribute information and the second attribute information respectively include indexes of the first sub-object and the second sub-object, and the attribute information in the first sub-object and the second sub-object respectively include indexes of row objects and column objects of corresponding tables.

10. The method according to any one of claims 1 to 9, wherein Presenting the second streaming input on the rich text editor by rendering the difference file includes: The difference file is rendered in an incremental update manner without clearing the first streaming input that has been presented on the rich text editor.

11. The method according to any one of claims 1 to 10, wherein the first streaming input and the second streaming input are generated by a generative model. 12 . The method of claim 1 , wherein the rich text editor does not support direct rendering of the formats of the first streaming input and the second streaming input.

13. A device for presenting streaming input on a rich text editor, the device comprising: a streaming input acquiring unit configured to acquire a first streaming input and a second streaming input, wherein the second streaming input includes an increment relative to the first streaming input; a difference document generating unit, configured to generate a difference document in a format supported by the rich text editor based on the first streaming input and the second streaming input; as well as A rendering unit is configured to render the second stream input on the rich text editor by rendering the difference document.

14. A computing device comprising: at least one processing unit; At least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the computing device to perform the method of any one of claims 1 to 12.

15. A non-transitory computer storage medium comprising machine-executable instructions which, when executed by a device, cause the device to perform the method of any one of claims 1 to 12.

16. A computer program product comprising machine-executable instructions which, when executed by a device, cause the device to perform the method according to any one of claims 1 to 12.