CN120476401A - Method and device for presenting streaming input on a rich text editor - Google Patents
Method and device for presenting streaming input on a rich text editorInfo
- Publication number
- CN120476401A CN120476401A CN202480006869.9A CN202480006869A CN120476401A CN 120476401 A CN120476401 A CN 120476401A CN 202480006869 A CN202480006869 A CN 202480006869A CN 120476401 A CN120476401 A CN 120476401A
- Authority
- CN
- China
- Prior art keywords
- document
- streaming input
- streaming
- text editor
- rich text
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Machine Translation (AREA)
Abstract
The present disclosure provides methods, apparatus, computing devices, computer-readable storage media, and computer program products for rendering streaming input on a rich text editor. The method includes obtaining a first streaming input and a second streaming input, the second streaming input including an increment relative to the first streaming input, generating a difference document in a format supported by a 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, the technical scheme of the present disclosure improves the compatibility of the rich text editor to render streaming input, and simultaneously renders streaming input in an incremental update manner, which improves the rendering efficiency and page rendering effect of the rich text editor.
Description
Technical Field
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 rendering streaming input on a rich text editor.
Background
With the development of network technology, lightweight markup languages (such as Markdown) are widely used due to their features of simplicity, intuitiveness, easy 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 to a valid hypertext markup language (HTML) or other format, and render or render.
At the same time, more and more people are using generative language models to obtain information or to author. The generative language model accepts the user's query and provides the answer in the form of a streaming output, often a string conforming to the lightweight markup language format. The user device receives the streaming input from the generative language model and presents the streaming input on the rich text editor. However, some rich text editors may lack component support, may not be able to render streaming input in some lightweight markup language formats directly, or may require complex processing, resulting in lower rendering performance.
Disclosure of Invention
In view of this, the present disclosure provides a technical solution for presenting streaming input on a rich text editor, which can improve compatibility of presenting streaming input by the rich text editor, and enable the rich text editor to present streaming input in an incremental update manner, thereby improving rendering efficiency and page presentation effect of the rich text editor.
According to a first aspect of the present disclosure, a method for presenting streaming input on a rich text editor is provided. The method includes obtaining a first streaming input and a second streaming input, the second streaming input including an increment relative to the first streaming input, generating a difference document in a format supported by a 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.
According to a second aspect of the present disclosure, an apparatus for rendering streaming input on a rich text editor is provided. The apparatus includes a streaming input acquisition unit 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, a differential document generation unit configured to generate a differential document in a format supported by a 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 differential document.
According to a third aspect of the present disclosure there is provided 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, which when executed by the at least one processing unit, cause the computing device to perform the method of the first aspect of the present disclosure.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer storage medium comprising machine executable instructions which, when executed by a device, cause the device to perform the method of the first aspect of the present disclosure.
According to a fifth aspect of the present disclosure, there is provided a computer program product comprising machine executable instructions which, when executed by an apparatus, cause the apparatus to perform the method according to the first aspect of the present disclosure.
It should be understood that the summary is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The above and other objects, features and advantages of embodiments of the present disclosure will become more readily apparent from the following detailed description with reference to the accompanying drawings. Embodiments of the present disclosure will now be described, by way of example and not limitation, in the figures of the accompanying drawings, in which:
FIG. 1 illustrates an environmental schematic in which various embodiments of the present disclosure can be implemented;
FIG. 2 shows a schematic flow chart of a method for rendering streaming input on a rich text editor according to an embodiment of the disclosure;
FIG. 3 illustrates a flow diagram of a method of rendering streaming input by incremental updating in accordance with an embodiment of the present disclosure;
FIG. 4 shows a schematic block diagram of an apparatus for rendering streaming input on a rich text editor in accordance with an embodiment of the disclosure, and
Fig. 5 illustrates a block diagram of a device capable of implementing various embodiments of the present disclosure.
Detailed Description
The concepts of the present disclosure will now be described with reference to various exemplary embodiments shown in the drawings. It should be understood that these embodiments are merely described to enable those skilled in the art to better understand and further practice the present disclosure and are 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, where possible, in the figures and similar or identical reference numerals may designate similar or identical elements. Those of ordinary skill in the art will appreciate from the following description that alternative embodiments of the structures and/or methods illustrated herein may be employed without departing from the principles and concepts of the disclosure described.
In the context of this disclosure, the terms "comprise" and variations thereof may be understood as open-ended terms, which mean "including, but not limited to," the terms "based on" may be understood as "based at least in part on," the terms "one embodiment" may be understood as "at least one embodiment," and the terms "another embodiment" may be understood as "at least one other embodiment. Other terms that may occur but are not mentioned herein should not be construed or limited in a manner contrary to the concepts upon which the embodiments of the disclosure are based, unless explicitly stated.
As submitted above, lightweight markup languages such as Markdown allow one to write a document using a plain text format that is easy to read and write, and then convert it to a valid HTML or other format. Lightweight markup languages are simple and intuitive in grammar and easy to learn and use, and therefore find wide application in many fields.
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 a variety of text formats, styles and structures, such as bolded, italic, underlined, color, font changes, paragraph alignment, and the like. These editors typically support a what-see-is-what-you-get mode, allowing the user to view the format effects in real-time as they edit. Furthermore, they are typically capable of generating HTML code so that formatted content can be conveniently embedded into a web page or application.
However, some rich text editors cannot render strings in some grammatical formats (e.g., markdown) directly, requiring conversion to supported format content for rendering. In an application scenario where the generative model outputs streaming content, the rich text editor of the user device may not support the format of some of the streaming content, resulting in an incorrect display of the content. 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 volume rendering, whose performance is relatively low, and may cause jitter in the page. It is therefore desirable to enhance the compatibility of the rich text editor for input content and to implement a delta updated rendering approach to improve performance and user experience.
To solve or mitigate the above-mentioned problems and/or other potential problems, embodiments of the present disclosure propose a method for rendering streaming content on a rich text editor. According to the method, the user device may obtain streaming input (also referred to as existing content) and delta input with respect to the streaming input, which may be obtained later. The streaming input and delta input may be, for example, text conforming to a markup language format, such as Markdown text, but in some implementations the rich text editor may not support direct rendering of such markup language formats. The user device may then convert the entirety formed by the streaming input and the delta input into content conforming to the format supported by the rich text editor and compare it to the converted streaming input to generate a difference document that also conforms to the format supported by the rich text editor. The existing streaming content and delta content are then presented on the rich text editor by rendering the difference document. Based on the mode, the compatibility of the rich text editor for presenting the streaming input can be improved, and meanwhile, the rich text editor can present the streaming input in an incremental updating mode, so that the rendering efficiency and the page presenting effect of the rich text editor are improved.
It should be noted that Markdown language will be used herein as an example of the format of the streaming input received by the rich text editor, but it should be understood that other language formats are possible. In addition, the quilljs framework-based Delta language will be used herein as a format supported by (i.e., capable of direct rendering by) a rich text editor, although it should be understood that other formats are possible.
To facilitate an understanding of embodiments of the present disclosure, the following term explanations are provided:
TABLE 1 interpretation of related terms
The basic principles and implementations of the present disclosure are described below with reference to the accompanying drawings. It should be understood that the exemplary embodiments are presented merely to enable those skilled in the art to better understand and practice the embodiments of the present disclosure and are not intended to limit the scope of the present disclosure in any way.
Fig. 1 illustrates a schematic diagram of an environment 100 in which various embodiments of the present disclosure can be implemented. As shown in fig. 1, environment 100 includes user device 110 and server 120 operable by a user. Alternatively, user device 110 may be specifically any computing device having display functionality including, but not limited to, a smart phone, tablet, portable computer, smart television, car computer, wearable device (e.g., smart bracelet, smart watch), etc. The user device 110 may be equipped with a rich text editor 130 that may receive documents or inputs supporting various styles (fonts, font sizes, colors) and elements (pictures, tables, links, etc.), and render and present to the user.
The server 120 may be an independent physical network server, a network server cluster or a distributed system formed by a plurality of physical network servers, or a cloud network server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms, and the like. As shown, server 120 includes a generative model 140. In some implementations, generative model 140 may be a trained language model and can generate data or content based on the hint words.
The user device 110 and the server 120 may be communicatively connected via a network. The network between the user equipment 110 and the network server 120 may be a wired network or a wireless network, for example, it may be an electronic network capable of implementing an information exchange function, such as a Local Area Network (LAN), a Metropolitan Area Network (MAN), a Wide Area Network (WAN), a cellular data communication network, etc.
As shown in fig. 1, the user equipment 101 may communicate data, information, and services with the server 120 via a network. In this example, the user may transmit a query through the user device 110 to the server 120 and expect that the server 120 is able to provide content based on the query. Accordingly, the server 120 may receive the query and use the generative model 140 to generate an answer, e.g., provide the query as a prompt to the generative model 140. In some implementations, the generative model 140 will generate the answers streamwise, e.g., word by word. The server 120 may send the streaming answer to the user device 110. The user device 110 may present the answer upstream on the rich text editor. It should be noted that the environment 100 shown in fig. 1 is merely exemplary, and embodiments of the present disclosure may be implemented in environments other than this, e.g., streaming input need not be provided by a generative model, may be locally generated, or otherwise.
In some implementations, the streaming 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. For this reason, it is necessary to implement the conversion from Markdown format to Delta format.
Tables 2 and 3 below present a section of an exemplary Markdown document along with converted Delta text.
TABLE 2 exemplary MarkDown text
Table 3 example Delta document
In some embodiments, a Delta document (deltas) may include one or more deltas objects, each Delta object having a key or index (zoneId), a type (zoneType), and a change operation (ops), each change operation may be an insert (insert), a hold (retain), or a delete (delete). Key and index may be used interchangeably herein. In some embodiments, the change operation may have an attribute (attribute) that indicates the type of object or other information that the operation relates to.
In the above example, for a delta object whose key is "0" its attribute is "Z" (i.e., zoneDelta), its altering operation includes, in order, insert: ' HEADINGS H \n '; insert: ', insert: ' n '. Note that the attribute "aceTable" of the second occurrence of "insert: '\n'" indicates that the contents of its insertion are tables, and the attributes also include the row object (key is flIhB GF7c4FWkjvr Hw) and the column object (key is lUJB g 7g OAsHUI o39e 0) of the tables.
For a table row object whose key is flIhB GF7c4FWkjvr Hw, whose type is "R" (i.e., rowDelta), its altering operation includes inserting three rows in sequence (id 'flihb2GF7c4fwkjvr2hwr0', 'flihb GF7c4fwkjvr2 hwr', 'flihb GF7c4fwkjvr2hwr2', respectively). For a table column object whose key is lUJB, OAsHUI, 7o39e0, whose type is "C" (i.e., colDelta), its change operation sequentially includes inserting two columns (id 'lujb, oashui, 7o39e0C0', 'lujb, 7, oashui, 7o39e0C1', respectively).
Further, the Delta document also includes the cell objects of the table, with the key of each cell object being a combination of the keys of its rows and columns. For example, a delta object with key xflihb2gf7c4fwkjvr2hwr0xlujb7oashui7o39e0c0, of type "Z", whose change operation is to insert the string 'Syntax\n'.
Fig. 2 illustrates a flow diagram of a method 200 for rendering streaming input on a rich text editor, according to some embodiments of the disclosure. In some embodiments, the method 200 may be implemented by, for example, the user device 110 shown in fig. 1. It should be understood that method 200 may also include additional acts not shown and/or may omit acts shown, the scope of the present disclosure being not limited in this respect. For ease of illustration, the method 200 will be described with reference to FIG. 1.
As shown in FIG. 2, at block 210, the method 200 may include obtaining a first streaming input and a second streaming input, the second streaming input including an increment relative to the first streaming input. In some embodiments, the first and second streaming inputs may be strings that are streamed and output to the user device 110 by the generative model 140. For example, the user device 110 receives a first streaming input first and then receives an increment relative to the first streaming input, the increment and the first streaming input that have been received constituting a second streaming input. The user device 110 may buffer the first streaming input and combine the subsequently received delta and buffered data to obtain a second streaming input.
The rich text editor 130 of the user device 110 may render and present the first streaming input before receiving the delta input. As an example, assume that rich text editor 130 supports the direct render Delta format, but does not support the Markdown format. If the streaming input received by the user device 110 is a character string in Markdown format, a conversion from Markdown format to Delta format needs to be implemented. In some embodiments, the Markdown format input may be converted to an abstract syntax tree (Abstract Syntax Tree) and then the abstract syntax tree may be converted to a Delta format document. The conversion from abstract syntax tree to Delta format may include conversion for Markdown format, references, code blocks, inline codes, strikethrough, italics, bold, title, picture, inline formulas, paragraph formulas, hyperlinks, reference links, unordered lists, ordered lists, tables, and the like. Whereby the conversion as in table 2 to table 3 can be achieved. The converted Delta formatted document may be directly rendered.
It should be noted that, since streaming input may have a strong context dependency, separate conversion and rendering for delta cannot be performed. In order to render and render the delta-based second streaming input, the previously received first streaming input and delta need to be rendered and rendered as a whole. As mentioned above, full-volume rendering (i.e., flushing out the rendered first streaming input, re-rendering the second streaming input from scratch) has problems with low performance and page jitter.
At block 220, a difference document in a format supported by the rich text editor is generated based on the first and second streaming inputs. The formats supported by the rich text editor define a document (e.g., deltaSet) by describing the changes, the document may include at least one object (Delta), each object may include at least one change operation (ops), each change operation may include one of insert (insert), hold (retain), and delete (delete). By utilizing the difference document, the rendering of an incremental update mode can be realized, and full rendering is avoided.
In some embodiments, the user device 110 may obtain a first document (DELTASET A) for a first streaming input and a second document (DeltaSet B) for a second streaming input, where the first document and the second document have the formats supported by the rich text editor 130. The user device 110 may then generate a difference document based on the first document and the second document (DELTASET C). 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 pre-completed. For the second streaming input, the user device 110 may combine the first streaming input and the delta input, convert the resulting second streaming input into a second abstract syntax tree, and convert the second abstract syntax tree into a second document. It should be appreciated that the first document and the second document include respective Delta objects, each object having a corresponding index and type. The specific implementation of deriving the difference document from the first document and the second document will be described in detail below with reference to fig. 3.
At block 230, a second streaming input is presented on the rich text editor by rendering the difference document. In some embodiments, the difference document is applied to the rich text editor without the need to empty the first streaming input that has been presented on the rich text editor. Thus, operations of full-scale updating and rendering of a Document Object Model (DOM) can be advantageously avoided, performance impairment is reduced, and a jittery feeling at the time of page refresh is not generated.
Fig. 3 shows a flow diagram of a method of rendering streaming input by incremental updating in accordance with an embodiment of the present disclosure. In fig. 3, server 120 provides streaming input, i.e., incremental Markdown (MD) data 302, to user device 110. The user equipment 110 combines the received incremental MD with the MD that has been received and buffered to obtain the streaming input to be presented. The user device 110 then 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 comprising a set of new objects Delta. Next, a differencing (diff) algorithm proposed by the present disclosure will be used to generate a difference document (DELTASET C) based on a comparison of the converted and cached MD document (DELTASET A) and the new document DeltaSet (DeltaSet B). The difference document may be initialized to an empty set.
In some embodiments, the new Delta object 306 in DeltaSet B may be traversed to determine the Delta object of DELTASET C, the new Delta object 306 is compared to the Delta data (i.e., DELTASET A) 307 of the cached MD, the difference Delta 308 is generated, and added to DELTASET C. The generated DELTASET C may be applied to the rich text editor for rendering 308.
Specifically, for each new Delta object of DeltaSet B, if the index (e.g., key) of the Delta object does not exist at DELTASET A or the index exists at 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 that Delta object and another Delta object in DELTASET A that corresponds to the index is calculated and the difference is added to the difference document.
In some embodiments, delta objects may be serialized into two strings based on respective change operations in the two Delta objects, and differences between Delta objects determined based on comparisons between the strings. The comparison result of the character strings may include insertion, identical or deletion of the character strings.
For example, the Delta object in DELTASET A may be named DeltaX and the Delta object in DeltaSet B may be named DeltaY. Two Delta objects may be serialized into corresponding strings and the difference between the two strings calculated. In some embodiments, the fast-diff algorithm may be used to calculate the differences in strings, the output of which is of the INSERT, EQUAL, or DELETE type. Serialization may be achieved based on a change operation in the Delta object, e.g., strings in an insert operation are extracted and combined to yield a serialization result.
Then, based on the comparison result of the two character strings, the difference between DeltaX and DeltaY is determined. And slicing the Delta corresponding character string subscript region according to the comparison result of the INSERT type, and adding the Delta corresponding character string subscript region into DELTASETC [ key ] as an INSERT operation. For the comparison result of the EQUAL type, the Delta corresponding string subscript region is sliced and added to DELTASETC [ key ] as retain operations. For DELETE type, then the Delta corresponding string index region is sliced and added to DELTASETC [ key ] as DELETE operation.
It should be noted that when the Delta corresponding string type is EQUAL type, that is, there is an identical string, it is further necessary to further determine whether there is true identical content or nesting according to the attribute information. This is because a predefined string, e.g., an empty string or "#", corresponds to a table, code block, etc. in the Delta object, and more information is stored in the corresponding attribute (atrribute) that contains the index value of its actual Delta content. Thus, when an EQUAL type is encountered, a differencing algorithm as described above needs to be recursively invoked when its string is a table, a code block, or the like.
In some embodiments, if the result of the comparison includes the same string and the same string includes a predefined character, then it is determined whether the attribute information of the two Delta objects corresponding to the change operation of the string, e.g., is a table, code block, or other structure. If so, sub-objects in DELTASET A and DeltaSet B, respectively, are determined based on the attribute information, the difference of the two sub-objects is further compared, and the difference is added to DELTASET C. In some embodiments, the attribute information may include an index of sub-objects, and if the attribute information indicates that the Delta object is a table, an index of row objects (RowDelta) and column objects (ColDelta) may also be included. In calculating the difference of two delta sub-objects, it is possible to continue recursively calculating the difference of more delta sub-objects.
Taking the diff procedure of mdA and mdB as an example, the procedure of recursive invocation is described.
TABLE 4 MarkDown input examples
In a first step, the Markdown input shown in table 4 is converted into a corresponding Delta document as follows
Table 5 Delta document examples
And secondly, comparing the two Delta documents, wherein for Delta objects with keys of 0, the Delta objects are the same in type, and the corresponding character strings are obtained through serialization.
TABLE 6 serialization result example
Third, the first 11 characters operate retain as the 'HEADINGS H' in strA and strB are the same, traversing its serialized string.
In the fourth step, 12-15 strings are newly added in strB, so that the string is an insert operation, and because strA is the same as the sixteenth string of strB, and the Delta attributes of strA contains an attribute aceTable, the values of strA are the Delta indexes of the table rows and the Delta indexes of columns and are connected by spaces, the corresponding Delta object is found in DeltaSet B after the strB is divided by the spaces, and the previous first step to fourth step operation is recursively carried out, so that the difference of the cell Delta objects is obtained.
Finally, an incremental difference document DELTASET C is obtained, the result of which is
TABLE 7 DeltaSet C example
Fig. 4 illustrates an apparatus 400 for rendering streaming input on a rich text editor according to an embodiment of the disclosure. As shown, the apparatus 400 includes a streaming input acquisition unit 410, a differential document generation unit 420, and a presentation unit 430. The streaming input acquisition unit 410 may 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 generating unit 420 may be configured to generate a difference document in a format supported by the rich text editor based on the first and second streaming inputs. The presentation unit 430 may be configured to present the second streaming input on the rich text editor by rendering the difference document.
It should be noted that further actions or steps shown with reference to fig. 1-3 may be implemented by the apparatus 400 shown in fig. 4. For example, apparatus 400 may include additional modules or units to implement the acts or steps described above, or some of the units or modules shown in fig. 4 may be further configured to implement the acts or steps described above. And will not be repeated here.
Fig. 5 shows a schematic block diagram of an example device 500 that may be used to implement embodiments of the present disclosure. As shown, the device 500 includes a computing unit 501 that may perform various suitable actions and processes in accordance with 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. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, ROM 502, and RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The various components in the device 500 are connected to an I/O interface 505, including an input unit 506, e.g., a keyboard, a mouse, etc., an output unit 507, e.g., various types of displays, speakers, etc., a storage unit 508, e.g., a magnetic disk, optical disk, etc., and a communication unit 509, e.g., a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 501 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable 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, the method 300 may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 500 via the ROM 502 and/or the communication unit 509. When the computer program is loaded into RAM 503 and executed by computing unit 501, one or more steps of method 300 described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the method 300 by any other suitable means (e.g., by means of firmware).
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 having computer readable program instructions embodied thereon for performing aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include a portable computer diskette, 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 Disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, punch cards or intra-groove protrusion structures such as those having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media, as used herein, are not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., optical pulses through fiber optic cables), or electrical signals transmitted through wires.
The computer readable program instructions described herein may be downloaded from a computer readable storage medium to a respective computing/processing device or to an external computer or external storage device over a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers and/or edge servers. The network interface card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium in the respective computing/processing device.
The computer program instructions for performing the operations of the present disclosure can be assembly instructions, instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object-oriented programming language and conventional procedural programming languages. The computer readable program instructions may be executed entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the present disclosure are implemented by personalizing electronic circuitry, such as programmable logic circuitry, field Programmable Gate Arrays (FPGAs), or Programmable Logic Arrays (PLAs), with state information of computer readable program instructions, which can execute the computer readable program instructions.
These computer readable program instructions may be provided to a processing unit of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable medium having the instructions stored therein includes an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of devices, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The foregoing description of the embodiments of the present disclosure has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the various embodiments described. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or the technical improvement of the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.
Claims (16)
1. A method for rendering streaming input on a rich text editor, comprising:
Obtaining a first streaming input and a second streaming input, the second streaming input comprising 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
The second streaming input is presented on the rich text editor by rendering the difference document.
2. The method of claim 1, wherein the format supported by the rich text editor defines a document by way of describing changes, the document including at least one object, each object including at least one change operation, each change operation including one of insert, hold, and delete.
3. The method of claim 2, wherein generating a difference file for rendering based on the first streaming input and the second streaming input comprises:
Acquiring a first document for the first streaming input and a second document for the second streaming input, the first document and the second document having the formats supported by the rich text editor, and
The difference document is generated based on the first document and the second document.
4. The method of 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 said first abstract syntax tree into said first document, and
A second streaming input is converted to a second abstract syntax tree, and the second abstract syntax tree is converted to the second document.
5. The method of claim 3, wherein 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 comprises:
For each object in the second document,
Adding the object to the differential document if the index of the object does not exist in the first document or the index exists in the first document but is of a different type, 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 in the first document corresponding to the index is calculated and the difference is added to the difference document.
6. The method of claim 5, wherein the other object in the first document is a first object, the object in the second document is a second object, and calculating a difference between the second object and the first object comprises:
Serializing the first object and the second object into a first string and a second string, respectively, based on respective change operations in the first object and the second object;
a difference between the second object and the first object is determined based on a comparison between the first string and the second string, wherein a result of the comparison includes insertion, identity, or deletion of strings.
7. The method of claim 6, the method further comprising:
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 in response to the result of the comparison including the same character string and the same character string including a predefined character;
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, and
A difference of the second sub-object compared to the first sub-object is added to the difference document.
8. The method of claim 7, wherein the first attribute information and the second attribute information indicate that the types of the first sub-object and the second sub-object, respectively, are tables.
9. The method of claim 8, wherein the first and second attribute information comprise indexes of the first and second sub-objects, respectively, the attribute information in the first and second sub-objects comprising indexes of row and column objects, respectively, of a corresponding table.
10. The method of any of claims 1-9, wherein presenting the second streaming input on the rich text editor by rendering the difference file comprises:
rendering the difference file in an incrementally updated manner without clearing the first streaming input that has been presented on the rich text editor.
11. The method of any of claims 1 to 10, the first and second streaming inputs being generated by a generative model.
12. The method of any of claims 1-11, wherein the rich text editor does not support direct rendering of formats of the first and second streaming inputs.
13. An apparatus for rendering streaming input on a rich text editor, the apparatus comprising:
A streaming input acquisition unit 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;
A difference document generation unit configured to generate a difference document in a format supported by the rich text editor based on the first and second streaming inputs, and
A presentation unit configured to present the second streaming 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 cause the computing device to perform the method of any of claims 1 to 12.
15. A non-transitory computer storage medium comprising machine executable instructions that, when executed by a device, cause the device to perform the method of any of claims 1-12.
16. A computer program product comprising machine executable instructions which, when executed by a device, cause the device to perform the method of any of claims 1 to 12.
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2024121228 | 2024-09-25 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN120476401A true CN120476401A (en) | 2025-08-12 |
Family
ID=96635526
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202480006869.9A Pending CN120476401A (en) | 2024-09-25 | 2024-09-25 | Method and device for presenting streaming input on a rich text editor |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN120476401A (en) |
-
2024
- 2024-09-25 CN CN202480006869.9A patent/CN120476401A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3916579A1 (en) | Method for resource sorting, method for training sorting model and corresponding apparatuses | |
JP4339554B2 (en) | System and method for creating and displaying a user interface for displaying hierarchical data | |
US10534830B2 (en) | Dynamically updating a running page | |
KR20210035786A (en) | Method and apparatus for generating model for representing heterogeneous graph node, electronic device, storage medium and program | |
KR20210092147A (en) | Method and apparatus for mining entity focus in text | |
JP2021099774A (en) | Vectorized representation method of document, vectorized representation device of document, and computer device | |
US20130132840A1 (en) | Declarative Animation Timelines | |
US20130127875A1 (en) | Value Templates in Animation Timelines | |
US20130127877A1 (en) | Parameterizing Animation Timelines | |
US20210312308A1 (en) | Method for determining answer of question, computing device and storage medium | |
KR20210040318A (en) | Similarity processing method, apparatus, server and storage medium | |
KR20210119923A (en) | Method and apparatus for annotating data | |
CN111488422A (en) | Incremental method and device for structured data sample, electronic equipment and medium | |
Rebah et al. | Website Design and Development with HTML5 and CSS3 | |
US10956658B2 (en) | Digital content editing of a document object model (DOM) based on object model comparison | |
US20230154220A1 (en) | Pre-processing a table in a document for natural language processing | |
US12260186B2 (en) | Method of generating text, method of training model, electronic device, and medium | |
KR102531507B1 (en) | Method, device, equipment and storage medium for outputting information | |
CN114398138B (en) | Interface generation method, device, computer equipment and storage medium | |
US20250013671A1 (en) | Cross-platform content management | |
CN112817585B (en) | Cocos2dx UI interface construction method based on Unity editor | |
CN115906875A (en) | Document translation method, device, storage medium and program product | |
CN113515959A (en) | Training method of machine translation model, machine translation method and related equipment | |
CN120476401A (en) | Method and device for presenting streaming input on a rich text editor | |
CN114580439B (en) | Translation model training method, translation device, translation equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination |